[Xfce4-commits] <xfce4-screenshooter:master> Remove the horodate checkbox and title entry.

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


Updating branch refs/heads/master
         to 28f2d4297e70799ff745f7796c3c7a3feeaf4194 (commit)
       from d9a263f2301bd525a179fc95478c8e58696b0624 (commit)

commit 28f2d4297e70799ff745f7796c3c7a3feeaf4194
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sat Aug 8 19:12:22 2009 +0200

    Remove the horodate checkbox and title entry.
    
    Try to set some sane defaults: always append the date and the time to
    the file name, the default title being "Screenshot". The title and
    horodating options are still setable in the configuration file.
    
    Fix the date format and always save the preferences in the main app.

 ChangeLog                   |   10 +++++
 TODO                        |    8 +++-
 lib/screenshooter-dialogs.c |   89 +------------------------------------------
 lib/screenshooter-utils.c   |    4 +-
 src/main.c                  |   34 +----------------
 5 files changed, 20 insertions(+), 125 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7cfaf96..db86861 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-08-08 jeromeg
+
+Remove the horodate checkbox and title entry.
+
+Try to set some sane defaults: always append the date and the time to
+the file name, the default title being "Screenshot". The title and
+horodating options are still setable in the configuration file.
+
+Fix the date format and always save the preferences in the main app.
+
 2009-08-08 mmassonnet
 
 Update documentation translations
diff --git a/TODO b/TODO
index 441e600..86238ea 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,11 @@
-Long term:
+Before next release:
 
+* Save captures in the XDG images directory by default, fallback to home
+if it does not exist.
 * Port "select a region" to use cairo to have transparent rubber banding
-as in thunar and xfdesktop.
+as in thunar and xfdesktop (only when the screen is composited).
+
+Long term:
 * Use Xshape to have a transparent background in the generated screenshots.
 
 Low priority:
diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c
index 910968c..92b6d7e 100644
--- a/lib/screenshooter-dialogs.c
+++ b/lib/screenshooter-dialogs.c
@@ -49,16 +49,6 @@ static void
 cb_open_toggled                    (GtkToggleButton    *tb,
                                     ScreenshotData     *sd);
 static void
-cb_title_entry_changed             (GtkEditable        *editable,
-                                    ScreenshotData     *sd);
-static void
-cb_horodate_toggled                (GtkToggleButton    *togglebutton,
-                                    ScreenshotData     *sd);
-static void
-cb_hide_horodate                   (GtkToggleButton    *togglebutton,
-                                    GtkWidget          *widget);
-
-static void
 cb_clipboard_toggled               (GtkToggleButton    *tb,
                                     ScreenshotData     *sd);
 static void
@@ -188,23 +178,6 @@ static void cb_open_toggled (GtkToggleButton *tb, ScreenshotData *sd)
 
 
 
-static void cb_title_entry_changed (GtkEditable *editable,
-                                    ScreenshotData *sd)
-{
-  g_free (sd->title);
-  sd->title = gtk_editable_get_chars (editable, 0, -1);
-}
-
-
-
-static void cb_horodate_toggled (GtkToggleButton *togglebutton,
-                                 ScreenshotData *sd)
-{
-  sd->horodate = gtk_toggle_button_get_active (togglebutton);
-}
-
-
-
 static void cb_clipboard_toggled (GtkToggleButton *tb, ScreenshotData *sd)
 {
   if (gtk_toggle_button_get_active (tb))
@@ -230,16 +203,6 @@ static void cb_default_folder (GtkWidget *chooser, ScreenshotData  *sd)
 
 
 
-static void cb_hide_horodate (GtkToggleButton *togglebutton, GtkWidget *widget)
-{
-  if (gtk_toggle_button_get_active (togglebutton))
-    gtk_widget_show (widget);
-  else
-    gtk_widget_hide (widget);
-}
-
-
-
 /* Set the delay according to the spinner */
 static void cb_delay_spinner_changed (GtkWidget *spinner, ScreenshotData *sd)
 {
@@ -927,7 +890,7 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
   GtkWidget *dlg, *main_alignment;
   GtkWidget *vbox;
 
-  GtkWidget *layout_table, *right_table;
+  GtkWidget *layout_table;
 
   GtkWidget *left_box;
   GtkWidget *actions_label, *actions_alignment, *actions_box;
@@ -939,8 +902,6 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
   GtkWidget *combobox, *open_box;
   GtkCellRenderer *renderer, *renderer_pixbuf;
 
-  GtkWidget *capture_info_box;
-  GtkWidget *title_box, *title_label, *title_entry, *horodate_checkbox;
   GtkWidget *preview, *preview_box, *preview_label;
   GdkPixbuf *thumbnail;
 
@@ -1107,28 +1068,10 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
   gtk_box_pack_start (GTK_BOX (actions_box), zimagez_radio_button, FALSE, FALSE, 0);
   gtk_widget_show (zimagez_radio_button);
 
-  /* Create the horodate checkbox */
-  horodate_checkbox =
-    gtk_check_button_new_with_label (_("Horodate the capture"));
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (horodate_checkbox),
-                                sd->horodate);
-  g_signal_connect (horodate_checkbox, "toggled",
-                    (GCallback) cb_horodate_toggled, sd);
-  g_signal_connect (save_radio_button, "toggled",
-                    (GCallback) cb_hide_horodate, horodate_checkbox);
-  gtk_box_pack_start (GTK_BOX (left_box), horodate_checkbox, FALSE, FALSE, 5);
-  gtk_widget_show (horodate_checkbox);
-
-  /* Right table for the right of the UI */
-  right_table = gtk_table_new (2, 1, FALSE);
-  gtk_table_set_row_spacings (GTK_TABLE (right_table), 12);
-  gtk_table_attach_defaults (GTK_TABLE (layout_table), right_table, 1, 2, 0, 1);
-  gtk_widget_show (right_table);
-
   /* Preview box */
   preview_box = gtk_vbox_new (FALSE, 6);
   gtk_container_set_border_width (GTK_CONTAINER (preview_box), 0);
-  gtk_table_attach_defaults (GTK_TABLE (right_table), preview_box, 0, 1, 0, 1);
+  gtk_table_attach_defaults (GTK_TABLE (layout_table), preview_box, 1, 2, 0, 1);
   gtk_widget_show (preview_box);
 
   /* Preview label*/
@@ -1147,34 +1090,6 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
   g_object_unref (thumbnail);
   gtk_widget_show (preview);
 
-  /* Create the capture_info box */
-  capture_info_box = gtk_vbox_new (FALSE, 6);
-  gtk_container_set_border_width (GTK_CONTAINER (capture_info_box), 0);
-  gtk_table_attach_defaults (GTK_TABLE (right_table), capture_info_box, 0, 1, 1, 2);
-  gtk_widget_show (capture_info_box);
-
-  /* Create the title horizontal box */
-  title_box = gtk_hbox_new (FALSE, 6);
-  gtk_container_set_border_width (GTK_CONTAINER (title_box), 0);
-  gtk_box_pack_start (GTK_BOX (capture_info_box), title_box, TRUE, TRUE, 0);
-  gtk_widget_show (title_box);
-
-  /* Create the title label */
-  title_label = gtk_label_new ("Title:");
-  gtk_misc_set_alignment (GTK_MISC (title_label), 0, 0.5);
-  gtk_box_pack_start (GTK_BOX (title_box), title_label, FALSE, FALSE, 0);
-  gtk_widget_show (title_label);
-
-  /* Create the title entry */
-  title_entry = gtk_entry_new ();
-  gtk_entry_set_text (GTK_ENTRY (title_entry), sd->title);
-  g_signal_connect (title_entry, "changed",
-                    (GCallback) cb_title_entry_changed, sd);
-  gtk_box_pack_start (GTK_BOX (title_box), title_entry, TRUE, TRUE, 0);
-  gtk_widget_show (title_entry);
-
-
-
   return dlg;
 }
 
diff --git a/lib/screenshooter-utils.c b/lib/screenshooter-utils.c
index 4532cee..a1fc665 100644
--- a/lib/screenshooter-utils.c
+++ b/lib/screenshooter-utils.c
@@ -141,9 +141,7 @@ screenshooter_write_rc_file (const gchar *file, ScreenshotData *sd)
   xfce_rc_write_int_entry (rc, "region", sd->region);
   xfce_rc_write_int_entry (rc, "action", sd->action);
   xfce_rc_write_int_entry (rc, "show_mouse", sd->show_mouse);
-  xfce_rc_write_bool_entry (rc, "horodate", sd->horodate);
   xfce_rc_write_entry (rc, "screenshot_dir", sd->screenshot_dir);
-  xfce_rc_write_entry (rc, "title", sd->title);
   xfce_rc_write_entry (rc, "app", sd->app);
   xfce_rc_write_entry (rc, "last_user", sd->last_user);
 
@@ -277,7 +275,7 @@ gchar *screenshooter_get_date_hour (void)
 
   tm = localtime (&now);
 
-  converted = g_locale_from_utf8 ("%x-%X", -1, NULL, NULL, NULL);
+  converted = g_locale_from_utf8 ("%x - %X", -1, NULL, NULL, NULL);
   if (G_UNLIKELY (converted == NULL))
     converted = g_strdup ("");
 
diff --git a/src/main.c b/src/main.c
index 717c365..dbd8afe 100644
--- a/src/main.c
+++ b/src/main.c
@@ -313,39 +313,7 @@ int main (int argc, char **argv)
   gtk_main ();
 
   /* Save preferences */
-  if (!(fullscreen || window || region))
-    {
-      const gchar *preferences_file =
-        xfce_resource_save_location (XFCE_RESOURCE_CONFIG,
-                                     "xfce4/xfce4-screenshooter",
-                                     TRUE);
-
-      if (preferences_file != NULL)
-        screenshooter_write_rc_file (preferences_file, sd);
-    }
-  else if (sd->action == UPLOAD)
-    {
-      const gchar *preferences_file =
-        xfce_resource_save_location (XFCE_RESOURCE_CONFIG,
-                                     "xfce4/xfce4-screenshooter",
-                                     TRUE);
-      if (preferences_file != NULL)
-        {
-          XfceRc *rc;
-
-          TRACE ("Open the rc file");
-          rc = xfce_rc_simple_open (preferences_file, FALSE);
-
-          if (rc != NULL)
-            {
-                xfce_rc_write_entry (rc, "last_user", sd->last_user);
-
-                TRACE ("Flush and close the rc file");
-                xfce_rc_flush (rc);
-                xfce_rc_close (rc);
-            }
-        }
-    }
+  screenshooter_write_rc_file (rc_file, sd);
 
   g_free (sd->screenshot_dir);
   g_free (sd->title);



More information about the Xfce4-commits mailing list