From 4ca41b3e2371f706dd129bd8938a55cf2e421ad8 Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Mon, 26 Nov 2012 19:16:22 +0200 Subject: [eel-background] refactor to untangle directory & desktop bg-setting code --- src/caja-information-panel.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c index 5e7fb3dd..89891410 100644 --- a/src/caja-information-panel.c +++ b/src/caja-information-panel.c @@ -488,6 +488,7 @@ receive_dropped_uri_list (CajaInformationPanel *information_panel, char **uris; gboolean exactly_one; GtkWindow *window; + EelBackground *background; uris = g_uri_list_extract_uris ((gchar *) gtk_selection_data_get_data (selection_data)); exactly_one = uris[0] != NULL && (uris[1] == NULL || uris[1][0] == '\0'); @@ -504,22 +505,19 @@ receive_dropped_uri_list (CajaInformationPanel *information_panel, { if (action == GDK_ACTION_ASK) { - action = caja_drag_drop_background_ask (GTK_WIDGET (information_panel), CAJA_DND_ACTION_SET_AS_BACKGROUND | CAJA_DND_ACTION_SET_AS_GLOBAL_BACKGROUND); + action = caja_drag_drop_background_ask (GTK_WIDGET (information_panel), + CAJA_DND_ACTION_SET_AS_BACKGROUND | CAJA_DND_ACTION_SET_AS_GLOBAL_BACKGROUND); } if (action > 0) { - eel_background_receive_dropped_background_image - (eel_get_widget_background (GTK_WIDGET (information_panel)), - action, - uris[0]); + background = eel_get_widget_background (GTK_WIDGET (information_panel)); + eel_background_set_dropped_image (background, action, uris[0]); } } else if (exactly_one) { - g_signal_emit (information_panel, - signals[LOCATION_CHANGED], 0, - uris[0]); + g_signal_emit (information_panel, signals[LOCATION_CHANGED], 0, uris[0]); } break; case ICON_PART: @@ -584,6 +582,7 @@ receive_dropped_color (CajaInformationPanel *information_panel, { guint16 *channels; char color_spec[8]; + EelBackground *background; if (gtk_selection_data_get_length (selection_data) != 8 || gtk_selection_data_get_format (selection_data) != 16) @@ -605,16 +604,15 @@ receive_dropped_color (CajaInformationPanel *information_panel, case BACKGROUND_PART: if (action == GDK_ACTION_ASK) { - action = caja_drag_drop_background_ask (GTK_WIDGET (information_panel), CAJA_DND_ACTION_SET_AS_BACKGROUND | CAJA_DND_ACTION_SET_AS_GLOBAL_BACKGROUND); + action = caja_drag_drop_background_ask (GTK_WIDGET (information_panel), + CAJA_DND_ACTION_SET_AS_BACKGROUND | CAJA_DND_ACTION_SET_AS_GLOBAL_BACKGROUND); } if (action > 0) { - /* Let the background change based on the dropped color. */ - eel_background_receive_dropped_color - (eel_get_widget_background (GTK_WIDGET (information_panel)), - GTK_WIDGET (information_panel), - action, x, y, selection_data); + background = eel_get_widget_background (GTK_WIDGET (information_panel)); + eel_background_set_dropped_color (background, GTK_WIDGET (information_panel), + action, x, y, selection_data); } break; @@ -892,9 +890,7 @@ command_button_callback (GtkWidget *button, GAppInfo *application) static void metadata_button_callback (GtkWidget *button, const char *command_str) { - CajaInformationPanel *information_panel; - - information_panel = CAJA_INFORMATION_PANEL (g_object_get_data (G_OBJECT (button), "user_data")); + //CajaInformationPanel *self = CAJA_INFORMATION_PANEL (g_object_get_data (G_OBJECT (button), "user_data")); } /* utility routine that allocates the command buttons from the command list */ -- cgit v1.2.1 From 532fbb1ce6bf446c8c5e40f8a49abc3e450a65d0 Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Wed, 28 Nov 2012 01:33:08 +0200 Subject: [directory-bg] rewrite/refactor, untangle directory & desktop bg-setting code - Fixes crashes when resizing a VM window in VirtualBox. - Adds a method to allow handling desktop reset. --- src/file-manager/fm-icon-view.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index 931df9f8..414aae37 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -1301,7 +1301,7 @@ fm_icon_view_begin_loading (FMDirectoryView *view) */ if (FM_IS_DESKTOP_ICON_VIEW (view)) { - caja_connect_desktop_background_to_file_metadata (CAJA_ICON_CONTAINER (icon_container), file); + caja_connect_desktop_background_to_settings (CAJA_ICON_CONTAINER (icon_container)); } else { @@ -1316,10 +1316,7 @@ fm_icon_view_begin_loading (FMDirectoryView *view) default_action = CAJA_DND_ACTION_SET_AS_FOLDER_BACKGROUND; } - caja_connect_background_to_file_metadata - (icon_container, - file, - default_action); + caja_connect_background_to_file_metadata (icon_container, file, default_action); } -- cgit v1.2.1 From 01c34579453893b76849400c9375dcc67c44622f Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Thu, 29 Nov 2012 19:39:28 +0200 Subject: [global-prefs|application] use MATE global 'show-desktop-icons' setting instead of a local-to-caja setting 'show-desktop' This key would indicate that file managers (by default Caja, but applies to others like Thunar or ROX) should handle desktop, i.e. draw a background and place icons there. Otherwise (when false), mate-settings-daemon will take over drawing desktop background. This is different from 'draw-background', which is a separate option used only for drawing background without icons (by mate-settings-daemon). To Caja, 'show-desktop-icons' implies 'draw-background', and so if set to false, Caja won't (needlessly) draw the desktop. However, if the user uses the "Background & Emblems dialog" to drop an image-pattern/color/reset on the desktop, Caja will again draw the desktop. For reference: https://bugzilla.gnome.org/show_bug.cgi?id=632225 --- src/caja-application.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/caja-application.c b/src/caja-application.c index 47a956c4..f09e2720 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -74,6 +74,8 @@ #include #include #include +#define MATE_DESKTOP_USE_UNSTABLE_API +#include #include "glibcompat.h" /* for g_list_free_full */ @@ -964,7 +966,7 @@ caja_application_startup (CajaApplication *application, char *accel_map_filename; if (!no_desktop && - !g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_DESKTOP)) + !g_settings_get_boolean (mate_background_preferences, MATE_BG_KEY_SHOW_DESKTOP)) { no_desktop = TRUE; } @@ -989,7 +991,8 @@ caja_application_startup (CajaApplication *application, } /* Monitor the preference to show or hide the desktop */ - g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_SHOW_DESKTOP, + g_signal_connect_swapped (mate_background_preferences, + "changed::" MATE_BG_KEY_SHOW_DESKTOP, G_CALLBACK(desktop_changed_callback), G_OBJECT (application)); @@ -1567,7 +1570,7 @@ desktop_changed_callback (gpointer user_data) CajaApplication *application; application = CAJA_APPLICATION (user_data); - if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_DESKTOP)) + if (g_settings_get_boolean (mate_background_preferences, MATE_BG_KEY_SHOW_DESKTOP)) { caja_application_open_desktop (application); } -- cgit v1.2.1