[cheese] widemode: save wide mode state in gconf



commit 6eed130081c5fa3fbb82840259948a14a6214e47
Author: Filippo Argiolas <filippo argiolas gmail com>
Date:   Mon Aug 10 21:57:56 2009 +0200

    widemode: save wide mode state in gconf
    
    Enable wide mode at startup if wide_mode gconf is TRUE.

 data/cheese.schemas.in |   14 ++++++++++++++
 src/cheese-gconf.c     |   18 ++++++++++++++++++
 src/cheese-gconf.h     |    1 +
 src/cheese-window.c    |   10 ++++++++++
 4 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/data/cheese.schemas.in b/data/cheese.schemas.in
index 6e419df..935ad35 100644
--- a/data/cheese.schemas.in
+++ b/data/cheese.schemas.in
@@ -148,6 +148,20 @@
       </locale>
     </schema>
 
+      <key>/schemas/apps/cheese/wide_mode</key>
+      <applyto>/apps/cheese/wide_mode</applyto>
+      <owner>cheese</owner>
+      <type>bool</type>
+      <default>0</default>
+      <locale name="C">
+        <short>Whether to start in wide mode</short>
+        <long>If set to true, Cheese will startup in a wide mode with
+        the image collection placed on the right side. Useful with
+        small screens.</long>
+      </locale>
+    </schema>
+
+
     <schema>
       <key>/schemas/apps/cheese/burst_delay</key>
       <applyto>/apps/cheese/burst_delay</applyto>
diff --git a/src/cheese-gconf.c b/src/cheese-gconf.c
index db8439a..3c47f54 100644
--- a/src/cheese-gconf.c
+++ b/src/cheese-gconf.c
@@ -172,6 +172,11 @@ cheese_gconf_get_property (GObject *object, guint prop_id, GValue *value,
                                                          CHEESE_GCONF_PREFIX "/enable_delete",
                                                          NULL));
       break;
+    case GCONF_PROP_WIDE_MODE:
+      g_value_set_boolean (value, gconf_client_get_bool (priv->client,
+                                                         CHEESE_GCONF_PREFIX "/wide_mode",
+                                                         NULL));
+      break;
     case GCONF_PROP_BURST_DELAY:
       g_value_set_int (value, gconf_client_get_int (priv->client,
                                                     CHEESE_GCONF_PREFIX "/burst_delay",
@@ -309,6 +314,12 @@ cheese_gconf_set_property (GObject *object, guint prop_id, const GValue *value,
                              g_value_get_boolean (value),
                              NULL);
       break;
+    case GCONF_PROP_WIDE_MODE:
+      gconf_client_set_bool (priv->client,
+                             CHEESE_GCONF_PREFIX "/wide_mode",
+                             g_value_get_boolean (value),
+                             NULL);
+      break;
     case GCONF_PROP_BURST_DELAY:
       gconf_client_set_int (priv->client,
                             CHEESE_GCONF_PREFIX "/burst_delay",
@@ -443,6 +454,13 @@ cheese_gconf_class_init (CheeseGConfClass *klass)
                                                          FALSE,
                                                          G_PARAM_READWRITE));
 
+  g_object_class_install_property (object_class, GCONF_PROP_WIDE_MODE,
+                                   g_param_spec_boolean ("gconf_prop_wide_mode",
+                                                         NULL,
+                                                         NULL,
+                                                         FALSE,
+                                                         G_PARAM_READWRITE));
+
   g_object_class_install_property (object_class, GCONF_PROP_BURST_DELAY,
                                    g_param_spec_int ("gconf_prop_burst_delay",
                                                      NULL,
diff --git a/src/cheese-gconf.h b/src/cheese-gconf.h
index d9cabb8..2ba0209 100644
--- a/src/cheese-gconf.h
+++ b/src/cheese-gconf.h
@@ -54,6 +54,7 @@ enum
   GCONF_PROP_VIDEO_PATH,
   GCONF_PROP_PHOTO_PATH,
   GCONF_PROP_ENABLE_DELETE,
+  GCONF_PROP_WIDE_MODE,
   GCONF_PROP_BURST_DELAY,
   GCONF_PROP_BURST_REPEAT
 };
diff --git a/src/cheese-window.c b/src/cheese-window.c
index b438405..4b3df35 100644
--- a/src/cheese-window.c
+++ b/src/cheese-window.c
@@ -448,6 +448,8 @@ cheese_window_toggle_wide_mode (GtkWidget *widget, CheeseWindow *cheese_window)
     g_object_set (G_OBJECT (cheese_window->netbook_alignment),
                   "left-padding", 0, NULL);
   }
+
+  g_object_set (cheese_window->gconf, "gconf_prop_wide_mode", toggled, NULL);
 }
 
 static void
@@ -2145,6 +2147,7 @@ void
 cheese_window_init (char *hal_dev_udi, CheeseDbus *dbus_server, gboolean startup_in_wide_mode)
 {
   CheeseWindow *cheese_window;
+  gboolean startup_in_wide_mode_saved;
 
   cheese_window = g_new0 (CheeseWindow, 1);
 
@@ -2174,6 +2177,13 @@ cheese_window_init (char *hal_dev_udi, CheeseDbus *dbus_server, gboolean startup
   cheese_window->webcam_mode = WEBCAM_MODE_PHOTO;
   cheese_window->recording   = FALSE;
 
+  g_object_get (cheese_window->gconf,
+                "gconf_prop_wide_mode",
+                &startup_in_wide_mode_saved,
+                NULL);
+
+  startup_in_wide_mode = startup_in_wide_mode_saved ? TRUE : startup_in_wide_mode;
+
   if (startup_in_wide_mode) {
     GtkAction *action = gtk_ui_manager_get_action (cheese_window->ui_manager, "/MainMenu/Cheese/WideMode");
     gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);



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