[gnome-control-center/extensible-shell] mouse: initialise the gconf monitors and accessibility page in the panel



commit 4f237fec3072c21c95e72c039523c45086e68555
Author: Thomas Wood <thomas wood intel com>
Date:   Wed Apr 21 10:46:13 2010 +0100

    mouse: initialise the gconf monitors and accessibility page in the panel
    
    Complete the missing setup steps in the control center panel so that
    changes are actually stored in gconf.

 capplets/mouse/Makefile.am              |    4 +++
 capplets/mouse/cc-pointer-panel.c       |   24 ++++++++++++++++------
 capplets/mouse/gnome-mouse-properties.c |   28 ++++++++++++++++++++++---
 capplets/mouse/gnome-mouse-properties.h |   33 +++++++++++++++++++++++++++++++
 4 files changed, 78 insertions(+), 11 deletions(-)
---
diff --git a/capplets/mouse/Makefile.am b/capplets/mouse/Makefile.am
index 67a0b20..3f30b8d 100644
--- a/capplets/mouse/Makefile.am
+++ b/capplets/mouse/Makefile.am
@@ -21,6 +21,9 @@ libpointer_la_SOURCES =			\
 	cc-pointer-panel.h		\
 	cc-pointer-panel.c		\
 	gnome-mouse-properties.c	\
+	gnome-mouse-properties.h	\
+	gnome-mouse-accessibility.c	\
+	gnome-mouse-accessibility.h	\
 	$(NULL)
 
 libpointer_la_LDFLAGS =			\
@@ -30,6 +33,7 @@ libpointer_la_LDFLAGS =			\
 libpointer_la_LIBADD =			\
 	$(EXTENSION_LIBS)		\
 	$(EXTENSION_COMMON_LIBS)	\
+	$(GNOMECC_CAPPLETS_LIBS)	\
 	$(NULL)
 
 libpointer_la_CFLAGS =			\
diff --git a/capplets/mouse/cc-pointer-panel.c b/capplets/mouse/cc-pointer-panel.c
index 461af96..fdecf4c 100644
--- a/capplets/mouse/cc-pointer-panel.c
+++ b/capplets/mouse/cc-pointer-panel.c
@@ -22,6 +22,9 @@
  */
 
 #include "cc-pointer-panel.h"
+#include "gnome-mouse-properties.h"
+#include "gnome-mouse-accessibility.h"
+
 #include <glib/gi18n.h>
 
 G_DEFINE_DYNAMIC_TYPE (CcPointerPanel, cc_pointer_panel, CC_TYPE_PANEL)
@@ -31,7 +34,7 @@ G_DEFINE_DYNAMIC_TYPE (CcPointerPanel, cc_pointer_panel, CC_TYPE_PANEL)
 
 struct _CcPointerPanelPrivate
 {
-  gpointer dummy;
+  GConfClient *client;
 };
 
 
@@ -64,6 +67,14 @@ cc_pointer_panel_set_property (GObject      *object,
 static void
 cc_pointer_panel_dispose (GObject *object)
 {
+  CcPointerPanelPrivate *priv = CC_POINTER_PANEL (object)->priv;
+
+  if (priv->client)
+    {
+      g_object_unref (priv->client);
+      priv->client = NULL;
+    }
+
   G_OBJECT_CLASS (cc_pointer_panel_parent_class)->dispose (object);
 }
 
@@ -73,10 +84,6 @@ cc_pointer_panel_finalize (GObject *object)
   G_OBJECT_CLASS (cc_pointer_panel_parent_class)->finalize (object);
 }
 
-/* this is defined in gnome-mouse-properties.c */
-GtkBuilder * create_dialog (void);
-/* TODO: split out the pages into seperate objects */
-
 static GObject*
 cc_pointer_panel_constructor (GType                  type,
                               guint                  n_properties,
@@ -120,14 +127,17 @@ cc_pointer_panel_class_finalize (CcPointerPanelClass *klass)
 static void
 cc_pointer_panel_init (CcPointerPanel *self)
 {
-  GtkBuilder *builder;
-  GtkWidget *prefs_widget;
+  GtkBuilder  *builder;
+  GtkWidget   *prefs_widget;
 
   self->priv = POINTER_PANEL_PRIVATE (self);
 
+  self->priv->client = mouse_properties_conf_init ();
 
   builder = create_dialog ();
 
+  setup_accessibility (builder, self->priv->client);
+
   prefs_widget = (GtkWidget*) gtk_builder_get_object (builder, "prefs_widget");
 
   gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));
diff --git a/capplets/mouse/gnome-mouse-properties.c b/capplets/mouse/gnome-mouse-properties.c
index 09466c0..7857130 100644
--- a/capplets/mouse/gnome-mouse-properties.c
+++ b/capplets/mouse/gnome-mouse-properties.c
@@ -25,6 +25,8 @@
 
 #include <config.h>
 
+#include "gnome-mouse-properties.h"
+
 #include <glib/gi18n.h>
 #include <string.h>
 #include <gconf/gconf-client.h>
@@ -558,6 +560,8 @@ create_dialog (void)
 	gtk_size_group_add_widget (size_group, WID ("dwell_delay_long_label"));
 	gtk_size_group_add_widget (size_group, WID ("dwell_threshold_large_label"));
 
+        setup_dialog (dialog, NULL);
+
 	return dialog;
 }
 
@@ -573,6 +577,25 @@ dialog_response_cb (GtkDialog *dialog, gint response_id, GConfChangeSet *changes
 		gtk_main_quit ();
 }
 
+GConfClient *
+mouse_properties_conf_init ()
+{
+	GConfClient *client;
+
+	capplet_init_stock_icons ();
+
+	activate_settings_daemon ();
+
+	client = gconf_client_get_default ();
+	gconf_client_add_dir (client, "/desktop/gnome/peripherals/mouse",
+			      GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+	gconf_client_add_dir (client, "/desktop/gnome/peripherals/touchpad",
+			      GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+	return client;
+}
+
+
 int
 main (int argc, char **argv)
 {
@@ -609,14 +632,11 @@ main (int argc, char **argv)
 
 	activate_settings_daemon ();
 
-	client = gconf_client_get_default ();
-	gconf_client_add_dir (client, "/desktop/gnome/peripherals/mouse", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-	gconf_client_add_dir (client, "/desktop/gnome/peripherals/touchpad", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+	client = mouse_properties_conf_init ();
 
 	dialog = create_dialog ();
 
 	if (dialog) {
-		setup_dialog (dialog, NULL);
 		setup_accessibility (dialog, client);
 
 		if (socket_id) {
diff --git a/capplets/mouse/gnome-mouse-properties.h b/capplets/mouse/gnome-mouse-properties.h
new file mode 100644
index 0000000..2c67fcc
--- /dev/null
+++ b/capplets/mouse/gnome-mouse-properties.h
@@ -0,0 +1,33 @@
+/* mouse-properties-capplet.h
+ *
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Written by: Thomas Wood <thos gnome org>
+ */
+
+
+#ifndef __GNOME_MOUSE_PROPETIES_H__
+#define __GNOME_MOUSE_PROPETIES_H__
+
+#include <gconf/gconf-client.h>
+#include <gtk/gtk.h>
+
+GtkBuilder* create_dialog (void);
+GConfClient* mouse_properties_conf_init (void);
+
+#endif /* __GNOME_MOUSE_PROPETIES_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]