Пример #1
0
static void
cc_ua_panel_init (CcUaPanel *self)
{
  CcUaPanelPrivate *priv;
  GtkWidget *widget;
  GError *err = NULL;
  gchar *objects[] = { "universal_access_box", "contrast_model",
                       "text_size_model", "slowkeys_delay_adjustment",
                       "bouncekeys_delay_adjustment", "click_delay_adjustment",
                       "dwell_time_adjustment", "dwell_threshold_adjustment",
                       "seeing_sizegroup", "typing_sizegroup",
                       "pointing_sizegroup", "pointing_sizegroup2",
                       "pointing_scale_sizegroup", "sizegroup1",
                       "hearing_sizegroup",
                       NULL };

  priv = self->priv = UA_PANEL_PRIVATE (self);

  priv->builder = gtk_builder_new ();

  gtk_builder_add_objects_from_file (priv->builder,
                                     GNOMECC_UI_DIR "/uap.ui",
                                     objects,
                                     &err);

  if (err)
    {
      g_warning ("Could not load interface file: %s", err->message);
      g_error_free (err);

      g_object_unref (priv->builder);
      priv->builder = NULL;

      return;
    }

  priv->client = gconf_client_get_default ();

  priv->interface_settings = g_settings_new ("org.gnome.desktop.interface");
  g_signal_connect (priv->interface_settings, "changed",
                    G_CALLBACK (interface_settings_changed_cb), self);
  interface_settings_changed_cb (priv->interface_settings, "gtk-theme", self);

  priv->kb_settings = g_settings_new ("org.gnome.desktop.a11y.keyboard");
  priv->mouse_settings = g_settings_new ("org.gnome.desktop.a11y.mouse");
  priv->application_settings = g_settings_new ("org.gnome.desktop.a11y.applications");
  priv->mediakeys_settings = g_settings_new ("org.gnome.settings-daemon.plugins.media-keys");

  cc_ua_panel_init_keyboard (self);
  cc_ua_panel_init_mouse (self);
  cc_ua_panel_init_hearing (self);
  cc_ua_panel_init_seeing (self);

  widget = (GtkWidget*) gtk_builder_get_object (priv->builder,
                                                "universal_access_box");

  gtk_container_add (GTK_CONTAINER (self), widget);
}
Пример #2
0
static void
cc_ua_panel_init (CcUaPanel *self)
{
  CcUaPanelPrivate *priv;
  GtkWidget *panel;
  GtkWidget *content;

  priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
                                                   CC_TYPE_UA_PANEL,
                                                   CcUaPanelPrivate);

  g_resources_register (cc_universal_access_get_resource ());

  priv->interface_settings = g_settings_new (INTERFACE_SETTINGS);
  priv->a11y_settings = g_settings_new (A11Y_SETTINGS);
  priv->wm_settings = g_settings_new (WM_SETTINGS);
  priv->kb_settings = g_settings_new (KEYBOARD_SETTINGS);
  priv->mouse_settings = g_settings_new (MOUSE_SETTINGS);
  priv->application_settings = g_settings_new (APPLICATION_SETTINGS);

  priv->builder = gtk_builder_new ();
  gtk_builder_add_from_resource (priv->builder,

                                 "/org/gnome/control-center/universal-access/uap.ui",
                                 NULL);

  cc_ua_panel_init_status (self);
  cc_ua_panel_init_seeing (self);
  cc_ua_panel_init_hearing (self);
  cc_ua_panel_init_keyboard (self);
  cc_ua_panel_init_mouse (self);

  panel = WID ("universal_access_panel");
  content = WID ("universal_access_content");

  g_signal_connect (content, "size-allocate",
                    G_CALLBACK (on_content_size_changed), panel);

  priv->focus_adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (panel));
  gtk_container_set_focus_vadjustment (GTK_CONTAINER (content), priv->focus_adjustment);

  gtk_widget_reparent (panel, GTK_WIDGET (self));
}