diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gs-manager.c | 20 | ||||
-rw-r--r-- | src/mate-screensaver-preferences.c | 15 |
2 files changed, 34 insertions, 1 deletions
diff --git a/src/gs-manager.c b/src/gs-manager.c index 00ec982..cf40164 100644 --- a/src/gs-manager.c +++ b/src/gs-manager.c @@ -1049,6 +1049,13 @@ gs_manager_init (GSManager *manager) manager); mate_bg_load_from_preferences (manager->priv->bg); + GSettings *settings = g_settings_new ("org.mate.screensaver"); + char *filename= g_settings_get_string (settings, "picture-filename"); + if (g_file_test (filename, G_FILE_TEST_EXISTS)) { + mate_bg_set_filename (manager->priv->bg, filename); + } + g_free (filename); + g_object_unref (settings); } static void @@ -1261,11 +1268,22 @@ static void apply_background_to_window (GSManager *manager, GSWindow *window) { + GSettings *settings; + char *filename; cairo_surface_t *surface; int width; int height; - mate_bg_load_from_preferences (manager->priv->bg); + mate_bg_load_from_preferences(manager->priv->bg); + + settings = g_settings_new ("org.mate.screensaver"); + filename = g_settings_get_string (settings, "picture-filename"); + + if (g_file_test (filename, G_FILE_TEST_EXISTS)) { + mate_bg_set_filename (manager->priv->bg, filename); + } + g_free (filename); + g_object_unref (settings); if (manager->priv->bg == NULL) { diff --git a/src/mate-screensaver-preferences.c b/src/mate-screensaver-preferences.c index e2d5fa6..651ff8f 100644 --- a/src/mate-screensaver-preferences.c +++ b/src/mate-screensaver-preferences.c @@ -1087,6 +1087,12 @@ enabled_checkbox_toggled (GtkToggleButton *button, gpointer user_data) } static void +picture_filename_changed (GtkFileChooserButton *button, gpointer user_data) +{ + g_settings_set_string (screensaver_settings, "picture-filename", gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (button))); +} + +static void ui_disable_lock (gboolean disable) { GtkWidget *widget; @@ -1534,6 +1540,7 @@ init_capplet (void) GtkWidget *fullscreen_preview_previous; GtkWidget *fullscreen_preview_next; GtkWidget *fullscreen_preview_close; + GtkWidget *picture_filename; gdouble activate_delay; gboolean enabled; gboolean is_writable; @@ -1580,6 +1587,7 @@ init_capplet (void) fullscreen_preview_close = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_preview_close")); fullscreen_preview_previous = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_preview_previous_button")); fullscreen_preview_next = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_preview_next_button")); + picture_filename = GTK_WIDGET (gtk_builder_get_object (builder, "picture_filename")); label = GTK_WIDGET (gtk_builder_get_object (builder, "activate_delay_label")); gtk_label_set_mnemonic_widget (GTK_LABEL (label), activate_delay_hscale); @@ -1630,6 +1638,13 @@ init_capplet (void) g_signal_connect (lock_checkbox, "toggled", G_CALLBACK (lock_checkbox_toggled), NULL); + char *path = g_settings_get_string (screensaver_settings, "picture-filename"); + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (gtk_builder_get_object (builder, "picture_filename")), path); + gtk_file_filter_add_pixbuf_formats (GTK_FILE_FILTER (gtk_builder_get_object (builder, "picture_filefilter"))); + g_free (path); + g_signal_connect (picture_filename, "selection-changed", + G_CALLBACK (picture_filename_changed), NULL); + enabled = config_get_enabled (&is_writable); ui_set_enabled (enabled); if (! is_writable) |