gnome-utils r7996 - trunk/gnome-screenshot



Author: ebassi
Date: Sun Aug 10 20:09:04 2008
New Revision: 7996
URL: http://svn.gnome.org/viewvc/gnome-utils?rev=7996&view=rev

Log:
2008-08-10  Emmanuele Bassi  <ebassi gnome org>

	Bug 434580 â gnome-screenshot does not remember user settings

	* gnome-screenshot.c:
	* gnome-screenshot.schemas.in: Save the user settings after
	the screenshot has been taken. (Elliott Hughes)

Modified:
   trunk/gnome-screenshot/ChangeLog
   trunk/gnome-screenshot/gnome-screenshot.c
   trunk/gnome-screenshot/gnome-screenshot.schemas.in

Modified: trunk/gnome-screenshot/gnome-screenshot.c
==============================================================================
--- trunk/gnome-screenshot/gnome-screenshot.c	(original)
+++ trunk/gnome-screenshot/gnome-screenshot.c	Sun Aug 10 20:09:04 2008
@@ -55,6 +55,9 @@
 #define INCLUDE_POINTER_KEY     GNOME_SCREENSHOT_GCONF "/include_pointer"
 #define LAST_SAVE_DIRECTORY_KEY GNOME_SCREENSHOT_GCONF "/last_save_directory"
 #define BORDER_EFFECT_KEY       GNOME_SCREENSHOT_GCONF "/border_effect"
+#define DELAY_KEY               GNOME_SCREENSHOT_GCONF "/delay"
+#define TAKE_WINDOW_SHOT_KEY    GNOME_SCREENSHOT_GCONF "/take_window_shot"
+
 
 enum
 {
@@ -102,9 +105,10 @@
 static guint delay = 0;
 
 /* some local prototypes */
-static void display_help           (GtkWindow *parent);
-static void save_done_notification (gpointer   data);
-static char *get_desktop_dir (void);
+static void  display_help           (GtkWindow *parent);
+static void  save_done_notification (gpointer   data);
+static char *get_desktop_dir        (void);
+static void  save_options           (void);
 
 static GtkWidget *border_check = NULL;
 static GtkWidget *effect_combo = NULL;
@@ -917,6 +921,7 @@
 prepare_screenshot_timeout (gpointer data)
 {
   prepare_screenshot ();
+  save_options ();
 
   return FALSE;
 }
@@ -1014,14 +1019,44 @@
   if (!border_effect)
     border_effect = g_strdup ("none");
 
+  take_window_shot = gconf_client_get_bool (gconf_client,
+                                            TAKE_WINDOW_SHOT_KEY,
+                                            NULL);
+
+  delay = gconf_client_get_int (gconf_client, DELAY_KEY, NULL);
+
+  g_object_unref (gconf_client);
+}
+
+static void
+save_options (void)
+{
+  GConfClient *gconf_client;
+
+  gconf_client = gconf_client_get_default ();
+
+  /* Error is NULL, as there's nothing we can do */
+  gconf_client_set_bool (gconf_client,
+                         TAKE_WINDOW_SHOT_KEY,
+                         take_window_shot,
+                         NULL);
+  gconf_client_set_int (gconf_client, DELAY_KEY, delay, NULL);
+  gconf_client_set_bool (gconf_client,
+                         INCLUDE_BORDER_KEY, include_border,
+                         NULL);
+  gconf_client_set_string (gconf_client,
+                           BORDER_EFFECT_KEY, border_effect,
+                           NULL);
+ 
   g_object_unref (gconf_client);
 }
 
+
 static void
 register_screenshooter_icon (GtkIconFactory * factory)
 {
-  GtkIconSource * source;
-  GtkIconSet * icon_set;
+  GtkIconSource *source;
+  GtkIconSet *icon_set;
 
   source = gtk_icon_source_new ();
   gtk_icon_source_set_icon_name (source, SCREENSHOOTER_ICON);

Modified: trunk/gnome-screenshot/gnome-screenshot.schemas.in
==============================================================================
--- trunk/gnome-screenshot/gnome-screenshot.schemas.in	(original)
+++ trunk/gnome-screenshot/gnome-screenshot.schemas.in	Sun Aug 10 20:09:04 2008
@@ -4,6 +4,30 @@
   <schemalist>    
 
     <schema>
+      <key>/schemas/apps/gnome-screenshot/take_window_shot</key>
+      <applyto>/apps/gnome-screenshot/take_window_shot</applyto>
+      <owner>gnome-screenshot</owner>
+      <type>bool</type>
+      <default></default>
+      <locale name="C">
+        <short>Window-specific screenshot</short>
+        <long>Grab just the current window, rather than the whole desktop.</long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/gnome-screenshot/delay</key>
+      <applyto>/apps/gnome-screenshot/delay</applyto>
+      <owner>gnome-screenshot</owner>
+      <type>int</type>
+      <default></default>
+      <locale name="C">
+        <short>Screenshot delay</short>
+        <long>The number of seconds to wait before taking the screenshot.</long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/gnome-screenshot/last_save_directory</key>
       <applyto>/apps/gnome-screenshot/last_save_directory</applyto>
       <owner>gnome-screenshot</owner>



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