[gnome-screenshot] screenshot: set the delay box insensitive for interactive mode



commit 38549a8ee9c715fc6e17851c587d119b53ae6751
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Feb 14 16:23:29 2012 -0500

    screenshot: set the delay box insensitive for interactive mode
    
    If we're taking an area shot and asked for the interactive mode, set the
    delay box as insensitive.
    Also, change the way we avoid propagating and saving back to gsettings
    the delay for area mode.

 src/screenshot-application.c        |    3 +++
 src/screenshot-config.c             |    4 +++-
 src/screenshot-interactive-dialog.c |   19 ++++++++-----------
 3 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/src/screenshot-application.c b/src/screenshot-application.c
index 157a7fc..8c4dc07 100644
--- a/src/screenshot-application.c
+++ b/src/screenshot-application.c
@@ -469,6 +469,9 @@ screenshot_start (ScreenshotApplication *self)
   /* hold the GApplication while doing the async screenshot op */
   g_application_hold (G_APPLICATION (self));
 
+  if (screenshot_config->take_area_shot)
+    delay = 0;
+
   /* HACK: give time to the dialog to actually disappear.
    * We don't have any way to tell when the compositor has finished 
    * re-drawing.
diff --git a/src/screenshot-config.c b/src/screenshot-config.c
index 43f9701..4d372ba 100644
--- a/src/screenshot-config.c
+++ b/src/screenshot-config.c
@@ -143,7 +143,9 @@ screenshot_save_config (void)
                           INCLUDE_BORDER_KEY, c->include_border);
   g_settings_set_boolean (c->settings,
                           INCLUDE_POINTER_KEY, c->include_pointer);
-  g_settings_set_int (c->settings, DELAY_KEY, c->delay);
   g_settings_set_string (c->settings,
                          BORDER_EFFECT_KEY, c->border_effect);
+
+  if (!c->take_area_shot)
+    g_settings_set_int (c->settings, DELAY_KEY, c->delay);
 }
diff --git a/src/screenshot-interactive-dialog.c b/src/screenshot-interactive-dialog.c
index 47ba523..98c2cc3 100644
--- a/src/screenshot-interactive-dialog.c
+++ b/src/screenshot-interactive-dialog.c
@@ -34,7 +34,6 @@ static GtkWidget *effect_combo = NULL;
 static GtkWidget *effect_label = NULL;
 static GtkWidget *effects_vbox = NULL;
 static GtkWidget *delay_hbox = NULL;
-static GtkWidget *delay_spin = NULL;
 
 enum
 {
@@ -91,11 +90,6 @@ target_toggled_cb (GtkToggleButton *button,
       gtk_widget_set_sensitive (delay_hbox, !take_area_shot);
       gtk_widget_set_sensitive (effects_vbox, !take_area_shot);
 
-      if (take_area_shot)
-        screenshot_config->delay = 0;
-      else
-        screenshot_config->delay = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (delay_spin));
-
       screenshot_config->take_window_shot = take_window_shot;
       screenshot_config->take_area_shot = take_area_shot;
     }
@@ -403,6 +397,9 @@ create_screenshot_frame (GtkWidget   *outer_vbox,
   gtk_box_pack_start (GTK_BOX (vbox), delay_hbox, FALSE, FALSE, 0);
   gtk_widget_show (delay_hbox);
 
+  if (screenshot_config->take_area_shot)
+    gtk_widget_set_sensitive (delay_hbox, FALSE);
+
   /* translators: this is the first part of the "grab after a
    * delay of <spin button> seconds".
    */
@@ -415,13 +412,13 @@ create_screenshot_frame (GtkWidget   *outer_vbox,
                                                0.0, 99.0,
                                                1.0,  1.0,
                                                0.0));
-  delay_spin = gtk_spin_button_new (adjust, 1.0, 0);
-  g_signal_connect (delay_spin, "value-changed",
+  spin = gtk_spin_button_new (adjust, 1.0, 0);
+  g_signal_connect (spin, "value-changed",
                     G_CALLBACK (delay_spin_value_changed_cb),
                     NULL);
-  gtk_box_pack_start (GTK_BOX (delay_hbox), delay_spin, FALSE, FALSE, 0);
-  gtk_label_set_mnemonic_widget (GTK_LABEL (label), delay_spin);
-  gtk_widget_show (delay_spin);
+  gtk_box_pack_start (GTK_BOX (delay_hbox), spin, FALSE, FALSE, 0);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (label), spin);
+  gtk_widget_show (spin);
 
   /* translators: this is the last part of the "grab after a
    * delay of <spin button> seconds".



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]