[cheese/cheese-window-refactor: 5/8] Restore temporarily disabled wide mode
- From: Filippo Argiolas <fargiolas src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [cheese/cheese-window-refactor: 5/8] Restore temporarily disabled wide mode
- Date: Sun, 31 Jan 2010 10:49:58 +0000 (UTC)
commit 0033b1e878e2455baa21679df073d58b74c33e2e
Author: Filippo Argiolas <filippo argiolas gmail com>
Date: Wed Jan 27 19:13:52 2010 +0100
Restore temporarily disabled wide mode
src/cheese-window.c | 91 +++++++++++++++++++++++++++++++++++++++-----------
src/cheese.c | 1 +
2 files changed, 72 insertions(+), 20 deletions(-)
---
diff --git a/src/cheese-window.c b/src/cheese-window.c
index 27f7e8a..9616fce 100644
--- a/src/cheese-window.c
+++ b/src/cheese-window.c
@@ -59,6 +59,7 @@
enum
{
PROP_0,
+ PROP_STARTUP_WIDE
};
typedef enum
@@ -81,9 +82,8 @@ typedef struct
gboolean recording;
gboolean isFullscreen;
+ gboolean startup_wide;
- /* UDI device requested on the command line */
- char *startup_hal_dev_udi;
char *video_filename;
CheeseCamera *camera;
@@ -1523,6 +1523,7 @@ cheese_window_init (CheeseWindow *window)
priv->flash = cheese_flash_new (NULL);
priv->isFullscreen = FALSE;
priv->is_bursting = FALSE;
+ priv->startup_wide = FALSE;
priv->fullscreen_timeout_source = NULL;
@@ -1537,20 +1538,38 @@ cheese_window_init (CheeseWindow *window)
priv->camera_mode = CAMERA_MODE_PHOTO;
priv->recording = FALSE;
-#if 0
+
+ /* Run cam setup in its own thread */
+ GError *error = NULL;
+ if (!g_thread_create ((GThreadFunc) setup_camera, window, FALSE, &error))
+ {
+ g_error ("Failed to create setup thread: %s\n", error->message);
+ g_error_free (error);
+ return;
+ }
+}
+
+static void
+cheese_window_constructed (GObject *object)
+{
+ CheeseWindow *window = CHEESE_WINDOW (object);
+ CheeseWindowPrivate *priv = CHEESE_WINDOW_GET_PRIVATE (window);
+
+ gboolean startup_wide_saved;
+
g_object_get (priv->gconf,
"gconf_prop_wide_mode",
- &startup_in_wide_mode_saved,
+ &startup_wide_saved,
NULL);
- startup_in_wide_mode = startup_in_wide_mode_saved ? TRUE : startup_in_wide_mode;
+ priv->startup_wide = startup_wide_saved ? TRUE : priv->startup_wide;
- if (startup_in_wide_mode)
+ if (priv->startup_wide)
{
GtkAction *action = gtk_ui_manager_get_action (priv->ui_manager, "/MainMenu/Cheese/WideMode");
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
}
-#endif
+
/* handy trick to set default size of the drawing area while not
* limiting its minimum size, thanks Owen! */
GtkRequisition req;
@@ -1561,15 +1580,6 @@ cheese_window_init (CheeseWindow *window)
gtk_widget_set_size_request (priv->notebook, -1, -1);
gtk_widget_show_all (priv->main_vbox);
-
- /* Run cam setup in its own thread */
- GError *error = NULL;
- if (!g_thread_create ((GThreadFunc) setup_camera, window, FALSE, &error))
- {
- g_error ("Failed to create setup thread: %s\n", error->message);
- g_error_free (error);
- return;
- }
}
static void
@@ -1578,6 +1588,7 @@ cheese_window_dispose (GObject *object)
CheeseWindow *window = CHEESE_WINDOW (object);
CheeseWindowPrivate *priv = CHEESE_WINDOW_GET_PRIVATE (window);
+ /* FIXME: fix the flash to be a gtk_window subclass */
g_object_unref (priv->flash);
G_OBJECT_CLASS (cheese_window_parent_class)->dispose (object);
}
@@ -1588,11 +1599,8 @@ cheese_window_finalize (GObject *object)
CheeseWindow *window = CHEESE_WINDOW (object);
CheeseWindowPrivate *priv = CHEESE_WINDOW_GET_PRIVATE (window);
- g_message ("FINALIZE");
-
g_object_unref (priv->camera);
g_object_unref (priv->fileutil);
-#if 0
g_object_unref (priv->actions_main);
g_object_unref (priv->actions_countdown);
g_object_unref (priv->actions_effects);
@@ -1604,7 +1612,6 @@ cheese_window_finalize (GObject *object)
g_object_unref (priv->actions_video);
g_object_unref (priv->actions_burst);
g_object_unref (priv->actions_fullscreen);
-#endif
g_object_unref (priv->gconf);
G_OBJECT_CLASS (cheese_window_parent_class)->finalize (object);
@@ -1612,12 +1619,56 @@ cheese_window_finalize (GObject *object)
}
static void
+cheese_window_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ CheeseWindow *window = CHEESE_WINDOW (object);
+ CheeseWindowPrivate *priv =
+ CHEESE_WINDOW_GET_PRIVATE (window);
+
+ switch (prop_id)
+ {
+ case PROP_STARTUP_WIDE:
+ g_value_set_boolean (value, priv->startup_wide);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+cheese_window_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+ CheeseWindow *window = CHEESE_WINDOW (object);
+ CheeseWindowPrivate *priv =
+ CHEESE_WINDOW_GET_PRIVATE (window);
+
+ switch (prop_id)
+ {
+ case PROP_STARTUP_WIDE:
+ priv->startup_wide = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
cheese_window_class_init (CheeseWindowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = cheese_window_finalize;
object_class->dispose = cheese_window_dispose;
+ object_class->constructed = cheese_window_constructed;
+ object_class->get_property = cheese_window_get_property;
+ object_class->set_property = cheese_window_set_property;
+
+ g_object_class_install_property (object_class, PROP_STARTUP_WIDE,
+ g_param_spec_boolean ("startup-wide",
+ NULL, NULL, FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_type_class_add_private (object_class, sizeof(CheeseWindowPrivate));
}
diff --git a/src/cheese.c b/src/cheese.c
index 2eeacf4..5e1c952 100644
--- a/src/cheese.c
+++ b/src/cheese.c
@@ -148,6 +148,7 @@ main (int argc, char **argv)
APPNAME_DATA_DIR G_DIR_SEPARATOR_S "icons");
CheeseWindow *window = g_object_new (CHEESE_TYPE_WINDOW,
+ "startup-wide", CheeseOptions.wide_mode,
NULL);
cheese_dbus_set_window (window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]