[gnome-control-center/extensible-shell] Add "pointer" module that has Mouse, Touchpad and Accessibility settings



commit 6d52caec199c32f2c16b08d2a5f3b4a3b60f2c7b
Author: Thomas Wood <thomas wood intel com>
Date:   Fri Feb 12 16:27:18 2010 +0000

    Add "pointer" module that has Mouse, Touchpad and Accessibility settings

 capplets/mouse/Makefile.am              |   23 +++---
 capplets/mouse/cc-pointer-panel.c       |  151 +++++++++++++++++++++++++++++++
 capplets/mouse/cc-pointer-panel.h       |   77 ++++++++++++++++
 capplets/mouse/gnome-mouse-properties.c |    4 +-
 capplets/mouse/pointer-module.c         |   42 +++++++++
 5 files changed, 283 insertions(+), 14 deletions(-)
---
diff --git a/capplets/mouse/Makefile.am b/capplets/mouse/Makefile.am
index 21c70c7..67a0b20 100644
--- a/capplets/mouse/Makefile.am
+++ b/capplets/mouse/Makefile.am
@@ -14,31 +14,30 @@ INCLUDES = 						\
 bin_PROGRAMS = gnome-mouse-properties
 
 ccmodulesdir = $(EXTENSIONSDIR)
-ccmodules_LTLIBRARIES = libmouse.la
-
-libmouse_la_SOURCES =			\
-	mouse-module.c			\
-	cc-mouse-panel.h		\
-	cc-mouse-panel.c		\
-	cc-mouse-page.h			\
-	cc-mouse-page.c			\
+ccmodules_LTLIBRARIES = libpointer.la
+
+libpointer_la_SOURCES =			\
+	pointer-module.c		\
+	cc-pointer-panel.h		\
+	cc-pointer-panel.c		\
+	gnome-mouse-properties.c	\
 	$(NULL)
 
-libmouse_la_LDFLAGS =			\
+libpointer_la_LDFLAGS =			\
 	$(EXTENSION_LIBTOOL_FLAGS)	\
 	$(NULL)
 
-libmouse_la_LIBADD =			\
+libpointer_la_LIBADD =			\
 	$(EXTENSION_LIBS)		\
 	$(EXTENSION_COMMON_LIBS)	\
 	$(NULL)
 
-libmouse_la_CFLAGS =			\
+libpointer_la_CFLAGS =			\
 	$(EXTENSION_CFLAGS)		\
 	$(EXTENSION_COMMON_CFLAGS)	\
 	$(NULL)
 
-libmouse_la_LIBTOOLFLAGS = --tag=disable-static
+libpointer_la_LIBTOOLFLAGS = --tag=disable-static
 
 gnome_mouse_properties_LDADD = 		\
 	$(top_builddir)/libgnome-control-center-extension/libcommon.la \
diff --git a/capplets/mouse/cc-pointer-panel.c b/capplets/mouse/cc-pointer-panel.c
new file mode 100644
index 0000000..461af96
--- /dev/null
+++ b/capplets/mouse/cc-pointer-panel.c
@@ -0,0 +1,151 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * 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 of the License, 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.
+ *
+ * Author: Thomas Wood <thomas wood intel com>
+ *
+ */
+
+#include "cc-pointer-panel.h"
+#include <glib/gi18n.h>
+
+G_DEFINE_DYNAMIC_TYPE (CcPointerPanel, cc_pointer_panel, CC_TYPE_PANEL)
+
+#define POINTER_PANEL_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_POINTER_PANEL, CcPointerPanelPrivate))
+
+struct _CcPointerPanelPrivate
+{
+  gpointer dummy;
+};
+
+
+static void
+cc_pointer_panel_get_property (GObject    *object,
+                               guint       property_id,
+                               GValue     *value,
+                               GParamSpec *pspec)
+{
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+cc_pointer_panel_set_property (GObject      *object,
+                               guint         property_id,
+                               const GValue *value,
+                               GParamSpec   *pspec)
+{
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+cc_pointer_panel_dispose (GObject *object)
+{
+  G_OBJECT_CLASS (cc_pointer_panel_parent_class)->dispose (object);
+}
+
+static void
+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,
+                              GObjectConstructParam *properties)
+{
+  CcPointerPanel *panel;
+  GObjectClass *parent_class;
+
+  parent_class = G_OBJECT_CLASS (cc_pointer_panel_parent_class);
+
+  panel = (CcPointerPanel*) parent_class->constructor (type, n_properties,
+                                                       properties);
+
+  g_object_set (panel,
+                "id", "gnome-settings-mouse.desktop",
+                "display-name", _("Pointing Devices"),
+                NULL);
+
+  return (GObject *) panel;
+}
+
+static void
+cc_pointer_panel_class_init (CcPointerPanelClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (CcPointerPanelPrivate));
+
+  object_class->get_property = cc_pointer_panel_get_property;
+  object_class->set_property = cc_pointer_panel_set_property;
+  object_class->dispose = cc_pointer_panel_dispose;
+  object_class->finalize = cc_pointer_panel_finalize;
+  object_class->constructor = cc_pointer_panel_constructor;
+}
+
+static void
+cc_pointer_panel_class_finalize (CcPointerPanelClass *klass)
+{
+}
+
+static void
+cc_pointer_panel_init (CcPointerPanel *self)
+{
+  GtkBuilder *builder;
+  GtkWidget *prefs_widget;
+
+  self->priv = POINTER_PANEL_PRIVATE (self);
+
+
+  builder = create_dialog ();
+
+  prefs_widget = (GtkWidget*) gtk_builder_get_object (builder, "prefs_widget");
+
+  gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));
+}
+
+CcPointerPanel *
+cc_pointer_panel_new (void)
+{
+  return g_object_new (CC_TYPE_POINTER_PANEL, NULL);
+}
+
+
+void
+cc_pointer_panel_register (GIOModule *module)
+{
+  cc_pointer_panel_register_type (G_TYPE_MODULE (module));
+  g_io_extension_point_implement (CC_PANEL_EXTENSION_POINT_NAME,
+                                  CC_TYPE_POINTER_PANEL,
+                                  "pointer",
+                                  10);
+}
diff --git a/capplets/mouse/cc-pointer-panel.h b/capplets/mouse/cc-pointer-panel.h
new file mode 100644
index 0000000..4042a23
--- /dev/null
+++ b/capplets/mouse/cc-pointer-panel.h
@@ -0,0 +1,77 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * 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 of the License, 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.
+ *
+ * Author: Thomas Wood <thomas wood intel com>
+ *
+ */
+
+#ifndef _CC_POINTER_PANEL_H
+#define _CC_POINTER_PANEL_H
+
+#include <glib-object.h>
+#include "cc-panel.h"
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_POINTER_PANEL cc_pointer_panel_get_type()
+
+#define CC_POINTER_PANEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  CC_TYPE_POINTER_PANEL, CcPointerPanel))
+
+#define CC_POINTER_PANEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+  CC_TYPE_POINTER_PANEL, CcPointerPanelClass))
+
+#define CC_IS_POINTER_PANEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  CC_TYPE_POINTER_PANEL))
+
+#define CC_IS_POINTER_PANEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  CC_TYPE_POINTER_PANEL))
+
+#define CC_POINTER_PANEL_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  CC_TYPE_POINTER_PANEL, CcPointerPanelClass))
+
+typedef struct _CcPointerPanel CcPointerPanel;
+typedef struct _CcPointerPanelClass CcPointerPanelClass;
+typedef struct _CcPointerPanelPrivate CcPointerPanelPrivate;
+
+struct _CcPointerPanel
+{
+  CcPanel parent;
+
+  CcPointerPanelPrivate *priv;
+};
+
+struct _CcPointerPanelClass
+{
+  CcPanelClass parent_class;
+};
+
+GType cc_pointer_panel_get_type (void) G_GNUC_CONST;
+
+CcPointerPanel *cc_pointer_panel_new (void);
+void cc_pointer_panel_register (GIOModule *module);
+
+G_END_DECLS
+
+#endif /* _CC_POINTER_PANEL_H */
diff --git a/capplets/mouse/gnome-mouse-properties.c b/capplets/mouse/gnome-mouse-properties.c
index c5a05e9..09466c0 100644
--- a/capplets/mouse/gnome-mouse-properties.c
+++ b/capplets/mouse/gnome-mouse-properties.c
@@ -511,7 +511,7 @@ setup_dialog (GtkBuilder *dialog, GConfChangeSet *changeset)
 
 /* Construct the dialog */
 
-static GtkBuilder *
+GtkBuilder *
 create_dialog (void)
 {
 	GtkBuilder   *dialog;
@@ -580,7 +580,7 @@ main (int argc, char **argv)
 	GtkBuilder     *dialog;
 	GtkWidget      *dialog_win, *w;
 	gchar *start_page = NULL;
-	guint32 socket_id;
+	guint32 socket_id = 0;
 
 	GOptionContext *context;
 	GOptionEntry cap_options[] = {
diff --git a/capplets/mouse/pointer-module.c b/capplets/mouse/pointer-module.c
new file mode 100644
index 0000000..7fdc09a
--- /dev/null
+++ b/capplets/mouse/pointer-module.c
@@ -0,0 +1,42 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * 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 of the License, 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.
+ *
+ * Author: Thomas Wood <thomas wood intel com>
+ *
+ */
+
+#include <config.h>
+
+#include "cc-pointer-panel.h"
+
+#include <glib/gi18n.h>
+
+void
+g_io_module_load (GIOModule *module)
+{
+  bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+  cc_pointer_panel_register (module);
+}
+
+void
+g_io_module_unload (GIOModule *module)
+{
+}



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