diff options
Diffstat (limited to 'capplets/common')
-rw-r--r-- | capplets/common/ChangeLog | 45 | ||||
-rw-r--r-- | capplets/common/Makefile.am | 3 | ||||
-rw-r--r-- | capplets/common/bonobo-property-editor-range.c | 70 | ||||
-rw-r--r-- | capplets/common/bonobo-property-editor-range.h | 8 | ||||
-rw-r--r-- | capplets/common/capplet-util.c | 264 | ||||
-rw-r--r-- | capplets/common/capplet-util.h | 43 | ||||
-rw-r--r-- | capplets/common/gconf-property-editor.c | 98 | ||||
-rw-r--r-- | capplets/common/gnome-theme-info.c | 27 |
8 files changed, 89 insertions, 469 deletions
diff --git a/capplets/common/ChangeLog b/capplets/common/ChangeLog index b60d377e7..6800772bd 100644 --- a/capplets/common/ChangeLog +++ b/capplets/common/ChangeLog @@ -1,3 +1,48 @@ +2008-06-01 Thomas Wood <thos@gnome.org> + + * capplet-util.c: + * capplet-util.h: + + Remove some redundant and unused code + +2008-05-24 Jens Granseuer <jensgr@gmx.net> + + * gnome-theme-info.c: (gnome_theme_read_meta_theme), + (read_icon_theme), (read_cursor_theme), (read_cursor_fonts), + (update_theme_index): return to using paths instead of URIs since + most of the code using them expects paths + +2008-05-18 Thomas Wood <thos@gnome.org> + + * gconf-property-editor.c: (gconf_property_editor_class_init), + (gconf_property_editor_get_prop): Allow the data property to be + read as well as written. + +2008-05-18 Jens Granseuer <jensgr@gmx.net> + + * gconf-property-editor.c: (gconf_property_editor_init), + (gconf_property_editor_class_init), + (gconf_property_editor_finalize), (gconf_peditor_new), + (gconf_peditor_new_boolean), (gconf_peditor_new_integer_valist), + (gconf_peditor_new_string_valist), (gconf_peditor_new_color), + (gconf_peditor_new_combo_box), + (gconf_peditor_new_combo_box_with_enum), + (gconf_peditor_new_select_radio), + (gconf_peditor_new_numeric_range), + (gconf_peditor_widget_set_guard), (gconf_peditor_new_enum_toggle), + (peditor_image_set_filename), (peditor_image_clicked_cb), + (gconf_peditor_new_image), + (gconf_peditor_new_select_radio_with_enum): use G_DEFINE_TYPE to + get rid of the boilerplate code and remove a number of unnecessary + casts + +==================== 2.23.2 ==================== + +2008-05-17 Jens Granseuer <jensgr@gmx.net> + + * bonobo-property-editor-range.c: + * bonobo-property-editor-range.h: remove unused files + 2008-05-07 Jens Granseuer <jensgr@gmx.net> * gnome-theme-info.c: (gtk_theme_info_missing_engine), diff --git a/capplets/common/Makefile.am b/capplets/common/Makefile.am index ac0fbca3f..6b0d40d16 100644 --- a/capplets/common/Makefile.am +++ b/capplets/common/Makefile.am @@ -7,7 +7,6 @@ INCLUDES = \ -DG_LOG_DOMAIN=\"capplet-common\" \ -DINSTALL_PREFIX=\"$(prefix)\" \ -I$(top_srcdir) \ - -I$(top_srcdir)/libbackground \ -I$(top_srcdir)/libwindow-settings \ $(DBUS_CFLAGS) \ $(GNOME_DESKTOP_CFLAGS) \ @@ -41,7 +40,7 @@ libcommon_la_SOURCES = \ wm-common.c \ wm-common.h -libcommon_la_LIBADD = $(top_builddir)/libbackground/libbackground.la \ +libcommon_la_LIBADD = \ $(top_builddir)/libwindow-settings/libgnome-window-settings.la \ $(METACITY_LIBS) \ $(DBUS_LIBS) \ diff --git a/capplets/common/bonobo-property-editor-range.c b/capplets/common/bonobo-property-editor-range.c deleted file mode 100644 index f4069b63e..000000000 --- a/capplets/common/bonobo-property-editor-range.c +++ /dev/null @@ -1,70 +0,0 @@ -#include <bonobo-conf/bonobo-property-editor.h> -#include <gtk/gtkrange.h> -#include <gtk/gtksignal.h> -#include <bonobo.h> - -static void -changed_cb (GtkAdjustment *adj, BonoboPEditor *editor) -{ - CORBA_Environment ev; - DynamicAny_DynAny dyn; - BonoboArg *arg; - gulong val; - - CORBA_exception_init (&ev); - - val = adj->value; - - dyn = CORBA_ORB_create_basic_dyn_any (bonobo_orb (), TC_ulong, &ev); - DynamicAny_DynAny_insert_ulong (dyn, val, &ev); - - if (BONOBO_EX (&ev) || dyn == NULL) - return; - - arg = DynamicAny_DynAny_to_any (dyn, &ev); - bonobo_peditor_set_value (editor, arg, &ev); - - bonobo_arg_release (arg); - CORBA_Object_release ((CORBA_Object) dyn, &ev); - CORBA_exception_free (&ev); -} - -static void -adj_set_value_cb (BonoboPEditor *editor, - BonoboArg *value, - CORBA_Environment *ev) -{ - GtkAdjustment *adj; - gulong v; - - adj = gtk_range_get_adjustment (GTK_RANGE (bonobo_peditor_get_widget (editor))); - - if (!bonobo_arg_type_is_equal (value->_type, TC_ulong, NULL)) - return; - - v = BONOBO_ARG_GET_GENERAL (value, TC_ulong, CORBA_unsigned_long, NULL); - - gtk_signal_handler_block_by_func (GTK_OBJECT (adj), changed_cb, - editor); - - gtk_adjustment_set_value (adj, v); - - gtk_signal_handler_unblock_by_func (GTK_OBJECT (adj), changed_cb, - editor); -} - -GtkObject* bonobo_peditor_range_construct (GtkWidget *widget) -{ - BonoboPEditor *editor; - GtkAdjustment *adj; - - g_return_val_if_fail (widget != NULL, NULL); - g_return_val_if_fail (GTK_IS_RANGE (widget), NULL); - - editor = bonobo_peditor_construct (widget, adj_set_value_cb, TC_ulong); - adj = gtk_range_get_adjustment (GTK_RANGE (widget)); - gtk_signal_connect (GTK_OBJECT (adj), "value_changed", - GTK_SIGNAL_FUNC (changed_cb), editor); - - return GTK_OBJECT (editor); -} diff --git a/capplets/common/bonobo-property-editor-range.h b/capplets/common/bonobo-property-editor-range.h deleted file mode 100644 index a0167d48d..000000000 --- a/capplets/common/bonobo-property-editor-range.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __BONOBO_PROPERTY_RANGE_SCALE_H__ -#define __BONOBO_PROPERTY_RANGE_SCALE_H__ - -#include <gtk/gtkwidget.h> - -GtkObject* bonobo_peditor_range_construct (GtkWidget *widget); - -#endif /* __BONOBO_PROPERTY_RANGE_SCALE_H__ */ diff --git a/capplets/common/capplet-util.c b/capplets/common/capplet-util.c index afdc7956e..a1c6c6c9b 100644 --- a/capplets/common/capplet-util.c +++ b/capplets/common/capplet-util.c @@ -34,271 +34,7 @@ #include "capplet-util.h" -#if 0 - -/* apply_cb - * - * Callback issued when the user clicks "Apply" or "Ok". This function is - * responsible for making sure the current settings are properly saved. - */ - static void -apply_cb (BonoboPropertyControl *pc, Bonobo_PropertyControl_Action action) -{ - if (action == Bonobo_PropertyControl_APPLY) - gconf_engine_commit_change_set (gconf_engine_get_default (), - changeset, TRUE, NULL); -} - -/* properties_changed_cb - * - * Callback issued when some setting has changed - */ - -static void -properties_changed_cb (GConfEngine *engine, guint cnxn_id, GConfEntry *entry, gpointer user_data) -{ - if (apply_settings_cb != NULL) - apply_settings_cb (); -} - -/* get_control_cb - * - * Callback to construct the main dialog box for this capplet; invoked by Bonobo - * whenever capplet activation is requested. Returns a BonoboObject representing - * the control that encapsulates the object. - */ - -static BonoboObject * -get_control_cb (BonoboPropertyControl *property_control, gint page_number) -{ - BonoboControl *control; - GtkWidget *widget; - - widget = create_dialog_cb (); - - if (widget == NULL) - return NULL; - - control = bonobo_control_new (widget); - setup_property_editors_cb (widget, changeset); - - bonobo_control_set_automerge (control, TRUE); - - return BONOBO_OBJECT (control); -} - -/* create_control_cb - * - * Small function to create the PropertyControl and return it. - */ - -static BonoboObject * -create_control_cb (BonoboGenericFactory *factory, const gchar *component_id) -{ - BonoboObject *obj; - BonoboPropertyControl *property_control; - - static const gchar *prefix1 = "OAFIID:Bonobo_Control_Capplet_"; - - g_message ("%s: Enter", G_GNUC_FUNCTION); - - if (!strncmp (component_id, prefix1, strlen (prefix1))) { - property_control = bonobo_property_control_new - ((BonoboPropertyControlGetControlFn) get_control_cb, 1, NULL); - g_signal_connect (G_OBJECT (property_control), "action", - G_CALLBACK (apply_cb), NULL); - obj = BONOBO_OBJECT (property_control); - } else { - g_critical ("Not creating %s", component_id); - obj = NULL; - } - - return obj; -} - -/* get_factory_name - * - * Construct the OAF IID of the factory from the binary name - */ - -static gchar * -get_factory_name (const gchar *binary) -{ - gchar *s, *tmp, *tmp1, *res; - - s = g_strdup (binary); - tmp = strrchr (s, '/'); - if (tmp == NULL) tmp = s; - else tmp++; - if ((tmp1 = strstr (tmp, "-control")) != NULL) *tmp1 = '\0'; - if ((tmp1 = strstr (tmp, "-capplet")) != NULL) *tmp1 = '\0'; - while ((tmp1 = strchr (tmp, '-')) != NULL) *tmp1 = '_'; - - res = g_strconcat ("OAFIID:Bonobo_", tmp, "_Factory", NULL); - g_free (s); - return res; -} - -/* get_property_name - * - * Get the property name associated with this capplet - */ - -static gchar * -get_property_name (const gchar *binary) -{ - gchar *s, *tmp, *tmp1, *res; - - s = g_strdup (binary); - tmp = strrchr (s, '/'); - if (tmp == NULL) tmp = s; - else tmp++; - if ((tmp1 = strstr (tmp, "-control")) != NULL) *tmp1 = '\0'; - if ((tmp1 = strstr (tmp, "-capplet")) != NULL) *tmp1 = '\0'; - - for (tmp1 = tmp; *tmp1 != '\0'; tmp1++) { - *tmp1 = toupper (*tmp1); - if (*tmp1 == '-') *tmp1 = '_'; - } - - res = g_strconcat ("GNOME_", tmp, NULL); - g_free (s); - return res; -} - -#endif - -/* setup_session_mgmt - * - * Make sure the capplet launches and applies its settings next time the user - * logs in - */ - -void -setup_session_mgmt (const gchar *binary_name) -{ -/* Disabled. I never really understood this code anyway, and I am absolutely - * unclear about how to port it to GNOME 2.0 */ -#if 0 - GnomeClient *client; - GnomeClientFlags flags; - gint token; - gchar *restart_args[3]; - gchar *prop_name; - - g_return_if_fail (binary_name != NULL); - - client = gnome_master_client (); - flags = gnome_client_get_flags (client); - - if (flags & GNOME_CLIENT_IS_CONNECTED) { - prop_name = get_property_name (binary_name); - token = gnome_startup_acquire_token - (prop_name, gnome_client_get_id (client)); - g_free (prop_name); - - if (token) { - gnome_client_set_priority (client, 20); - gnome_client_set_restart_style - (client, GNOME_RESTART_ANYWAY); - restart_args[0] = g_strdup (binary_name); - restart_args[1] = "--init-session-settings"; - restart_args[2] = NULL; - gnome_client_set_restart_command - (client, 2, restart_args); - g_free (restart_args[0]); - } else { - gnome_client_set_restart_style - (client, GNOME_RESTART_NEVER); - } - } -#endif -} - -#if 0 - -/* capplet_init -- see documentation in capplet-util.h - */ - -void -capplet_init (int argc, - char **argv, - ApplySettingsFn apply_fn, - CreateDialogFn create_dialog_fn, - SetupPropertyEditorsFn setup_fn, - GetLegacySettingsFn get_legacy_fn) -{ - gchar *factory_iid; - BonoboGenericFactory *factory; - GOptionContext *context; - - static gboolean apply_only; - static gboolean get_legacy; - static GOptionEntry cap_options[] = { - { "apply", 0, 0, G_OPTION_ARG_NONE, &apply_only, - N_("Just apply settings and quit"), NULL }, - { "init-session-settings", 0, 0, G_OPTION_ARG_NONE, &apply_only, - N_("Just apply settings and quit"), NULL }, - { "get-legacy", 0, 0, G_OPTION_ARG_NONE, &get_legacy, - N_("Retrieve and store legacy settings"), NULL }, - { NULL } - }; - - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); - - context = g_option_context_new (NULL); - g_option_context_add_main_entries (context, cap_options, GETTEXT_PACKAGE); - - gnome_program_init (argv[0], VERSION, LIBGNOMEUI_MODULE, argc, argv, - GNOME_PARAM_GOPTION_CONTEXT, context, - NULL); - - if (!bonobo_init (&argc, argv)) - g_error ("Cannot initialize bonobo"); - - if (apply_only && apply_fn != NULL) { - setup_session_mgmt (argv[0]); - apply_fn (); - } - else if (get_legacy && get_legacy_fn != NULL) { - setup_session_mgmt (argv[0]); - get_legacy_fn (); - } else { - setup_session_mgmt (argv[0]); - - create_dialog_cb = create_dialog_fn; - apply_settings_cb = apply_fn; - setup_property_editors_cb = setup_fn; - - factory_iid = get_factory_name (argv[0]); - factory = bonobo_generic_factory_new - (factory_iid, (BonoboFactoryCallback) create_control_cb, NULL); - g_free (factory_iid); - bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory)); - - changeset = gconf_change_set_new (); - - bonobo_main (); - - gconf_change_set_unref (changeset); - } -} - -#endif - - -/** - * capplet_error_dialog : - * - * @parent : - * @msg : already translated. - * @err : - * - */ -void capplet_error_dialog (GtkWindow *parent, char const *msg, GError *err) { if (err != NULL) { diff --git a/capplets/common/capplet-util.h b/capplets/common/capplet-util.h index 5fa179d2f..f28e99299 100644 --- a/capplets/common/capplet-util.h +++ b/capplets/common/capplet-util.h @@ -42,49 +42,8 @@ if (!def) \ gconf_client_set_##type (client, key, val_##type, NULL); -/* Callback to apply the settings in the given database */ -typedef void (*ApplySettingsFn) (void); +/* Some miscellaneous functions useful to all capplets */ -/* Callback to set up the dialog proper */ -typedef GtkWidget *(*CreateDialogFn) (void); - -/* Callback to set up property editors for the dialog */ -typedef void (*SetupPropertyEditorsFn) (GtkWidget *dialog, GConfChangeSet *changeset); - -/* Callback to retrieve legacy settings and store them in the new configuration - * database */ -typedef void (*GetLegacySettingsFn) (void); - -/* Set up the session management so that this capplet will apply its - * settings on every startup - */ - -void setup_session_mgmt (const gchar *binary_name); - -/* Wrapper function for the entire capplet. This handles all initialization and - * runs the capplet for you. Just supply the appropriate callbacks and your argc - * and argv from main() - * - * This function makes several assumptions, requiring that all capplets follow a - * particular convention. In particular, suppose the name of the capplet binary - * is foo-properties-capplet. Then: - * - * - The factory IID is Bonobo_Control_Capplet_foo_properties_Factory - * - The default configuration moniker is archiver:foo-properties - * - * Following this convention yields capplets that are more uniform and thus - * easier to maintain, and simplifies the interfaces quite a bit. All capplet in - * this package are required to follow this convention. - */ - -void capplet_init (int argc, - gchar **argv, - ApplySettingsFn apply_fn, - CreateDialogFn create_dialog_fn, - SetupPropertyEditorsFn setup_property_editors_fn, - GetLegacySettingsFn get_legacy_settings_fn); - -void capplet_error_dialog (GtkWindow *parent, char const *msg, GError *err); void capplet_help (GtkWindow *parent, char const *helpfile, char const *section); void capplet_set_icon (GtkWidget *window, char const *icon_file_name); diff --git a/capplets/common/gconf-property-editor.c b/capplets/common/gconf-property-editor.c index 6c1ef00aa..728b528e5 100644 --- a/capplets/common/gconf-property-editor.c +++ b/capplets/common/gconf-property-editor.c @@ -48,8 +48,6 @@ enum { PROP_DATA_FREE_CB }; -typedef void (*GConfPropertyEditorDataFreeCb) (gpointer data); - struct _GConfPropertyEditorPrivate { gchar *key; @@ -61,8 +59,8 @@ struct _GConfPropertyEditorPrivate GConfClientNotifyFunc callback; gboolean inited; - gpointer data; - GConfPropertyEditorDataFreeCb data_free_cb; + gpointer data; + GFreeFunc data_free_cb; }; typedef struct @@ -76,13 +74,6 @@ typedef struct static guint peditor_signals[LAST_SIGNAL]; -static GObjectClass *parent_class; - -static void gconf_property_editor_init (GConfPropertyEditor *gconf_property_editor, - GConfPropertyEditorClass *class); -static void gconf_property_editor_class_init (GConfPropertyEditorClass *class); -static void gconf_property_editor_base_init (GConfPropertyEditorClass *class); - static void gconf_property_editor_set_prop (GObject *object, guint prop_id, const GValue *value, @@ -103,33 +94,11 @@ static GObject *gconf_peditor_new (const gchar *key, const gchar *first_custom, ...); -GType -gconf_property_editor_get_type (void) -{ - static GType gconf_property_editor_type = 0; - - if (!gconf_property_editor_type) { - GTypeInfo gconf_property_editor_info = { - sizeof (GConfPropertyEditorClass), - (GBaseInitFunc) gconf_property_editor_base_init, - NULL, /* GBaseFinalizeFunc */ - (GClassInitFunc) gconf_property_editor_class_init, - NULL, /* GClassFinalizeFunc */ - NULL, /* user-supplied data */ - sizeof (GConfPropertyEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gconf_property_editor_init, - NULL - }; - - gconf_property_editor_type = - g_type_register_static (G_TYPE_OBJECT, - "GConfPropertyEditor", - &gconf_property_editor_info, 0); - } +G_DEFINE_TYPE (GConfPropertyEditor, gconf_property_editor, G_TYPE_OBJECT) + +#define GCONF_PROPERTY_EDITOR_GET_PRIVATE(object) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((object), gconf_property_editor_get_type (), GConfPropertyEditorPrivate)) - return gconf_property_editor_type; -} static GConfValue* gconf_property_editor_conv_default (GConfPropertyEditor *peditor, @@ -139,21 +108,15 @@ gconf_property_editor_conv_default (GConfPropertyEditor *peditor, } static void -gconf_property_editor_init (GConfPropertyEditor *gconf_property_editor, - GConfPropertyEditorClass *class) +gconf_property_editor_init (GConfPropertyEditor *gconf_property_editor) { - gconf_property_editor->p = g_new0 (GConfPropertyEditorPrivate, 1); + gconf_property_editor->p = GCONF_PROPERTY_EDITOR_GET_PRIVATE (gconf_property_editor); gconf_property_editor->p->conv_to_widget_cb = gconf_property_editor_conv_default; gconf_property_editor->p->conv_from_widget_cb = gconf_property_editor_conv_default; gconf_property_editor->p->inited = FALSE; } static void -gconf_property_editor_base_init (GConfPropertyEditorClass *class) -{ -} - -static void gconf_property_editor_class_init (GConfPropertyEditorClass *class) { GObjectClass *object_class; @@ -216,7 +179,7 @@ gconf_property_editor_class_init (GConfPropertyEditorClass *class) g_param_spec_pointer ("data", _("Property editor object data"), _("Custom data required by the specific property editor"), - G_PARAM_WRITABLE)); + G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_DATA_FREE_CB, @@ -225,8 +188,7 @@ gconf_property_editor_class_init (GConfPropertyEditorClass *class) _("Callback to be issued when property editor object data is to be freed"), G_PARAM_WRITABLE)); - parent_class = G_OBJECT_CLASS - (g_type_class_ref (G_TYPE_OBJECT)); + g_type_class_add_private (class, sizeof (GConfPropertyEditorPrivate)); } static void @@ -314,6 +276,9 @@ gconf_property_editor_get_prop (GObject *object, g_value_set_pointer (value, peditor->p->changeset); break; + case PROP_DATA: + g_value_set_pointer (value, peditor->p->data); + break; default: g_warning ("Bad argument get"); break; @@ -344,9 +309,7 @@ gconf_property_editor_finalize (GObject *object) g_object_unref (client); } - g_free (gconf_property_editor->p); - - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gconf_property_editor_parent_class)->finalize (object); } static GObject * @@ -388,7 +351,7 @@ gconf_peditor_new (const gchar *key, GCONF_PROPERTY_EDITOR (obj)->p->callback (client, 0, gconf_entry, obj); GCONF_PROPERTY_EDITOR (obj)->p->inited = TRUE; gconf_entry_free (gconf_entry); - g_object_unref (G_OBJECT (client)); + g_object_unref (client); return obj; } @@ -490,7 +453,7 @@ gconf_peditor_new_boolean (GConfChangeSet *changeset, va_end (var_args); - g_signal_connect_swapped (G_OBJECT (checkbox), "toggled", + g_signal_connect_swapped (checkbox, "toggled", (GCallback) peditor_boolean_widget_changed, peditor); return peditor; @@ -559,7 +522,7 @@ gconf_peditor_new_integer_valist (GConfChangeSet *changeset, first_property_name, var_args, NULL); - g_signal_connect_swapped (G_OBJECT (entry), "changed", + g_signal_connect_swapped (entry, "changed", (GCallback) peditor_integer_widget_changed, peditor); return peditor; @@ -653,7 +616,7 @@ gconf_peditor_new_string_valist (GConfChangeSet *changeset, first_property_name, var_args, NULL); - g_signal_connect_swapped (G_OBJECT (entry), "changed", + g_signal_connect_swapped (entry, "changed", (GCallback) peditor_string_widget_changed, peditor); return peditor; @@ -788,7 +751,7 @@ gconf_peditor_new_color (GConfChangeSet *changeset, va_end (var_args); - g_signal_connect_swapped (G_OBJECT (cb), "color_set", + g_signal_connect_swapped (cb, "color_set", (GCallback) peditor_color_widget_changed, peditor); return peditor; @@ -941,7 +904,7 @@ gconf_peditor_new_combo_box (GConfChangeSet *changeset, va_end (var_args); - g_signal_connect_swapped (G_OBJECT (combo_box), "changed", + g_signal_connect_swapped (combo_box, "changed", (GCallback) peditor_combo_box_widget_changed, peditor); return peditor; @@ -991,7 +954,7 @@ gconf_peditor_new_combo_box_with_enum (GConfChangeSet *changeset, va_end (var_args); - g_signal_connect_swapped (G_OBJECT (combo_box), "changed", + g_signal_connect_swapped (combo_box, "changed", (GCallback) peditor_combo_box_widget_changed, peditor); return peditor; @@ -1078,7 +1041,7 @@ gconf_peditor_new_select_radio (GConfChangeSet *changeset, va_end (var_args); for (item = radio_group; item != NULL; item = item->next) - g_signal_connect_swapped (G_OBJECT (item->data), "toggled", + g_signal_connect_swapped (item->data, "toggled", (GCallback) peditor_select_radio_widget_changed, peditor); return peditor; @@ -1190,7 +1153,7 @@ gconf_peditor_new_numeric_range (GConfChangeSet *changeset, (key, (GConfClientNotifyFunc) peditor_numeric_range_value_changed, changeset, - G_OBJECT (adjustment), + adjustment, first_property_name, var_args, NULL); @@ -1237,7 +1200,6 @@ gconf_peditor_widget_set_guard (GConfPropertyEditor *peditor, g_return_if_fail (GTK_IS_WIDGET (widget)); client = gconf_client_get_default (); - value = gconf_client_get (client, peditor->p->key, NULL); g_object_unref (client); @@ -1248,7 +1210,7 @@ gconf_peditor_widget_set_guard (GConfPropertyEditor *peditor, g_warning ("NULL GConf value: %s: possibly incomplete setup", peditor->p->key); } - g_signal_connect (G_OBJECT (peditor), "value-changed", (GCallback) guard_value_changed, widget); + g_signal_connect (peditor, "value-changed", (GCallback) guard_value_changed, widget); } GConfValue * @@ -1442,7 +1404,7 @@ gconf_peditor_new_enum_toggle (GConfChangeSet *changeset, va_end (var_args); - g_signal_connect_swapped (G_OBJECT (checkbox), "toggled", + g_signal_connect_swapped (checkbox, "toggled", (GCallback) peditor_boolean_widget_changed, peditor); return peditor; @@ -1519,7 +1481,7 @@ peditor_image_set_filename (GConfPropertyEditor *peditor, const gchar *filename) } gtk_image_set_from_pixbuf (image, pixbuf); - g_object_unref (G_OBJECT (pixbuf)); + g_object_unref (pixbuf); return TRUE; } @@ -1637,10 +1599,10 @@ peditor_image_clicked_cb (GConfPropertyEditor *peditor, GtkButton *button) if (filename && strcmp (filename, "")) gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (chooser), filename); - g_signal_connect (G_OBJECT (chooser), "update-preview", + g_signal_connect (chooser, "update-preview", G_CALLBACK (peditor_image_chooser_update_preview_cb), preview); - g_signal_connect (G_OBJECT (chooser), "response", + g_signal_connect (chooser, "response", G_CALLBACK (peditor_image_chooser_response_cb), peditor); @@ -1700,7 +1662,7 @@ gconf_peditor_new_image (GConfChangeSet *changeset, va_end (var_args); - g_signal_connect_swapped (G_OBJECT (button), "clicked", + g_signal_connect_swapped (button, "clicked", (GCallback) peditor_image_clicked_cb, peditor); return peditor; @@ -1754,7 +1716,7 @@ gconf_peditor_new_select_radio_with_enum (GConfChangeSet *changeset, va_end (var_args); for (item = radio_group; item != NULL; item = item->next) - g_signal_connect_swapped (G_OBJECT (item->data), "toggled", + g_signal_connect_swapped (item->data, "toggled", (GCallback) peditor_select_radio_widget_changed, peditor); return peditor; diff --git a/capplets/common/gnome-theme-info.c b/capplets/common/gnome-theme-info.c index b9edbcdf1..98941ad4f 100644 --- a/capplets/common/gnome-theme-info.c +++ b/capplets/common/gnome-theme-info.c @@ -269,14 +269,14 @@ gnome_theme_read_meta_theme (GFile *meta_theme_uri) meta_theme_file = g_file_get_uri (meta_theme_uri); meta_theme_ditem = gnome_desktop_item_new_from_uri (meta_theme_file, 0, NULL); - if (meta_theme_ditem == NULL) { - g_free (meta_theme_file); + g_free (meta_theme_file); + + if (meta_theme_ditem == NULL) return NULL; - } common_theme_dir_uri = g_file_get_parent (meta_theme_uri); meta_theme_info = gnome_theme_meta_info_new (); - meta_theme_info->path = meta_theme_file; + meta_theme_info->path = g_file_get_path (meta_theme_uri); meta_theme_info->name = g_file_get_basename (common_theme_dir_uri); g_object_unref (common_theme_dir_uri); @@ -390,15 +390,14 @@ read_icon_theme (GFile *icon_theme_uri) icon_theme_file = g_file_get_uri (icon_theme_uri); icon_theme_ditem = gnome_desktop_item_new_from_uri (icon_theme_file, 0, NULL); - if (icon_theme_ditem == NULL) { - g_free (icon_theme_file); + g_free (icon_theme_file); + + if (icon_theme_ditem == NULL) return NULL; - } name = gnome_desktop_item_get_string (icon_theme_ditem, "Icon Theme/Name"); if (name == NULL) { gnome_desktop_item_unref (icon_theme_ditem); - g_free (icon_theme_file); return NULL; } @@ -406,7 +405,6 @@ read_icon_theme (GFile *icon_theme_uri) directories = gnome_desktop_item_get_string (icon_theme_ditem, "Icon Theme/Directories"); if (directories == NULL) { gnome_desktop_item_unref (icon_theme_ditem); - g_free (icon_theme_file); return NULL; } @@ -416,13 +414,12 @@ read_icon_theme (GFile *icon_theme_uri) gchar *dir_name; icon_theme_info = gnome_theme_icon_info_new (); icon_theme_info->readable_name = g_strdup (name); - icon_theme_info->path = icon_theme_file; - dir_name = g_path_get_dirname (icon_theme_file); + icon_theme_info->path = g_file_get_path (icon_theme_uri); + dir_name = g_path_get_dirname (icon_theme_info->path); icon_theme_info->name = g_path_get_basename (dir_name); g_free (dir_name); } else { icon_theme_info = NULL; - g_free (icon_theme_file); } gnome_desktop_item_unref (icon_theme_ditem); @@ -538,7 +535,7 @@ read_cursor_theme (GFile *cursor_theme_uri) } cursor_theme_info = gnome_theme_cursor_info_new (); - cursor_theme_info->path = g_file_get_uri (parent_uri); + cursor_theme_info->path = g_file_get_path (parent_uri); cursor_theme_info->name = name; cursor_theme_info->sizes = sizes; cursor_theme_info->thumbnail = thumbnail; @@ -664,7 +661,7 @@ read_cursor_fonts (void) theme_info->thumbnail = gdk_pixbuf_new_from_file (filename, NULL); g_free (filename); - theme_info->path = g_build_filename ("file://" GNOMECC_DATA_DIR, builtins[i][0], NULL); + theme_info->path = g_build_filename (GNOMECC_DATA_DIR, builtins[i][0], NULL); theme_info->name = g_strdup (theme_info->path); if (!strcmp (theme_info->path, cursor_font)) @@ -759,7 +756,7 @@ update_theme_index (GFile *index_uri, /* Next, we see what currently exists */ parent = g_file_get_parent (index_uri); common_theme_dir_uri = g_file_get_parent (parent); - common_theme_dir = g_file_get_uri (common_theme_dir_uri); + common_theme_dir = g_file_get_path (common_theme_dir_uri); theme_info = g_hash_table_lookup (theme_hash_by_uri, common_theme_dir); if (theme_info == NULL) { |