summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-11-15 10:56:33 +0200
committerJasmine Hassan <[email protected]>2012-11-16 09:45:51 +0200
commit20ceebe17ffc956f59ce28834d528d436e66f796 (patch)
tree785f519ada76d0dee84a8d3d6a695c6692c1f45d /libcaja-private
parentb6dc7b5cfbcc1f619084293d462f3f359c2e7121 (diff)
downloadcaja-20ceebe17ffc956f59ce28834d528d436e66f796.tar.bz2
caja-20ceebe17ffc956f59ce28834d528d436e66f796.tar.xz
[directory-background] Use weak refs instead of EelBackground destroy signal
i.e. don't connect to the destroy signal of EelBackground, in favor of g_object_weak_ref() and g_object_weak_unref() Though Nautilus removed code for setting non-desktop window backgrounds: http://git.gnome.org/browse/nautilus/commit/?id=c9be35b3ee6c468a9a102b317b82b8b639637d0f ..this is a tad similar: directory-background: don't user the 'destroy' signal of EelBackground http://git.gnome.org/browse/nautilus/commit/?id=fbb6b024128e3c35aeb1d74f8e287e8870c9999f&context=12
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-directory-background.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/libcaja-private/caja-directory-background.c b/libcaja-private/caja-directory-background.c
index 21aea675..a445aab7 100644
--- a/libcaja-private/caja-directory-background.c
+++ b/libcaja-private/caja-directory-background.c
@@ -296,11 +296,12 @@ desktop_background_settings_notify_cb (GSettings *settings, gchar *key, gpointer
}
static void
-desktop_background_destroyed_callback (EelBackground *background, void *georgeWBush)
+desktop_background_weak_notify (gpointer data,
+ GObject *object)
{
g_signal_handlers_disconnect_by_func(mate_background_preferences,
G_CALLBACK (desktop_background_settings_notify_cb),
- background);
+ object);
}
static void
@@ -309,10 +310,10 @@ caja_file_background_receive_settings_changes (EelBackground *background)
g_signal_connect (mate_background_preferences,
"changed",
G_CALLBACK (desktop_background_settings_notify_cb),
- background);
+ G_OBJECT (background));
- g_signal_connect (background, "destroy",
- G_CALLBACK (desktop_background_destroyed_callback), NULL);
+ g_object_weak_ref (G_OBJECT (background),
+ desktop_background_weak_notify, NULL);
}
/* return true if the background is not in the default state */
@@ -563,9 +564,11 @@ background_reset_callback (EelBackground *background,
/* handle the background destroyed signal */
static void
-background_destroyed_callback (EelBackground *background,
- CajaFile *file)
+background_weak_notify (gpointer data,
+ GObject *background)
{
+ CajaFile *file = CAJA_FILE (data);
+
g_signal_handlers_disconnect_by_func
(file,
G_CALLBACK (saved_settings_changed_callback), background);
@@ -598,23 +601,26 @@ caja_connect_background_to_file_metadata (GtkWidget *widget,
if (old_file != NULL)
{
g_assert (CAJA_IS_FILE (old_file));
- g_signal_handlers_disconnect_by_func
- (background,
- G_CALLBACK (background_changed_callback), old_file);
- g_signal_handlers_disconnect_by_func
- (background,
- G_CALLBACK (background_destroyed_callback), old_file);
- g_signal_handlers_disconnect_by_func
- (background,
- G_CALLBACK (background_reset_callback), old_file);
- g_signal_handlers_disconnect_by_func
- (old_file,
- G_CALLBACK (saved_settings_changed_callback), background);
+
+ g_signal_handlers_disconnect_by_func (background,
+ G_CALLBACK (background_changed_callback),
+ old_file);
+
+ g_signal_handlers_disconnect_by_func (background,
+ G_CALLBACK (background_reset_callback),
+ old_file);
+
+ g_object_weak_unref (G_OBJECT (background), background_weak_notify, old_file);
+
+ g_signal_handlers_disconnect_by_func (old_file,
+ G_CALLBACK (saved_settings_changed_callback),
+ background);
+
caja_file_monitor_remove (old_file, background);
+
g_signal_handlers_disconnect_by_func (caja_preferences,
caja_file_background_theme_changed,
background);
-
}
/* Attach the new directory. */
@@ -629,13 +635,15 @@ caja_connect_background_to_file_metadata (GtkWidget *widget,
{
g_signal_connect_object (background, "settings_changed",
G_CALLBACK (background_changed_callback), file, 0);
- g_signal_connect_object (background, "destroy",
- G_CALLBACK (background_destroyed_callback), file, 0);
+
g_signal_connect_object (background, "reset",
G_CALLBACK (background_reset_callback), file, 0);
+
g_signal_connect_object (file, "changed",
G_CALLBACK (saved_settings_changed_callback), background, 0);
+ g_object_weak_ref (G_OBJECT (background), background_weak_notify, file);
+
/* arrange to receive file metadata */
caja_file_monitor_add (file,
background,