[gnome-control-center] Use the same marshaller for both GConfPropertyEditor and CcSettingEditor



commit b7972bc1cbb49a212556ae4c1b18e9a9a113e081
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Fri Oct 8 17:17:12 2010 +0200

    Use the same marshaller for both GConfPropertyEditor and CcSettingEditor

 libgnome-control-center/Makefile.am                |    4 +-
 ...conf-property-editor-marshal.c => cc-marshal.c} |   14 ++++----
 libgnome-control-center/cc-marshal.h               |   15 ++++++++
 libgnome-control-center/cc-setting-editor.c        |   37 +++++++++++++++-----
 .../gconf-property-editor-marshal.h                |   15 --------
 libgnome-control-center/gconf-property-editor.c    |    4 +-
 6 files changed, 54 insertions(+), 35 deletions(-)
---
diff --git a/libgnome-control-center/Makefile.am b/libgnome-control-center/Makefile.am
index 17af870..d0c3720 100644
--- a/libgnome-control-center/Makefile.am
+++ b/libgnome-control-center/Makefile.am
@@ -17,14 +17,14 @@ libgnome_control_center_include_HEADERS =	\
 	$(NULL)
 
 libgnome_control_center_la_SOURCES =		\
+	cc-marshal.c				\
+	cc-marshal.h				\
 	cc-panel.c				\
 	cc-panel.h				\
 	cc-setting-editor.c			\
 	cc-setting-editor.h			\
 	cc-shell.c				\
 	cc-shell.h				\
-	gconf-property-editor-marshal.c 	\
-	gconf-property-editor-marshal.h 	\
 	gconf-property-editor.c			\
 	gconf-property-editor.h			\
 	$(NULL)
diff --git a/libgnome-control-center/gconf-property-editor-marshal.c b/libgnome-control-center/cc-marshal.c
similarity index 67%
rename from libgnome-control-center/gconf-property-editor-marshal.c
rename to libgnome-control-center/cc-marshal.c
index bb6c9b0..bf0ce47 100644
--- a/libgnome-control-center/gconf-property-editor-marshal.c
+++ b/libgnome-control-center/cc-marshal.c
@@ -1,15 +1,15 @@
 #include <glib.h>
 #include <glib-object.h>
-#include "gconf-property-editor-marshal.h"
+#include "cc-marshal.h"
 
 /* VOID:STRING,POINTER (peditor-marshal.list:25) */
 void
-gconf_property_editor_marshal_VOID__STRING_POINTER (GClosure     *closure,
-                                                    GValue       *return_value,
-                                                    guint         n_param_values,
-                                                    const GValue *param_values,
-                                                    gpointer      invocation_hint,
-                                                    gpointer      marshal_data)
+cc_marshal_VOID__STRING_POINTER (GClosure     *closure,
+				 GValue       *return_value,
+				 guint         n_param_values,
+				 const GValue *param_values,
+				 gpointer      invocation_hint,
+				 gpointer      marshal_data)
 {
   typedef void (*GMarshalFunc_VOID__STRING_POINTER) (gpointer     data1,
                                                      gpointer     arg_1,
diff --git a/libgnome-control-center/cc-marshal.h b/libgnome-control-center/cc-marshal.h
new file mode 100644
index 0000000..86599df
--- /dev/null
+++ b/libgnome-control-center/cc-marshal.h
@@ -0,0 +1,15 @@
+
+#include	<gobject/gmarshal.h>
+
+G_BEGIN_DECLS
+
+/* VOID:STRING,POINTER (peditor-marshal.list:25) */
+extern void cc_marshal_VOID__STRING_POINTER (GClosure     *closure,
+					     GValue       *return_value,
+					     guint         n_param_values,
+					     const GValue *param_values,
+					     gpointer      invocation_hint,
+					     gpointer      marshal_data);
+
+G_END_DECLS
+
diff --git a/libgnome-control-center/cc-setting-editor.c b/libgnome-control-center/cc-setting-editor.c
index 34c38fe..db15cf7 100644
--- a/libgnome-control-center/cc-setting-editor.c
+++ b/libgnome-control-center/cc-setting-editor.c
@@ -20,12 +20,18 @@
  */
 
 #include "cc-setting-editor.h"
+#include "cc-marshal.h"
 
 enum {
-    PIXBUF_COL,
-    TEXT_COL,
-    APP_INFO_COL,
-    N_COLUMNS
+  PIXBUF_COL,
+  TEXT_COL,
+  APP_INFO_COL,
+  N_COLUMNS
+};
+
+enum {
+  VALUE_CHANGED,
+  LAST_SIGNAL
 };
 
 typedef enum {
@@ -43,6 +49,8 @@ struct _CcSettingEditorPrivate
   GtkWidget *ui_control;
 };
 
+static guint seditor_signals[LAST_SIGNAL] = { 0, };
+
 G_DEFINE_TYPE(CcSettingEditor, cc_setting_editor, G_TYPE_OBJECT)
 
 static void
@@ -72,6 +80,14 @@ cc_setting_editor_class_init (CcSettingEditorClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->finalize = cc_setting_editor_finalize;
+
+  /* Class signals */
+  seditor_signals[VALUE_CHANGED] = g_signal_new ("value-changed",
+                                                 G_TYPE_FROM_CLASS (klass), 0,
+                                                 G_STRUCT_OFFSET (CcSettingEditorClass, value_changed),
+                                                 NULL, NULL,
+                                                 (GSignalCMarshaller) cc_marshal_VOID__STRING_POINTER,
+                                                 G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_POINTER);
 }
 
 static void
@@ -113,11 +129,13 @@ application_selection_changed_cb (GtkComboBox *combobox, CcSettingEditor *sedito
     gtk_tree_model_get (gtk_combo_box_get_model (combobox), &selected_row,
                          APP_INFO_COL, &app_info,
                          -1);
-    if (!g_app_info_set_as_default_for_type (app_info, seditor->priv->key, &error)) {
-      g_warning ("Could not set %s as default app for %s: %s",
-                 g_app_info_get_display_name (app_info),
-                 seditor->priv->key,
-                 error->message);
+    if (app_info != NULL) {
+      if (!g_app_info_set_as_default_for_type (app_info, seditor->priv->key, &error)) {
+        g_warning ("Could not set %s as default app for %s: %s",
+                   g_app_info_get_display_name (app_info),
+                   seditor->priv->key,
+                   error->message);
+      }
     }
   }
 }
@@ -146,6 +164,7 @@ cc_setting_editor_new_application (const gchar *mime_type, GtkWidget *combobox)
                                    mime_type,
                                    combobox);
 
+  /* Setup the combo box */
   model = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER);
 
   renderer = gtk_cell_renderer_pixbuf_new ();
diff --git a/libgnome-control-center/gconf-property-editor.c b/libgnome-control-center/gconf-property-editor.c
index bf3b4eb..7f709ee 100644
--- a/libgnome-control-center/gconf-property-editor.c
+++ b/libgnome-control-center/gconf-property-editor.c
@@ -30,7 +30,7 @@
 #include <stdlib.h>
 
 #include "gconf-property-editor.h"
-#include "gconf-property-editor-marshal.h"
+#include "cc-marshal.h"
 
 enum {
 	VALUE_CHANGED,
@@ -172,7 +172,7 @@ gconf_property_editor_class_init (GConfPropertyEditorClass *class)
 			      G_TYPE_FROM_CLASS (object_class), 0,
 			      G_STRUCT_OFFSET (GConfPropertyEditorClass, value_changed),
 			      NULL, NULL,
-			      (GSignalCMarshaller) gconf_property_editor_marshal_VOID__STRING_POINTER,
+			      (GSignalCMarshaller) cc_marshal_VOID__STRING_POINTER,
 			      G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_POINTER);
 
 	g_object_class_install_property



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