Use the same marshaller for both GConfPropertyEditor and CcSettingEditor

This commit is contained in:
Rodrigo Moya 2010-10-08 17:17:12 +02:00
parent 7ebaaf64c9
commit b7972bc1cb
6 changed files with 54 additions and 35 deletions

View file

@ -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)

View file

@ -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,

View file

@ -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

View file

@ -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 ();

View file

@ -1,15 +0,0 @@
#include <gobject/gmarshal.h>
G_BEGIN_DECLS
/* VOID:STRING,POINTER (peditor-marshal.list:25) */
extern 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);
G_END_DECLS

View file

@ -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