Commit ed6d133c authored by Cosimo Cecchi's avatar Cosimo Cecchi

screenshot: don't save back settings when we're not in interactive mode

It doesn't make sense to save settings specified on the command line in
GSettings, as the command line use is typically one-shot for a specific
purpose (or inside a script which will always append settings).

https://bugzilla.gnome.org/show_bug.cgi?id=572817
parent 89fad3e5
......@@ -542,7 +542,7 @@ prepare_screenshot_timeout (gpointer data)
}
static void
screenshot_start (gboolean interactive)
screenshot_start ()
{
guint delay = screenshot_config->delay * 1000;
......@@ -550,7 +550,7 @@ screenshot_start (gboolean interactive)
* We don't have any way to tell when the compositor has finished
* re-drawing.
*/
if (delay == 0 && interactive)
if (delay == 0 && screenshot_config->interactive)
delay = 200;
if (delay > 0)
......@@ -575,7 +575,7 @@ interactive_dialog_response_cb (GtkWidget *d,
gtk_main_quit ();
break;
case GTK_RESPONSE_OK:
screenshot_start (TRUE);
screenshot_start ();
break;
default:
g_assert_not_reached ();
......@@ -701,7 +701,8 @@ main (int argc, char *argv[])
include_border_arg,
disable_border_arg,
border_effect_arg,
delay_arg);
delay_arg,
interactive_arg);
if (!res || !screenshot_app_init ())
exit (1);
......@@ -718,7 +719,7 @@ main (int argc, char *argv[])
}
else
{
screenshot_start (FALSE);
screenshot_start ();
}
gtk_main ();
......
......@@ -64,7 +64,8 @@ screenshot_load_config (gboolean clipboard_arg,
gboolean include_border_arg,
gboolean disable_border_arg,
const gchar *border_effect_arg,
guint delay_arg)
guint delay_arg,
gboolean interactive_arg)
{
static gboolean initialized = FALSE;
ScreenshotConfig *config;
......@@ -89,6 +90,8 @@ screenshot_load_config (gboolean clipboard_arg,
config = g_slice_new0 (ScreenshotConfig);
initialized = TRUE;
config->interactive = interactive_arg;
config->settings = g_settings_new ("org.gnome.gnome-screenshot");
populate_from_settings (config);
......@@ -129,6 +132,12 @@ screenshot_save_config (void)
g_assert (c != NULL);
/* if we were not started up in interactive mode, avoid
* overwriting these settings.
*/
if (!c->interactive)
return;
g_settings_set_boolean (c->settings,
INCLUDE_BORDER_KEY, c->include_border);
g_settings_set_boolean (c->settings,
......
......@@ -42,6 +42,8 @@ typedef struct {
gchar *border_effect;
guint delay;
gboolean interactive;
} ScreenshotConfig;
ScreenshotConfig *screenshot_config;
......@@ -52,7 +54,8 @@ gboolean screenshot_load_config (gboolean clipboard_arg,
gboolean include_border_arg,
gboolean disable_border_arg,
const gchar *border_effect_arg,
guint delay_arg);
guint delay_arg,
gboolean interactive_arg);
void screenshot_save_config (void);
G_END_DECLS
......
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