diff options
Diffstat (limited to 'src/caja-information-panel.c')
-rw-r--r-- | src/caja-information-panel.c | 156 |
1 files changed, 0 insertions, 156 deletions
diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c index e1d0fe73..2beae1c9 100644 --- a/src/caja-information-panel.c +++ b/src/caja-information-panel.c @@ -698,162 +698,6 @@ caja_information_panel_press_event (GtkWidget *widget, GdkEventButton *event) return TRUE; } -static gboolean -value_different (const char *a, const char *b) -{ - if (!a && !b) - return FALSE; - - if (!a || !b) - return TRUE; - - return strcmp (a, b); -} - -/* Handle the background changed signal by writing out the settings to metadata. - */ -static void -background_settings_changed_callback (EelBackground *background, GdkDragAction action, CajaInformationPanel *information_panel) -{ - char *image; - char *color; - - g_assert (EEL_IS_BACKGROUND (background)); - g_assert (CAJA_IS_INFORMATION_PANEL (information_panel)); - - if (information_panel->details->file == NULL) - { - return; - } - - /* Block so we don't respond to our own metadata changes. - */ - g_signal_handlers_block_by_func (information_panel->details->file, - G_CALLBACK (background_metadata_changed_callback), - information_panel); - - color = eel_background_get_color (background); - image = eel_background_get_image_uri (background); - - if (action != (GdkDragAction) CAJA_DND_ACTION_SET_AS_BACKGROUND) - { - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR, - NULL, - NULL); - - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE, - NULL, - NULL); - - g_signal_handlers_block_by_func (caja_preferences, - G_CALLBACK(caja_information_panel_theme_changed), - information_panel); - g_settings_set_string (caja_preferences, - CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR, color ? color : ""); - g_settings_set_string (caja_preferences, - CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_URI, image ? image : ""); - g_settings_set_boolean (caja_preferences, - CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET, TRUE); - g_signal_handlers_unblock_by_func (caja_preferences, - G_CALLBACK(caja_information_panel_theme_changed), - information_panel); - } - else - { - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR, - NULL, - color); - - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE, - NULL, - image); - } - - if (value_different (information_panel->details->current_background_color, color)) - { - g_free (information_panel->details->current_background_color); - information_panel->details->current_background_color = g_strdup (color); - } - - if (value_different (information_panel->details->current_background_image, image)) - { - g_free (information_panel->details->current_background_image); - information_panel->details->current_background_image = g_strdup (image); - } - - g_free (color); - g_free (image); - - g_signal_handlers_unblock_by_func (information_panel->details->file, - G_CALLBACK (background_metadata_changed_callback), - information_panel); -} - -/* handle the background reset signal by writing out NULL to metadata and setting the backgrounds - fields to their default values */ -static void -background_reset_callback (EelBackground *background, CajaInformationPanel *information_panel) -{ - char *color; - char *image; - g_assert (EEL_IS_BACKGROUND (background)); - g_assert (CAJA_IS_INFORMATION_PANEL (information_panel)); - - if (information_panel->details->file == NULL) - { - return; - } - - /* Block so we don't respond to our own metadata changes. - */ - g_signal_handlers_block_by_func (information_panel->details->file, - G_CALLBACK (background_metadata_changed_callback), - information_panel); - - color = caja_file_get_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR, - NULL); - - image = caja_file_get_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE, - NULL); - if (color || image) - { - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR, - NULL, - NULL); - - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE, - NULL, - NULL); - } - else - { - g_signal_handlers_block_by_func (caja_preferences, - G_CALLBACK(caja_information_panel_theme_changed), - information_panel); - g_settings_set_boolean (caja_preferences, - CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET, FALSE); - g_signal_handlers_unblock_by_func (caja_preferences, - G_CALLBACK(caja_information_panel_theme_changed), - information_panel); - } - - g_signal_handlers_unblock_by_func (information_panel->details->file, - G_CALLBACK (background_metadata_changed_callback), - information_panel); - - /* Force a read from the metadata to set the defaults - */ - background_metadata_changed_callback (information_panel); -} - static GtkWindow * caja_information_panel_get_window (CajaInformationPanel *information_panel) { |