[Xfce4-commits] <xfce4-screenshooter:master> Remove the option to take several screenshots in a row.

Jérôme Guelfucci jeromeg at xfce.org
Fri Aug 14 00:26:07 CEST 2009


Updating branch refs/heads/master
         to 93e5c70eddeea7d19ac198790d5f8058da8ff3b3 (commit)
       from 7ad0211b03b6623efef7e172fca018d61c713f99 (commit)

commit 93e5c70eddeea7d19ac198790d5f8058da8ff3b3
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sun Aug 2 18:55:14 2009 +0200

    Remove the option to take several screenshots in a row.
    
    This option creates a lot of technical issues which are currently
    painful to fix. Moreover, I want to keep things simple in the future.

 ChangeLog                           |    7 +++++++
 lib/screenshooter-actions.c         |   14 ++------------
 lib/screenshooter-dialogs.c         |   34 ----------------------------------
 lib/screenshooter-global.h          |    4 +---
 lib/screenshooter-utils.c           |    4 ----
 panel-plugin/screenshooter-plugin.c |    4 +---
 src/main.c                          |   12 +++---------
 7 files changed, 14 insertions(+), 65 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 58ffcb0..3b2c2c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,13 @@ Updated Italian and Galician documentation translation.
 
 2009-08-02 jeromeg
 
+Remove the option to take several screenshots in a row.
+
+This option creates a lot of technical issues which are currently
+painful to fix. Moreover, I want to keep things simple in the future.
+
+2009-08-02 jeromeg
+
 Remove the ugly sleep one second workaround.
 
 Now that the idle func no longer creates the dialog, it shouldn't
diff --git a/lib/screenshooter-actions.c b/lib/screenshooter-actions.c
index 359eae0..4bcab6c 100644
--- a/lib/screenshooter-actions.c
+++ b/lib/screenshooter-actions.c
@@ -71,18 +71,8 @@ gboolean screenshooter_take_and_output_screenshot (ScreenshotData *sd)
 
   g_object_unref (screenshot);
 
-  if (sd->close == 1)
-    {
-      if (sd->dialog)
-        gtk_widget_destroy (sd->dialog);
-
-      gtk_main_quit ();
-    }
-  else
-    {
-      if (sd->dialog)
-        gtk_widget_show (sd->dialog);
-    }
+  if (!sd->plugin)
+    gtk_main_quit ();
 
   return FALSE;
 }
diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c
index b8b5ac1..71fa5ff 100644
--- a/lib/screenshooter-dialogs.c
+++ b/lib/screenshooter-dialogs.c
@@ -57,9 +57,6 @@ static void
 cb_show_save_dialog_toggled        (GtkToggleButton    *tb,
                                     ScreenshotData     *sd);
 static void
-cb_close_toggled                   (GtkToggleButton    *tb,
-                                    ScreenshotData     *sd);
-static void
 cb_default_folder                  (GtkWidget          *chooser,
                                     ScreenshotData     *sd);
 static void
@@ -221,15 +218,6 @@ static void cb_show_save_dialog_toggled (GtkToggleButton *tb, ScreenshotData *sd
 
 
 
-/* Set sd->close when the button is toggled */
-static void cb_close_toggled  (GtkToggleButton *tb, ScreenshotData   *sd)
-{
-  gtk_toggle_button_get_active (tb) ? (sd->close = 1) : (sd->close = 0);
-
-}
-
-
-
 /* Set sd->screenshot_dir when the user changed the value in the file chooser */
 static void cb_default_folder (GtkWidget *chooser, ScreenshotData  *sd)
 {
@@ -1004,28 +992,6 @@ GtkWidget *screenshooter_dialog_new (ScreenshotData  *sd, gboolean plugin)
   g_signal_connect (G_OBJECT (save_checkbox), "toggled",
                     G_CALLBACK (cb_show_save_dialog_toggled), sd);
 
-  /* Create the 'close the user interface after taking the screenshot' checkbox */
-  if (!plugin)
-    {
-      GtkWidget *close_checkbox =
-        gtk_check_button_new_with_label (_("Close the application"));
-
-      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (close_checkbox),
-                                    (sd->close == 1));
-
-	    gtk_widget_set_tooltip_text (close_checkbox,
-	                                 _("If unchecked, the current window will be displayed "
-                                     "again after the screenshot has been taken to allow"
-									                   " you to take several screenshots in a row"));
-
-      gtk_box_pack_start (GTK_BOX (options_box), close_checkbox, FALSE, FALSE, 0);
-
-      gtk_widget_show (close_checkbox);
-
-      g_signal_connect (G_OBJECT (close_checkbox), "toggled",
-                        G_CALLBACK (cb_close_toggled), sd);
-    }
-
   /* Create the actions main box */
   actions_main_box = gtk_vbox_new (FALSE, 6);
 
diff --git a/lib/screenshooter-global.h b/lib/screenshooter-global.h
index a6e5aef..cf19918 100644
--- a/lib/screenshooter-global.h
+++ b/lib/screenshooter-global.h
@@ -46,12 +46,10 @@ typedef struct
   gint show_mouse;
   gint delay;
   gint action;
-  gint close;
+  gboolean plugin;
   gchar *screenshot_dir;
   gchar *app;
   gchar *last_user;
-  gboolean cli;
-  GtkWidget *dialog;
 }
 ScreenshotData;
 
diff --git a/lib/screenshooter-utils.c b/lib/screenshooter-utils.c
index 57e5b95..8872b7c 100644
--- a/lib/screenshooter-utils.c
+++ b/lib/screenshooter-utils.c
@@ -62,7 +62,6 @@ screenshooter_read_rc_file (const gchar *file, ScreenshotData *sd)
   gint action = SAVE;
   gint show_save_dialog = 1;
   gint show_mouse = 1;
-  gint close_app = 1;
   gchar *screenshot_dir = g_strdup (home_uri);
   gchar *app = g_strdup ("none");
   gchar *last_user = g_strdup ("");
@@ -82,7 +81,6 @@ screenshooter_read_rc_file (const gchar *file, ScreenshotData *sd)
           action = xfce_rc_read_int_entry (rc, "action", SAVE);
           show_save_dialog = xfce_rc_read_int_entry (rc, "show_save_dialog", 1);
           show_mouse = xfce_rc_read_int_entry (rc, "show_mouse", 1);
-          close_app = xfce_rc_read_int_entry (rc, "close", 1);
 
           g_free (app);
           app = g_strdup (xfce_rc_read_entry (rc, "app", "none"));
@@ -108,7 +106,6 @@ screenshooter_read_rc_file (const gchar *file, ScreenshotData *sd)
   sd->action = action;
   sd->show_save_dialog = show_save_dialog;
   sd->show_mouse = show_mouse;
-  sd->close = close_app;
   sd->screenshot_dir = screenshot_dir;
   sd->app = app;
   sd->last_user = last_user;
@@ -140,7 +137,6 @@ screenshooter_write_rc_file (const gchar *file, ScreenshotData *sd)
   xfce_rc_write_int_entry (rc, "action", sd->action);
   xfce_rc_write_int_entry (rc, "show_save_dialog", sd->show_save_dialog);
   xfce_rc_write_int_entry (rc, "show_mouse", sd->show_mouse);
-  xfce_rc_write_int_entry (rc, "close", sd->close);
   xfce_rc_write_entry (rc, "screenshot_dir", sd->screenshot_dir);
   xfce_rc_write_entry (rc, "app", sd->app);
   xfce_rc_write_entry (rc, "last_user", sd->last_user);
diff --git a/panel-plugin/screenshooter-plugin.c b/panel-plugin/screenshooter-plugin.c
index b2c0956..b3d5c2c 100644
--- a/panel-plugin/screenshooter-plugin.c
+++ b/panel-plugin/screenshooter-plugin.c
@@ -330,9 +330,7 @@ screenshooter_plugin_construct (XfcePanelPlugin *plugin)
 
   /* We want to take only one screenshot as in CLI, but not to close the main
      loop after taking a screenshot */
-  pd->sd->cli = TRUE;
-  pd->sd->close = 0;
-  pd->sd->dialog = NULL;
+  pd->sd->plugin = TRUE;
 
   /* Create the panel button */
   TRACE ("Create the panel button");
diff --git a/src/main.c b/src/main.c
index 8e8a49b..7da37bc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -123,7 +123,7 @@ cb_dialog_response (GtkWidget *dialog, gint response, ScreenshotData *sd)
     }
   else if (response == GTK_RESPONSE_OK)
     {
-      gtk_widget_hide (dialog);
+      gtk_widget_destroy (dialog);
       g_idle_add ((GSourceFunc) screenshooter_take_and_output_screenshot, sd);
     }
   else
@@ -147,7 +147,7 @@ int main (int argc, char **argv)
   const gchar *rc_file;
 
   ScreenshotData *sd = g_new0 (ScreenshotData, 1);
-  sd->dialog = NULL;
+  sd->plugin = FALSE;
 
   xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
 
@@ -197,9 +197,6 @@ int main (int argc, char **argv)
   /* If a region cli option is given, take the screenshot accordingly.*/
   if (fullscreen || window || region)
     {
-      sd->cli = TRUE;
-      sd->close = 1;
-
       /* Set the region to be captured */
       if (window)
         {
@@ -269,19 +266,16 @@ int main (int argc, char **argv)
     {
       GtkWidget *dialog;
 
-      sd->cli = FALSE;
-
       /* Set the dialog up */
       dialog = screenshooter_dialog_new (sd, FALSE);
       g_signal_connect (dialog, "response", (GCallback) cb_dialog_response, sd);
-      sd->dialog = dialog;
       gtk_widget_show (dialog);
     }
 
   gtk_main ();
 
   /* Save preferences */
-  if (!sd->cli)
+  if (!(fullscreen || window || region))
     {
       const gchar *preferences_file =
         xfce_resource_save_location (XFCE_RESOURCE_CONFIG,



More information about the Xfce4-commits mailing list