diff options
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | data/Makefile.am | 3 | ||||
-rw-r--r-- | data/mate-screensaver-preferences.ui | 61 | ||||
-rw-r--r-- | data/org.mate.screensaver.gschema.xml.in | 7 | ||||
-rw-r--r-- | src/gs-manager.c | 20 | ||||
-rw-r--r-- | src/mate-screensaver-preferences.c | 15 |
6 files changed, 102 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index f492ffa..fa4de45 100644 --- a/configure.ac +++ b/configure.ac @@ -1112,7 +1112,6 @@ data/Makefile data/mate-screensavers.menu data/mate-screensaver.pc data/org.mate.ScreenSaver.service -data/org.mate.screensaver.gschema.xml data/images/Makefile data/images/cosmos/Makefile savers/Makefile diff --git a/data/Makefile.am b/data/Makefile.am index 942fd55..f842873 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -46,6 +46,9 @@ dbussessionservice_DATA = org.mate.ScreenSaver.service gsettingsschema_in_files = org.mate.screensaver.gschema.xml.in gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml) +org.mate.screensaver.gschema.xml: org.mate.screensaver.gschema.xml.in + $(AM_V_GEN) sed -e 's|@datadir[@]|$(datadir)|g' $< > $@ + EXTRA_DIST = \ $(gsettingsschema_in_files) \ $(desktop_in_files) \ diff --git a/data/mate-screensaver-preferences.ui b/data/mate-screensaver-preferences.ui index cd3855b..0311064 100644 --- a/data/mate-screensaver-preferences.ui +++ b/data/mate-screensaver-preferences.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.2 --> <interface> <requires lib="gtk+" version="3.14"/> <!-- interface-license-type gplv2 --> @@ -24,6 +24,9 @@ <property name="skip_taskbar_hint">True</property> <property name="skip_pager_hint">True</property> <property name="decorated">False</property> + <child type="titlebar"> + <placeholder/> + </child> <child> <object class="GtkBox" id="vbox10"> <property name="visible">True</property> @@ -149,6 +152,7 @@ </object> </child> </object> + <object class="GtkFileFilter" id="picture_filefilter"/> <object class="GtkImage" id="power_image"> <property name="can_focus">False</property> <property name="stock">gtk-jump-to</property> @@ -165,6 +169,9 @@ <property name="default_width">600</property> <property name="default_height">400</property> <property name="type_hint">dialog</property> + <child type="titlebar"> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="visible">True</property> @@ -459,6 +466,56 @@ </packing> </child> <child> + <object class="GtkBox" id="activate_delay_hbox1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Background picture for lock screen:</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="hbox5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkFileChooserButton" id="picture_filename"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="create_folders">False</property> + <property name="filter">picture_filefilter</property> + <property name="title" translatable="yes">Select Background Image</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> <object class="GtkLabel" id="root_warning_label"> <property name="can_focus">False</property> <property name="halign">start</property> @@ -469,7 +526,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> </object> diff --git a/data/org.mate.screensaver.gschema.xml.in b/data/org.mate.screensaver.gschema.xml.in index 7671144..5e2cf06 100644 --- a/data/org.mate.screensaver.gschema.xml.in +++ b/data/org.mate.screensaver.gschema.xml.in @@ -1,4 +1,4 @@ -<schemalist gettext-domain="@GETTEXT_PACKAGE@"> +<schemalist gettext-domain="mate-screensaver"> <enum id="org.mate.screensaver.Mode"> <value nick="blank-only" value="0"/> <value nick="random" value="1"/> @@ -80,5 +80,10 @@ <summary>Allow the session status message to be displayed</summary> <description>Allow the session status message to be displayed when the screen is locked.</description> </key> + <key name="picture-filename" type="s"> + <default>'@datadir@/backgrounds/mate/desktop/Stripes.png'</default> + <summary>Picture Filename</summary> + <description>File to use for the background image.</description> + </key> </schema> </schemalist> 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) |