[drwright] Make cc panel work with latest cc



commit 5ebd75d3ef00d00087688a8fc998d5b4cff89495
Author: Christian Persch <chpe gnome org>
Date:   Thu Sep 29 21:55:23 2011 +0200

    Make cc panel work with latest cc

 configure.in        |    5 +--
 src/drw-cc-module.c |    4 ++-
 src/drw-cc-panel.c  |   52 +++++++++++++++++++++++++++++++++++++++++++++++---
 src/drw-cc-panel.h  |   16 +-------------
 4 files changed, 55 insertions(+), 22 deletions(-)
---
diff --git a/configure.in b/configure.in
index 2359154..505e12d 100644
--- a/configure.in
+++ b/configure.in
@@ -99,10 +99,9 @@ AC_SUBST([GSD_PLUGIN_LDFLAGS])
 # Control centre panel
 # ********************
 
-PKG_CHECK_MODULES([CCPANEL],[
-  libgnome-control-center >= $GNOMECC_REQUIRED])
+PKG_CHECK_MODULES([CCPANEL],[gio-2.0 gtk+-3.0])
 
-ccpanelsdir=`$PKG_CONFIG --variable=extensiondir libgnome-control-center`
+ccpanelsdir='${libdir}/control-center-1/panels'
 AC_SUBST([ccpanelsdir])
 
 CCPANEL_LDFLAGS="-export_dynamic -avoid-version -module -no-undefined -export-symbols-regex '^g_io_module_(load|unload)'"
diff --git a/src/drw-cc-module.c b/src/drw-cc-module.c
index dd53938..39a747c 100644
--- a/src/drw-cc-module.c
+++ b/src/drw-cc-module.c
@@ -22,6 +22,8 @@
 
 #include "drw-cc-panel.h"
 
+#include <glib-object.h>
+#include <gio/gio.h>
 #include <glib/gi18n-lib.h>
 
 void
@@ -31,7 +33,7 @@ g_io_module_load (GIOModule *module)
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
   /* register the panel */
-  drw_cc_panel_register (module);
+  drw_cc_panel_register_type (G_TYPE_MODULE (module));
 }
 
 void
diff --git a/src/drw-cc-panel.c b/src/drw-cc-panel.c
index dbcb20a..1e4f404 100644
--- a/src/drw-cc-panel.c
+++ b/src/drw-cc-panel.c
@@ -26,11 +26,18 @@
 #include <errno.h>
 #include <string.h>
 
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
 #include "drw-cc-panel.h"
 
 #define DRW_SETTINGS_SCHEMA_ID "org.gnome.settings-daemon.plugins.typing-break"
 
-G_DEFINE_DYNAMIC_TYPE (DrwCcPanel, drw_cc_panel, CC_TYPE_PANEL)
+/* from libgnome-control-center */
+#define CC_SHELL_PANEL_EXTENSION_POINT "control-center-1"
+
+static GType drw_cc_panel_type;
+static gpointer drw_cc_panel_parent_class;
 
 #if 0
 #define DRW_PANEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DRW_TYPE_CC_PANEL, DrwCcPanelPrivate))
@@ -142,6 +149,8 @@ drw_cc_panel_class_init (DrwCcPanelClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
+  drw_cc_panel_parent_class = g_type_class_peek_parent (klass);
+
   /* g_type_class_add_private (klass, sizeof (DrwCcPanelPrivate)); */
 
   object_class->get_property = drw_cc_panel_get_property;
@@ -220,10 +229,45 @@ drw_cc_panel_init (DrwCcPanel *self)
 }
 
 void
-drw_cc_panel_register (GIOModule *module)
+drw_cc_panel_register_type (GTypeModule *module)
 {
-  drw_cc_panel_register_type (G_TYPE_MODULE (module));
+  GType parent_type, g_define_type_id;
+  GTypeQuery query;
+  GTypeInfo type_info = {
+    0,
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) drw_cc_panel_class_init,
+    (GClassFinalizeFunc) drw_cc_panel_class_finalize,
+    NULL,
+    0,
+    0,
+    (GInstanceInitFunc) drw_cc_panel_init,
+    NULL
+  };
+
+  parent_type = g_type_from_name ("CcPanel");
+  g_assert (parent_type != G_TYPE_INVALID);
+
+  g_type_query (parent_type, &query);
+  type_info.class_size = query.class_size;
+  type_info.instance_size = query.instance_size;
+
+  g_define_type_id =
+    drw_cc_panel_type =
+      g_type_module_register_type (module,
+                                   parent_type,
+                                   "DrwCcPanel",
+                                   &type_info,
+                                   0);
+
   g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
-                                  DRW_TYPE_CC_PANEL,
+                                  g_define_type_id,
                                   "typing-break", 0);
 }
+
+GType
+drw_cc_panel_get_type (void)
+{
+  return drw_cc_panel_type;
+}
diff --git a/src/drw-cc-panel.h b/src/drw-cc-panel.h
index 6ddea93..b0db9fb 100644
--- a/src/drw-cc-panel.h
+++ b/src/drw-cc-panel.h
@@ -21,7 +21,7 @@
 #ifndef DRW_CC_PANEL_H
 #define DRW_CC_PANEL_H
 
-#include <libgnome-control-center/cc-panel.h>
+#include <glib-object.h>
 
 G_BEGIN_DECLS
 
@@ -51,21 +51,9 @@ typedef struct _DrwCcPanel DrwCcPanel;
 typedef struct _DrwCcPanelClass DrwCcPanelClass;
 typedef struct _DrwCcPanelPrivate DrwCcPanelPrivate;
 
-struct _DrwCcPanel
-{
-  CcPanel parent;
-
-  DrwCcPanelPrivate *priv;
-};
-
-struct _DrwCcPanelClass
-{
-  CcPanelClass parent_class;
-};
-
 GType drw_cc_panel_get_type (void) G_GNUC_CONST;
 
-void  drw_cc_panel_register (GIOModule *module);
+void  drw_cc_panel_register_type (GTypeModule *module);
 
 G_END_DECLS
 



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