Commit 33c23eae authored by Florian Müllner's avatar Florian Müllner Committed by Julian Sparber
Browse files

background: Remove lock-screen preview

Without different lock-screen settings, there's little reason to
keep showing a lock-screen preview. So rather than updating the
preview to a blurred version of the regular background, just remove
it altogether.

GNOME/gnome-control-center#864
parent 7c436727
......@@ -57,12 +57,10 @@ struct _CcBackgroundPanel
GnomeDesktopThumbnailFactory *thumb_factory;
CcBackgroundItem *current_background;
CcBackgroundItem *current_lock_background;
CcBackgroundChooser *background_chooser;
GtkWidget *add_picture_button;
CcBackgroundPreview *desktop_preview;
CcBackgroundPreview *lock_screen_preview;
GtkWidget *spinner;
GtkWidget *chooser;
......@@ -70,55 +68,41 @@ struct _CcBackgroundPanel
CC_PANEL_REGISTER (CcBackgroundPanel, cc_background_panel)
static CcBackgroundItem *
get_current_background (CcBackgroundPanel *panel,
GSettings *settings)
{
if (settings == panel->settings)
return panel->current_background;
else
return panel->current_lock_background;
}
static void
update_preview (CcBackgroundPanel *panel,
GSettings *settings)
update_preview (CcBackgroundPanel *panel)
{
CcBackgroundItem *current_background;
current_background = get_current_background (panel, settings);
if (settings == panel->settings)
cc_background_preview_set_item (panel->desktop_preview, current_background);
else
cc_background_preview_set_item (panel->lock_screen_preview, current_background);
current_background = panel->current_background;
cc_background_preview_set_item (panel->desktop_preview, current_background);
}
static gchar *
get_save_path (CcBackgroundPanel *panel, GSettings *settings)
get_save_path (void)
{
return g_build_filename (g_get_user_config_dir (),
"gnome-control-center",
"backgrounds",
settings == panel->settings ? "last-edited.xml" : "last-edited-lock.xml",
"last-edited.xml",
NULL);
}
static void
reload_current_bg (CcBackgroundPanel *panel,
GSettings *settings)
reload_current_bg (CcBackgroundPanel *panel)
{
g_autoptr(CcBackgroundItem) saved = NULL;
CcBackgroundItem *configured;
GSettings *settings = NULL;
g_autofree gchar *uri = NULL;
g_autofree gchar *pcolor = NULL;
g_autofree gchar *scolor = NULL;
/* Load the saved configuration */
uri = get_save_path (panel, settings);
uri = get_save_path ();
saved = cc_background_xml_get_item (uri);
/* initalise the current background information from settings */
settings = panel->settings;
uri = g_settings_get_string (settings, WP_URI_KEY);
if (uri && *uri == '\0')
g_clear_pointer (&uri, g_free);
......@@ -150,16 +134,8 @@ reload_current_bg (CcBackgroundPanel *panel,
NULL);
}
if (settings == panel->settings)
{
g_clear_object (&panel->current_background);
panel->current_background = configured;
}
else
{
g_clear_object (&panel->current_lock_background);
panel->current_lock_background = configured;
}
g_clear_object (&panel->current_background);
panel->current_background = configured;
cc_background_item_load (configured, NULL);
}
......@@ -220,9 +196,9 @@ set_background (CcBackgroundPanel *panel,
g_settings_apply (settings);
/* Save the source XML if there is one */
filename = get_save_path (panel, settings);
filename = get_save_path ();
if (create_save_dir ())
cc_background_xml_save (get_current_background (panel, settings), filename);
cc_background_xml_save (panel->current_background, filename);
}
......@@ -282,7 +258,6 @@ cc_background_panel_finalize (GObject *object)
CcBackgroundPanel *panel = CC_BACKGROUND_PANEL (object);
g_clear_object (&panel->current_background);
g_clear_object (&panel->current_lock_background);
G_OBJECT_CLASS (cc_background_panel_parent_class)->finalize (object);
}
......@@ -308,7 +283,6 @@ cc_background_panel_class_init (CcBackgroundPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcBackgroundPanel, add_picture_button);
gtk_widget_class_bind_template_child (widget_class, CcBackgroundPanel, background_chooser);
gtk_widget_class_bind_template_child (widget_class, CcBackgroundPanel, desktop_preview);
gtk_widget_class_bind_template_child (widget_class, CcBackgroundPanel, lock_screen_preview);
gtk_widget_class_bind_template_callback (widget_class, on_chooser_background_chosen_cb);
gtk_widget_class_bind_template_callback (widget_class, on_add_picture_button_clicked_cb);
......@@ -319,8 +293,8 @@ on_settings_changed (GSettings *settings,
gchar *key,
CcBackgroundPanel *panel)
{
reload_current_bg (panel, settings);
update_preview (panel, settings);
reload_current_bg (panel);
update_preview (panel);
}
static void
......@@ -336,17 +310,14 @@ cc_background_panel_init (CcBackgroundPanel *panel)
panel->settings = g_settings_new (WP_PATH_ID);
g_settings_delay (panel->settings);
panel->lock_settings = g_settings_new (WP_LOCK_PATH_ID);
g_settings_delay (panel->lock_settings);
/* Load the backgrounds */
reload_current_bg (panel, panel->settings);
update_preview (panel, panel->settings);
reload_current_bg (panel, panel->lock_settings);
update_preview (panel, panel->lock_settings);
/* Load the background */
reload_current_bg (panel);
update_preview (panel);
/* Background settings */
g_signal_connect (panel->settings, "changed", G_CALLBACK (on_settings_changed), panel);
g_signal_connect (panel->lock_settings, "changed", G_CALLBACK (on_settings_changed), panel);
}
......@@ -13,8 +13,8 @@
<child>
<object class="HdyColumn">
<property name="visible">1</property>
<property name="maximum_width">600</property>
<property name="linear_growth_width">400</property>
<property name="maximum_width">300</property>
<property name="linear_growth_width">200</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
......@@ -32,14 +32,6 @@
<property name="valign">center</property>
</object>
</child>
<child>
<object class="CcBackgroundPreview" id="lock_screen_preview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="is-lock-screen">True</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment