cheese r955 - in trunk: . src tools
- From: dgsiegel svn gnome org
- To: svn-commits-list gnome org
- Subject: cheese r955 - in trunk: . src tools
- Date: Sat, 23 Aug 2008 17:07:43 +0000 (UTC)
Author: dgsiegel
Date: Sat Aug 23 17:07:43 2008
New Revision: 955
URL: http://svn.gnome.org/viewvc/cheese?rev=955&view=rev
Log:
a small syntax cleanup made with uncrustify
Modified:
trunk/ChangeLog
trunk/src/cheese-countdown.c
trunk/src/cheese-countdown.h
trunk/src/cheese-dbus.c
trunk/src/cheese-dbus.h
trunk/src/cheese-effect-chooser.c
trunk/src/cheese-effect-chooser.h
trunk/src/cheese-fileutil.c
trunk/src/cheese-fileutil.h
trunk/src/cheese-flash.c
trunk/src/cheese-flash.h
trunk/src/cheese-gconf.c
trunk/src/cheese-gconf.h
trunk/src/cheese-no-camera.c
trunk/src/cheese-no-camera.h
trunk/src/cheese-prefs-dialog-widgets.c
trunk/src/cheese-prefs-dialog-widgets.h
trunk/src/cheese-prefs-dialog.c
trunk/src/cheese-prefs-dialog.h
trunk/src/cheese-prefs-resolution-combo.c
trunk/src/cheese-prefs-resolution-combo.h
trunk/src/cheese-prefs-webcam-combo.c
trunk/src/cheese-prefs-webcam-combo.h
trunk/src/cheese-prefs-widget.c
trunk/src/cheese-prefs-widget.h
trunk/src/cheese-thumb-view.c
trunk/src/cheese-thumb-view.h
trunk/src/cheese-webcam.c
trunk/src/cheese-webcam.h
trunk/src/cheese-window.c
trunk/src/cheese-window.h
trunk/src/cheese.c
trunk/tools/cheese-indent.cfg
Modified: trunk/src/cheese-countdown.c
==============================================================================
--- trunk/src/cheese-countdown.c (original)
+++ trunk/src/cheese-countdown.c Sat Aug 23 17:07:43 2008
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2008 Mirco "MacSlow" MÃller <macslow bangang de>
- * Copyright (C) 2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2008 Patryk Zawadzki <patrys pld-linux org>
- * Copyright (C) 2008 Andrea Cimitan <andrea cimitan gmail com>
+ * Copyright  2008 Mirco "MacSlow" MÃller <macslow bangang de>
+ * Copyright  2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2008 Patryk Zawadzki <patrys pld-linux org>
+ * Copyright  2008 Andrea Cimitan <andrea cimitan gmail com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -21,7 +21,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <cheese-config.h>
+ #include <cheese-config.h>
#endif
#include <stdlib.h>
@@ -55,7 +55,7 @@
typedef struct
{
int iState;
- cairo_surface_t* pSurface;
+ cairo_surface_t *pSurface;
cheese_countdown_cb_t picture_callback;
cheese_countdown_cb_t hide_callback;
gpointer callback_data;
@@ -77,9 +77,9 @@
gdouble h, l, s;
gdouble delta;
- red = *r;
+ red = *r;
green = *g;
- blue = *b;
+ blue = *b;
if (red > green)
{
@@ -119,7 +119,7 @@
else
s = (max - min) / (2 - max - min);
- delta = max -min;
+ delta = max - min;
if (red == max)
h = (green - blue) / delta;
else if (green == max)
@@ -149,7 +149,7 @@
gdouble m1, m2;
gdouble r, g, b;
- lightness = *l;
+ lightness = *l;
saturation = *s;
if (lightness <= 0.5)
@@ -220,7 +220,7 @@
/* Performs a color shading operation */
static void
-color_shade (const CairoColor * a, float k, CairoColor * b)
+color_shade (const CairoColor *a, float k, CairoColor *b)
{
double red;
double green;
@@ -263,16 +263,16 @@
}
static int
-do_text (cairo_t* pContext,
- gchar* pcText,
+do_text (cairo_t *pContext,
+ gchar *pcText,
int iFontSize,
- gchar* pcFontFamily,
+ gchar *pcFontFamily,
PangoWeight fontWeight,
PangoStyle fontStyle)
{
- PangoFontDescription* pDesc = NULL;
- PangoLayout* pLayout = NULL;
- GString* pTextString = NULL;
+ PangoFontDescription *pDesc = NULL;
+ PangoLayout *pLayout = NULL;
+ GString *pTextString = NULL;
PangoRectangle logicalRect;
int iAdvanceWidth;
@@ -331,26 +331,27 @@
}
static gboolean
-on_expose (GtkWidget* widget, GdkEventExpose* pEvent, gpointer data)
+on_expose (GtkWidget *widget, GdkEventExpose *pEvent, gpointer data)
{
- CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (widget);
- cairo_t *pContext = NULL;
- cairo_pattern_t *pattern;
- CairoColor bgBorder;
- CairoColor bgHighlight;
- CairoColor bgShade1;
- CairoColor bgShade2;
- CairoColor bgShade3;
- CairoColor bgShade4;
- gdouble fWidth = (gdouble) widget->allocation.width;
- gdouble fHeight = (gdouble) widget->allocation.height;
+ CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (widget);
+ cairo_t *pContext = NULL;
+ cairo_pattern_t *pattern;
+ CairoColor bgBorder;
+ CairoColor bgHighlight;
+ CairoColor bgShade1;
+ CairoColor bgShade2;
+ CairoColor bgShade3;
+ CairoColor bgShade4;
+ gdouble fWidth = (gdouble) widget->allocation.width;
+ gdouble fHeight = (gdouble) widget->allocation.height;
+
/* 3 * 26 are the three numbers, 30 is the width of camera-icon.svg */
- int iOffsetX = (widget->allocation.width - 3 * 26 - 30) / 2;
- int iOffsetY = (widget->allocation.height - 30) / 2;
- gdouble fAlpha1;
- gdouble fAlpha2;
- gdouble fAlpha3;
- gdouble fAlphaClick;
+ int iOffsetX = (widget->allocation.width - 3 * 26 - 30) / 2;
+ int iOffsetY = (widget->allocation.height - 30) / 2;
+ gdouble fAlpha1;
+ gdouble fAlpha2;
+ gdouble fAlpha3;
+ gdouble fAlphaClick;
/* deal with the timing stuff */
if (priv->iState == STATE_3)
@@ -403,33 +404,36 @@
cairo_fill (pContext);
/* draw border */
- cairo_rectangle (pContext, 0.5f, 0.5f, fWidth-1.0f, fHeight-1.0f);
+ cairo_rectangle (pContext, 0.5f, 0.5f, fWidth - 1.0f, fHeight - 1.0f);
cairo_set_source_rgba (pContext, bgBorder.r, bgBorder.g, bgBorder.b, 0.6f);
cairo_stroke (pContext);
/* draw inner highlight */
- cairo_rectangle (pContext, 1.5f, 1.5f, fWidth-3.0f, fHeight-3.0f);
+ cairo_rectangle (pContext, 1.5f, 1.5f, fWidth - 3.0f, fHeight - 3.0f);
cairo_set_source_rgba (pContext, bgHighlight.r, bgHighlight.g, bgHighlight.b, 0.5f);
cairo_stroke (pContext);
/* plain version */
+
/*
- cairo_set_source_rgba (pContext, bg.r, bg.g, bg.b, 1.0f);
- cairo_rectangle (pContext, 0.0f, 0.0f, fWidth, fHeight);
- cairo_fill (pContext);
- */
+ * cairo_set_source_rgba (pContext, bg.r, bg.g, bg.b, 1.0f);
+ * cairo_rectangle (pContext, 0.0f, 0.0f, fWidth, fHeight);
+ * cairo_fill (pContext);
+ */
char *number;
+
/* draw the 3 */
cairo_set_source_rgba (pContext, priv->text.r, priv->text.g, priv->text.b, fAlpha3);
cairo_move_to (pContext, (gdouble) iOffsetX, (gdouble) iOffsetY);
+
/* TRANSLATORS:
* This is the countdown number when taking the photo.
* If you leave as is (that is, %d), it will show 3, 2, 1, 0.
* To enable to show the numbers in your own language, use %Id instead.
* Please leave the additional whitespace after the number
*/
- number = g_strdup_printf (_("%d "), 3);
+ number = g_strdup_printf (_("%d "), 3);
iOffsetX += do_text (pContext,
number,
26 * PANGO_SCALE,
@@ -441,13 +445,14 @@
/* draw the 2 */
cairo_set_source_rgba (pContext, priv->text.r, priv->text.g, priv->text.b, fAlpha2);
cairo_move_to (pContext, (gdouble) iOffsetX, (gdouble) iOffsetY);
+
/* TRANSLATORS:
* This is the countdown number when taking the photo.
* If you leave as is (that is, %d), it will show 3, 2, 1, 0.
* To enable to show the numbers in your own language, use %Id instead.
* Please leave the additional whitespace after the number
*/
- number = g_strdup_printf (_("%d "), 2);
+ number = g_strdup_printf (_("%d "), 2);
iOffsetX += do_text (pContext,
number,
26 * PANGO_SCALE,
@@ -459,13 +464,14 @@
/* draw the 1 */
cairo_set_source_rgba (pContext, priv->text.r, priv->text.g, priv->text.b, fAlpha1);
cairo_move_to (pContext, (gdouble) iOffsetX, (gdouble) iOffsetY);
+
/* TRANSLATORS:
* This is the countdown number when taking the photo.
* If you leave as is (that is, %d), it will show 3, 2, 1, 0.
* To enable to show the numbers in your own language, use %Id instead.
* Please leave the additional whitespace after the number
*/
- number = g_strdup_printf (_("%d "), 1);
+ number = g_strdup_printf (_("%d "), 1);
iOffsetX += do_text (pContext,
number,
26 * PANGO_SCALE,
@@ -490,22 +496,22 @@
static gboolean
redraw_handler (gpointer data)
{
- GtkWidget* widget = (GtkWidget*) data;
+ GtkWidget *widget = (GtkWidget *) data;
gtk_widget_queue_draw (widget);
return TRUE;
}
-static cairo_surface_t*
-create_surface_from_svg (GtkWidget *widget, gchar* pcFilename)
+static cairo_surface_t *
+create_surface_from_svg (GtkWidget *widget, gchar *pcFilename)
{
- cairo_surface_t* pSurface = NULL;
- RsvgHandle* pSvgHandle = NULL;
- GError* pError = NULL;
- cairo_t* pContext = NULL;
+ cairo_surface_t *pSurface = NULL;
+ RsvgHandle *pSvgHandle = NULL;
+ GError *pError = NULL;
+ cairo_t *pContext = NULL;
RsvgDimensionData dimension;
- CheeseCountdownPrivate* priv = CHEESE_COUNTDOWN_GET_PRIVATE (widget);
+ CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (widget);
rsvg_init ();
@@ -558,17 +564,18 @@
static void
on_style_set_cb (GtkWidget *widget, GtkStyle *previous_style, gpointer data)
{
- CheeseCountdownPrivate* priv = CHEESE_COUNTDOWN_GET_PRIVATE (data);
+ CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (data);
- GdkColor *color_bg = >K_WIDGET (widget)->style->bg[GTK_STATE_SELECTED];
+ GdkColor *color_bg = >K_WIDGET (widget)->style->bg[GTK_STATE_SELECTED];
GdkColor *color_text = >K_WIDGET (widget)->style->fg[GTK_STATE_SELECTED];
- priv->bg.r = ((double)color_bg->red) / 65535;
- priv->bg.g = ((double)color_bg->green) / 65535;
- priv->bg.b = ((double)color_bg->blue) / 65535;
- priv->bg.a = 1.0f;
- priv->text.r = ((double)color_text->red) / 65535;
- priv->text.g = ((double)color_text->green) / 65535;
- priv->text.b = ((double)color_text->blue) / 65535;
+
+ priv->bg.r = ((double) color_bg->red) / 65535;
+ priv->bg.g = ((double) color_bg->green) / 65535;
+ priv->bg.b = ((double) color_bg->blue) / 65535;
+ priv->bg.a = 1.0f;
+ priv->text.r = ((double) color_text->red) / 65535;
+ priv->text.g = ((double) color_text->green) / 65535;
+ priv->text.b = ((double) color_text->blue) / 65535;
priv->text.a = 1.0f;
/* create/load svg-icon */
@@ -579,11 +586,12 @@
static gboolean
cheese_countdown_cb (gpointer countdown)
{
- CheeseCountdownPrivate* priv = CHEESE_COUNTDOWN_GET_PRIVATE (countdown);
+ CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (countdown);
switch (priv->iState)
{
case STATE_OFF:
+
/* Countdown was cancelled */
return FALSE;
@@ -610,32 +618,38 @@
}
void
-cheese_countdown_start (CheeseCountdown *countdown, cheese_countdown_cb_t picture_cb, cheese_countdown_cb_t hide_cb, gpointer data)
+cheese_countdown_start (CheeseCountdown *countdown,
+ cheese_countdown_cb_t picture_cb,
+ cheese_countdown_cb_t hide_cb,
+ gpointer data)
{
- CheeseCountdownPrivate* priv = CHEESE_COUNTDOWN_GET_PRIVATE (countdown);
+ CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (countdown);
+
if (priv->iState != STATE_OFF)
{
g_print ("Should not happen, state is not off.\n");
return;
}
- priv->iState = STATE_3;
+ priv->iState = STATE_3;
priv->picture_callback = picture_cb;
- priv->hide_callback = hide_cb;
- priv->callback_data = data;
+ priv->hide_callback = hide_cb;
+ priv->callback_data = data;
g_timeout_add_seconds (1, cheese_countdown_cb, (gpointer) countdown);
}
void
cheese_countdown_cancel (CheeseCountdown *countdown)
{
- CheeseCountdownPrivate* priv = CHEESE_COUNTDOWN_GET_PRIVATE (countdown);
+ CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (countdown);
+
priv->iState = STATE_OFF;
}
int
cheese_countdown_get_state (CheeseCountdown *countdown)
{
- CheeseCountdownPrivate* priv = CHEESE_COUNTDOWN_GET_PRIVATE (countdown);
+ CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (countdown);
+
return priv->iState;
}
@@ -649,6 +663,7 @@
cheese_countdown_class_init (CheeseCountdownClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
object_class->finalize = cheese_countdown_finalize;
g_type_class_add_private (klass, sizeof (CheeseCountdownPrivate));
@@ -657,11 +672,11 @@
static void
cheese_countdown_init (CheeseCountdown *countdown)
{
- CheeseCountdownPrivate* priv = CHEESE_COUNTDOWN_GET_PRIVATE (countdown);
+ CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (countdown);
- priv->iState = STATE_OFF;
+ priv->iState = STATE_OFF;
priv->picture_callback = NULL;
- priv->hide_callback = NULL;
+ priv->hide_callback = NULL;
g_signal_connect (G_OBJECT (countdown), "expose-event",
G_CALLBACK (on_expose), NULL);
@@ -671,11 +686,12 @@
g_timeout_add (100, redraw_handler, (gpointer) countdown);
}
-GtkWidget *
+GtkWidget *
cheese_countdown_new ()
{
CheeseCountdown *countdown;
- countdown = g_object_new (CHEESE_TYPE_COUNTDOWN, NULL);
+
+ countdown = g_object_new (CHEESE_TYPE_COUNTDOWN, NULL);
return GTK_WIDGET (countdown);
}
Modified: trunk/src/cheese-countdown.h
==============================================================================
--- trunk/src/cheese-countdown.h (original)
+++ trunk/src/cheese-countdown.h Sat Aug 23 17:07:43 2008
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2008 Mirco "MacSlow" MÃller <macslow bangang de>
- * Copyright (C) 2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2008 Mirco "MacSlow" MÃller <macslow bangang de>
+ * Copyright  2008 daniel g. siegel <dgsiegel gmail com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -23,31 +23,34 @@
G_BEGIN_DECLS
-#define CHEESE_TYPE_COUNTDOWN (cheese_countdown_get_type ())
-#define CHEESE_COUNTDOWN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_COUNTDOWN, CheeseCountdown))
-#define CHEESE_COUNTDOWN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_COUNTDOWN, CheeseCountdownClass))
-#define CHEESE_IS_COUNTDOWN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_COUNTDOWN))
-#define CHEESE_IS_COUNTDOWN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_COUNTDOWN))
-#define CHEESE_COUNTDOWN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_COUNTDOWN, CheeseCountdownClass))
+#define CHEESE_TYPE_COUNTDOWN (cheese_countdown_get_type ())
+#define CHEESE_COUNTDOWN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_COUNTDOWN, CheeseCountdown))
+#define CHEESE_COUNTDOWN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_COUNTDOWN, CheeseCountdownClass))
+#define CHEESE_IS_COUNTDOWN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_COUNTDOWN))
+#define CHEESE_IS_COUNTDOWN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_COUNTDOWN))
+#define CHEESE_COUNTDOWN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_COUNTDOWN, CheeseCountdownClass))
-typedef struct
+typedef struct
{
GtkDrawingArea parent;
} CheeseCountdown;
-typedef struct
+typedef struct
{
GtkDrawingAreaClass parent_class;
} CheeseCountdownClass;
-typedef void (* cheese_countdown_cb_t) (gpointer data);
+typedef void (*cheese_countdown_cb_t)(gpointer data);
-GType cheese_countdown_get_type (void);
-GtkWidget *cheese_countdown_new ();
+GType cheese_countdown_get_type (void);
+GtkWidget *cheese_countdown_new ();
-void cheese_countdown_start (CheeseCountdown *countdown, cheese_countdown_cb_t picture_cb, cheese_countdown_cb_t hide_cb, gpointer data);
+void cheese_countdown_start (CheeseCountdown *countdown,
+ cheese_countdown_cb_t picture_cb,
+ cheese_countdown_cb_t hide_cb,
+ gpointer data);
void cheese_countdown_cancel (CheeseCountdown *countdown);
-int cheese_countdown_get_state (CheeseCountdown *countdown);
+int cheese_countdown_get_state (CheeseCountdown *countdown);
G_END_DECLS
Modified: trunk/src/cheese-dbus.c
==============================================================================
--- trunk/src/cheese-dbus.c (original)
+++ trunk/src/cheese-dbus.c Sat Aug 23 17:07:43 2008
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
- * Copyright (C) 2008 Felix Kaser <f kaser gmx net>
- *
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2008 Felix Kaser <f kaser gmx net>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
#ifdef HAVE_CONFIG_H
-#include <cheese-config.h>
+ #include <cheese-config.h>
#endif
#include <dbus/dbus-glib-bindings.h>
@@ -67,7 +67,7 @@
g_error_free (error);
return;
}
-
+
dbus_g_object_type_install_info (CHEESE_TYPE_DBUS, &dbus_glib_cheese_dbus_object_info);
}
@@ -85,21 +85,22 @@
CheeseDbus *
cheese_dbus_new ()
{
- CheeseDbus *server;
- GError *error = NULL;
- DBusGProxy *proxy;
- guint request_ret;
+ CheeseDbus *server;
+ GError *error = NULL;
+ DBusGProxy *proxy;
+ guint request_ret;
CheeseDbusClass *klass;
-
+
server = g_object_new (CHEESE_TYPE_DBUS, NULL);
-
+
klass = CHEESE_DBUS_GET_CLASS (server);
+
/* Register the service name, the constant here are defined in dbus-glib-bindings.h */
proxy = dbus_g_proxy_new_for_name (klass->connection,
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS);
-
+
if (!org_freedesktop_DBus_request_name (proxy,
"org.gnome.Cheese",
0, &request_ret,
@@ -108,31 +109,31 @@
g_warning ("Unable to register service: %s", error->message);
g_error_free (error);
}
-
- /*check if there is already a instance running -> exit*/
+
+ /* check if there is already a instance running -> exit*/
if (request_ret == DBUS_REQUEST_NAME_REPLY_EXISTS ||
request_ret == DBUS_REQUEST_NAME_REPLY_IN_QUEUE)
{
g_warning ("Another instance of cheese is already running!");
-
- /*notify the other instance of cheese*/
+
+ /* notify the other instance of cheese*/
proxy = dbus_g_proxy_new_for_name (klass->connection,
"org.gnome.Cheese",
"/org/gnome/cheese",
"org.gnome.Cheese");
-
+
if (!dbus_g_proxy_call (proxy, "notify", &error, G_TYPE_INVALID, G_TYPE_INVALID))
{
/* Method failed, the GError is set, let's warn everyone */
g_warning ("Notifying the other cheese instance failed: %s", error->message);
g_error_free (error);
}
-
+
g_object_unref (server);
server = NULL;
}
g_object_unref (proxy);
-
+
return server;
}
Modified: trunk/src/cheese-dbus.h
==============================================================================
--- trunk/src/cheese-dbus.h (original)
+++ trunk/src/cheese-dbus.h Sat Aug 23 17:07:43 2008
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
- * Copyright (C) 2008 Felix Kaser <f kaser gmx net>
- *
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2008 Felix Kaser <f kaser gmx net>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -33,21 +33,23 @@
DBusGConnection *connection;
} CheeseDbusClass;
-typedef struct _CheeseDbus {
+typedef struct _CheeseDbus
+{
GObject parent;
} CheeseDbus;
-#define CHEESE_TYPE_DBUS (cheese_dbus_get_type ())
+#define CHEESE_TYPE_DBUS (cheese_dbus_get_type ())
#define CHEESE_DBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_DBUS, CheeseDbus))
-#define CHEESE_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_DBUS, CheeseDbusClass))
+#define CHEESE_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_DBUS, CheeseDbusClass))
#define CHEESE_IS_DBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_DBUS))
-#define CHEESE_IS_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_DBUS))
-#define CHEESE_DBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_DBUS, CheeseDbusClass))
+#define CHEESE_IS_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_DBUS))
+#define CHEESE_DBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_DBUS, CheeseDbusClass))
+
+GType cheese_dbus_get_type (void);
+CheeseDbus *cheese_dbus_new (void);
-GType cheese_dbus_get_type (void);
-CheeseDbus * cheese_dbus_new (void);
-void cheese_dbus_set_window (gpointer);
+void cheese_dbus_set_window (gpointer);
gboolean cheese_dbus_notify (void);
G_END_DECLS
Modified: trunk/src/cheese-effect-chooser.c
==============================================================================
--- trunk/src/cheese-effect-chooser.c (original)
+++ trunk/src/cheese-effect-chooser.c Sat Aug 23 17:07:43 2008
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
*
* Licensed under the GNU General Public License Version 2
*
@@ -19,7 +19,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <cheese-config.h>
+ #include <cheese-config.h>
#endif
#include <string.h>
@@ -31,14 +31,14 @@
#include "cheese-effect-chooser.h"
#include "cheese-webcam.h"
-#define BOARD_COLS 4
-#define BOARD_ROWS 3
+#define BOARD_COLS 4
+#define BOARD_ROWS 3
#define NUM_EFFECTS (BOARD_ROWS * BOARD_COLS)
-#define SHRINK(cr, x) cairo_translate (cr, (1-(x))/2.0, (1-(x))/2.0); cairo_scale (cr, (x), (x))
+#define SHRINK(cr, x) cairo_translate (cr, (1 - (x)) / 2.0, (1 - (x)) / 2.0); cairo_scale (cr, (x), (x))
#define CHEESE_EFFECT_CHOOSER_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_EFFECT_CHOOSER, CheeseEffectChooserPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_EFFECT_CHOOSER, CheeseEffectChooserPrivate))
G_DEFINE_TYPE (CheeseEffectChooser, cheese_effect_chooser, GTK_TYPE_DRAWING_AREA);
@@ -48,7 +48,7 @@
} CheeseEffectChooserPrivate;
-typedef struct
+typedef struct
{
CheeseWebcamEffect effect;
char *name;
@@ -56,37 +56,36 @@
gboolean is_black;
} GstEffect;
-static const GstEffect GST_EFFECT[] =
-{
- {CHEESE_WEBCAM_EFFECT_NO_EFFECT, N_("No Effect"),
+static const GstEffect GST_EFFECT[] = {
+ {CHEESE_WEBCAM_EFFECT_NO_EFFECT, N_("No Effect"),
PACKAGE_DATADIR "/effects/identity.png", FALSE},
- {CHEESE_WEBCAM_EFFECT_MAUVE, N_("Mauve"),
+ {CHEESE_WEBCAM_EFFECT_MAUVE, N_("Mauve"),
PACKAGE_DATADIR "/effects/Mauve.png", FALSE},
- {CHEESE_WEBCAM_EFFECT_NOIR_BLANC, N_("Noir/Blanc"),
+ {CHEESE_WEBCAM_EFFECT_NOIR_BLANC, N_("Noir/Blanc"),
PACKAGE_DATADIR "/effects/NoirBlanc.png", FALSE},
- {CHEESE_WEBCAM_EFFECT_SATURATION, N_("Saturation"),
+ {CHEESE_WEBCAM_EFFECT_SATURATION, N_("Saturation"),
PACKAGE_DATADIR "/effects/Saturation.png", FALSE},
- {CHEESE_WEBCAM_EFFECT_HULK, N_("Hulk"),
+ {CHEESE_WEBCAM_EFFECT_HULK, N_("Hulk"),
PACKAGE_DATADIR "/effects/Hulk.png", FALSE},
- {CHEESE_WEBCAM_EFFECT_VERTICAL_FLIP, N_("Vertical Flip"),
+ {CHEESE_WEBCAM_EFFECT_VERTICAL_FLIP, N_("Vertical Flip"),
PACKAGE_DATADIR "/effects/videoflip_v.png", FALSE},
- {CHEESE_WEBCAM_EFFECT_HORIZONTAL_FLIP, N_("Horizontal Flip"),
+ {CHEESE_WEBCAM_EFFECT_HORIZONTAL_FLIP, N_("Horizontal Flip"),
PACKAGE_DATADIR "/effects/videoflip_h.png", FALSE},
- {CHEESE_WEBCAM_EFFECT_SHAGADELIC, N_("Shagadelic"),
+ {CHEESE_WEBCAM_EFFECT_SHAGADELIC, N_("Shagadelic"),
PACKAGE_DATADIR "/effects/shagadelictv.png", FALSE},
- {CHEESE_WEBCAM_EFFECT_VERTIGO, N_("Vertigo"),
+ {CHEESE_WEBCAM_EFFECT_VERTIGO, N_("Vertigo"),
PACKAGE_DATADIR "/effects/vertigotv.png", FALSE},
- {CHEESE_WEBCAM_EFFECT_EDGE, N_("Edge"),
+ {CHEESE_WEBCAM_EFFECT_EDGE, N_("Edge"),
PACKAGE_DATADIR "/effects/edgetv.png", TRUE},
- {CHEESE_WEBCAM_EFFECT_DICE, N_("Dice"),
+ {CHEESE_WEBCAM_EFFECT_DICE, N_("Dice"),
PACKAGE_DATADIR "/effects/dicetv.png", FALSE},
- {CHEESE_WEBCAM_EFFECT_WARP, N_("Warp"),
+ {CHEESE_WEBCAM_EFFECT_WARP, N_("Warp"),
PACKAGE_DATADIR "/effects/warptv.png", FALSE}
};
static void
-cheese_cairo_rectangle_round (cairo_t * cr,
+cheese_cairo_rectangle_round (cairo_t *cr,
double x0, double y0,
double width, double height, double radius)
{
@@ -147,6 +146,9 @@
static void
cheese_cairo_draw_card (cairo_t *cr, const GstEffect *card, gboolean highlight)
{
+ int w, h;
+ cairo_surface_t *image;
+
cairo_save (cr);
SHRINK (cr, .9);
@@ -156,15 +158,13 @@
cairo_save (cr);
- int w, h;
- cairo_surface_t *image;
cheese_cairo_rectangle_round (cr, 0, 0, 1.0, 1.0, 0.1);
cairo_clip (cr);
cairo_new_path (cr);
image = cairo_image_surface_create_from_png (card->filename);
- w = cairo_image_surface_get_width (image);
- h = cairo_image_surface_get_height (image);
+ w = cairo_image_surface_get_width (image);
+ h = cairo_image_surface_get_height (image);
cairo_scale (cr, 1.0 / w, 1.0 / h);
@@ -180,7 +180,7 @@
double x, y;
cairo_select_font_face (cr, "Sans",
- CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+ CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 0.09);
gchar *name = gettext (card->name);
@@ -203,12 +203,13 @@
static void
cheese_effect_chooser_expose_cb (GtkWidget *widget, GdkEventExpose *expose_event, gpointer data)
{
- CheeseEffectChooserPrivate* priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (widget);
- int width, height;
- int i;
+ CheeseEffectChooserPrivate *priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (widget);
+
+ int width, height;
+ int i;
cairo_t *cr;
- width = widget->allocation.width;
+ width = widget->allocation.width;
height = widget->allocation.height;
cr = gdk_cairo_create (widget->window);
@@ -232,13 +233,14 @@
static gboolean
cheese_effect_chooser_button_press_event_cb (GtkWidget *widget, GdkEventButton *button_event, gpointer data)
{
- CheeseEffectChooserPrivate* priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (widget);
+ CheeseEffectChooserPrivate *priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (widget);
+
int i;
- int col = (int) (button_event->x / widget->allocation.width * BOARD_COLS);
- int row = (int) (button_event->y / widget->allocation.height * BOARD_ROWS);
+ int col = (int) (button_event->x / widget->allocation.width * BOARD_COLS);
+ int row = (int) (button_event->y / widget->allocation.height * BOARD_ROWS);
int slot = (row * BOARD_COLS + col);
- priv->selected [slot] = !priv->selected [slot];
+ priv->selected[slot] = !priv->selected[slot];
if (priv->selected[0] == TRUE)
{
@@ -254,8 +256,9 @@
CheeseWebcamEffect
cheese_effect_chooser_get_selection (CheeseEffectChooser *effect_chooser)
{
- CheeseEffectChooserPrivate* priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (effect_chooser);
- int i;
+ CheeseEffectChooserPrivate *priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (effect_chooser);
+
+ int i;
CheeseWebcamEffect effect = 0;
for (i = 0; i < NUM_EFFECTS; i++)
@@ -271,8 +274,9 @@
char *
cheese_effect_chooser_get_selection_string (CheeseEffectChooser *effect_chooser)
{
- CheeseEffectChooserPrivate* priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (effect_chooser);
- int i;
+ CheeseEffectChooserPrivate *priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (effect_chooser);
+
+ int i;
char *effects = NULL;
for (i = 0; i < NUM_EFFECTS; i++)
@@ -298,31 +302,32 @@
cheese_effect_chooser_class_init (CheeseEffectChooserClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
object_class->finalize = cheese_effect_chooser_finalize;
g_type_class_add_private (klass, sizeof (CheeseEffectChooserPrivate));
}
-
static void
cheese_effect_chooser_init (CheeseEffectChooser *effect_chooser)
{
gtk_widget_add_events (GTK_WIDGET (effect_chooser), GDK_BUTTON_PRESS_MASK);
- g_signal_connect (G_OBJECT (effect_chooser),"button_press_event",
+ g_signal_connect (G_OBJECT (effect_chooser), "button_press_event",
G_CALLBACK (cheese_effect_chooser_button_press_event_cb), NULL);
- g_signal_connect (G_OBJECT (effect_chooser), "expose-event",
+ g_signal_connect (G_OBJECT (effect_chooser), "expose-event",
G_CALLBACK (cheese_effect_chooser_expose_cb), NULL);
}
-GtkWidget *
-cheese_effect_chooser_new (char* selected_effects)
+GtkWidget *
+cheese_effect_chooser_new (char *selected_effects)
{
CheeseEffectChooser *effect_chooser;
- effect_chooser = g_object_new (CHEESE_TYPE_EFFECT_CHOOSER, NULL);
+ int i;
- CheeseEffectChooserPrivate* priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (effect_chooser);
- int i;
+ effect_chooser = g_object_new (CHEESE_TYPE_EFFECT_CHOOSER, NULL);
+
+ CheeseEffectChooserPrivate *priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (effect_chooser);
if (selected_effects != NULL)
{
Modified: trunk/src/cheese-effect-chooser.h
==============================================================================
--- trunk/src/cheese-effect-chooser.h (original)
+++ trunk/src/cheese-effect-chooser.h Sat Aug 23 17:07:43 2008
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
*
* Licensed under the GNU General Public License Version 2
*
@@ -26,28 +26,32 @@
G_BEGIN_DECLS
-#define CHEESE_TYPE_EFFECT_CHOOSER (cheese_effect_chooser_get_type ())
-#define CHEESE_EFFECT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_EFFECT_CHOOSER, CheeseEffectChooser))
-#define CHEESE_EFFECT_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_EFFECT_CHOOSER, CheeseEffectChooserClass))
+#define CHEESE_TYPE_EFFECT_CHOOSER (cheese_effect_chooser_get_type ())
+#define CHEESE_EFFECT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_EFFECT_CHOOSER, \
+ CheeseEffectChooser))
+#define CHEESE_EFFECT_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_EFFECT_CHOOSER, \
+ CheeseEffectChooserClass))
#define CHEESE_IS_EFFECT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_EFFECT_CHOOSER))
-#define CHEESE_IS_EFFECT_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_EFFECT_CHOOSER))
-#define CHEESE_EFFECT_CHOOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_EFFECT_CHOOSER, CheeseEffectChooserClass))
+#define CHEESE_IS_EFFECT_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_EFFECT_CHOOSER))
+#define CHEESE_EFFECT_CHOOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_EFFECT_CHOOSER, \
+ CheeseEffectChooserClass))
-typedef struct
+typedef struct
{
GtkDrawingArea parent;
} CheeseEffectChooser;
-typedef struct
+typedef struct
{
GtkDrawingAreaClass parent_class;
} CheeseEffectChooserClass;
-GType cheese_effect_chooser_get_type (void);
-GtkWidget *cheese_effect_chooser_new (char* selected_effects);
+GType cheese_effect_chooser_get_type (void);
+GtkWidget *cheese_effect_chooser_new (char *selected_effects);
+
CheeseWebcamEffect cheese_effect_chooser_get_selection (CheeseEffectChooser *effect_chooser);
-char *cheese_effect_chooser_get_selection_string (CheeseEffectChooser *effect_chooser);
+char * cheese_effect_chooser_get_selection_string (CheeseEffectChooser *effect_chooser);
void cheese_effect_chooser_unselect_all (CheeseEffectChooser *effect_chooser);
G_END_DECLS
Modified: trunk/src/cheese-fileutil.c
==============================================================================
--- trunk/src/cheese-fileutil.c (original)
+++ trunk/src/cheese-fileutil.c Sat Aug 23 17:07:43 2008
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
- * Copyright (C) 2008 Felix Kaser <f kaser gmx net>
- *
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2008 Felix Kaser <f kaser gmx net>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -20,7 +20,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <cheese-config.h>
+ #include <cheese-config.h>
#endif
#include <glib.h>
@@ -35,9 +35,10 @@
G_DEFINE_TYPE (CheeseFileUtil, cheese_fileutil, G_TYPE_OBJECT)
#define CHEESE_FILEUTIL_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_FILEUTIL, CheeseFileUtilPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_FILEUTIL, CheeseFileUtilPrivate))
-typedef struct{
+typedef struct
+{
gchar *video_path;
gchar *photo_path;
gchar *log_path;
@@ -46,11 +47,12 @@
gchar *
cheese_fileutil_get_video_path (CheeseFileUtil *fileutil)
{
+ CheeseFileUtilPrivate *priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
+
gchar *path;
- CheeseFileUtilPrivate* priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
-
+
#ifdef HILDON
- // TODO change HILDON to xdg as well?
+ /* TODO change HILDON to xdg as well? */
path = g_strjoin (G_DIR_SEPARATOR_S, g_get_home_dir (), "Mydocs", ".videos", NULL);
#else
path = priv->video_path;
@@ -62,11 +64,12 @@
gchar *
cheese_fileutil_get_photo_path (CheeseFileUtil *fileutil)
{
+ CheeseFileUtilPrivate *priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
+
gchar *path;
- CheeseFileUtilPrivate* priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
-
+
#ifdef HILDON
- // TODO change HILDON to xdg as well?
+ /* TODO change HILDON to xdg as well? */
path = g_strjoin (G_DIR_SEPARATOR_S, g_get_home_dir (), "Mydocs", ".images", NULL);
#else
path = priv->photo_path;
@@ -78,11 +81,12 @@
gchar *
cheese_fileutil_get_log_path (CheeseFileUtil *fileutil)
{
+ CheeseFileUtilPrivate *priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
+
gchar *path;
- CheeseFileUtilPrivate* priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
-
+
#ifdef HILDON
- // TODO change HILDON to xdg as well?
+ /* TODO change HILDON to xdg as well? */
path = g_strjoin (G_DIR_SEPARATOR_S, g_get_home_dir (), "Mydocs", ".cheese-log", NULL);
#else
path = priv->log_path;
@@ -95,14 +99,14 @@
cheese_fileutil_get_new_media_filename (CheeseFileUtil *fileutil, CheeseMediaMode mode)
{
struct tm *ptr;
- time_t tm;
- char date[21];
- gchar *path;
- char *filename;
- GFile *file;
- int num;
+ time_t tm;
+ char date[21];
+ gchar *path;
+ char *filename;
+ GFile *file;
+ int num;
- tm = time (NULL);
+ tm = time (NULL);
ptr = localtime (&tm);
strftime (date, 20, "%F-%H%M%S", ptr);
@@ -110,7 +114,7 @@
path = cheese_fileutil_get_photo_path (fileutil);
else
path = cheese_fileutil_get_video_path (fileutil);
-
+
if (mode == CHEESE_MEDIA_MODE_PHOTO)
filename = g_strdup_printf ("%s%s%s%s", path, G_DIR_SEPARATOR_S, date, PHOTO_NAME_SUFFIX);
else
@@ -139,7 +143,7 @@
file = g_file_new_for_path (filename);
}
}
-
+
return filename;
}
@@ -149,7 +153,7 @@
CheeseFileUtil *fileutil;
fileutil = CHEESE_FILEUTIL (object);
- CheeseFileUtilPrivate *priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
+ CheeseFileUtilPrivate *priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
g_free (priv->video_path);
g_free (priv->photo_path);
@@ -159,8 +163,9 @@
static void
cheese_fileutil_class_init (CheeseFileUtilClass *klass)
-{
+{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
object_class->finalize = cheese_fileutil_finalize;
g_type_class_add_private (klass, sizeof (CheeseFileUtilPrivate));
@@ -169,53 +174,54 @@
static void
cheese_fileutil_init (CheeseFileUtil *fileutil)
{
- CheeseFileUtilPrivate* priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
- gchar *v_path, *p_path;
+ CheeseFileUtilPrivate *priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
+
CheeseGConf *gconf;
-
- gconf = cheese_gconf_new ();
-
- //get the path from gconf, xdg or hardcoded
+ gchar *v_path, *p_path;
+
+ gconf = cheese_gconf_new ();
+
+ /* get the path from gconf, xdg or hardcoded */
g_object_get (gconf, "gconf_prop_video_path", &v_path, NULL);
-
+
if (!v_path || strcmp (v_path, "") == 0)
{
- //get xdg
+ /* get xdg */
v_path = g_strjoin (G_DIR_SEPARATOR_S, g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS), "Webcam", NULL);
if (strcmp (v_path, "") == 0)
{
- //get "~/.gnome2/cheese/media"
-
+ /* get "~/.gnome2/cheese/media" */
+
v_path = g_strjoin (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2", "cheese", "media", NULL);
}
}
priv->video_path = v_path;
-
- //get the path from gconf, xdg or hardcoded
+
+ /* get the path from gconf, xdg or hardcoded */
g_object_get (gconf, "gconf_prop_photo_path", &p_path, NULL);
-
+
if (!p_path || strcmp (p_path, "") == 0)
{
- //get xdg
+ /* get xdg */
p_path = g_strjoin (G_DIR_SEPARATOR_S, g_get_user_special_dir (G_USER_DIRECTORY_PICTURES), "Webcam", NULL);
if (strcmp (p_path, "") == 0)
{
- //get "~/.gnome2/cheese/media"
+ /* get "~/.gnome2/cheese/media" */
p_path = g_strjoin (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2", "cheese", "media", NULL);
}
}
priv->photo_path = p_path;
-
+
priv->log_path = g_strjoin (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2", "cheese", NULL);
-
+
g_object_unref (gconf);
}
-CheeseFileUtil *
+CheeseFileUtil *
cheese_fileutil_new ()
{
CheeseFileUtil *fileutil;
- fileutil = g_object_new (CHEESE_TYPE_FILEUTIL, NULL);
+ fileutil = g_object_new (CHEESE_TYPE_FILEUTIL, NULL);
return fileutil;
}
Modified: trunk/src/cheese-fileutil.h
==============================================================================
--- trunk/src/cheese-fileutil.h (original)
+++ trunk/src/cheese-fileutil.h Sat Aug 23 17:07:43 2008
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
- * Copyright (C) 2008 Felix Kaser <f kaser gmx net>
- *
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2008 Felix Kaser <f kaser gmx net>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -29,14 +29,14 @@
#include <glib-object.h>
-#define CHEESE_TYPE_FILEUTIL (cheese_fileutil_get_type ())
+#define CHEESE_TYPE_FILEUTIL (cheese_fileutil_get_type ())
#define CHEESE_FILEUTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_FILEUTIL, CheeseFileUtil))
-#define CHEESE_FILEUTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_FILEUTIL, CheeseFileUtilClass))
+#define CHEESE_FILEUTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_FILEUTIL, CheeseFileUtilClass))
#define CHEESE_IS_FILEUTIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_FILEUTIL))
-#define CHEESE_IS_FILEUTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_FILEUTIL))
-#define CHEESE_FILEUTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_FILEUTIL, CheeseFileUtilClass))
+#define CHEESE_IS_FILEUTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_FILEUTIL))
+#define CHEESE_FILEUTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_FILEUTIL, CheeseFileUtilClass))
-typedef struct
+typedef struct
{
GObject parent;
} CheeseFileUtil;
@@ -53,8 +53,9 @@
} CheeseMediaMode;
-GType cheese_fileutil_get_type (void);
-CheeseFileUtil *cheese_fileutil_new (void);
+GType cheese_fileutil_get_type (void);
+CheeseFileUtil *cheese_fileutil_new (void);
+
gchar *cheese_fileutil_get_video_path (CheeseFileUtil *fileutil);
gchar *cheese_fileutil_get_photo_path (CheeseFileUtil *fileutil);
gchar *cheese_fileutil_get_log_path (CheeseFileUtil *fileutil);
@@ -63,4 +64,3 @@
G_END_DECLS
#endif /* __CHEESE_FILEUTIL_H__ */
-
Modified: trunk/src/cheese-flash.c
==============================================================================
--- trunk/src/cheese-flash.c (original)
+++ trunk/src/cheese-flash.c Sat Aug 23 17:07:43 2008
@@ -1,7 +1,7 @@
/*
* Copyright  2008 Alexander âweejâ Jones <alex weej com>
* Copyright  2008 Thomas Perl <thp perli net>
- *
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* This is a "flash" object that you can create and invoke a method "flash" on to
- flood the screen with white temporarily */
+/* This is a "flash" object that you can create and invoke a method "flash" on to
+ * flood the screen with white temporarily */
#include <gtk/gtk.h>
@@ -44,7 +44,7 @@
typedef struct
{
- GtkWindow* window;
+ GtkWindow *window;
guint flash_timeout_tag;
guint fade_timeout_tag;
} CheeseFlashPrivate;
@@ -66,27 +66,28 @@
static void
cheese_flash_init (CheeseFlash *self)
{
- CheeseFlashPrivate* priv = CHEESE_FLASH_GET_PRIVATE (self);
- GtkWindow* window;
+ CheeseFlashPrivate *priv = CHEESE_FLASH_GET_PRIVATE (self);
+
+ GtkWindow *window;
priv->flash_timeout_tag = 0;
- priv->fade_timeout_tag = 0;
+ priv->fade_timeout_tag = 0;
window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
/* make it so it doesn't look like a window on the desktop (+fullscreen) */
- gtk_window_set_decorated (window, FALSE);
+ gtk_window_set_decorated (window, FALSE);
gtk_window_set_skip_taskbar_hint (window, TRUE);
gtk_window_set_skip_pager_hint (window, TRUE);
gtk_window_fullscreen (window);
gtk_window_set_keep_above (window, TRUE);
-
+
/* Don't take focus */
gtk_window_set_accept_focus (window, FALSE);
/* Don't consume input */
gtk_widget_realize (GTK_WIDGET (window));
- GdkRegion* input_region;
+ GdkRegion *input_region;
input_region = gdk_region_new ();
gdk_window_input_shape_combine_region (GTK_WIDGET (window)->window, input_region, 0, 0);
gdk_region_destroy (input_region);
@@ -98,7 +99,8 @@
static void
cheese_flash_dispose (GObject *object)
{
- CheeseFlashPrivate* priv = CHEESE_FLASH_GET_PRIVATE (object);
+ CheeseFlashPrivate *priv = CHEESE_FLASH_GET_PRIVATE (object);
+
g_object_unref (priv->window);
if (G_OBJECT_CLASS (cheese_flash_parent_class)->dispose)
@@ -115,26 +117,26 @@
static void
cheese_flash_class_init (CheeseFlashClass *klass)
{
- GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (CheeseFlashPrivate));
- object_class->dispose = cheese_flash_dispose;
+ object_class->dispose = cheese_flash_dispose;
object_class->finalize = cheese_flash_finalize;
}
static gboolean
cheese_flash_opacity_fade (gpointer data)
{
- CheeseFlash* flash = data;
- CheeseFlashPrivate* flash_priv = CHEESE_FLASH_GET_PRIVATE (flash);
- GtkWindow* flash_window = flash_priv->window;
- double opacity = gtk_window_get_opacity (flash_window);
+ CheeseFlash *flash = data;
+ CheeseFlashPrivate *flash_priv = CHEESE_FLASH_GET_PRIVATE (flash);
+ GtkWindow *flash_window = flash_priv->window;
+ double opacity = gtk_window_get_opacity (flash_window);
/* exponentially decrease */
gtk_window_set_opacity (flash_window, opacity * FLASH_FADE_FACTOR);
-
- if (opacity <= FLASH_LOW_THRESHOLD)
+
+ if (opacity <= FLASH_LOW_THRESHOLD)
{
/* the flasher has finished when we reach the quit value */
gtk_widget_hide (GTK_WIDGET (flash_window));
@@ -147,12 +149,12 @@
static gboolean
cheese_flash_start_fade (gpointer data)
{
- CheeseFlash* flash = data;
- CheeseFlashPrivate* flash_priv = CHEESE_FLASH_GET_PRIVATE (flash);
- GtkWindow* flash_window = flash_priv->window;
-
+ CheeseFlashPrivate *flash_priv = CHEESE_FLASH_GET_PRIVATE (CHEESE_FLASH (data));
+
+ GtkWindow *flash_window = flash_priv->window;
+
/* If the screen is non-composited, just hide and finish up */
- if (!gdk_screen_is_composited (gtk_window_get_screen (flash_window)))
+ if (!gdk_screen_is_composited (gtk_window_get_screen (flash_window)))
{
gtk_widget_hide (GTK_WIDGET (flash_window));
return FALSE;
@@ -163,10 +165,11 @@
}
void
-cheese_flash_fire (CheeseFlash* flash)
+cheese_flash_fire (CheeseFlash *flash)
{
- CheeseFlashPrivate* flash_priv = CHEESE_FLASH_GET_PRIVATE (flash);
- GtkWindow* flash_window = flash_priv->window;
+ CheeseFlashPrivate *flash_priv = CHEESE_FLASH_GET_PRIVATE (flash);
+
+ GtkWindow *flash_window = flash_priv->window;
if (flash_priv->flash_timeout_tag > 0)
g_source_remove (flash_priv->flash_timeout_tag);
@@ -175,12 +178,11 @@
gtk_window_set_opacity (flash_window, 1);
gtk_widget_show_all (GTK_WIDGET (flash_window));
- flash_priv->flash_timeout_tag = g_timeout_add (FLASH_DURATION, cheese_flash_start_fade, (gpointer)flash);
+ flash_priv->flash_timeout_tag = g_timeout_add (FLASH_DURATION, cheese_flash_start_fade, (gpointer) flash);
}
-CheeseFlash*
+CheeseFlash *
cheese_flash_new (void)
{
return g_object_new (CHEESE_TYPE_FLASH, NULL);
}
-
Modified: trunk/src/cheese-flash.h
==============================================================================
--- trunk/src/cheese-flash.h (original)
+++ trunk/src/cheese-flash.h Sat Aug 23 17:07:43 2008
@@ -1,6 +1,6 @@
/*
* Copyright  2008 Alexander âweejâ Jones <alex weej com>
- *
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -24,26 +24,27 @@
G_BEGIN_DECLS
-#define CHEESE_TYPE_FLASH (cheese_flash_get_type ())
-#define CHEESE_FLASH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_FLASH, CheeseFlash))
-#define CHEESE_FLASH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_FLASH, CheeseFlashClass))
-#define CHEESE_IS_FLASH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_FLASH))
-#define CHEESE_IS_FLASH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_FLASH))
-#define CHEESE_FLASH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_FLASH, CheeseFlashClass))
+#define CHEESE_TYPE_FLASH (cheese_flash_get_type ())
+#define CHEESE_FLASH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_FLASH, CheeseFlash))
+#define CHEESE_FLASH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_FLASH, CheeseFlashClass))
+#define CHEESE_IS_FLASH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_FLASH))
+#define CHEESE_IS_FLASH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_FLASH))
+#define CHEESE_FLASH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_FLASH, CheeseFlashClass))
typedef struct
{
GObjectClass parent_class;
} CheeseFlashClass;
-typedef struct
+typedef struct
{
GObject parent_instance;
} CheeseFlash;
-GType cheese_flash_get_type (void) G_GNUC_CONST;
-void cheese_flash_fire (CheeseFlash* flash);
-CheeseFlash* cheese_flash_new (void);
+GType cheese_flash_get_type (void) G_GNUC_CONST;
+CheeseFlash *cheese_flash_new (void);
+
+void cheese_flash_fire (CheeseFlash *flash);
G_END_DECLS
Modified: trunk/src/cheese-gconf.c
==============================================================================
--- trunk/src/cheese-gconf.c (original)
+++ trunk/src/cheese-gconf.c Sat Aug 23 17:07:43 2008
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -18,7 +18,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <cheese-config.h>
+ #include <cheese-config.h>
#endif
#include <glib.h>
@@ -29,17 +29,16 @@
#include "cheese-gconf.h"
-#define CHEESE_GCONF_PREFIX "/apps/cheese"
+#define CHEESE_GCONF_PREFIX "/apps/cheese"
G_DEFINE_TYPE (CheeseGConf, cheese_gconf, G_TYPE_OBJECT)
#define CHEESE_GCONF_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_GCONF, CheeseGConfPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_GCONF, CheeseGConfPrivate))
typedef struct
{
GConfClient *client;
-
} CheeseGConfPrivate;
static void
@@ -47,13 +46,14 @@
GParamSpec *pspec)
{
CheeseGConf *self;
+
self = CHEESE_GCONF (object);
CheeseGConfPrivate *priv = CHEESE_GCONF_GET_PRIVATE (self);
- char *effects;
+ char *effects;
GSList *list, *tmp;
- switch (prop_id)
+ switch (prop_id)
{
case GCONF_PROP_COUNTDOWN:
g_value_set_boolean (value, gconf_client_get_bool (priv->client,
@@ -67,26 +67,26 @@
break;
case GCONF_PROP_SELECTED_EFFECTS:
effects = NULL;
- list = gconf_client_get_list (priv->client,
- CHEESE_GCONF_PREFIX "/selected_effects",
- GCONF_VALUE_STRING,
- NULL);
+ list = gconf_client_get_list (priv->client,
+ CHEESE_GCONF_PREFIX "/selected_effects",
+ GCONF_VALUE_STRING,
+ NULL);
tmp = list;
while (tmp != NULL)
{
char *str = tmp->data;
- int j;
+ int j;
str[0] = g_ascii_toupper (str[0]);
for (j = 1; j < g_utf8_strlen (str, -1); j++)
{
if (str[j] == '-')
{
- str[j] = ' ';
+ str[j] = ' ';
str[j + 1] = g_ascii_toupper (str[j + 1]);
}
else if (str[j] == '_')
{
- str[j] = '/';
+ str[j] = '/';
str[j + 1] = g_ascii_toupper (str[j + 1]);
}
}
@@ -114,19 +114,19 @@
break;
case GCONF_PROP_VIDEO_PATH:
g_value_set_string (value, gconf_client_get_string (priv->client,
- CHEESE_GCONF_PREFIX "/video_path",
- NULL));
+ CHEESE_GCONF_PREFIX "/video_path",
+ NULL));
break;
case GCONF_PROP_PHOTO_PATH:
g_value_set_string (value, gconf_client_get_string (priv->client,
- CHEESE_GCONF_PREFIX "/photo_path",
- NULL));
+ CHEESE_GCONF_PREFIX "/photo_path",
+ NULL));
break;
case GCONF_PROP_ENABLE_DELETE:
g_value_set_boolean (value, gconf_client_get_bool (priv->client,
- CHEESE_GCONF_PREFIX "/enable_delete",
- NULL));
- break;
+ CHEESE_GCONF_PREFIX "/enable_delete",
+ NULL));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -138,14 +138,15 @@
GParamSpec *pspec)
{
CheeseGConf *self;
+
self = CHEESE_GCONF (object);
CheeseGConfPrivate *priv = CHEESE_GCONF_GET_PRIVATE (self);
gchar **effects = NULL;
- GSList *list = NULL;
- int i;
+ GSList *list = NULL;
+ int i;
- switch (prop_id)
+ switch (prop_id)
{
case GCONF_PROP_COUNTDOWN:
gconf_client_set_bool (priv->client,
@@ -168,7 +169,7 @@
else
{
char *str = g_value_dup_string (value);
- int j;
+ int j;
for (j = 0; j < g_utf8_strlen (str, -1); j++)
{
if (g_ascii_isupper (str[j]))
@@ -192,10 +193,10 @@
g_free (str);
}
gconf_client_set_list (priv->client,
- CHEESE_GCONF_PREFIX "/selected_effects",
- GCONF_VALUE_STRING,
- list,
- NULL);
+ CHEESE_GCONF_PREFIX "/selected_effects",
+ GCONF_VALUE_STRING,
+ list,
+ NULL);
g_slist_free (list);
g_strfreev (effects);
break;
@@ -213,21 +214,21 @@
break;
case GCONF_PROP_VIDEO_PATH:
gconf_client_set_string (priv->client,
- CHEESE_GCONF_PREFIX "/video_path",
- g_value_get_string (value),
- NULL);
+ CHEESE_GCONF_PREFIX "/video_path",
+ g_value_get_string (value),
+ NULL);
break;
case GCONF_PROP_PHOTO_PATH:
gconf_client_set_string (priv->client,
- CHEESE_GCONF_PREFIX "/photo_path",
- g_value_get_string (value),
- NULL);
+ CHEESE_GCONF_PREFIX "/photo_path",
+ g_value_get_string (value),
+ NULL);
break;
case GCONF_PROP_ENABLE_DELETE:
gconf_client_set_bool (priv->client,
- CHEESE_GCONF_PREFIX "/enable_delete",
- g_value_get_boolean (value),
- NULL);
+ CHEESE_GCONF_PREFIX "/enable_delete",
+ g_value_get_boolean (value),
+ NULL);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -241,7 +242,7 @@
CheeseGConf *gconf;
gconf = CHEESE_GCONF (object);
- CheeseGConfPrivate *priv = CHEESE_GCONF_GET_PRIVATE (gconf);
+ CheeseGConfPrivate *priv = CHEESE_GCONF_GET_PRIVATE (gconf);
g_object_unref (priv->client);
G_OBJECT_CLASS (cheese_gconf_parent_class)->finalize (object);
@@ -251,6 +252,7 @@
cheese_gconf_class_init (CheeseGConfClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
object_class->finalize = cheese_gconf_finalize;
object_class->get_property = cheese_gconf_get_property;
@@ -273,8 +275,8 @@
NULL,
NULL,
"",
- G_PARAM_READWRITE));
-
+ G_PARAM_READWRITE));
+
g_object_class_install_property (object_class, GCONF_PROP_X_RESOLUTION,
g_param_spec_int ("gconf_prop_x_resolution",
NULL,
@@ -283,7 +285,7 @@
G_MAXINT,
0,
G_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class, GCONF_PROP_Y_RESOLUTION,
g_param_spec_int ("gconf_prop_y_resolution",
NULL,
@@ -292,14 +294,14 @@
G_MAXINT,
0,
G_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class, GCONF_PROP_VIDEO_PATH,
g_param_spec_string ("gconf_prop_video_path",
NULL,
NULL,
"",
G_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class, GCONF_PROP_PHOTO_PATH,
g_param_spec_string ("gconf_prop_photo_path",
NULL,
@@ -309,27 +311,28 @@
g_object_class_install_property (object_class, GCONF_PROP_ENABLE_DELETE,
g_param_spec_boolean ("gconf_prop_enable_delete",
- NULL,
- NULL,
- FALSE,
- G_PARAM_READWRITE));
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
-
g_type_class_add_private (klass, sizeof (CheeseGConfPrivate));
}
static void
cheese_gconf_init (CheeseGConf *gconf)
{
- CheeseGConfPrivate* priv = CHEESE_GCONF_GET_PRIVATE (gconf);
+ CheeseGConfPrivate *priv = CHEESE_GCONF_GET_PRIVATE (gconf);
+
priv->client = gconf_client_get_default ();
}
-CheeseGConf *
+CheeseGConf *
cheese_gconf_new ()
{
CheeseGConf *gconf;
- gconf = g_object_new (CHEESE_TYPE_GCONF, NULL);
+ gconf = g_object_new (CHEESE_TYPE_GCONF, NULL);
return gconf;
}
Modified: trunk/src/cheese-gconf.h
==============================================================================
--- trunk/src/cheese-gconf.h (original)
+++ trunk/src/cheese-gconf.h Sat Aug 23 17:07:43 2008
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -22,14 +22,14 @@
G_BEGIN_DECLS
-#define CHEESE_TYPE_GCONF (cheese_gconf_get_type ())
+#define CHEESE_TYPE_GCONF (cheese_gconf_get_type ())
#define CHEESE_GCONF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_GCONF, CheeseGConf))
-#define CHEESE_GCONF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_GCONF, CheeseGConfClass))
+#define CHEESE_GCONF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_GCONF, CheeseGConfClass))
#define CHEESE_IS_GCONF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_GCONF))
-#define CHEESE_IS_GCONF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_GCONF))
-#define CHEESE_GCONF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_GCONF, CheeseGConfClass))
+#define CHEESE_IS_GCONF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_GCONF))
+#define CHEESE_GCONF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_GCONF, CheeseGConfClass))
-typedef struct
+typedef struct
{
GObject parent;
} CheeseGConf;
@@ -39,7 +39,7 @@
GObjectClass parent_class;
} CheeseGConfClass;
-enum
+enum
{
GCONF_PROP_0,
GCONF_PROP_COUNTDOWN,
@@ -50,13 +50,11 @@
GCONF_PROP_VIDEO_PATH,
GCONF_PROP_PHOTO_PATH,
GCONF_PROP_ENABLE_DELETE
-
};
GType cheese_gconf_get_type (void);
-CheeseGConf *cheese_gconf_new ();
+CheeseGConf *cheese_gconf_new ();
G_END_DECLS
#endif /* __CHEESE_GCONF_H__ */
-
Modified: trunk/src/cheese-no-camera.c
==============================================================================
--- trunk/src/cheese-no-camera.c (original)
+++ trunk/src/cheese-no-camera.c Sat Aug 23 17:07:43 2008
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2005 Paolo Maggi
- * Copyright (C) 2008 Sebastian Keller <sebastian-keller gmx de>
- * Copyright (C) 2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2005 Paolo Maggi
+ * Copyright  2008 Sebastian Keller <sebastian-keller gmx de>
+ * Copyright  2008 daniel g. siegel <dgsiegel gmail com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -38,8 +38,8 @@
GtkWidget *hbox_content;
GtkWidget *image;
GtkWidget *vbox;
- gchar *primary_markup;
- gchar *secondary_markup;
+ gchar *primary_markup;
+ gchar *secondary_markup;
GtkWidget *primary_label;
GtkWidget *secondary_label;
@@ -56,7 +56,7 @@
gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0);
primary_markup = g_strdup_printf ("<b>%s</b>", primary_text);
- primary_label = gtk_label_new (primary_markup);
+ primary_label = gtk_label_new (primary_markup);
g_free (primary_markup);
gtk_widget_show (primary_label);
gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0);
@@ -97,8 +97,8 @@
_("Please refer to the help for further information."));
gedit_message_area_add_stock_button_with_text (GEDIT_MESSAGE_AREA (message_area),
- _("Help"),
- GTK_STOCK_HELP, GTK_RESPONSE_HELP);
+ _("Help"), GTK_STOCK_HELP,
+ GTK_RESPONSE_HELP);
return message_area;
}
Modified: trunk/src/cheese-no-camera.h
==============================================================================
--- trunk/src/cheese-no-camera.h (original)
+++ trunk/src/cheese-no-camera.h Sat Aug 23 17:07:43 2008
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2008 Sebastian Keller <sebastian-keller gmx de>
- * Copyright (C) 2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2008 Sebastian Keller <sebastian-keller gmx de>
+ * Copyright  2008 daniel g. siegel <dgsiegel gmail com>
*
* Licensed under the GNU General Public License Version 2
*
Modified: trunk/src/cheese-prefs-dialog-widgets.c
==============================================================================
--- trunk/src/cheese-prefs-dialog-widgets.c (original)
+++ trunk/src/cheese-prefs-dialog-widgets.c Sat Aug 23 17:07:43 2008
@@ -1,7 +1,6 @@
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 2; tab-width: 2 -*- */
/*
- * Copyright (C) 2008 James Liggett <jrliggett cox net>
- *
+ * Copyright  2008 James Liggett <jrliggett cox net>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -20,15 +19,15 @@
#include "cheese-prefs-dialog-widgets.h"
-typedef struct
+typedef struct
{
GList *widgets;
CheeseGConf *gconf;
} CheesePrefsDialogWidgetsPrivate;
-#define CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE(o) \
+#define CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_PREFS_DIALOG_WIDGETS, \
- CheesePrefsDialogWidgetsPrivate))
+ CheesePrefsDialogWidgetsPrivate))
G_DEFINE_TYPE (CheesePrefsDialogWidgets, cheese_prefs_dialog_widgets, G_TYPE_OBJECT);
@@ -36,61 +35,61 @@
cheese_prefs_dialog_widgets_init (CheesePrefsDialogWidgets *self)
{
CheesePrefsDialogWidgetsPrivate *priv = CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE (self);
-
+
priv->widgets = NULL;
- priv->gconf = NULL;
+ priv->gconf = NULL;
}
static void
cheese_prefs_dialog_widgets_finalize (GObject *object)
-{
+{
CheesePrefsDialogWidgetsPrivate *priv = CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE (object);
+
GList *current_widget;
-
+
current_widget = priv->widgets;
-
+
while (current_widget)
{
g_object_unref (current_widget->data);
current_widget = g_list_next (current_widget);
}
-
+
g_list_free (priv->widgets);
-
+
G_OBJECT_CLASS (cheese_prefs_dialog_widgets_parent_class)->finalize (object);
}
static void
cheese_prefs_dialog_widgets_class_init (CheesePrefsDialogWidgetsClass *klass)
{
- GObjectClass* object_class = G_OBJECT_CLASS (klass);
-
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
g_type_class_add_private (klass, sizeof (CheesePrefsDialogWidgetsPrivate));
-
+
object_class->finalize = cheese_prefs_dialog_widgets_finalize;
}
-
CheesePrefsDialogWidgets *
cheese_prefs_dialog_widgets_new (CheeseGConf *gconf)
{
- CheesePrefsDialogWidgets *self;
+ CheesePrefsDialogWidgets *self;
CheesePrefsDialogWidgetsPrivate *priv;
-
+
self = g_object_new (CHEESE_TYPE_PREFS_DIALOG_WIDGETS, NULL);
-
- priv = CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE (self);
+
+ priv = CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE (self);
priv->gconf = gconf;
-
+
return self;
}
void
-cheese_prefs_dialog_widgets_add (CheesePrefsDialogWidgets *prefs_widgets,
- CheesePrefsWidget *widget)
+cheese_prefs_dialog_widgets_add (CheesePrefsDialogWidgets *prefs_widgets,
+ CheesePrefsWidget *widget)
{
CheesePrefsDialogWidgetsPrivate *priv = CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE (prefs_widgets);
-
+
if (!g_list_find (priv->widgets, widget))
{
priv->widgets = g_list_append (priv->widgets, widget);
@@ -102,11 +101,11 @@
cheese_prefs_dialog_widgets_synchronize (CheesePrefsDialogWidgets *prefs_widgets)
{
CheesePrefsDialogWidgetsPrivate *priv = CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE (prefs_widgets);
-
+
GList *current_widget;
-
+
current_widget = priv->widgets;
-
+
while (current_widget)
{
cheese_prefs_widget_synchronize (CHEESE_PREFS_WIDGET (current_widget->data));
Modified: trunk/src/cheese-prefs-dialog-widgets.h
==============================================================================
--- trunk/src/cheese-prefs-dialog-widgets.h (original)
+++ trunk/src/cheese-prefs-dialog-widgets.h Sat Aug 23 17:07:43 2008
@@ -1,7 +1,6 @@
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 2; tab-width: 2 -*- */
/*
- * Copyright (C) 2008 James Liggett <jrliggett cox net>
- *
+ * Copyright  2008 James Liggett <jrliggett cox net>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -26,12 +25,17 @@
G_BEGIN_DECLS
-#define CHEESE_TYPE_PREFS_DIALOG_WIDGETS (cheese_prefs_dialog_widgets_get_type ())
-#define CHEESE_PREFS_DIALOG_WIDGETS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_PREFS_DIALOG_WIDGETS, CheesePrefsDialogWidgets))
-#define CHEESE_PREFS_DIALOG_WIDGETS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_PREFS_DIALOG_WIDGETS, CheesePrefsDialogWidgetsClass))
-#define CHEESE_IS_PREFS_DIALOG_WIDGETS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_PREFS_DIALOG_WIDGETS))
-#define CHEESE_IS_PREFS_DIALOG_WIDGETS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_PREFS_DIALOG_WIDGETS))
-#define CHEESE_PREFS_DIALOG_WIDGETS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_PREFS_DIALOG_WIDGETS, CheesePrefsDialogWidgetsClass))
+#define CHEESE_TYPE_PREFS_DIALOG_WIDGETS (cheese_prefs_dialog_widgets_get_type ())
+#define CHEESE_PREFS_DIALOG_WIDGETS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ CHEESE_TYPE_PREFS_DIALOG_WIDGETS, \
+ CheesePrefsDialogWidgets))
+#define CHEESE_PREFS_DIALOG_WIDGETS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_PREFS_DIALOG_WIDGETS, \
+ CheesePrefsDialogWidgetsClass))
+#define CHEESE_IS_PREFS_DIALOG_WIDGETS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ CHEESE_TYPE_PREFS_DIALOG_WIDGETS))
+#define CHEESE_IS_PREFS_DIALOG_WIDGETS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_PREFS_DIALOG_WIDGETS))
+#define CHEESE_PREFS_DIALOG_WIDGETS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_PREFS_DIALOG_WIDGETS, \
+ CheesePrefsDialogWidgetsClass))
typedef struct _CheesePrefsDialogWidgetsClass CheesePrefsDialogWidgetsClass;
typedef struct _CheesePrefsDialogWidgets CheesePrefsDialogWidgets;
@@ -46,10 +50,11 @@
GObject parent_instance;
};
-GType cheese_prefs_dialog_widgets_get_type (void) G_GNUC_CONST;
+GType cheese_prefs_dialog_widgets_get_type (void) G_GNUC_CONST;
CheesePrefsDialogWidgets *cheese_prefs_dialog_widgets_new (CheeseGConf *gconf);
-void cheese_prefs_dialog_widgets_add (CheesePrefsDialogWidgets *prefs_widgets,
- CheesePrefsWidget *widget);
+
+void cheese_prefs_dialog_widgets_add (CheesePrefsDialogWidgets *prefs_widgets,
+ CheesePrefsWidget *widget);
void cheese_prefs_dialog_widgets_synchronize (CheesePrefsDialogWidgets *prefs_widgets);
G_END_DECLS
Modified: trunk/src/cheese-prefs-dialog.c
==============================================================================
--- trunk/src/cheese-prefs-dialog.c (original)
+++ trunk/src/cheese-prefs-dialog.c Sat Aug 23 17:07:43 2008
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2008 James Liggett <jrliggett cox net>
- * Copyright (C) 2008 daniel g. siegel <dgsiegel gmail com>
- *
+ * Copyright  2008 James Liggett <jrliggett cox net>
+ * Copyright  2008 daniel g. siegel <dgsiegel gmail com>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -25,10 +25,10 @@
GtkWidget *cheese_prefs_dialog;
GtkWidget *resolution_combo_box;
GtkWidget *webcam_combo_box;
-
+
GtkWidget *parent;
CheeseWebcam *webcam;
-
+
CheesePrefsDialogWidgets *widgets;
} CheesePrefsDialog;
@@ -36,21 +36,21 @@
cheese_prefs_dialog_create_dialog (CheesePrefsDialog *prefs_dialog)
{
GtkBuilder *builder;
- GError *error;
-
- error = NULL;
+ GError *error;
+
+ error = NULL;
builder = gtk_builder_new ();
- gtk_builder_add_from_file (builder, PACKAGE_DATADIR"/cheese-prefs.ui", &error);
+ gtk_builder_add_from_file (builder, PACKAGE_DATADIR "/cheese-prefs.ui", &error);
if (error)
{
- g_error ("building ui from %s failed: %s", PACKAGE_DATADIR"/cheese-prefs.ui", error->message);
+ g_error ("building ui from %s failed: %s", PACKAGE_DATADIR "/cheese-prefs.ui", error->message);
g_clear_error (&error);
}
-
- prefs_dialog->cheese_prefs_dialog = GTK_WIDGET (gtk_builder_get_object (builder,
+
+ prefs_dialog->cheese_prefs_dialog = GTK_WIDGET (gtk_builder_get_object (builder,
"cheese_prefs_dialog"));
- prefs_dialog->resolution_combo_box = GTK_WIDGET (gtk_builder_get_object (builder,
+ prefs_dialog->resolution_combo_box = GTK_WIDGET (gtk_builder_get_object (builder,
"resolution_combo_box"));
prefs_dialog->webcam_combo_box = GTK_WIDGET (gtk_builder_get_object (builder,
"webcam_combo_box"));
@@ -61,15 +61,15 @@
static void
cheese_prefs_dialog_on_resolution_changed (CheesePrefsWidget *widget, gpointer user_data)
{
- CheeseWebcam *webcam;
+ CheeseWebcam *webcam;
CheeseVideoFormat *current_format;
CheeseVideoFormat *new_format;
-
+
g_object_get (widget, "webcam", &webcam, NULL);
-
+
current_format = cheese_webcam_get_current_video_format (webcam);
- new_format = cheese_prefs_resolution_combo_get_selected_format (CHEESE_PREFS_RESOLUTION_COMBO (widget));
-
+ new_format = cheese_prefs_resolution_combo_get_selected_format (CHEESE_PREFS_RESOLUTION_COMBO (widget));
+
if (new_format != current_format)
cheese_webcam_set_video_format (webcam, new_format);
}
@@ -78,8 +78,8 @@
cheese_prefs_dialog_on_device_changed (CheesePrefsWidget *widget, CheesePrefsDialog *prefs_dialog)
{
CheeseWebcam *webcam;
- char *new_device_name;
- char *old_device_name;
+ char *new_device_name;
+ char *old_device_name;
g_object_get (widget, "webcam", &webcam, NULL);
g_object_get (webcam, "device_name", &old_device_name, NULL);
@@ -90,6 +90,7 @@
if (!cheese_webcam_switch_webcam_device (webcam))
{
g_warning ("Couldn't change webcam device.");
+
/* Revert to default device */
g_object_set (webcam, "device_name", old_device_name, NULL);
}
@@ -102,7 +103,7 @@
{
CheesePrefsWidget *resolution_widget;
CheesePrefsWidget *webcam_widget;
-
+
resolution_widget = CHEESE_PREFS_WIDGET (cheese_prefs_resolution_combo_new (prefs_dialog->resolution_combo_box,
prefs_dialog->webcam,
"gconf_prop_x_resolution",
@@ -128,9 +129,9 @@
cheese_prefs_dialog_destroy_dialog (CheesePrefsDialog *prefs_dialog)
{
gtk_widget_destroy (prefs_dialog->cheese_prefs_dialog);
-
+
g_object_unref (prefs_dialog->widgets);
-
+
g_free (prefs_dialog);
}
@@ -138,17 +139,17 @@
cheese_prefs_dialog_run (GtkWidget *parent, CheeseGConf *gconf, CheeseWebcam *webcam)
{
CheesePrefsDialog *prefs_dialog;
-
+
prefs_dialog = g_new0 (CheesePrefsDialog, 1);
-
- prefs_dialog->parent = parent;
- prefs_dialog->webcam = webcam;
+
+ prefs_dialog->parent = parent;
+ prefs_dialog->webcam = webcam;
prefs_dialog->widgets = cheese_prefs_dialog_widgets_new (gconf);
-
+
cheese_prefs_dialog_create_dialog (prefs_dialog);
cheese_prefs_dialog_setup_widgets (prefs_dialog);
-
+
gtk_dialog_run (GTK_DIALOG (prefs_dialog->cheese_prefs_dialog));
-
+
cheese_prefs_dialog_destroy_dialog (prefs_dialog);
}
Modified: trunk/src/cheese-prefs-dialog.h
==============================================================================
--- trunk/src/cheese-prefs-dialog.h (original)
+++ trunk/src/cheese-prefs-dialog.h Sat Aug 23 17:07:43 2008
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2008 James Liggett <jrliggett cox net>
- *
+ * Copyright  2008 James Liggett <jrliggett cox net>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
#define _CHEESE_PREFS_DIALOG_H_
#ifdef HAVE_CONFIG_H
-#include "cheese-config.h"
+ #include "cheese-config.h"
#endif
#include "cheese-webcam.h"
Modified: trunk/src/cheese-prefs-resolution-combo.c
==============================================================================
--- trunk/src/cheese-prefs-resolution-combo.c (original)
+++ trunk/src/cheese-prefs-resolution-combo.c Sat Aug 23 17:07:43 2008
@@ -1,7 +1,6 @@
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 2; tab-width: 2 -*- */
/*
- * Copyright (C) 2008 James Liggett <jrliggett cox net>
- *
+ * Copyright  2008 James Liggett <jrliggett cox net>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -33,14 +32,14 @@
* sets webcam on construction. */
} CheesePrefsResolutionComboPrivate;
-#define CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE(o) \
+#define CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_PREFS_RESOLUTION_COMBO, \
- CheesePrefsResolutionComboPrivate))
+ CheesePrefsResolutionComboPrivate))
enum
{
PROP_0,
-
+
PROP_X_RESOLUTION_KEY,
PROP_Y_RESOLUTION_KEY,
PROP_MAX_X_RESOLUTION,
@@ -61,132 +60,132 @@
cheese_prefs_resolution_combo_init (CheesePrefsResolutionCombo *self)
{
CheesePrefsResolutionComboPrivate *priv = CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE (self);
-
- priv->x_resolution_key = NULL;
- priv->y_resolution_key = NULL;
- priv->max_x_resolution = G_MAXUINT;
- priv->max_y_resolution = G_MAXUINT;
- priv->list_store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_POINTER);
- priv->webcam = NULL;
- priv->selected_format = NULL;
+
+ priv->x_resolution_key = NULL;
+ priv->y_resolution_key = NULL;
+ priv->max_x_resolution = G_MAXUINT;
+ priv->max_y_resolution = G_MAXUINT;
+ priv->list_store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_POINTER);
+ priv->webcam = NULL;
+ priv->selected_format = NULL;
priv->has_been_synchronized = FALSE;
}
static void
cheese_prefs_resolution_combo_finalize (GObject *object)
{
- CheesePrefsResolutionCombo *self = CHEESE_PREFS_RESOLUTION_COMBO (object);
+ CheesePrefsResolutionCombo *self = CHEESE_PREFS_RESOLUTION_COMBO (object);
CheesePrefsResolutionComboPrivate *priv = CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE (self);
-
+
g_free (priv->x_resolution_key);
g_free (priv->y_resolution_key);
g_object_unref (priv->list_store);
-
+
G_OBJECT_CLASS (cheese_prefs_resolution_combo_parent_class)->finalize (object);
}
static void
-combo_selection_changed (GtkComboBox *combo_box,
+combo_selection_changed (GtkComboBox *combo_box,
CheesePrefsResolutionCombo *self)
{
- CheesePrefsResolutionComboPrivate *priv = CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE (self);
- GtkTreeIter iter;
+ CheesePrefsResolutionComboPrivate *priv = CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE (self);
+
+ GtkTreeIter iter;
CheeseVideoFormat *format;
-
+
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &iter);
- gtk_tree_model_get (GTK_TREE_MODEL (priv->list_store), &iter, COL_FORMAT,
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->list_store), &iter, COL_FORMAT,
&format, -1);
-
+
g_object_set (CHEESE_PREFS_WIDGET (self)->gconf, priv->x_resolution_key,
format->width, priv->y_resolution_key, format->height, NULL);
-
+
priv->selected_format = format;
-
+
cheese_prefs_widget_notify_changed (CHEESE_PREFS_WIDGET (self));
}
static void
cheese_prefs_resolution_combo_synchronize (CheesePrefsWidget *prefs_widget)
{
- CheesePrefsResolutionCombo *self = CHEESE_PREFS_RESOLUTION_COMBO (prefs_widget);
- CheesePrefsResolutionComboPrivate *priv = CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE (self);
- GtkWidget *combo_box;
+ CheesePrefsResolutionCombo *self = CHEESE_PREFS_RESOLUTION_COMBO (prefs_widget);
+ CheesePrefsResolutionComboPrivate *priv = CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE (self);
+
+ GtkWidget *combo_box;
CheeseVideoFormat *current_format;
- GArray *formats;
- int i;
+ GArray *formats;
+ int i;
CheeseVideoFormat *format;
- gchar *format_name;
- GtkTreeIter iter;
- GtkTreeIter active_iter;
- gboolean found_resolution;
-
+ gchar *format_name;
+ GtkTreeIter iter;
+ GtkTreeIter active_iter;
+ gboolean found_resolution;
+
priv->has_been_synchronized = TRUE;
- found_resolution = FALSE;
-
+ found_resolution = FALSE;
+
/* Don't generate spurious changed events when we set the active resolution */
g_object_get (prefs_widget, "widget", &combo_box, NULL);
- g_signal_handlers_disconnect_by_func (combo_box, combo_selection_changed,
+ g_signal_handlers_disconnect_by_func (combo_box, combo_selection_changed,
prefs_widget);
-
+
g_object_ref (priv->list_store);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), NULL);
-
+
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), NULL);
current_format = cheese_webcam_get_current_video_format (priv->webcam);
-
+
gtk_list_store_clear (priv->list_store);
formats = cheese_webcam_get_video_formats (priv->webcam);
-
+
for (i = 0; i < formats->len; i++)
{
- format = &g_array_index (formats, CheeseVideoFormat, i);
+ format = &g_array_index (formats, CheeseVideoFormat, i);
format_name = g_strdup_printf ("%i x %i", format->width, format->height);
-
-
- if (format->width <= priv->max_x_resolution &&
+
+
+ if (format->width <= priv->max_x_resolution &&
format->height <= priv->max_y_resolution)
{
gtk_list_store_append (priv->list_store, &iter);
- gtk_list_store_set (priv->list_store, &iter,
+ gtk_list_store_set (priv->list_store, &iter,
COL_NAME, format_name,
- COL_FORMAT, format,
+ COL_FORMAT, format,
-1);
-
+
g_free (format_name);
-
+
if (format == current_format)
{
- active_iter = iter;
+ active_iter = iter;
found_resolution = TRUE;
}
-
}
}
-
- gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box),
+
+ gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box),
GTK_TREE_MODEL (priv->list_store));
g_object_unref (priv->list_store);
-
+
if (found_resolution)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &active_iter);
else
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
-
+
g_signal_connect (G_OBJECT (combo_box), "changed",
G_CALLBACK (combo_selection_changed),
self);
-
}
static void
-cheese_prefs_resolution_combo_set_property (GObject *object, guint prop_id,
- const GValue *value,
+cheese_prefs_resolution_combo_set_property (GObject *object, guint prop_id,
+ const GValue *value,
GParamSpec *pspec)
{
CheesePrefsResolutionComboPrivate *priv = CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE (object);
-
+
g_return_if_fail (CHEESE_IS_PREFS_RESOLUTION_COMBO (object));
-
+
switch (prop_id)
{
case PROP_X_RESOLUTION_KEY:
@@ -203,14 +202,14 @@
break;
case PROP_WEBCAM:
priv->webcam = CHEESE_WEBCAM (g_value_get_object (value));
-
+
/* If the webcam changes the resolutions change too. But only change the
* data if we've been synchronized once already. If this property is set
* on construction, we would synchronize twice--once when the property is
* set, and again when the dialog syncs when it's created. */
if (priv->has_been_synchronized)
cheese_prefs_resolution_combo_synchronize (CHEESE_PREFS_WIDGET (object));
-
+
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -219,13 +218,13 @@
}
static void
-cheese_prefs_resolution_combo_get_property (GObject *object, guint prop_id,
+cheese_prefs_resolution_combo_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
CheesePrefsResolutionComboPrivate *priv = CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE (object);
-
+
g_return_if_fail (CHEESE_IS_PREFS_RESOLUTION_COMBO (object));
-
+
switch (prop_id)
{
case PROP_X_RESOLUTION_KEY:
@@ -252,16 +251,16 @@
static void
cheese_prefs_resolution_combo_class_init (CheesePrefsResolutionComboClass *klass)
{
- GObjectClass* object_class = G_OBJECT_CLASS (klass);
- CheesePrefsWidgetClass* parent_class = CHEESE_PREFS_WIDGET_CLASS (klass);
-
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ CheesePrefsWidgetClass *parent_class = CHEESE_PREFS_WIDGET_CLASS (klass);
+
g_type_class_add_private (klass, sizeof (CheesePrefsResolutionComboPrivate));
-
- object_class->finalize = cheese_prefs_resolution_combo_finalize;
+
+ object_class->finalize = cheese_prefs_resolution_combo_finalize;
object_class->set_property = cheese_prefs_resolution_combo_set_property;
object_class->get_property = cheese_prefs_resolution_combo_get_property;
- parent_class->synchronize = cheese_prefs_resolution_combo_synchronize;
-
+ parent_class->synchronize = cheese_prefs_resolution_combo_synchronize;
+
g_object_class_install_property (object_class,
PROP_X_RESOLUTION_KEY,
g_param_spec_string ("x_resolution_key",
@@ -269,7 +268,7 @@
"GConf key for X resolution",
"",
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-
+
g_object_class_install_property (object_class,
PROP_Y_RESOLUTION_KEY,
g_param_spec_string ("y_resolution_key",
@@ -277,28 +276,28 @@
"GConf key for Y resolution",
"",
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-
+
g_object_class_install_property (object_class,
PROP_MAX_X_RESOLUTION,
g_param_spec_uint ("max_x_resolution",
"",
"Maximum supported X resolution",
- 0,
- G_MAXUINT,
+ 0,
+ G_MAXUINT,
G_MAXUINT,
G_PARAM_READABLE | G_PARAM_WRITABLE));
-
+
g_object_class_install_property (object_class,
PROP_MAX_Y_RESOLUTION,
g_param_spec_uint ("max_y_resolution",
"",
"Maximum supported Y resolution",
- 0,
- G_MAXUINT,
+ 0,
+ G_MAXUINT,
G_MAXUINT,
G_PARAM_READABLE | G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class,
+
+ g_object_class_install_property (object_class,
PROP_WEBCAM,
g_param_spec_object ("webcam",
"",
@@ -308,51 +307,48 @@
}
CheesePrefsResolutionCombo *
-cheese_prefs_resolution_combo_new (GtkWidget *combo_box, CheeseWebcam *webcam,
- const gchar *x_resolution_key,
+cheese_prefs_resolution_combo_new (GtkWidget *combo_box, CheeseWebcam *webcam,
+ const gchar *x_resolution_key,
const gchar *y_resolution_key,
unsigned int max_x_resolution,
unsigned int max_y_resolution)
{
- CheesePrefsResolutionCombo *self;
- GtkCellRenderer *renderer;
- CheesePrefsResolutionComboPrivate *priv;
-
- self = g_object_new (CHEESE_TYPE_PREFS_RESOLUTION_COMBO,
- "widget", combo_box,
+ CheesePrefsResolutionCombo *self;
+ GtkCellRenderer *renderer;
+ CheesePrefsResolutionComboPrivate *priv;
+
+ self = g_object_new (CHEESE_TYPE_PREFS_RESOLUTION_COMBO,
+ "widget", combo_box,
"webcam", webcam,
"x_resolution_key", x_resolution_key,
"y_resolution_key", y_resolution_key,
NULL);
-
+
if (max_x_resolution > 0 &&
max_y_resolution > 0)
{
- g_object_set (self,
- "max_x_resolution", max_x_resolution,
- "max_y_resolution", max_y_resolution,
+ g_object_set (self,
+ "max_x_resolution", max_x_resolution,
+ "max_y_resolution", max_y_resolution,
NULL);
}
-
+
priv = CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE (self);
-
+
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo_box), renderer, "text",
COL_NAME);
- gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box),
+ gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box),
GTK_TREE_MODEL (priv->list_store));
-
+
return self;
-
}
CheeseVideoFormat *
cheese_prefs_resolution_combo_get_selected_format (CheesePrefsResolutionCombo *resolution_combo)
{
- CheesePrefsResolutionComboPrivate *priv = CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE (resolution_combo);
-
+ CheesePrefsResolutionComboPrivate *priv = CHEESE_PREFS_RESOLUTION_COMBO_GET_PRIVATE (resolution_combo);
+
return priv->selected_format;
}
-
-
Modified: trunk/src/cheese-prefs-resolution-combo.h
==============================================================================
--- trunk/src/cheese-prefs-resolution-combo.h (original)
+++ trunk/src/cheese-prefs-resolution-combo.h Sat Aug 23 17:07:43 2008
@@ -1,7 +1,6 @@
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 2; tab-width: 2 -*- */
/*
- * Copyright (C) 2008 James Liggett <jrliggett cox net>
- *
+ * Copyright  2008 James Liggett <jrliggett cox net>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -27,34 +26,42 @@
G_BEGIN_DECLS
-#define CHEESE_TYPE_PREFS_RESOLUTION_COMBO (cheese_prefs_resolution_combo_get_type ())
-#define CHEESE_PREFS_RESOLUTION_COMBO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_PREFS_RESOLUTION_COMBO, CheesePrefsResolutionCombo))
-#define CHEESE_PREFS_RESOLUTION_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_PREFS_RESOLUTION_COMBO, CheesePrefsResolutionComboClass))
-#define CHEESE_IS_PREFS_RESOLUTION_COMBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_PREFS_RESOLUTION_COMBO))
-#define CHEESE_IS_PREFS_RESOLUTION_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_PREFS_RESOLUTION_COMBO))
-#define CHEESE_PREFS_RESOLUTION_COMBO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_PREFS_RESOLUTION_COMBO, CheesePrefsResolutionComboClass))
+#define CHEESE_TYPE_PREFS_RESOLUTION_COMBO (cheese_prefs_resolution_combo_get_type ())
+#define CHEESE_PREFS_RESOLUTION_COMBO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ CHEESE_TYPE_PREFS_RESOLUTION_COMBO, \
+ CheesePrefsResolutionCombo))
+#define CHEESE_PREFS_RESOLUTION_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ CHEESE_TYPE_PREFS_RESOLUTION_COMBO, \
+ CheesePrefsResolutionComboClass))
+#define CHEESE_IS_PREFS_RESOLUTION_COMBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ CHEESE_TYPE_PREFS_RESOLUTION_COMBO))
+#define CHEESE_IS_PREFS_RESOLUTION_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ CHEESE_TYPE_PREFS_RESOLUTION_COMBO))
+#define CHEESE_PREFS_RESOLUTION_COMBO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ CHEESE_TYPE_PREFS_RESOLUTION_COMBO, \
+ CheesePrefsResolutionComboClass))
typedef struct _CheesePrefsResolutionComboClass CheesePrefsResolutionComboClass;
typedef struct _CheesePrefsResolutionCombo CheesePrefsResolutionCombo;
struct _CheesePrefsResolutionComboClass
{
- CheesePrefsWidgetClass parent_class;
+ CheesePrefsWidgetClass parent_class;
};
struct _CheesePrefsResolutionCombo
{
- CheesePrefsWidget parent_instance;
+ CheesePrefsWidget parent_instance;
};
-GType cheese_prefs_resolution_combo_get_type (void) G_GNUC_CONST;
-
-CheesePrefsResolutionCombo *cheese_prefs_resolution_combo_new (GtkWidget *combo_box,
+GType cheese_prefs_resolution_combo_get_type (void) G_GNUC_CONST;
+CheesePrefsResolutionCombo *cheese_prefs_resolution_combo_new (GtkWidget *combo_box,
CheeseWebcam *webcam,
- const gchar *x_resolution_key,
- const gchar *y_resolution_key,
- unsigned int max_x_resolution,
- unsigned int max_y_resolution);
+ const gchar *x_resolution_key,
+ const gchar *y_resolution_key,
+ unsigned int max_x_resolution,
+ unsigned int max_y_resolution);
+
CheeseVideoFormat *cheese_prefs_resolution_combo_get_selected_format (CheesePrefsResolutionCombo *resolution_combo);
G_END_DECLS
Modified: trunk/src/cheese-prefs-webcam-combo.c
==============================================================================
--- trunk/src/cheese-prefs-webcam-combo.c (original)
+++ trunk/src/cheese-prefs-webcam-combo.c Sat Aug 23 17:07:43 2008
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2008 James Liggett <jrliggett cox net>
- * Copyright (C) 2008 Ryan Zeigler <zeiglerr gmail com>
- * Copyright (C) 2008 daniel g. siegel <dgsiegel gmail com>
- *
+ * Copyright  2008 James Liggett <jrliggett cox net>
+ * Copyright  2008 Ryan Zeigler <zeiglerr gmail com>
+ * Copyright  2008 daniel g. siegel <dgsiegel gmail com>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -25,11 +25,11 @@
#include "cheese-webcam.h"
#include "cheese-prefs-widget.h"
#include "cheese-prefs-webcam-combo.h"
+
enum
{
PRODUCT_NAME,
DEVICE_NAME,
-
NUM_COLS
};
@@ -49,7 +49,7 @@
* sets webcam on construction. */
} CheesePrefsWebcamComboPrivate;
-#define CHEESE_PREFS_WEBCAM_COMBO_GET_PRIVATE(o) \
+#define CHEESE_PREFS_WEBCAM_COMBO_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_PREFS_WEBCAM_COMBO, \
CheesePrefsWebcamComboPrivate))
@@ -59,75 +59,78 @@
cheese_prefs_webcam_combo_init (CheesePrefsWebcamCombo *self)
{
CheesePrefsWebcamComboPrivate *priv = CHEESE_PREFS_WEBCAM_COMBO_GET_PRIVATE (self);
-
+
priv->has_been_synchronized = FALSE;
- priv->webcam = NULL;
- priv->webcam_device_key = NULL;
- priv->list_store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+ priv->webcam = NULL;
+ priv->webcam_device_key = NULL;
+ priv->list_store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
}
static void
cheese_prefs_webcam_combo_finalize (GObject *object)
{
- CheesePrefsWebcamCombo *self = CHEESE_PREFS_WEBCAM_COMBO (object);
+ CheesePrefsWebcamCombo *self = CHEESE_PREFS_WEBCAM_COMBO (object);
CheesePrefsWebcamComboPrivate *priv = CHEESE_PREFS_WEBCAM_COMBO_GET_PRIVATE (self);
-
+
g_free (priv->webcam_device_key);
g_object_unref (priv->list_store);
-
- G_OBJECT_CLASS (cheese_prefs_webcam_combo_parent_class)->finalize (object);
+
+ G_OBJECT_CLASS (cheese_prefs_webcam_combo_parent_class)->finalize (object);
}
static void
cheese_prefs_webcam_combo_selection_changed (GtkComboBox *combo_box, CheesePrefsWebcamCombo *self)
{
CheesePrefsWebcamComboPrivate *priv = CHEESE_PREFS_WEBCAM_COMBO_GET_PRIVATE (self);
+
/* Put it into gconf */
char *new_device = cheese_prefs_webcam_combo_get_selected_webcam (self);
+
g_object_set (CHEESE_PREFS_WIDGET (self)->gconf, priv->webcam_device_key, new_device, NULL);
g_free (new_device);
-
+
cheese_prefs_widget_notify_changed (CHEESE_PREFS_WIDGET (self));
}
static void
cheese_prefs_webcam_combo_synchronize (CheesePrefsWidget *prefs_widget)
{
- CheesePrefsWebcamCombo *self = CHEESE_PREFS_WEBCAM_COMBO (prefs_widget);
+ CheesePrefsWebcamCombo *self = CHEESE_PREFS_WEBCAM_COMBO (prefs_widget);
CheesePrefsWebcamComboPrivate *priv = CHEESE_PREFS_WEBCAM_COMBO_GET_PRIVATE (self);
- GtkWidget *combo_box;
- GArray *webcam_devices;
- int selected_device_ind;
- int num_devices;
+
+ GtkWidget *combo_box;
+ GArray *webcam_devices;
+ int selected_device_ind;
+ int num_devices;
CheeseWebcamDevice *selected_device;
- char *gconf_device_name;
- char *product_name;
- char *device_name;
+ char *gconf_device_name;
+ char *product_name;
+ char *device_name;
CheeseWebcamDevice *device_ptr;
- GtkTreeIter iter;
- GtkTreeIter active_iter;
- int i;
-
+ GtkTreeIter iter;
+ GtkTreeIter active_iter;
+ int i;
+
gboolean found_same_device = FALSE;
-
- g_object_get (prefs_widget, "widget", &combo_box, NULL);
+
+ g_object_get (prefs_widget, "widget", &combo_box, NULL);
+
/* Disconnect to prevent a whole bunch of changed notifications */
- g_signal_handlers_disconnect_by_func (combo_box, cheese_prefs_webcam_combo_selection_changed,
- prefs_widget);
-
+ g_signal_handlers_disconnect_by_func (combo_box, cheese_prefs_webcam_combo_selection_changed, prefs_widget);
+
g_object_ref (priv->list_store);
-
+
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), NULL);
-
- webcam_devices = cheese_webcam_get_webcam_devices (priv->webcam);
+
+ webcam_devices = cheese_webcam_get_webcam_devices (priv->webcam);
selected_device_ind = cheese_webcam_get_selected_device_index (priv->webcam);
- num_devices = cheese_webcam_get_num_webcam_devices (priv->webcam);
-
+ num_devices = cheese_webcam_get_num_webcam_devices (priv->webcam);
+
selected_device = &g_array_index (webcam_devices, CheeseWebcamDevice, selected_device_ind);
-
+
/* If the selected device is not the same device as the one in gconf, the
- selected device isn't available or was set by --hal-device. Set it now.
- Not sure if this is desired behavior */
+ * selected device isn't available or was set by --hal-device. Set it now.
+ * Not sure if this is desired behavior */
if (num_devices > 0)
{
g_object_get (prefs_widget->gconf, priv->webcam_device_key, &gconf_device_name, NULL);
@@ -138,13 +141,13 @@
g_free (gconf_device_name);
}
gtk_list_store_clear (priv->list_store);
-
+
for (i = 0; i < num_devices; i++)
{
- device_ptr = &g_array_index (webcam_devices, CheeseWebcamDevice, i);
+ device_ptr = &g_array_index (webcam_devices, CheeseWebcamDevice, i);
product_name = g_strdup_printf ("%s (%s)", device_ptr->product_name, device_ptr->video_device);
- device_name = g_strdup (device_ptr->video_device);
-
+ device_name = g_strdup (device_ptr->video_device);
+
gtk_list_store_append (priv->list_store, &iter);
gtk_list_store_set (priv->list_store, &iter, PRODUCT_NAME, product_name,
DEVICE_NAME, device_name,
@@ -153,39 +156,40 @@
g_free (device_name);
if (device_ptr == selected_device)
{
- active_iter = iter;
+ active_iter = iter;
found_same_device = TRUE;
}
}
-
+
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box),
GTK_TREE_MODEL (priv->list_store));
-
+
g_object_unref (priv->list_store);
-
+
if (found_same_device)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &active_iter);
else
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
-
+
g_signal_connect (G_OBJECT (combo_box), "changed",
G_CALLBACK (cheese_prefs_webcam_combo_selection_changed),
self);
-
- /* Set sensitive or not depending on whether or not there are webcam devices
- available */
+
+ /* Set sensitive or not depending on whether or not there are webcam devices
+ * available */
gtk_widget_set_sensitive (combo_box, num_devices > 0);
-
+
g_array_free (webcam_devices, TRUE);
}
static void
-cheese_prefs_webcam_combo_set_property (GObject *object, guint prop_id,
- const GValue *value,
+cheese_prefs_webcam_combo_set_property (GObject *object, guint prop_id,
+ const GValue *value,
GParamSpec *pspec)
{
CheesePrefsWebcamComboPrivate *priv = CHEESE_PREFS_WEBCAM_COMBO_GET_PRIVATE (object);
- switch (prop_id)
+
+ switch (prop_id)
{
case PROP_WEBCAM_DEVICE_KEY:
priv->webcam_device_key = g_value_dup_string (value);
@@ -198,17 +202,17 @@
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
- }
+ }
}
static void
-cheese_prefs_webcam_combo_get_property (GObject *object, guint prop_id,
+cheese_prefs_webcam_combo_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
CheesePrefsWebcamComboPrivate *priv = CHEESE_PREFS_WEBCAM_COMBO_GET_PRIVATE (object);
-
+
g_return_if_fail (CHEESE_IS_PREFS_WEBCAM_COMBO (object));
-
+
switch (prop_id)
{
case PROP_WEBCAM_DEVICE_KEY:
@@ -226,16 +230,16 @@
static void
cheese_prefs_webcam_combo_class_init (CheesePrefsWebcamComboClass *klass)
{
- GObjectClass* object_class = G_OBJECT_CLASS (klass);
- CheesePrefsWidgetClass* parent_class = CHEESE_PREFS_WIDGET_CLASS (klass);
-
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ CheesePrefsWidgetClass *parent_class = CHEESE_PREFS_WIDGET_CLASS (klass);
+
g_type_class_add_private (klass, sizeof (CheesePrefsWebcamComboPrivate));
-
- object_class->finalize = cheese_prefs_webcam_combo_finalize;
+
+ object_class->finalize = cheese_prefs_webcam_combo_finalize;
object_class->set_property = cheese_prefs_webcam_combo_set_property;
object_class->get_property = cheese_prefs_webcam_combo_get_property;
- parent_class->synchronize = cheese_prefs_webcam_combo_synchronize;
-
+ parent_class->synchronize = cheese_prefs_webcam_combo_synchronize;
+
g_object_class_install_property (object_class,
PROP_WEBCAM_DEVICE_KEY,
g_param_spec_string ("webcam_device_key",
@@ -243,8 +247,8 @@
"Webcam device gconf key",
"",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property (object_class,
+
+ g_object_class_install_property (object_class,
PROP_WEBCAM,
g_param_spec_object ("webcam",
"",
@@ -253,30 +257,29 @@
G_PARAM_READWRITE));
}
-
CheesePrefsWebcamCombo *
-cheese_prefs_webcam_combo_new (GtkWidget *combo_box, CheeseWebcam *webcam,
+cheese_prefs_webcam_combo_new (GtkWidget *combo_box, CheeseWebcam *webcam,
const gchar *webcam_device_key)
{
- CheesePrefsWebcamCombo *self;
- GtkCellRenderer *renderer;
- CheesePrefsWebcamComboPrivate *priv;
-
- self = g_object_new (CHEESE_TYPE_PREFS_WEBCAM_COMBO,
- "widget", combo_box,
+ CheesePrefsWebcamCombo *self;
+ GtkCellRenderer *renderer;
+ CheesePrefsWebcamComboPrivate *priv;
+
+ self = g_object_new (CHEESE_TYPE_PREFS_WEBCAM_COMBO,
+ "widget", combo_box,
"webcam", webcam,
"webcam_device_key", webcam_device_key,
NULL);
-
+
priv = CHEESE_PREFS_WEBCAM_COMBO_GET_PRIVATE (self);
-
+
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo_box), renderer, "text",
PRODUCT_NAME);
- gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box),
+ gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box),
GTK_TREE_MODEL (priv->list_store));
-
+
return self;
}
@@ -284,12 +287,13 @@
cheese_prefs_webcam_combo_get_selected_webcam (CheesePrefsWebcamCombo *webcam)
{
CheesePrefsWebcamComboPrivate *priv = CHEESE_PREFS_WEBCAM_COMBO_GET_PRIVATE (webcam);
+
GtkTreeIter active_iter;
- GtkWidget *combo_box;
- char *device;
-
+ GtkWidget *combo_box;
+ char *device;
+
g_object_get (webcam, "widget", &combo_box, NULL);
-
+
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &active_iter);
gtk_tree_model_get (GTK_TREE_MODEL (priv->list_store), &active_iter, DEVICE_NAME, &device, -1);
Modified: trunk/src/cheese-prefs-webcam-combo.h
==============================================================================
--- trunk/src/cheese-prefs-webcam-combo.h (original)
+++ trunk/src/cheese-prefs-webcam-combo.h Sat Aug 23 17:07:43 2008
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2008 James Liggett <jrliggett cox net>
- * Copyright (C) 2008 Ryan Zeigler <zeiglerr gmail com>
- *
+ * Copyright  2008 James Liggett <jrliggett cox net>
+ * Copyright  2008 Ryan Zeigler <zeiglerr gmail com>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
+
#ifndef _CHEESE_PREFS_WEBCAM_COMBO_H_
#define _CHEESE_PREFS_WEBCAM_COMBO_H_
@@ -27,32 +27,34 @@
G_BEGIN_DECLS
-#define CHEESE_TYPE_PREFS_WEBCAM_COMBO (cheese_prefs_webcam_combo_get_type ())
-#define CHEESE_PREFS_WEBCAM_COMBO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_PREFS_WEBCAM_COMBO, CheesePrefsWebcamCombo))
-#define CHEESE_PREFS_WEBCAM_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_PREFS_WEBCAM_COMBO, CheesePrefsWebcamComboClass))
-#define CHEESE_IS_PREFS_WEBCAM_COMBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_PREFS_WEBCAM_COMBO))
-#define CHEESE_IS_PREFS_WEBCAM_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_PREFS_WEBCAM_COMBO))
-#define CHEESE_PREFS_WEBCAM_COMBO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_PREFS_WEBCAM_COMBO, CheesePrefsWebcamComboClass))
+#define CHEESE_TYPE_PREFS_WEBCAM_COMBO (cheese_prefs_webcam_combo_get_type ())
+#define CHEESE_PREFS_WEBCAM_COMBO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_PREFS_WEBCAM_COMBO, \
+ CheesePrefsWebcamCombo))
+#define CHEESE_PREFS_WEBCAM_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_PREFS_WEBCAM_COMBO, \
+ CheesePrefsWebcamComboClass))
+#define CHEESE_IS_PREFS_WEBCAM_COMBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_PREFS_WEBCAM_COMBO))
+#define CHEESE_IS_PREFS_WEBCAM_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_PREFS_WEBCAM_COMBO))
+#define CHEESE_PREFS_WEBCAM_COMBO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_PREFS_WEBCAM_COMBO, \
+ CheesePrefsWebcamComboClass))
typedef struct _CheesePrefsWebcamComboClass CheesePrefsWebcamComboClass;
typedef struct _CheesePrefsWebcamCombo CheesePrefsWebcamCombo;
struct _CheesePrefsWebcamComboClass
{
- CheesePrefsWidgetClass parent_class;
+ CheesePrefsWidgetClass parent_class;
};
struct _CheesePrefsWebcamCombo
{
- CheesePrefsWidget parent_instance;
+ CheesePrefsWidget parent_instance;
};
-GType cheese_prefs_webcam_combo_get_type (void) G_GNUC_CONST;
+GType cheese_prefs_webcam_combo_get_type (void) G_GNUC_CONST;
+CheesePrefsWebcamCombo *cheese_prefs_webcam_combo_new (GtkWidget *combo_box,
+ CheeseWebcam *webcam,
+ const gchar *webcam_device_key);
-CheesePrefsWebcamCombo * cheese_prefs_webcam_combo_new (GtkWidget *combo_box,
- CheeseWebcam *webcam,
- const gchar *webcam_device_key);
-
char *cheese_prefs_webcam_combo_get_selected_webcam (CheesePrefsWebcamCombo *webcam);
#endif /* _CHEESE_PREFS_WEBCAM_COMBO_H_ */
Modified: trunk/src/cheese-prefs-widget.c
==============================================================================
--- trunk/src/cheese-prefs-widget.c (original)
+++ trunk/src/cheese-prefs-widget.c Sat Aug 23 17:07:43 2008
@@ -1,7 +1,6 @@
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 2; tab-width: 2 -*- */
/*
- * Copyright (C) 2008 James Liggett <jrliggett cox net>
- *
+ * Copyright  2008 James Liggett <jrliggett cox net>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -23,28 +22,26 @@
enum
{
CHANGED,
-
LAST_SIGNAL
};
enum
{
PROP_0,
-
PROP_WIDGET
};
-static guint prefs_widget_signals[LAST_SIGNAL] = { 0 };
+static guint prefs_widget_signals[LAST_SIGNAL] = {0};
typedef struct
{
GtkWidget *widget;
} CheesePrefsWidgetPrivate;
-#define CHEESE_PREFS_WIDGET_GET_PRIVATE(o) \
+#define CHEESE_PREFS_WIDGET_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_PREFS_WIDGET, \
- CheesePrefsWidgetPrivate))
+ CheesePrefsWidgetPrivate))
G_DEFINE_TYPE (CheesePrefsWidget, cheese_prefs_widget, G_TYPE_OBJECT);
@@ -52,26 +49,26 @@
cheese_prefs_widget_init (CheesePrefsWidget *prefs_widget)
{
CheesePrefsWidgetPrivate *priv = CHEESE_PREFS_WIDGET_GET_PRIVATE (prefs_widget);
-
+
prefs_widget->gconf = NULL;
- priv->widget = NULL;
+ priv->widget = NULL;
}
static void
cheese_prefs_widget_finalize (GObject *object)
-{
+{
G_OBJECT_CLASS (cheese_prefs_widget_parent_class)->finalize (object);
}
static void
-cheese_prefs_widget_set_property (GObject *object, guint prop_id,
- const GValue *value,
+cheese_prefs_widget_set_property (GObject *object, guint prop_id,
+ const GValue *value,
GParamSpec *pspec)
{
CheesePrefsWidgetPrivate *priv = CHEESE_PREFS_WIDGET_GET_PRIVATE (object);
-
+
g_return_if_fail (CHEESE_IS_PREFS_WIDGET (object));
-
+
switch (prop_id)
{
case PROP_WIDGET:
@@ -84,13 +81,13 @@
}
static void
-cheese_prefs_widget_get_property (GObject *object, guint prop_id,
+cheese_prefs_widget_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
CheesePrefsWidgetPrivate *priv = CHEESE_PREFS_WIDGET_GET_PRIVATE (object);
-
+
g_return_if_fail (CHEESE_IS_PREFS_WIDGET (object));
-
+
switch (prop_id)
{
case PROP_WIDGET:
@@ -105,23 +102,22 @@
static void
cheese_prefs_widget_changed (CheesePrefsWidget *self)
{
-
}
static void
cheese_prefs_widget_class_init (CheesePrefsWidgetClass *klass)
{
- GObjectClass* object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = cheese_prefs_widget_finalize;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = cheese_prefs_widget_finalize;
object_class->set_property = cheese_prefs_widget_set_property;
object_class->get_property = cheese_prefs_widget_get_property;
-
- klass->changed = cheese_prefs_widget_changed;
+
+ klass->changed = cheese_prefs_widget_changed;
klass->synchronize = NULL;
-
+
g_type_class_add_private (klass, sizeof (CheesePrefsWidgetPrivate));
-
+
prefs_widget_signals[CHANGED] =
g_signal_new ("changed",
G_OBJECT_CLASS_TYPE (klass),
@@ -130,7 +126,7 @@
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
+
g_object_class_install_property (object_class, PROP_WIDGET,
g_param_spec_object ("widget",
"",
@@ -139,7 +135,6 @@
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}
-
void
cheese_prefs_widget_synchronize (CheesePrefsWidget *prefs_widget)
{
Modified: trunk/src/cheese-prefs-widget.h
==============================================================================
--- trunk/src/cheese-prefs-widget.h (original)
+++ trunk/src/cheese-prefs-widget.h Sat Aug 23 17:07:43 2008
@@ -1,7 +1,6 @@
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 2; tab-width: 2 -*- */
/*
- * Copyright (C) 2008 James Liggett <jrliggett cox net>
- *
+ * Copyright  2008 James Liggett <jrliggett cox net>
+ *
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
@@ -27,12 +26,15 @@
G_BEGIN_DECLS
-#define CHEESE_TYPE_PREFS_WIDGET (cheese_prefs_widget_get_type ())
-#define CHEESE_PREFS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_PREFS_WIDGET, CheesePrefsWidget))
-#define CHEESE_PREFS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_PREFS_WIDGET, CheesePrefsWidgetClass))
-#define CHEESE_IS_PREFS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_PREFS_WIDGET))
-#define CHEESE_IS_PREFS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_PREFS_WIDGET))
-#define CHEESE_PREFS_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_PREFS_WIDGET, CheesePrefsWidgetClass))
+#define CHEESE_TYPE_PREFS_WIDGET (cheese_prefs_widget_get_type ())
+#define CHEESE_PREFS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_PREFS_WIDGET, \
+ CheesePrefsWidget))
+#define CHEESE_PREFS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_PREFS_WIDGET, \
+ CheesePrefsWidgetClass))
+#define CHEESE_IS_PREFS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_PREFS_WIDGET))
+#define CHEESE_IS_PREFS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_PREFS_WIDGET))
+#define CHEESE_PREFS_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_PREFS_WIDGET, \
+ CheesePrefsWidgetClass))
typedef struct _CheesePrefsWidgetClass CheesePrefsWidgetClass;
typedef struct _CheesePrefsWidget CheesePrefsWidget;
@@ -40,10 +42,10 @@
struct _CheesePrefsWidgetClass
{
GObjectClass parent_class;
-
+
/* Signals */
void (*changed) (CheesePrefsWidget *self);
-
+
/* Virtual methods */
void (*synchronize) (CheesePrefsWidget *self);
};
@@ -51,11 +53,12 @@
struct _CheesePrefsWidget
{
GObject parent_instance;
-
+
CheeseGConf *gconf;
};
GType cheese_prefs_widget_get_type (void) G_GNUC_CONST;
+
void cheese_prefs_widget_synchronize (CheesePrefsWidget *prefs_widget);
void cheese_prefs_widget_notify_changed (CheesePrefsWidget *prefs_widget);
Modified: trunk/src/cheese-thumb-view.c
==============================================================================
--- trunk/src/cheese-thumb-view.c (original)
+++ trunk/src/cheese-thumb-view.c Sat Aug 23 17:07:43 2008
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
- * Copyright (C) 2008 Filippo Argiolas <filippo argiolas gmail com>
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2008 Filippo Argiolas <filippo argiolas gmail com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -20,7 +20,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include "cheese-config.h"
+ #include "cheese-config.h"
#endif
#include <glib.h>
@@ -34,7 +34,7 @@
#define CHEESE_THUMB_VIEW_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_THUMB_VIEW, CheeseThumbViewPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_THUMB_VIEW, CheeseThumbViewPrivate))
G_DEFINE_TYPE (CheeseThumbView, cheese_thumb_view, GTK_TYPE_ICON_VIEW);
@@ -43,8 +43,8 @@
{
GtkListStore *store;
CheeseFileUtil *fileutil;
- GFileMonitor *photo_file_monitor;
- GFileMonitor *video_file_monitor;
+ GFileMonitor *photo_file_monitor;
+ GFileMonitor *video_file_monitor;
GnomeThumbnailFactory *factory;
gboolean multiplex_thumbnail_generator;
} CheeseThumbViewPrivate;
@@ -57,16 +57,15 @@
};
/* Drag 'n Drop */
-enum
+enum
{
TARGET_PLAIN,
TARGET_PLAIN_UTF8,
TARGET_URILIST,
};
-static GtkTargetEntry target_table[] =
-{
- { "text/uri-list", 0, TARGET_URILIST },
+static GtkTargetEntry target_table[] = {
+ {"text/uri-list", 0, TARGET_URILIST},
};
typedef struct
@@ -77,22 +76,23 @@
} CheeseThumbViewThreadData;
static void
-cheese_thumb_view_thread_append_item (gpointer data)
+cheese_thumb_view_thread_append_item (gpointer data)
{
- CheeseThumbViewThreadData *item = data;
- CheeseThumbView *thumb_view = item->thumb_view;
- CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
+ CheeseThumbViewThreadData *item = data;
+ CheeseThumbView *thumb_view = item->thumb_view;
+ CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
+
GnomeThumbnailFactory *factory = priv->factory;
- GFile *file = item->file;
- GtkTreeIter iter = item->iter;
- GdkPixbuf *pixbuf = NULL;
- GFileInfo *info;
- char *thumb_loc;
- GTimeVal mtime;
- char *mime_type;
- char *uri;
- char *filename;
-
+ GFile *file = item->file;
+ GtkTreeIter iter = item->iter;
+ GdkPixbuf *pixbuf = NULL;
+ GFileInfo *info;
+ char *thumb_loc;
+ GTimeVal mtime;
+ char *mime_type;
+ char *uri;
+ char *filename;
+
info = g_file_query_info (file, "standard::content-type,time::modified", 0, NULL, NULL);
if (!info)
@@ -102,8 +102,8 @@
}
g_file_info_get_modification_time (info, &mtime);
mime_type = g_strdup (g_file_info_get_content_type (info));
-
- uri = g_file_get_uri (file);
+
+ uri = g_file_get_uri (file);
filename = g_file_get_path (file);
thumb_loc = gnome_thumbnail_factory_lookup (factory, uri, mtime.tv_sec);
@@ -114,7 +114,9 @@
if (!pixbuf)
{
g_warning ("could not generate thumbnail for %s (%s)\n", filename, mime_type);
- } else {
+ }
+ else
+ {
gnome_thumbnail_factory_save_thumbnail (factory, pixbuf, uri, mtime.tv_sec);
}
}
@@ -132,8 +134,8 @@
if (!pixbuf)
{
- gchar *escape = NULL;
- GError *error = NULL;
+ gchar *escape = NULL;
+ GError *error = NULL;
escape = g_strrstr (mime_type, "/");
if (escape != NULL) *escape = '-';
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
@@ -151,12 +153,12 @@
{
eog_thumbnail_add_frame (&pixbuf);
}
-
+
gdk_threads_enter ();
-
+
gtk_list_store_set (priv->store, &iter,
THUMBNAIL_PIXBUF_COLUMN, pixbuf, -1);
-
+
gdk_threads_leave ();
g_free (mime_type);
@@ -168,32 +170,34 @@
static void
cheese_thumb_view_append_item (CheeseThumbView *thumb_view, GFile *file)
{
- CheeseThumbViewPrivate* priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
- GtkTreeIter iter;
+ CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
+
+ GtkTreeIter iter;
GtkIconTheme *icon_theme;
- GdkPixbuf *pixbuf = NULL;
- GtkTreePath *path;
- char *filename, *basename;
- GError *error = NULL;
+ GdkPixbuf *pixbuf = NULL;
+ GtkTreePath *path;
+ char *filename, *basename;
+ GError *error = NULL;
CheeseThumbViewThreadData *data;
- data = g_new0 (CheeseThumbViewThreadData, 1);
+ data = g_new0 (CheeseThumbViewThreadData, 1);
data->thumb_view = g_object_ref (thumb_view);
- data->file = g_object_ref (file);
+ data->file = g_object_ref (file);
if (priv->multiplex_thumbnail_generator)
{
char *f;
- //f = g_strdup_printf ("%s/pixmaps/cheese-%i.svg", PACKAGE_DATADIR, g_random_int_range (1, 3));
- f = g_strdup_printf ("%s/pixmaps/cheese-1.svg", PACKAGE_DATADIR);
+
+ /* f = g_strdup_printf ("%s/pixmaps/cheese-%i.svg", PACKAGE_DATADIR, g_random_int_range (1, 3)); */
+ f = g_strdup_printf ("%s/pixmaps/cheese-1.svg", PACKAGE_DATADIR);
pixbuf = gdk_pixbuf_new_from_file (f, NULL);
g_free (f);
}
else
{
icon_theme = gtk_icon_theme_get_default ();
- pixbuf = gtk_icon_theme_load_icon (icon_theme, "image-loading", 96, 0, &error);
+ pixbuf = gtk_icon_theme_load_icon (icon_theme, "image-loading", 96, 0, &error);
}
if (!pixbuf)
@@ -206,7 +210,7 @@
filename = g_file_get_path (file);
basename = g_path_get_basename (filename);
-
+
gtk_list_store_append (priv->store, &iter);
data->iter = iter;
gtk_list_store_set (priv->store, &iter,
@@ -236,11 +240,12 @@
void
cheese_thumb_view_remove_item (CheeseThumbView *thumb_view, GFile *file)
{
- CheeseThumbViewPrivate* priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
- char *path;
+ CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
+
+ char *path;
GtkTreeIter iter;
- char *filename;
- gboolean found = FALSE;
+ char *filename;
+ gboolean found = FALSE;
filename = g_file_get_path (file);
@@ -252,7 +257,7 @@
/* check if the selected item is the first, else go through the store */
gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, THUMBNAIL_URL_COLUMN, &path, -1);
- if (g_ascii_strcasecmp (path, filename))
+ if (g_ascii_strcasecmp (path, filename))
{
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store), &iter))
{
@@ -263,7 +268,9 @@
break;
}
}
- } else {
+ }
+ else
+ {
found = TRUE;
}
g_free (path);
@@ -283,15 +290,14 @@
GtkTreePath *tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->store), &iter);
gtk_icon_view_select_path (GTK_ICON_VIEW (thumb_view), tree_path);
gtk_tree_path_free (tree_path);
-
}
static void
-cheese_thumb_view_monitor_cb (GFileMonitor *file_monitor,
- GFile *file,
- GFile *other_file,
- GFileMonitorEvent event_type,
- CheeseThumbView *thumb_view)
+cheese_thumb_view_monitor_cb (GFileMonitor *file_monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ CheeseThumbView *thumb_view)
{
switch (event_type)
{
@@ -306,7 +312,6 @@
}
}
-
static void
cheese_thumb_view_on_drag_data_get_cb (GtkIconView *thumb_view,
GdkDragContext *drag_context,
@@ -315,16 +320,16 @@
guint time,
gpointer user_data)
{
- GList *list;
- GtkTreePath *tree_path = NULL;
- GtkTreeIter iter;
+ GList *list;
+ GtkTreePath *tree_path = NULL;
+ GtkTreeIter iter;
GtkTreeModel *model;
- char *str;
- char *uris = NULL;
- char *tmp_str;
- gint i;
+ char *str;
+ char *uris = NULL;
+ char *tmp_str;
+ gint i;
- list = gtk_icon_view_get_selected_items (thumb_view);
+ list = gtk_icon_view_get_selected_items (thumb_view);
model = gtk_icon_view_get_model (thumb_view);
for (i = 0; i < g_list_length (list); i++)
@@ -338,13 +343,13 @@
*/
/* build the "text/uri-list" string */
- if (uris)
+ if (uris)
{
tmp_str = g_strconcat (uris, "file://", str, "\r\n", NULL);
g_free (uris);
- }
- else
- {
+ }
+ else
+ {
tmp_str = g_strconcat ("file://", str, "\r\n", NULL);
}
uris = tmp_str;
@@ -352,24 +357,23 @@
g_free (str);
}
gtk_selection_data_set (data, data->target, 8,
- (guchar*) uris, strlen (uris));
+ (guchar *) uris, strlen (uris));
g_free (uris);
g_list_free (list);
}
-
static char *
cheese_thumb_view_get_url_from_path (CheeseThumbView *thumb_view, GtkTreePath *path)
{
GtkTreeModel *model;
- GtkTreeIter iter;
- char *file;
+ GtkTreeIter iter;
+ char *file;
model = gtk_icon_view_get_model (GTK_ICON_VIEW (thumb_view));
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, THUMBNAIL_URL_COLUMN, &file, -1);
-
+
return file;
}
@@ -377,13 +381,13 @@
cheese_thumb_view_get_selected_image (CheeseThumbView *thumb_view)
{
GList *list;
- char *filename = NULL;
+ char *filename = NULL;
list = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (thumb_view));
if (list)
{
filename = cheese_thumb_view_get_url_from_path (thumb_view, (GtkTreePath *) list->data);
- g_list_foreach (list, (GFunc)gtk_tree_path_free, NULL);
+ g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
g_list_free (list);
}
@@ -401,7 +405,7 @@
l = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (thumb_view));
- for (item = l; item != NULL; item = item->next)
+ for (item = l; item != NULL; item = item->next)
{
path = (GtkTreePath *) item->data;
file = g_file_new_for_path (cheese_thumb_view_get_url_from_path (thumb_view, path));
@@ -418,16 +422,17 @@
static void
cheese_thumb_view_get_n_selected_helper (GtkIconView *thumbview,
GtkTreePath *path,
- gpointer data)
+ gpointer data)
{
/* data is of type (guint *) */
- (*(guint *) data) ++;
+ (*(guint *) data)++;
}
guint
cheese_thumb_view_get_n_selected (CheeseThumbView *thumbview)
{
guint count = 0;
+
gtk_icon_view_selected_foreach (GTK_ICON_VIEW (thumbview),
cheese_thumb_view_get_n_selected_helper,
(&count));
@@ -437,21 +442,22 @@
static void
cheese_thumb_view_fill (CheeseThumbView *thumb_view)
{
- CheeseThumbViewPrivate* priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
- GDir *dir_videos, *dir_photos;
- char *path_videos, *path_photos;
+ CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
+
+ GDir *dir_videos, *dir_photos;
+ char *path_videos, *path_photos;
const char *name;
- char *filename;
- GFile *file;
+ char *filename;
+ GFile *file;
gtk_list_store_clear (priv->store);
path_videos = cheese_fileutil_get_video_path (priv->fileutil);
path_photos = cheese_fileutil_get_photo_path (priv->fileutil);
-
+
dir_videos = g_dir_open (path_videos, 0, NULL);
dir_photos = g_dir_open (path_photos, 0, NULL);
-
+
if (!dir_videos && !dir_photos)
return;
@@ -461,28 +467,28 @@
priv->multiplex_thumbnail_generator = !priv->multiplex_thumbnail_generator;
g_free (multiplex_file);
- //read videos from the vid directory
+ /* read videos from the vid directory */
while ((name = g_dir_read_name (dir_videos)))
{
if (!(g_str_has_suffix (name, VIDEO_NAME_SUFFIX)))
continue;
-
+
filename = g_build_filename (path_videos, name, NULL);
- file = g_file_new_for_path (filename);
+ file = g_file_new_for_path (filename);
cheese_thumb_view_append_item (thumb_view, file);
g_free (filename);
g_object_unref (file);
}
g_dir_close (dir_videos);
-
- //read photos from the photo directory
+
+ /* read photos from the photo directory */
while ((name = g_dir_read_name (dir_photos)))
{
if (!(g_str_has_suffix (name, PHOTO_NAME_SUFFIX)))
continue;
filename = g_build_filename (path_photos, name, NULL);
- file = g_file_new_for_path (filename);
+ file = g_file_new_for_path (filename);
cheese_thumb_view_append_item (thumb_view, file);
g_free (filename);
g_object_unref (file);
@@ -496,7 +502,7 @@
CheeseThumbView *thumb_view;
thumb_view = CHEESE_THUMB_VIEW (object);
- CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
+ CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
g_object_unref (priv->store);
g_object_unref (priv->fileutil);
@@ -511,19 +517,20 @@
cheese_thumb_view_class_init (CheeseThumbViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
object_class->finalize = cheese_thumb_view_finalize;
g_type_class_add_private (klass, sizeof (CheeseThumbViewPrivate));
}
-
static void
cheese_thumb_view_init (CheeseThumbView *thumb_view)
{
- CheeseThumbViewPrivate* priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
+ CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
+
char *path_videos = NULL, *path_photos = NULL;
-
- GFile *file;
+
+ GFile *file;
const int THUMB_VIEW_HEIGHT = 120;
eog_thumbnail_init ();
@@ -538,22 +545,22 @@
path_videos = cheese_fileutil_get_video_path (priv->fileutil);
path_photos = cheese_fileutil_get_photo_path (priv->fileutil);
-
+
g_mkdir_with_parents (path_videos, 0775);
g_mkdir_with_parents (path_photos, 0775);
-
+
priv->factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
- //connect signal to video path
- file = g_file_new_for_path (path_videos);
+ /* connect signal to video path */
+ file = g_file_new_for_path (path_videos);
priv->video_file_monitor = g_file_monitor_directory (file, 0, NULL, NULL);
g_signal_connect (priv->video_file_monitor, "changed", G_CALLBACK (cheese_thumb_view_monitor_cb), thumb_view);
-
- //if both paths are the same, make only one file monitor and point twice to the file monitor (photo_file_monitor = video_file_monitor)
+
+ /* if both paths are the same, make only one file monitor and point twice to the file monitor (photo_file_monitor = video_file_monitor) */
if (strcmp (path_videos, path_photos) != 0)
{
- //connect signal to photo path
- file = g_file_new_for_path (path_photos);
+ /* connect signal to photo path */
+ file = g_file_new_for_path (path_photos);
priv->photo_file_monitor = g_file_monitor_directory (file, 0, NULL, NULL);
g_signal_connect (priv->photo_file_monitor, "changed", G_CALLBACK (cheese_thumb_view_monitor_cb), thumb_view);
}
@@ -561,7 +568,7 @@
{
priv->photo_file_monitor = priv->video_file_monitor;
}
-
+
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (thumb_view), 0);
#ifdef HILDON
gtk_icon_view_set_columns (GTK_ICON_VIEW (thumb_view), -1);
@@ -582,11 +589,11 @@
cheese_thumb_view_fill (thumb_view);
}
-GtkWidget *
+GtkWidget *
cheese_thumb_view_new ()
{
CheeseThumbView *thumb_view;
- thumb_view = g_object_new (CHEESE_TYPE_THUMB_VIEW, NULL);
+ thumb_view = g_object_new (CHEESE_TYPE_THUMB_VIEW, NULL);
return GTK_WIDGET (thumb_view);
}
Modified: trunk/src/cheese-thumb-view.h
==============================================================================
--- trunk/src/cheese-thumb-view.h (original)
+++ trunk/src/cheese-thumb-view.h Sat Aug 23 17:07:43 2008
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
*
* Licensed under the GNU General Public License Version 2
*
@@ -27,30 +27,33 @@
G_BEGIN_DECLS
-#define CHEESE_TYPE_THUMB_VIEW (cheese_thumb_view_get_type ())
+#define CHEESE_TYPE_THUMB_VIEW (cheese_thumb_view_get_type ())
#define CHEESE_THUMB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_THUMB_VIEW, CheeseThumbView))
-#define CHEESE_THUMB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_THUMB_VIEW, CheeseThumbViewClass))
+#define CHEESE_THUMB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_THUMB_VIEW, \
+ CheeseThumbViewClass))
#define CHEESE_IS_THUMB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_THUMB_VIEW))
-#define CHEESE_IS_THUMB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_THUMB_VIEW))
-#define CHEESE_THUMB_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_THUMB_VIEW, CheeseThumbViewClass))
+#define CHEESE_IS_THUMB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_THUMB_VIEW))
+#define CHEESE_THUMB_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_THUMB_VIEW, \
+ CheeseThumbViewClass))
-typedef struct
+typedef struct
{
GtkIconView parent;
} CheeseThumbView;
-typedef struct
+typedef struct
{
GtkIconViewClass parent_class;
} CheeseThumbViewClass;
-GType cheese_thumb_view_get_type (void);
-GtkWidget *cheese_thumb_view_new ();
-GList *cheese_thumb_view_get_selected_images_list (CheeseThumbView *thumb_view);
-char *cheese_thumb_view_get_selected_image (CheeseThumbView *thumb_view);
-guint cheese_thumb_view_get_n_selected (CheeseThumbView *thumbview);
-void cheese_thumb_view_remove_item (CheeseThumbView *thumb_view, GFile *file);
+GType cheese_thumb_view_get_type (void);
+GtkWidget *cheese_thumb_view_new ();
+
+GList *cheese_thumb_view_get_selected_images_list (CheeseThumbView *thumb_view);
+char * cheese_thumb_view_get_selected_image (CheeseThumbView *thumb_view);
+guint cheese_thumb_view_get_n_selected (CheeseThumbView *thumbview);
+void cheese_thumb_view_remove_item (CheeseThumbView *thumb_view, GFile *file);
G_END_DECLS
Modified: trunk/src/cheese-webcam.c
==============================================================================
--- trunk/src/cheese-webcam.c (original)
+++ trunk/src/cheese-webcam.c Sat Aug 23 17:07:43 2008
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2008 Ryan Zeigler <zeiglerr gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2008 Ryan Zeigler <zeiglerr gmail com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
-#include <cheese-config.h>
+ #include <cheese-config.h>
#endif
#include <string.h>
@@ -51,10 +51,11 @@
typedef struct
{
- GtkWidget* video_window;
+ GtkWidget *video_window;
+
+ GstElement *pipeline;
+ GstBus *bus;
- GstElement *pipeline;
- GstBus *bus;
/* We build the active pipeline by linking the appropriate pipelines listed below*/
GstElement *webcam_source_bin;
GstElement *video_display_bin;
@@ -89,7 +90,7 @@
CheeseFlash *flash;
} CheeseWebcamPrivate;
-enum
+enum
{
PROP_0,
PROP_VIDEO_WINDOW,
@@ -98,14 +99,14 @@
PROP_Y_RESOLUTION
};
-enum
+enum
{
PHOTO_SAVED,
VIDEO_SAVED,
LAST_SIGNAL
};
-static guint webcam_signals [LAST_SIGNAL];
+static guint webcam_signals[LAST_SIGNAL];
typedef enum
{
@@ -121,20 +122,19 @@
} EffectToPipelineDesc;
-static const EffectToPipelineDesc EFFECT_TO_PIPELINE_DESC [] =
-{
- {CHEESE_WEBCAM_EFFECT_NO_EFFECT, "identity", RGB},
- {CHEESE_WEBCAM_EFFECT_MAUVE, "videobalance saturation=1.5 hue=+0.5", YUV},
- {CHEESE_WEBCAM_EFFECT_NOIR_BLANC, "videobalance saturation=0", YUV},
- {CHEESE_WEBCAM_EFFECT_SATURATION, "videobalance saturation=2", YUV},
- {CHEESE_WEBCAM_EFFECT_HULK, "videobalance saturation=1.5 hue=-0.5", YUV},
- {CHEESE_WEBCAM_EFFECT_VERTICAL_FLIP, "videoflip method=5", YUV},
- {CHEESE_WEBCAM_EFFECT_HORIZONTAL_FLIP, "videoflip method=4", YUV},
- {CHEESE_WEBCAM_EFFECT_SHAGADELIC, "shagadelictv", RGB},
- {CHEESE_WEBCAM_EFFECT_VERTIGO, "vertigotv", RGB},
- {CHEESE_WEBCAM_EFFECT_EDGE, "edgetv", RGB},
- {CHEESE_WEBCAM_EFFECT_DICE, "dicetv", RGB},
- {CHEESE_WEBCAM_EFFECT_WARP, "warptv", RGB}
+static const EffectToPipelineDesc EFFECT_TO_PIPELINE_DESC[] = {
+ {CHEESE_WEBCAM_EFFECT_NO_EFFECT, "identity", RGB},
+ {CHEESE_WEBCAM_EFFECT_MAUVE, "videobalance saturation=1.5 hue=+0.5", YUV},
+ {CHEESE_WEBCAM_EFFECT_NOIR_BLANC, "videobalance saturation=0", YUV},
+ {CHEESE_WEBCAM_EFFECT_SATURATION, "videobalance saturation=2", YUV},
+ {CHEESE_WEBCAM_EFFECT_HULK, "videobalance saturation=1.5 hue=-0.5", YUV},
+ {CHEESE_WEBCAM_EFFECT_VERTICAL_FLIP, "videoflip method=5", YUV},
+ {CHEESE_WEBCAM_EFFECT_HORIZONTAL_FLIP, "videoflip method=4", YUV},
+ {CHEESE_WEBCAM_EFFECT_SHAGADELIC, "shagadelictv", RGB},
+ {CHEESE_WEBCAM_EFFECT_VERTIGO, "vertigotv", RGB},
+ {CHEESE_WEBCAM_EFFECT_EDGE, "edgetv", RGB},
+ {CHEESE_WEBCAM_EFFECT_DICE, "dicetv", RGB},
+ {CHEESE_WEBCAM_EFFECT_WARP, "warptv", RGB}
};
static const int NUM_EFFECTS = G_N_ELEMENTS (EFFECT_TO_PIPELINE_DESC);
@@ -150,17 +150,18 @@
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- GstXOverlay *overlay = GST_X_OVERLAY (gst_bin_get_by_interface (GST_BIN (priv->pipeline),
- GST_TYPE_X_OVERLAY));
+ GstXOverlay *overlay = GST_X_OVERLAY (gst_bin_get_by_interface (GST_BIN (priv->pipeline),
+ GST_TYPE_X_OVERLAY));
+
gst_x_overlay_set_xwindow_id (overlay, GDK_WINDOW_XWINDOW (priv->video_window->window));
}
static void
-cheese_webcam_change_sink (CheeseWebcam *webcam, GstElement *src,
+cheese_webcam_change_sink (CheeseWebcam *webcam, GstElement *src,
GstElement *new_sink, GstElement *old_sink)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- gboolean is_playing = priv->pipeline_is_playing;
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ gboolean is_playing = priv->pipeline_is_playing;
cheese_webcam_stop (webcam);
@@ -175,7 +176,6 @@
cheese_webcam_play (webcam);
}
-
static gboolean
cheese_webcam_expose_cb (GtkWidget *widget, GdkEventExpose *event, CheeseWebcam *webcam)
{
@@ -188,26 +188,27 @@
GstPad *pad, CheeseWebcam *webcam)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- GstCaps *caps;
+
+ GstCaps *caps;
const GstStructure *structure;
- int width, height, stride;
- GdkPixbuf *pixbuf;
- const int bits_per_pixel = 8;
+ int width, height, stride;
+ GdkPixbuf *pixbuf;
+ const int bits_per_pixel = 8;
- caps = gst_buffer_get_caps (buffer);
+ caps = gst_buffer_get_caps (buffer);
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "width", &width);
gst_structure_get_int (structure, "height", &height);
- stride = buffer->size/height;
- pixbuf = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buffer), GDK_COLORSPACE_RGB,
- FALSE, bits_per_pixel, width, height, stride,
+ stride = buffer->size / height;
+ pixbuf = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buffer), GDK_COLORSPACE_RGB,
+ FALSE, bits_per_pixel, width, height, stride,
NULL, NULL);
gdk_pixbuf_save (pixbuf, priv->photo_filename, "jpeg", NULL, NULL);
g_object_unref (G_OBJECT (pixbuf));
- g_signal_handler_disconnect (G_OBJECT (priv->photo_sink),
+ g_signal_handler_disconnect (G_OBJECT (priv->photo_sink),
priv->photo_handler_signal_id);
g_signal_emit (webcam, webcam_signals[PHOTO_SAVED], 0);
@@ -216,54 +217,54 @@
static void
cheese_webcam_bus_message_cb (GstBus *bus, GstMessage *message, CheeseWebcam *webcam)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_EOS)
{
g_print ("Received EOS message\n");
- g_signal_emit (webcam, webcam_signals [VIDEO_SAVED], 0);
-
- cheese_webcam_change_sink (webcam, priv->video_display_bin,
+ g_signal_emit (webcam, webcam_signals[VIDEO_SAVED], 0);
+
+ cheese_webcam_change_sink (webcam, priv->video_display_bin,
priv->photo_save_bin, priv->video_save_bin);
priv->is_recording = FALSE;
}
}
-
static void
cheese_webcam_get_video_devices_from_hal (CheeseWebcam *webcam)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
int i;
int num_udis;
- int num_devices; /* Devices we actually create formats for; can either be the
- * number of webcams detected, or 1 if none were. The one
- * refers to a fake device so that resolution changing still
- * works even if the computer doesn't have a webcam. */
- char **udis;
- DBusError error;
+ int num_devices; /* Devices we actually create formats for; can either be the
+ * number of webcams detected, or 1 if none were. The one
+ * refers to a fake device so that resolution changing still
+ * works even if the computer doesn't have a webcam. */
+ char **udis;
+ DBusError error;
LibHalContext *hal_ctx;
dbus_error_init (&error);
- hal_ctx = libhal_ctx_new ();
- if (hal_ctx == NULL)
+ hal_ctx = libhal_ctx_new ();
+ if (hal_ctx == NULL)
{
g_error ("error: libhal_ctx_new");
dbus_error_free (&error);
return;
}
- if (!libhal_ctx_set_dbus_connection (hal_ctx, dbus_bus_get (DBUS_BUS_SYSTEM, &error)))
+ if (!libhal_ctx_set_dbus_connection (hal_ctx, dbus_bus_get (DBUS_BUS_SYSTEM, &error)))
{
g_error ("error: libhal_ctx_set_dbus_connection: %s: %s", error.name, error.message);
dbus_error_free (&error);
return;
}
- if (!libhal_ctx_init (hal_ctx, &error))
+ if (!libhal_ctx_init (hal_ctx, &error))
{
- if (dbus_error_is_set (&error))
+ if (dbus_error_is_set (&error))
{
g_error ("error: libhal_ctx_init: %s: %s\n", error.name, error.message);
dbus_error_free (&error);
@@ -275,7 +276,7 @@
udis = libhal_find_device_by_capability (hal_ctx, "video4linux", &num_udis, &error);
- if (dbus_error_is_set (&error))
+ if (dbus_error_is_set (&error))
{
g_error ("error: %s: %s\n", error.name, error.message);
dbus_error_free (&error);
@@ -283,31 +284,31 @@
}
/* Initialize webcam structures */
-
+
if (num_udis > 0)
- priv->num_webcam_devices = num_devices = num_udis;
+ priv->num_webcam_devices = num_devices = num_udis;
else
{
- num_devices = 1;
- priv->num_webcam_devices = num_udis; /* We don't have any real cameras--
- * this is important when we create
+ num_devices = 1;
+ priv->num_webcam_devices = num_udis; /* We don't have any real cameras--
+ * this is important when we create
* the pipeline. */
}
-
+
priv->webcam_devices = g_new0 (CheeseWebcamDevice, num_devices);
for (i = 0; i < num_devices; i++)
{
priv->webcam_devices[i].num_video_formats = 0;
- priv->webcam_devices[i].video_formats = g_array_new (FALSE, FALSE, sizeof (CheeseVideoFormat));
- priv->webcam_devices[i].hal_udi = g_strdup (udis[i]);
+ priv->webcam_devices[i].video_formats = g_array_new (FALSE, FALSE, sizeof (CheeseVideoFormat));
+ priv->webcam_devices[i].hal_udi = g_strdup (udis[i]);
}
- for (i = 0; i < priv->num_webcam_devices; i++)
+ for (i = 0; i < priv->num_webcam_devices; i++)
{
char *device;
-
+
device = libhal_device_get_property_string (hal_ctx, udis[i], "video4linux.device", &error);
- if (dbus_error_is_set (&error))
+ if (dbus_error_is_set (&error))
{
g_error ("error: %s: %s\n", error.name, error.message);
dbus_error_free (&error);
@@ -323,51 +324,51 @@
cheese_webcam_get_supported_framerates (CheeseVideoFormat *video_format, GstStructure *structure)
{
const GValue *framerates;
- int i, j;
+ int i, j;
framerates = gst_structure_get_value (structure, "framerate");
if (GST_VALUE_HOLDS_FRACTION (framerates))
{
- video_format->num_framerates = 1;
- video_format->framerates = g_new0 (CheeseFramerate, video_format->num_framerates);
- video_format->framerates[0].numerator = gst_value_get_fraction_numerator (framerates);
- video_format->framerates[0].denominator = gst_value_get_fraction_denominator (framerates);
+ video_format->num_framerates = 1;
+ video_format->framerates = g_new0 (CheeseFramerate, video_format->num_framerates);
+ video_format->framerates[0].numerator = gst_value_get_fraction_numerator (framerates);
+ video_format->framerates[0].denominator = gst_value_get_fraction_denominator (framerates);
}
else if (GST_VALUE_HOLDS_LIST (framerates))
{
video_format->num_framerates = gst_value_list_get_size (framerates);
- video_format->framerates = g_new0 (CheeseFramerate, video_format->num_framerates);
+ video_format->framerates = g_new0 (CheeseFramerate, video_format->num_framerates);
for (i = 0; i < video_format->num_framerates; i++)
{
const GValue *value;
- value = gst_value_list_get_value (framerates, i);
- video_format->framerates[i].numerator = gst_value_get_fraction_numerator (value);
+ value = gst_value_list_get_value (framerates, i);
+ video_format->framerates[i].numerator = gst_value_get_fraction_numerator (value);
video_format->framerates[i].denominator = gst_value_get_fraction_denominator (value);
}
}
else if (GST_VALUE_HOLDS_FRACTION_RANGE (framerates))
{
- int numerator_min, denominator_min, numerator_max, denominator_max;
+ int numerator_min, denominator_min, numerator_max, denominator_max;
const GValue *fraction_range_min;
const GValue *fraction_range_max;
fraction_range_min = gst_value_get_fraction_range_min (framerates);
- numerator_min = gst_value_get_fraction_numerator (fraction_range_min);
- denominator_min = gst_value_get_fraction_denominator (fraction_range_min);
+ numerator_min = gst_value_get_fraction_numerator (fraction_range_min);
+ denominator_min = gst_value_get_fraction_denominator (fraction_range_min);
fraction_range_max = gst_value_get_fraction_range_max (framerates);
- numerator_max = gst_value_get_fraction_numerator (fraction_range_max);
- denominator_max = gst_value_get_fraction_denominator (fraction_range_max);
+ numerator_max = gst_value_get_fraction_numerator (fraction_range_max);
+ denominator_max = gst_value_get_fraction_denominator (fraction_range_max);
g_print ("FractionRange: %d/%d - %d/%d\n", numerator_min, denominator_min, numerator_max, denominator_max);
video_format->num_framerates = (numerator_max - numerator_min + 1) * (denominator_max - denominator_min + 1);
- video_format->framerates = g_new0 (CheeseFramerate, video_format->num_framerates);
+ video_format->framerates = g_new0 (CheeseFramerate, video_format->num_framerates);
int k = 0;
for (i = numerator_min; i <= numerator_max; i++)
{
for (j = denominator_min; j <= denominator_max; j++)
{
- video_format->framerates[k].numerator = i;
+ video_format->framerates[k].numerator = i;
video_format->framerates[k].denominator = j;
k++;
}
@@ -375,8 +376,8 @@
}
else
{
- g_critical ("GValue type %s, cannot be handled for framerates", G_VALUE_TYPE_NAME (framerates));
- }
+ g_critical ("GValue type %s, cannot be handled for framerates", G_VALUE_TYPE_NAME (framerates));
+ }
}
static void
@@ -402,7 +403,7 @@
continue;
}
- width = gst_structure_get_value (structure, "width");
+ width = gst_structure_get_value (structure, "width");
height = gst_structure_get_value (structure, "height");
if (G_VALUE_HOLDS_INT (width))
@@ -422,40 +423,40 @@
int min_width, max_width, min_height, max_height;
int cur_width, cur_height;
- min_width = gst_value_get_int_range_min (width);
- max_width = gst_value_get_int_range_max (width);
+ min_width = gst_value_get_int_range_min (width);
+ max_width = gst_value_get_int_range_max (width);
min_height = gst_value_get_int_range_min (height);
max_height = gst_value_get_int_range_max (height);
- cur_width = min_width;
+ cur_width = min_width;
cur_height = min_height;
while (cur_width < max_width && cur_height < max_height)
{
CheeseVideoFormat video_format;
video_format.mimetype = g_strdup (gst_structure_get_name (structure));
- video_format.width = cur_width;
- video_format.height = cur_height;
+ video_format.width = cur_width;
+ video_format.height = cur_height;
cheese_webcam_get_supported_framerates (&video_format, structure);
g_array_append_val (webcam_device->video_formats, video_format);
webcam_device->num_video_formats++;
- cur_width *= 2;
+ cur_width *= 2;
cur_height *= 2;
}
- cur_width = max_width;
+ cur_width = max_width;
cur_height = max_height;
while (cur_width > min_width && cur_height > min_height)
{
CheeseVideoFormat video_format;
video_format.mimetype = g_strdup (gst_structure_get_name (structure));
- video_format.width = cur_width;
- video_format.height = cur_height;
+ video_format.width = cur_width;
+ video_format.height = cur_height;
cheese_webcam_get_supported_framerates (&video_format, structure);
g_array_append_val (webcam_device->video_formats, video_format);
webcam_device->num_video_formats++;
- cur_width /= 2;
+ cur_width /= 2;
cur_height /= 2;
}
}
@@ -467,21 +468,21 @@
}
static void
-cheese_webcam_get_webcam_device_data (CheeseWebcam *webcam,
+cheese_webcam_get_webcam_device_data (CheeseWebcam *webcam,
CheeseWebcamDevice *webcam_device)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- char *pipeline_desc;
- GstElement *pipeline;
- GError *err;
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
+ char *pipeline_desc;
+ GstElement *pipeline;
+ GError *err;
GstStateChangeReturn ret;
- GstMessage *msg;
- GstBus *bus;
- gboolean pipeline_works = FALSE;
- int i, j;
+ GstMessage *msg;
+ GstBus *bus;
+ gboolean pipeline_works = FALSE;
+ int i, j;
- static const char* GSTREAMER_VIDEO_SOURCES[] =
- {
+ static const char *GSTREAMER_VIDEO_SOURCES[] = {
"v4l2src",
"v4lsrc"
};
@@ -489,10 +490,10 @@
i = 0;
while (!pipeline_works && (i < G_N_ELEMENTS (GSTREAMER_VIDEO_SOURCES)))
{
- pipeline_desc = g_strdup_printf ("%s name=source device=%s ! fakesink",
+ pipeline_desc = g_strdup_printf ("%s name=source device=%s ! fakesink",
GSTREAMER_VIDEO_SOURCES[i],
webcam_device->video_device);
- err = NULL;
+ err = NULL;
pipeline = gst_parse_launch (pipeline_desc, &err);
if ((pipeline != NULL) && (err == NULL))
{
@@ -504,19 +505,19 @@
bus = gst_element_get_bus (pipeline);
msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);
gst_object_unref (bus);
-
+
if ((msg == NULL) && (ret == GST_STATE_CHANGE_SUCCESS))
{
GstElement *src;
- GstPad* pad;
- char *name;
- GstCaps *caps;
-
+ GstPad *pad;
+ char *name;
+ GstCaps *caps;
+
pipeline_works = TRUE;
gst_element_set_state (pipeline, GST_STATE_PAUSED);
webcam_device->gstreamer_src = g_strdup (GSTREAMER_VIDEO_SOURCES[i]);
- src = gst_bin_get_by_name (GST_BIN (pipeline), "source");
+ src = gst_bin_get_by_name (GST_BIN (pipeline), "source");
g_object_get (G_OBJECT (src), "device-name", &name, NULL);
if (name == NULL)
@@ -524,8 +525,8 @@
g_print ("Detected webcam: %s\n", name);
webcam_device->product_name = g_strdup (name);
- pad = gst_element_get_pad (src, "src");
- caps = gst_pad_get_caps (pad);
+ pad = gst_element_get_pad (src, "src");
+ caps = gst_pad_get_caps (pad);
gst_object_unref (pad);
cheese_webcam_get_supported_video_formats (webcam_device, caps);
gst_caps_unref (caps);
@@ -543,15 +544,14 @@
for (i = 0; i < webcam_device->num_video_formats; i++)
{
CheeseVideoFormat video_format;
-
+
video_format = g_array_index (webcam_device->video_formats, CheeseVideoFormat, i);
- g_hash_table_insert (priv->supported_resolutions,
+ g_hash_table_insert (priv->supported_resolutions,
g_strdup_printf ("%ix%i", video_format.width,
- video_format.height),
- &g_array_index (webcam_device->video_formats,
- CheeseVideoFormat,
- i));
- g_print ("%s %d x %d num_framerates %d\n", video_format.mimetype, video_format.width,
+ video_format.height),
+ &g_array_index (webcam_device->video_formats,
+ CheeseVideoFormat, i));
+ g_print ("%s %d x %d num_framerates %d\n", video_format.mimetype, video_format.width,
video_format.height, video_format.num_framerates);
for (j = 0; j < video_format.num_framerates; j++)
{
@@ -566,18 +566,19 @@
cheese_webcam_create_fake_format (CheeseWebcam *webcam)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
CheeseVideoFormat format;
-
+
/* Right now just emulate one format: video/x-raw-yuv, 320x240 @ 30 Hz */
-
- format.mimetype = g_strdup ("video/x-raw-yuv");
- format.width = 320;
- format.height = 240;
- format.num_framerates = 1;
- format.framerates = g_new0 (CheeseFramerate, 1);
- format.framerates[0].numerator = 30;
+
+ format.mimetype = g_strdup ("video/x-raw-yuv");
+ format.width = 320;
+ format.height = 240;
+ format.num_framerates = 1;
+ format.framerates = g_new0 (CheeseFramerate, 1);
+ format.framerates[0].numerator = 30;
format.framerates[0].denominator = 1;
-
+
g_array_append_val (priv->webcam_devices[0].video_formats, format);
priv->current_format = &format;
}
@@ -585,115 +586,120 @@
static void
cheese_webcam_detect_webcam_devices (CheeseWebcam *webcam)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
int i;
cheese_webcam_get_video_devices_from_hal (webcam);
- for (i = 0; i < priv->num_webcam_devices; i++)
+ for (i = 0; i < priv->num_webcam_devices; i++)
{
cheese_webcam_get_webcam_device_data (webcam, &(priv->webcam_devices[i]));
}
-
+
if (priv->num_webcam_devices == 0)
- cheese_webcam_create_fake_format (webcam);
+ cheese_webcam_create_fake_format (webcam);
}
static void
-find_highest_framerate (CheeseVideoFormat *format, int *numerator,
+find_highest_framerate (CheeseVideoFormat *format, int *numerator,
int *denominator)
{
int framerate_numerator;
int framerate_denominator;
int i;
-
+
/* Select the highest framerate up to 30 Hz*/
- framerate_numerator = 1;
+ framerate_numerator = 1;
framerate_denominator = 1;
for (i = 0; i < format->num_framerates; i++)
{
float framerate = format->framerates[i].numerator / format->framerates[i].denominator;
- if (framerate > ((float)framerate_numerator / framerate_denominator)
+ if (framerate > ((float) framerate_numerator / framerate_denominator)
&& framerate <= 30)
{
- framerate_numerator = format->framerates[i].numerator;
- framerate_denominator = format->framerates[i].denominator;
+ framerate_numerator = format->framerates[i].numerator;
+ framerate_denominator = format->framerates[i].denominator;
}
}
-
- *numerator = framerate_numerator;
+
+ *numerator = framerate_numerator;
*denominator = framerate_denominator;
}
-static gboolean
+static gboolean
cheese_webcam_create_webcam_source_bin (CheeseWebcam *webcam)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
GError *err = NULL;
- char *webcam_input;
+ char *webcam_input;
if (priv->num_webcam_devices == 0)
{
- priv->webcam_source_bin = gst_parse_bin_from_description ("videotestsrc name=video_source ! capsfilter name=capsfilter ! identity",
- TRUE, &err);
+ priv->webcam_source_bin = gst_parse_bin_from_description (
+ "videotestsrc name=video_source ! capsfilter name=capsfilter ! identity",
+ TRUE,
+ &err);
}
else
{
- CheeseVideoFormat *format;
- int i;
- int framerate_numerator, framerate_denominator;
- gchar *resolution;
+ CheeseVideoFormat *format;
+ int i;
+ int framerate_numerator, framerate_denominator;
+ gchar *resolution;
/* If we have a matching video device use that one, otherwise use the first */
priv->selected_device = 0;
- format = NULL;
- for (i = 1; i < priv->num_webcam_devices ; i++)
+ format = NULL;
+ for (i = 1; i < priv->num_webcam_devices; i++)
{
- if (g_strcmp0 (priv->webcam_devices[i].video_device, priv->device_name) == 0)
- priv->selected_device = i;
+ if (g_strcmp0 (priv->webcam_devices[i].video_device, priv->device_name) == 0)
+ priv->selected_device = i;
}
CheeseWebcamDevice *selected_webcam = &(priv->webcam_devices[priv->selected_device]);
- resolution = g_strdup_printf ("%ix%i", priv->x_resolution,
+ resolution = g_strdup_printf ("%ix%i", priv->x_resolution,
priv->y_resolution);
- /* Use the previously set resolution from gconf if it is set and the
+ /* Use the previously set resolution from gconf if it is set and the
* camera supports it. */
if (priv->x_resolution != 0 && priv->y_resolution != 0)
format = g_hash_table_lookup (priv->supported_resolutions, resolution);
-
+
if (!format)
- {
+ {
/* Select the highest resolution */
- format = &(g_array_index (selected_webcam->video_formats,
+ format = &(g_array_index (selected_webcam->video_formats,
CheeseVideoFormat, 0));
for (i = 1; i < selected_webcam->num_video_formats; i++)
{
- if (g_array_index (selected_webcam->video_formats,
- CheeseVideoFormat, i).width > format->width)
+ if (g_array_index (selected_webcam->video_formats,
+ CheeseVideoFormat, i).width > format->width)
{
- format = &(g_array_index (selected_webcam->video_formats,
+ format = &(g_array_index (selected_webcam->video_formats,
CheeseVideoFormat, i));
}
}
}
-
+
priv->current_format = format;
g_free (resolution);
-
+
if (format == NULL)
goto fallback;
- find_highest_framerate (format, &framerate_numerator,
+ find_highest_framerate (format, &framerate_numerator,
&framerate_denominator);
- webcam_input = g_strdup_printf ("%s name=video_source device=%s ! capsfilter name=capsfilter caps=%s,width=%d,height=%d,framerate=%d/%d ! identity",
- selected_webcam->gstreamer_src,
- selected_webcam->video_device,
- format->mimetype,
- format->width,
- format->height,
- framerate_numerator,
- framerate_denominator);
+ webcam_input = g_strdup_printf (
+ "%s name=video_source device=%s ! capsfilter name=capsfilter caps=%s,width=%d,height=%d,framerate=%d/%d ! identity",
+ selected_webcam->gstreamer_src,
+ selected_webcam->video_device,
+ format->mimetype,
+ format->width,
+ format->height,
+ framerate_numerator,
+ framerate_denominator);
g_print ("%s\n", webcam_input);
priv->webcam_source_bin = gst_parse_bin_from_description (webcam_input,
@@ -705,8 +711,7 @@
}
priv->video_source = gst_bin_get_by_name (GST_BIN (priv->webcam_source_bin), "video_source");
- priv->capsfilter = gst_bin_get_by_name (GST_BIN (priv->webcam_source_bin),
- "capsfilter");
+ priv->capsfilter = gst_bin_get_by_name (GST_BIN (priv->webcam_source_bin), "capsfilter");
return TRUE;
fallback:
@@ -717,19 +722,19 @@
}
priv->webcam_source_bin = gst_parse_bin_from_description ("videotestsrc name=video_source",
- TRUE, &err);
+ TRUE, &err);
priv->video_source = gst_bin_get_by_name (GST_BIN (priv->webcam_source_bin), "video_source");
if (err != NULL)
{
g_error_free (err);
return FALSE;
}
- priv->capsfilter = gst_bin_get_by_name (GST_BIN (priv->webcam_source_bin),
+ priv->capsfilter = gst_bin_get_by_name (GST_BIN (priv->webcam_source_bin),
"capsfilter");
return TRUE;
}
-static void
+static void
cheese_webcam_set_error_element_not_found (GError **error, const char *factoryname)
{
if (error == NULL)
@@ -743,17 +748,17 @@
{
/* Ensure that what is found is not a substring of an element; all strings
* should have a ' ' or nothing to the left and a '.' or ',' to the right */
- gchar *found = g_strrstr((*error)->message, factoryname);
- gchar prev = 0;
- gchar next = 0;
+ gchar *found = g_strrstr ((*error)->message, factoryname);
+ gchar prev = 0;
+ gchar next = 0;
if (found != NULL)
{
prev = *(found - 1);
- next = *(found + strlen(factoryname));
+ next = *(found + strlen (factoryname));
}
- if (found == NULL ||
+ if (found == NULL ||
((found != (*error)->message && prev != ' ') && /* Prefix check */
(next != ',' && next != '.'))) /* Postfix check */
{
@@ -766,10 +771,11 @@
cheese_webcam_create_video_display_bin (CheeseWebcam *webcam, GError **error)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
GstElement *tee, *video_display_queue, *video_scale, *video_sink, *save_queue;
gboolean ok;
- GstPad *pad;
+ GstPad *pad;
priv->video_display_bin = gst_bin_new ("video_display_bin");
@@ -788,7 +794,7 @@
{
cheese_webcam_set_error_element_not_found (error, "tee");
}
-
+
if ((save_queue = gst_element_factory_make ("queue", "save_queue")) == NULL)
{
cheese_webcam_set_error_element_not_found (error, "queue");
@@ -817,11 +823,11 @@
if (error != NULL && *error != NULL)
return FALSE;
- gst_bin_add_many (GST_BIN (priv->video_display_bin), priv->webcam_source_bin,
- priv->effect_filter, priv->csp_post_effect, tee, save_queue,
+ gst_bin_add_many (GST_BIN (priv->video_display_bin), priv->webcam_source_bin,
+ priv->effect_filter, priv->csp_post_effect, tee, save_queue,
video_display_queue, video_scale, video_sink, NULL);
- ok = gst_element_link_many (priv->webcam_source_bin, priv->effect_filter,
+ ok = gst_element_link_many (priv->webcam_source_bin, priv->effect_filter,
priv->csp_post_effect, tee, NULL);
ok &= gst_element_link_many (tee, save_queue, NULL);
@@ -843,10 +849,11 @@
cheese_webcam_create_photo_save_bin (CheeseWebcam *webcam, GError **error)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
GstElement *csp_photo_save_bin;
gboolean ok;
- GstPad *pad;
+ GstPad *pad;
GstCaps *caps;
priv->photo_save_bin = gst_bin_new ("photo_save_bin");
@@ -872,9 +879,9 @@
gst_object_unref (GST_OBJECT (pad));
caps = gst_caps_new_simple ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, 24,
- "depth", G_TYPE_INT, 24,
- NULL);
+ "bpp", G_TYPE_INT, 24,
+ "depth", G_TYPE_INT, 24,
+ NULL);
ok = gst_element_link_filtered (csp_photo_save_bin, priv->photo_sink, caps);
gst_caps_unref (caps);
@@ -886,7 +893,7 @@
return TRUE;
}
-static gboolean
+static gboolean
cheese_webcam_create_video_save_bin (CheeseWebcam *webcam, GError **error)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
@@ -894,8 +901,8 @@
GstElement *audio_queue, *audio_convert, *audio_enc;
GstElement *video_save_csp, *video_save_rate, *video_save_scale, *video_enc;
GstElement *mux;
- GstPad *pad;
- gboolean ok;
+ GstPad *pad;
+ gboolean ok;
priv->video_save_bin = gst_bin_new ("video_save_bin");
@@ -913,7 +920,7 @@
}
if ((audio_enc = gst_element_factory_make ("vorbisenc", "audio_enc")) == NULL)
{
- cheese_webcam_set_error_element_not_found (error, "vorbisenc");
+ cheese_webcam_set_error_element_not_found (error, "vorbisenc");
}
if ((video_save_csp = gst_element_factory_make ("ffmpegcolorspace", "video_save_csp")) == NULL)
@@ -956,7 +963,7 @@
return FALSE;
gst_bin_add_many (GST_BIN (priv->video_save_bin), priv->audio_source, audio_queue,
- audio_convert, audio_enc, video_save_csp, video_save_rate, video_save_scale, video_enc,
+ audio_convert, audio_enc, video_save_csp, video_save_rate, video_save_scale, video_enc,
mux, priv->video_file_sink, NULL);
/* add ghostpad */
@@ -965,7 +972,7 @@
gst_object_unref (GST_OBJECT (pad));
- ok = gst_element_link_many (priv->audio_source, audio_queue, audio_convert,
+ ok = gst_element_link_many (priv->audio_source, audio_queue, audio_convert,
audio_enc, mux, priv->video_file_sink, NULL);
ok &= gst_element_link_many (video_save_csp, video_save_rate, video_save_scale, video_enc,
@@ -981,71 +988,74 @@
int
cheese_webcam_get_num_webcam_devices (CheeseWebcam *webcam)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
return priv->num_webcam_devices;
}
-gboolean
+gboolean
cheese_webcam_switch_webcam_device (CheeseWebcam *webcam)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- gboolean was_recording = FALSE;
- gboolean pipeline_was_playing = FALSE;
- gboolean disp_bin_created = FALSE;
- gboolean disp_bin_added = FALSE;
- gboolean disp_bin_linked = FALSE;
- GError *error = NULL;
-
+
+ gboolean was_recording = FALSE;
+ gboolean pipeline_was_playing = FALSE;
+ gboolean disp_bin_created = FALSE;
+ gboolean disp_bin_added = FALSE;
+ gboolean disp_bin_linked = FALSE;
+ GError *error = NULL;
+
if (priv->is_recording)
{
cheese_webcam_stop_video_recording (webcam);
was_recording = TRUE;
}
-
+
if (priv->pipeline_is_playing)
{
cheese_webcam_stop (webcam);
pipeline_was_playing = TRUE;
}
-
+
gst_bin_remove (GST_BIN (priv->pipeline), priv->video_display_bin);
-
+
disp_bin_created = cheese_webcam_create_video_display_bin (webcam, &error);
if (!disp_bin_created)
{
return FALSE;
}
disp_bin_added = gst_bin_add (GST_BIN (priv->pipeline), priv->video_display_bin);
- if (!disp_bin_added)
+ if (!disp_bin_added)
{
gst_object_sink (priv->video_display_bin);
return FALSE;
}
-
+
disp_bin_linked = gst_element_link (priv->video_display_bin, priv->photo_save_bin);
if (!disp_bin_linked)
{
gst_bin_remove (GST_BIN (priv->pipeline), priv->video_display_bin);
return FALSE;
}
-
+
if (pipeline_was_playing)
{
cheese_webcam_play (webcam);
}
-
+
/* if (was_recording)
- {
- Restart recording... ?
- } */
-
+ * {
+ * Restart recording... ?
+ * } */
+
return TRUE;
}
void
cheese_webcam_play (CheeseWebcam *webcam)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
GstStateChangeReturn ret;
ret = gst_element_set_state (priv->pipeline, GST_STATE_PLAYING);
@@ -1054,10 +1064,11 @@
priv->pipeline_is_playing = TRUE;
}
-void
+void
cheese_webcam_stop (CheeseWebcam *webcam)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
gst_element_set_state (priv->pipeline, GST_STATE_NULL);
priv->pipeline_is_playing = FALSE;
}
@@ -1065,12 +1076,14 @@
static void
cheese_webcam_change_effect_filter (CheeseWebcam *webcam, GstElement *new_filter)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
gboolean is_playing = priv->pipeline_is_playing;
gboolean ok;
+
cheese_webcam_stop (webcam);
- gst_element_unlink_many (priv->webcam_source_bin, priv->effect_filter,
+ gst_element_unlink_many (priv->webcam_source_bin, priv->effect_filter,
priv->csp_post_effect, NULL);
gst_bin_remove (GST_BIN (priv->video_display_bin), priv->effect_filter);
@@ -1089,12 +1102,12 @@
void
cheese_webcam_set_effect (CheeseWebcam *webcam, CheeseWebcamEffect effect)
{
- GString *rgb_effects_str = g_string_new ("");
- GString *yuv_effects_str = g_string_new ("");
- char *effects_pipeline_desc;
- int i;
+ GString *rgb_effects_str = g_string_new ("");
+ GString *yuv_effects_str = g_string_new ("");
+ char *effects_pipeline_desc;
+ int i;
GstElement *effect_filter;
- GError *err = NULL;
+ GError *err = NULL;
for (i = 0; i < NUM_EFFECTS; i++)
{
@@ -1113,7 +1126,7 @@
}
}
effects_pipeline_desc = g_strconcat ("ffmpegcolorspace ! ",
- rgb_effects_str->str,
+ rgb_effects_str->str,
"ffmpegcolorspace",
yuv_effects_str->str,
NULL);
@@ -1134,10 +1147,10 @@
void
cheese_webcam_start_video_recording (CheeseWebcam *webcam, char *filename)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
g_object_set (CHEESE_WEBCAM_GET_PRIVATE (webcam)->video_file_sink, "location", filename, NULL);
- cheese_webcam_change_sink (webcam, priv->video_display_bin,
+ cheese_webcam_change_sink (webcam, priv->video_display_bin,
priv->video_save_bin, priv->photo_save_bin);
priv->is_recording = TRUE;
}
@@ -1145,7 +1158,7 @@
void
cheese_webcam_stop_video_recording (CheeseWebcam *webcam)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
/* Send EOS message down the pipeline by stopping video and audio source*/
gst_element_send_event (priv->video_source, gst_event_new_eos ());
@@ -1155,13 +1168,15 @@
void
cheese_webcam_take_photo (CheeseWebcam *webcam, char *filename)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
g_free (priv->photo_filename);
priv->photo_filename = g_strdup (filename);
+
/* Take the photo by connecting the handoff signal */
- priv->photo_handler_signal_id = g_signal_connect (G_OBJECT (priv->photo_sink),
+ priv->photo_handler_signal_id = g_signal_connect (G_OBJECT (priv->photo_sink),
"handoff",
- G_CALLBACK (cheese_webcam_photo_data_cb),
+ G_CALLBACK (cheese_webcam_photo_data_cb),
webcam);
cheese_flash_fire (priv->flash);
}
@@ -1170,14 +1185,14 @@
cheese_webcam_finalize (GObject *object)
{
CheeseWebcam *webcam;
- int i, j;
+ int i, j;
webcam = CHEESE_WEBCAM (object);
- CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
cheese_webcam_stop (webcam);
gst_object_unref (priv->pipeline);
-
+
if (priv->is_recording)
gst_object_unref (priv->photo_save_bin);
else
@@ -1198,7 +1213,7 @@
g_array_free (priv->webcam_devices[i].video_formats, TRUE);
}
g_free (priv->webcam_devices);
-
+
g_hash_table_destroy (priv->supported_resolutions);
G_OBJECT_CLASS (cheese_webcam_parent_class)->finalize (object);
@@ -1209,10 +1224,11 @@
GParamSpec *pspec)
{
CheeseWebcam *self;
+
self = CHEESE_WEBCAM (object);
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (self);
- switch (prop_id)
+ switch (prop_id)
{
case PROP_VIDEO_WINDOW:
g_value_set_pointer (value, priv->video_window);
@@ -1237,15 +1253,16 @@
GParamSpec *pspec)
{
CheeseWebcam *self;
+
self = CHEESE_WEBCAM (object);
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (self);
- switch (prop_id)
+ switch (prop_id)
{
case PROP_VIDEO_WINDOW:
priv->video_window = g_value_get_pointer (value);
- g_signal_connect (priv->video_window, "expose-event",
- G_CALLBACK(cheese_webcam_expose_cb), self);
+ g_signal_connect (priv->video_window, "expose-event",
+ G_CALLBACK (cheese_webcam_expose_cb), self);
break;
case PROP_DEVICE_NAME:
g_free (priv->device_name);
@@ -1256,7 +1273,7 @@
break;
case PROP_Y_RESOLUTION:
priv->y_resolution = g_value_get_int (value);
- break;
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1267,39 +1284,40 @@
cheese_webcam_class_init (CheeseWebcamClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = cheese_webcam_finalize;
+
+ object_class->finalize = cheese_webcam_finalize;
object_class->get_property = cheese_webcam_get_property;
object_class->set_property = cheese_webcam_set_property;
- webcam_signals [PHOTO_SAVED] = g_signal_new ("photo-saved", G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (CheeseWebcamClass, photo_saved),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- webcam_signals [VIDEO_SAVED] = g_signal_new ("video-saved", G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (CheeseWebcamClass, video_saved),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ webcam_signals[PHOTO_SAVED] = g_signal_new ("photo-saved", G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (CheeseWebcamClass, photo_saved),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ webcam_signals[VIDEO_SAVED] = g_signal_new ("video-saved", G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (CheeseWebcamClass, video_saved),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
g_object_class_install_property (object_class, PROP_VIDEO_WINDOW,
g_param_spec_pointer ("video-window",
- NULL,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_DEVICE_NAME,
- g_param_spec_string ("device-name",
NULL,
NULL,
- "",
G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_X_RESOLUTION,
+
+ g_object_class_install_property (object_class, PROP_DEVICE_NAME,
+ g_param_spec_string ("device-name",
+ NULL,
+ NULL,
+ "",
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_X_RESOLUTION,
g_param_spec_int ("x-resolution",
NULL,
NULL,
@@ -1308,8 +1326,8 @@
0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property (object_class, PROP_Y_RESOLUTION,
+
+ g_object_class_install_property (object_class, PROP_Y_RESOLUTION,
g_param_spec_int ("y-resolution",
NULL,
NULL,
@@ -1326,53 +1344,54 @@
static void
cheese_webcam_init (CheeseWebcam *webcam)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- priv->is_recording = FALSE;
+ priv->is_recording = FALSE;
priv->pipeline_is_playing = FALSE;
- priv->photo_filename = NULL;
- priv->webcam_devices = NULL;
- priv->device_name = NULL;
-
- priv->supported_resolutions = g_hash_table_new_full (g_str_hash,
+ priv->photo_filename = NULL;
+ priv->webcam_devices = NULL;
+ priv->device_name = NULL;
+
+ priv->supported_resolutions = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free, NULL);
priv->flash = cheese_flash_new ();
}
-CheeseWebcam*
-cheese_webcam_new (GtkWidget* video_window, char *webcam_device_name,
+CheeseWebcam *
+cheese_webcam_new (GtkWidget *video_window, char *webcam_device_name,
int x_resolution, int y_resolution)
{
CheeseWebcam *webcam;
-
+
if (webcam_device_name)
{
- webcam = g_object_new (CHEESE_TYPE_WEBCAM, "video-window", video_window,
- "device_name", webcam_device_name,
- "x-resolution", x_resolution,
+ webcam = g_object_new (CHEESE_TYPE_WEBCAM, "video-window", video_window,
+ "device_name", webcam_device_name,
+ "x-resolution", x_resolution,
"y-resolution", y_resolution, NULL);
}
else
{
- webcam = g_object_new (CHEESE_TYPE_WEBCAM, "video-window", video_window,
- "x-resolution", x_resolution,
+ webcam = g_object_new (CHEESE_TYPE_WEBCAM, "video-window", video_window,
+ "x-resolution", x_resolution,
"y-resolution", y_resolution, NULL);
}
-
+
return webcam;
}
void
cheese_webcam_setup (CheeseWebcam *webcam, char *hal_dev_udi, GError **error)
{
- CheeseWebcamPrivate* priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- gboolean ok = TRUE;
- GError *tmp_error = NULL;
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
+ gboolean ok = TRUE;
+ GError *tmp_error = NULL;
cheese_webcam_detect_webcam_devices (webcam);
-
+
if (hal_dev_udi != NULL)
{
cheese_webcam_set_device_by_dev_udi (webcam, hal_dev_udi);
@@ -1392,7 +1411,7 @@
return;
}
- gst_bin_add_many (GST_BIN (priv->pipeline), priv->video_display_bin,
+ gst_bin_add_many (GST_BIN (priv->pipeline), priv->video_display_bin,
priv->photo_save_bin, NULL);
ok = gst_element_link (priv->video_display_bin, priv->photo_save_bin);
@@ -1405,22 +1424,23 @@
if (!ok)
g_error ("Unable link pipeline for photo");
-
}
-int
+int
cheese_webcam_get_selected_device_index (CheeseWebcam *webcam)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
return priv->selected_device;
}
GArray *
cheese_webcam_get_webcam_devices (CheeseWebcam *webcam)
{
- GArray *devices_arr;
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ GArray *devices_arr;
+
devices_arr = g_array_sized_new (FALSE,
TRUE,
sizeof (CheeseWebcamDevice),
@@ -1441,7 +1461,9 @@
cheese_webcam_set_device_by_dev_udi (CheeseWebcam *webcam, char *udi)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
int i;
+
for (i = 0; i < priv->num_webcam_devices; i++)
{
if (strcmp (priv->webcam_devices[i].hal_udi, udi) == 0)
@@ -1455,8 +1477,8 @@
GArray *
cheese_webcam_get_video_formats (CheeseWebcam *webcam)
{
- CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
-
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
return priv->webcam_devices[priv->selected_device].video_formats;
}
@@ -1464,24 +1486,25 @@
cheese_webcam_set_video_format (CheeseWebcam *webcam, CheeseVideoFormat *format)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+
GstCaps *new_caps;
- int framerate_numerator;
- int framerate_denominator;
-
+ int framerate_numerator;
+ int framerate_denominator;
+
find_highest_framerate (format, &framerate_numerator, &framerate_denominator);
-
+
new_caps = gst_caps_new_simple (format->mimetype,
- "width", G_TYPE_INT,
+ "width", G_TYPE_INT,
format->width,
- "height", G_TYPE_INT,
+ "height", G_TYPE_INT,
format->height,
- "framerate", GST_TYPE_FRACTION,
+ "framerate", GST_TYPE_FRACTION,
framerate_numerator,
framerate_denominator,
NULL);
-
+
priv->current_format = format;
-
+
cheese_webcam_stop (webcam);
g_object_set (priv->capsfilter, "caps", new_caps, NULL);
cheese_webcam_play (webcam);
@@ -1491,6 +1514,6 @@
cheese_webcam_get_current_video_format (CheeseWebcam *webcam)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
-
+
return priv->current_format;
}
Modified: trunk/src/cheese-webcam.h
==============================================================================
--- trunk/src/cheese-webcam.h (original)
+++ trunk/src/cheese-webcam.h Sat Aug 23 17:07:43 2008
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2008 Ryan zeigler <zeiglerr gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2008 Ryan zeigler <zeiglerr gmail com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -30,34 +30,34 @@
G_BEGIN_DECLS
#define CHEESE_TYPE_WEBCAM (cheese_webcam_get_type ())
-#define CHEESE_WEBCAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CHEESE_TYPE_WEBCAM, CheeseWebcam))
-#define CHEESE_WEBCAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CHEESE_TYPE_WEBCAM, CheeseWebcamClass))
-#define CHEESE_IS_WEBCAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CHEESE_TYPE_WEBCAM))
-#define CHEESE_IS_WEBCAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CHEESE_TYPE_WEBCAM))
+#define CHEESE_WEBCAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CHEESE_TYPE_WEBCAM, CheeseWebcam))
+#define CHEESE_WEBCAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), CHEESE_TYPE_WEBCAM, CheeseWebcamClass))
+#define CHEESE_IS_WEBCAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CHEESE_TYPE_WEBCAM))
+#define CHEESE_IS_WEBCAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CHEESE_TYPE_WEBCAM))
#define CHEESE_WEBCAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CHEESE_TYPE_WEBCAM, CheeseWebcamClass))
-typedef struct
+typedef struct
{
int numerator;
int denominator;
} CheeseFramerate;
-typedef struct
+typedef struct
{
char *mimetype;
- int width;
- int height;
- int num_framerates;
- CheeseFramerate *framerates;
+ int width;
+ int height;
+ int num_framerates;
+ CheeseFramerate *framerates;
} CheeseVideoFormat;
typedef struct
{
- char *video_device;
+ char *video_device;
char *hal_udi;
char *gstreamer_src;
- char *product_name;
- int num_video_formats;
+ char *product_name;
+ int num_video_formats;
GArray *video_formats;
} CheeseWebcamDevice;
@@ -86,16 +86,17 @@
typedef struct
{
GObjectClass parent_class;
- void (* photo_saved) (CheeseWebcam *webcam);
- void (* video_saved) (CheeseWebcam *webcam);
+ void (*photo_saved) (CheeseWebcam *webcam);
+ void (*video_saved) (CheeseWebcam *webcam);
} CheeseWebcamClass;
-GType cheese_webcam_get_type (void);
-CheeseWebcam *cheese_webcam_new (GtkWidget *video_window,
- char *webcam_device_name,
- int x_resolution,
- int y_resolution);
+GType cheese_webcam_get_type (void);
+CheeseWebcam *cheese_webcam_new (GtkWidget *video_window,
+ char *webcam_device_name,
+ int x_resolution,
+ int y_resolution);
+
CheeseVideoFormat *cheese_webcam_get_current_video_format (CheeseWebcam *webcam);
void cheese_webcam_setup (CheeseWebcam *webcam, char *udi, GError **error);
void cheese_webcam_play (CheeseWebcam *webcam);
@@ -107,14 +108,13 @@
gboolean cheese_webcam_has_webcam (CheeseWebcam *webcam);
int cheese_webcam_get_num_webcam_devices (CheeseWebcam *webcam);
int cheese_webcam_get_selected_device_index (CheeseWebcam *webcam);
-GArray *cheese_webcam_get_webcam_devices (CheeseWebcam *webcam);
-void cheese_webcam_set_device_by_dev_file (CheeseWebcam *webcam, char *file);
-void cheese_webcam_set_device_by_dev_udi (CheeseWebcam *webcam, char *udi);
+GArray * cheese_webcam_get_webcam_devices (CheeseWebcam *webcam);
+void cheese_webcam_set_device_by_dev_file (CheeseWebcam *webcam, char *file);
+void cheese_webcam_set_device_by_dev_udi (CheeseWebcam *webcam, char *udi);
gboolean cheese_webcam_switch_webcam_device (CheeseWebcam *webcam);
-GArray *cheese_webcam_get_video_formats (CheeseWebcam *webcam);
-void cheese_webcam_set_video_format (CheeseWebcam *webcam,
+GArray * cheese_webcam_get_video_formats (CheeseWebcam *webcam);
+void cheese_webcam_set_video_format (CheeseWebcam *webcam,
CheeseVideoFormat *format);
G_END_DECLS
#endif /* __CHEESE_WEBCAM_H__ */
-
Modified: trunk/src/cheese-window.c
==============================================================================
--- trunk/src/cheese-window.c (original)
+++ trunk/src/cheese-window.c Sat Aug 23 17:07:43 2008
@@ -1,10 +1,10 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
- * Copyright (C) 2008 Patryk Zawadzki <patrys pld-linux org>
- * Copyright (C) 2008 Ryan Zeigler <zeiglerr gmail com>
- * Copyright (C) 2008 Filippo Argiolas <filippo argiolas gmail com>
- * Copyright (C) 2008 Felix Kaser <f kaser gmx net>
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2008 Patryk Zawadzki <patrys pld-linux org>
+ * Copyright  2008 Ryan Zeigler <zeiglerr gmail com>
+ * Copyright  2008 Filippo Argiolas <filippo argiolas gmail com>
+ * Copyright  2008 Felix Kaser <f kaser gmx net>
*
* Licensed under the GNU General Public License Version 2
*
@@ -23,7 +23,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include "cheese-config.h"
+ #include "cheese-config.h"
#endif
#include <string.h>
@@ -40,7 +40,7 @@
#include <libebook/e-book.h>
#ifdef HILDON
-#include <hildon/hildon-program.h>
+ #include <hildon/hildon-program.h>
#endif
#include "cheese-countdown.h"
@@ -56,9 +56,9 @@
#include "cheese-no-camera.h"
#include "cheese-prefs-dialog.h"
-#define SHUTTER_SOUNDS 5
-#define FULLSCREEN_POPUP_HEIGHT 40
-#define FULLSCREEN_TIMEOUT 5*1000
+#define SHUTTER_SOUNDS 5
+#define FULLSCREEN_POPUP_HEIGHT 40
+#define FULLSCREEN_TIMEOUT 5 * 1000
#define FULLSCREEN_EFFECTS_TIMEOUT 15
typedef enum
@@ -74,14 +74,14 @@
CHEESE_RESPONSE_DELETE_ALL
} CheeseDeleteResponseType;
-#define CHEESE_BUTTON_SKIP _("_Skip")
-#define CHEESE_BUTTON_SKIP_ALL _("S_kip All")
+#define CHEESE_BUTTON_SKIP _("_Skip")
+#define CHEESE_BUTTON_SKIP_ALL _("S_kip All")
#define CHEESE_BUTTON_DELETE_ALL _("Delete _All")
-typedef struct
+typedef struct
{
gboolean recording;
-
+
gboolean isFullscreen;
/* UDI device requested on the command line */
@@ -95,12 +95,12 @@
WebcamMode webcam_mode;
CheeseGConf *gconf;
CheeseFileUtil *fileutil;
-
+
CheeseDbus *server;
GtkWidget *window;
GtkWidget *fullscreen_popup;
-
+
GtkWidget *notebook;
GtkWidget *notebook_bar;
GtkWidget *fullscreen_bar;
@@ -147,9 +147,9 @@
GtkWidget *take_picture_fullscreen;
#ifdef HILDON
- GtkWidget *main_hbox;
- GtkWidget *subwindow;
-#endif
+ GtkWidget *main_hbox;
+ GtkWidget *subwindow;
+#endif
GtkActionGroup *actions_account_photo;
GtkActionGroup *actions_countdown;
@@ -167,7 +167,7 @@
GtkActionGroup *actions_fullscreen;
GtkUIManager *ui_manager;
-
+
GSource *fullscreen_timeout_source;
int audio_play_counter;
@@ -176,8 +176,9 @@
void
cheese_window_bring_to_front (gpointer data)
{
- CheeseWindow *cheese_window = data;
- guint32 startup_timestamp = gdk_x11_get_server_time (GTK_WIDGET (cheese_window->window)->window);
+ CheeseWindow *cheese_window = data;
+ guint32 startup_timestamp = gdk_x11_get_server_time (GTK_WIDGET (cheese_window->window)->window);
+
gdk_x11_window_set_user_time (GTK_WIDGET (cheese_window->window)->window, startup_timestamp);
gtk_window_present (GTK_WINDOW (cheese_window->window));
@@ -187,17 +188,17 @@
static void
cheese_about_dialog_handle_url (GtkAboutDialog *dialog, const char *url, gpointer data)
{
- GError *error = NULL;
+ GError *error = NULL;
GtkWidget *error_dialog;
- gboolean ret;
+ gboolean ret;
ret = g_app_info_launch_default_for_uri (url, NULL, &error);
if (ret == FALSE)
{
- error_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
- _("Failed to open browser to show:\n%s"), url);
+ error_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ _("Failed to open browser to show:\n%s"), url);
gtk_dialog_run (GTK_DIALOG (error_dialog));
gtk_widget_destroy (error_dialog);
g_error_free (error);
@@ -208,20 +209,20 @@
static void
cheese_about_dialog_handle_email (GtkAboutDialog *dialog, const char *email, gpointer data)
{
- char *uri;
- GError *error = NULL;
+ char *uri;
+ GError *error = NULL;
GtkWidget *error_dialog;
- gboolean ret;
+ gboolean ret;
uri = g_strconcat ("mailto:", email, NULL);
ret = g_app_info_launch_default_for_uri (uri, NULL, &error);
if (ret == FALSE)
{
- error_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
- _("Failed to open email client to send message to:\n%s"), email);
+ error_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ _("Failed to open email client to send message to:\n%s"), email);
gtk_dialog_run (GTK_DIALOG (error_dialog));
gtk_widget_destroy (error_dialog);
g_error_free (error);
@@ -233,11 +234,12 @@
audio_play_get_filename (CheeseWindow *cheese_window)
{
char *filename;
+
if (cheese_window->audio_play_counter > 21)
- filename = g_strdup_printf ("%s/sounds/shutter%i.ogg", PACKAGE_DATADIR,
- g_random_int_range (0, SHUTTER_SOUNDS));
+ filename = g_strdup_printf ("%s/sounds/shutter%i.ogg", PACKAGE_DATADIR,
+ g_random_int_range (0, SHUTTER_SOUNDS));
else
- filename = g_strdup_printf ("%s/sounds/shutter0.ogg", PACKAGE_DATADIR);
+ filename = g_strdup_printf ("%s/sounds/shutter0.ogg", PACKAGE_DATADIR);
cheese_window->audio_play_counter++;
@@ -263,10 +265,11 @@
cheese_window->fullscreen_timeout_source = NULL;
}
-static gboolean
+static gboolean
cheese_window_fullscreen_timeout_cb (gpointer data)
{
CheeseWindow *cheese_window = data;
+
gtk_widget_hide_all (cheese_window->fullscreen_popup);
cheese_window_fullscreen_clear_timeout (cheese_window);
@@ -281,7 +284,7 @@
cheese_window_fullscreen_clear_timeout (cheese_window);
- //make a difference between effects page and video preview
+ /* make a difference between effects page and video preview */
if (gtk_notebook_get_current_page (GTK_NOTEBOOK (cheese_window->notebook)) == 0)
source = g_timeout_source_new (FULLSCREEN_TIMEOUT);
else
@@ -297,27 +300,28 @@
cheese_window_fullscreen_show_bar (CheeseWindow *cheese_window)
{
gtk_widget_show_all (cheese_window->fullscreen_popup);
- //show me the notebook with the buttons if the countdown was not triggered
+
+ /* show me the notebook with the buttons if the countdown was not triggered */
if (cheese_countdown_get_state (CHEESE_COUNTDOWN (cheese_window->countdown_fullscreen)) == 0)
gtk_notebook_set_current_page (GTK_NOTEBOOK (cheese_window->fullscreen_bar), 0);
}
static gboolean
-cheese_window_fullscreen_motion_notify_cb (GtkWidget *widget,
+cheese_window_fullscreen_motion_notify_cb (GtkWidget *widget,
GdkEventMotion *event,
- CheeseWindow *cheese_window)
+ CheeseWindow *cheese_window)
{
if (cheese_window->isFullscreen)
{
int height;
int width;
-
+
gtk_window_get_size (GTK_WINDOW (cheese_window->window), &width, &height);
- if (event->y > height-5)
+ if (event->y > height - 5)
{
cheese_window_fullscreen_show_bar (cheese_window);
}
-
+
cheese_window_fullscreen_set_timeout (cheese_window);
}
return FALSE;
@@ -326,10 +330,11 @@
static void
cheese_window_toggle_fullscreen (GtkWidget *widget, CheeseWindow *cheese_window)
{
- GdkColor bg_color = {0,0,0,0};
+ GdkColor bg_color = {0, 0, 0, 0};
GtkWidget *menubar;
+
menubar = gtk_ui_manager_get_widget (cheese_window->ui_manager, "/MainMenu");
-
+
if (!cheese_window->isFullscreen)
{
gtk_widget_hide (cheese_window->thumb_view);
@@ -337,10 +342,10 @@
gtk_widget_hide (menubar);
gtk_widget_hide (cheese_window->notebook_bar);
gtk_widget_modify_bg (cheese_window->window, GTK_STATE_NORMAL, &bg_color);
-
+
gtk_widget_add_events (cheese_window->window, GDK_POINTER_MOTION_MASK);
gtk_widget_add_events (cheese_window->screen, GDK_POINTER_MOTION_MASK);
-
+
g_signal_connect (cheese_window->window, "motion-notify-event",
G_CALLBACK (cheese_window_fullscreen_motion_notify_cb),
cheese_window);
@@ -356,15 +361,15 @@
gtk_widget_show_all (cheese_window->window);
gtk_widget_hide_all (cheese_window->fullscreen_popup);
gtk_widget_modify_bg (cheese_window->window, GTK_STATE_NORMAL, NULL);
-
- g_signal_handlers_disconnect_by_func (cheese_window->window,
- (gpointer) cheese_window_fullscreen_motion_notify_cb, cheese_window);
- g_signal_handlers_disconnect_by_func (cheese_window->screen,
- (gpointer) cheese_window_fullscreen_motion_notify_cb, cheese_window);
-
+
+ g_signal_handlers_disconnect_by_func (cheese_window->window,
+ (gpointer) cheese_window_fullscreen_motion_notify_cb, cheese_window);
+ g_signal_handlers_disconnect_by_func (cheese_window->screen,
+ (gpointer) cheese_window_fullscreen_motion_notify_cb, cheese_window);
+
gtk_window_unfullscreen (GTK_WINDOW (cheese_window->window));
cheese_window->isFullscreen = FALSE;
-
+
cheese_window_fullscreen_clear_timeout (cheese_window);
}
}
@@ -373,13 +378,14 @@
cheese_window_exit_fullscreen_button_clicked_cb (GtkWidget *button, CheeseWindow *cheese_window)
{
GtkAction *action = gtk_ui_manager_get_action (cheese_window->ui_manager, "/MainMenu/Cheese/Fullscreen");
+
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), FALSE);
}
static gboolean
-cheese_window_fullscreen_leave_notify_cb (GtkWidget *widget,
+cheese_window_fullscreen_leave_notify_cb (GtkWidget *widget,
GdkEventCrossing *event,
- CheeseWindow *cheese_window)
+ CheeseWindow *cheese_window)
{
cheese_window_fullscreen_clear_timeout (cheese_window);
return FALSE;
@@ -387,8 +393,8 @@
static void
cheese_window_photo_saved_cb (CheeseWebcam *webcam, CheeseWindow *cheese_window)
-{
- // TODO look at this g_free
+{
+ /* TODO look at this g_free */
g_free (cheese_window->photo_filename);
cheese_window->photo_filename = NULL;
gtk_widget_set_sensitive (cheese_window->take_picture, TRUE);
@@ -398,7 +404,7 @@
static void
cheese_window_video_saved_cb (CheeseWebcam *webcam, CheeseWindow *cheese_window)
{
- // TODO look at this g_free
+ /* TODO look at this g_free */
g_free (cheese_window->video_filename);
cheese_window->video_filename = NULL;
gtk_action_group_set_sensitive (cheese_window->actions_effects, TRUE);
@@ -406,7 +412,6 @@
gtk_widget_set_sensitive (cheese_window->take_picture_fullscreen, TRUE);
}
-
static void
cheese_window_cmd_close (GtkWidget *widget, CheeseWindow *cheese_window)
{
@@ -436,23 +441,23 @@
static void
cheese_window_cmd_open (GtkWidget *widget, CheeseWindow *cheese_window)
{
- char *uri;
- char *filename;
- gboolean ret;
- GError *error = NULL;
+ char *uri;
+ char *filename;
+ gboolean ret;
+ GError *error = NULL;
GtkWidget *dialog;
filename = cheese_thumb_view_get_selected_image (CHEESE_THUMB_VIEW (cheese_window->thumb_view));
g_return_if_fail (filename);
uri = g_filename_to_uri (filename, NULL, NULL);
g_free (filename);
-
+
ret = g_app_info_launch_default_for_uri (uri, NULL, &error);
if (ret == FALSE)
{
- dialog = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ dialog = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
_("Failed to launch program to show:\n%s"), uri);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -465,9 +470,9 @@
cheese_window_cmd_save_as (GtkWidget *widget, CheeseWindow *cheese_window)
{
GtkWidget *dialog;
- int response;
- char *filename;
- char *basename;
+ int response;
+ char *filename;
+ char *basename;
filename = cheese_thumb_view_get_selected_image (CHEESE_THUMB_VIEW (cheese_window->thumb_view));
g_return_if_fail (filename);
@@ -481,7 +486,7 @@
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
- basename = g_path_get_basename (filename);
+ basename = g_path_get_basename (filename);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), basename);
g_free (basename);
@@ -490,8 +495,8 @@
if (response == GTK_RESPONSE_ACCEPT)
{
- char *target_filename;
- GError *error = NULL;
+ char *target_filename;
+ GError *error = NULL;
gboolean ok;
target_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
@@ -506,7 +511,7 @@
if (!ok)
{
- char *header;
+ char *header;
GtkWidget *dlg;
g_error_free (error);
@@ -530,9 +535,10 @@
static void
cheese_window_delete_error_dialog (CheeseWindow *cheese_window, GFile *file, gchar *message)
{
- gchar *primary, *secondary;
+ gchar *primary, *secondary;
GtkWidget *error_dialog;
- primary = g_strdup (_("Error while deleting"));
+
+ primary = g_strdup (_("Error while deleting"));
secondary = g_strdup_printf (_("The file \"%s\" cannot be deleted. Details: %s"),
g_file_get_basename (file), message);
error_dialog = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
@@ -549,12 +555,12 @@
static void
cheese_window_cmd_delete_file (CheeseWindow *cheese_window, GList *files, gboolean batch)
{
- GList *l = NULL;
- GError *error = NULL;
- gint list_length = g_list_length (files);
+ GList *l = NULL;
+ GError *error = NULL;
+ gint list_length = g_list_length (files);
GtkWidget *question_dialog;
- gint response;
- gchar *primary, *secondary;
+ gint response;
+ gchar *primary, *secondary;
if (batch == FALSE)
{
@@ -568,52 +574,50 @@
primary = g_strdup_printf (_("Are you sure you want to permanently delete \"%s\"?"),
g_file_get_basename (files->data));
}
- secondary = g_strdup_printf (_("If you delete an item, it will be permanently lost."));
+ secondary = g_strdup_printf (_("If you delete an item, it will be permanently lost."));
question_dialog = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", primary);
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (question_dialog),
- "%s", secondary);
- gtk_dialog_add_button (GTK_DIALOG (question_dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button (GTK_DIALOG (question_dialog), GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (question_dialog), "%s", secondary);
+ gtk_dialog_add_button (GTK_DIALOG (question_dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_button (GTK_DIALOG (question_dialog), GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
response = gtk_dialog_run (GTK_DIALOG (question_dialog));
gtk_widget_destroy (question_dialog);
g_free (primary);
g_free (secondary);
- if (response != GTK_RESPONSE_ACCEPT)
- return;
+ if (response != GTK_RESPONSE_ACCEPT)
+ return;
}
-
+
for (l = files; l != NULL; l = l->next)
{
g_print ("deleting %s\n", g_file_get_basename (l->data));
if (!g_file_delete (l->data, NULL, &error))
{
- cheese_window_delete_error_dialog (cheese_window, l->data,
+ cheese_window_delete_error_dialog (cheese_window, l->data,
error != NULL ? error->message : _("Unknown Error"));
g_error_free (error);
error = NULL;
- }
+ }
g_object_unref (l->data);
}
}
-
static void
cheese_window_cmd_move_file_to_trash (CheeseWindow *cheese_window, GList *files)
{
- GError *error = NULL;
- GList *l = NULL;
- GList *d = NULL;
- gchar *primary, *secondary;
+ GError *error = NULL;
+ GList *l = NULL;
+ GList *d = NULL;
+ gchar *primary, *secondary;
GtkWidget *question_dialog;
- gint response;
- gint list_length = g_list_length (files);
-
+ gint response;
+ gint list_length = g_list_length (files);
+
g_print ("received %d items to delete\n", list_length);
for (l = files; l != NULL; l = l->next)
- {
+ {
if (!g_file_test (g_file_get_path (l->data), G_FILE_TEST_EXISTS))
{
g_object_unref (l->data);
@@ -621,50 +625,53 @@
}
if (!g_file_trash (l->data, NULL, &error))
{
- primary = g_strdup (_("Cannot move file to trash, do you want to delete immediately?"));
+ primary = g_strdup (_("Cannot move file to trash, do you want to delete immediately?"));
secondary = g_strdup_printf (_("The file \"%s\" cannot be moved to the trash. Details: %s"),
g_file_get_basename (l->data), error->message);
question_dialog = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", primary);
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (question_dialog),
- "%s", secondary);
- gtk_dialog_add_button (GTK_DIALOG (question_dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (question_dialog), "%s", secondary);
+ gtk_dialog_add_button (GTK_DIALOG (question_dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
if (list_length > 1)
{
/* no need for all those buttons we have a single file to delete */
- gtk_dialog_add_button (GTK_DIALOG (question_dialog), CHEESE_BUTTON_SKIP, CHEESE_RESPONSE_SKIP);
- gtk_dialog_add_button (GTK_DIALOG (question_dialog), CHEESE_BUTTON_SKIP_ALL, CHEESE_RESPONSE_SKIP_ALL);
- gtk_dialog_add_button (GTK_DIALOG (question_dialog), CHEESE_BUTTON_DELETE_ALL, CHEESE_RESPONSE_DELETE_ALL);
+ gtk_dialog_add_button (GTK_DIALOG (question_dialog), CHEESE_BUTTON_SKIP, CHEESE_RESPONSE_SKIP);
+ gtk_dialog_add_button (GTK_DIALOG (question_dialog), CHEESE_BUTTON_SKIP_ALL, CHEESE_RESPONSE_SKIP_ALL);
+ gtk_dialog_add_button (GTK_DIALOG (question_dialog), CHEESE_BUTTON_DELETE_ALL, CHEESE_RESPONSE_DELETE_ALL);
}
- gtk_dialog_add_button (GTK_DIALOG (question_dialog), GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
+ gtk_dialog_add_button (GTK_DIALOG (question_dialog), GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
response = gtk_dialog_run (GTK_DIALOG (question_dialog));
gtk_widget_destroy (question_dialog);
g_free (primary);
g_free (secondary);
g_error_free (error);
error = NULL;
- switch (response)
+ switch (response)
{
- case CHEESE_RESPONSE_DELETE_ALL:
- /* forward the list to cmd_delete */
- cheese_window_cmd_delete_file (cheese_window, l, TRUE);
- return;
- case GTK_RESPONSE_ACCEPT:
- /* create a single file list for cmd_delete */
- d = g_list_append (d, g_object_ref (l->data));
- cheese_window_cmd_delete_file (cheese_window, d, TRUE);
- g_list_free (d);
- break;
- case CHEESE_RESPONSE_SKIP:
- /* do nothing, skip to the next item */
- break;
- case CHEESE_RESPONSE_SKIP_ALL:
- case GTK_RESPONSE_CANCEL:
- case GTK_RESPONSE_DELETE_EVENT:
- default:
- /* cancel the whole delete operation */
- return;
+ case CHEESE_RESPONSE_DELETE_ALL:
+
+ /* forward the list to cmd_delete */
+ cheese_window_cmd_delete_file (cheese_window, l, TRUE);
+ return;
+ case GTK_RESPONSE_ACCEPT:
+
+ /* create a single file list for cmd_delete */
+ d = g_list_append (d, g_object_ref (l->data));
+ cheese_window_cmd_delete_file (cheese_window, d, TRUE);
+ g_list_free (d);
+ break;
+ case CHEESE_RESPONSE_SKIP:
+
+ /* do nothing, skip to the next item */
+ break;
+ case CHEESE_RESPONSE_SKIP_ALL:
+ case GTK_RESPONSE_CANCEL:
+ case GTK_RESPONSE_DELETE_EVENT:
+ default:
+
+ /* cancel the whole delete operation */
+ return;
}
}
else
@@ -674,26 +681,26 @@
g_object_unref (l->data);
}
}
-
+
static void
cheese_window_move_all_media_to_trash (GtkWidget *widget, CheeseWindow *cheese_window)
{
- GtkWidget *dlg;
- char *prompt;
- int response;
- char *filename;
- GFile *file;
- GList *files_list = NULL;
- GDir *dir_videos, *dir_photos;
- char *path_videos, *path_photos;
+ GtkWidget *dlg;
+ char *prompt;
+ int response;
+ char *filename;
+ GFile *file;
+ GList *files_list = NULL;
+ GDir *dir_videos, *dir_photos;
+ char *path_videos, *path_photos;
const char *name;
prompt = g_strdup_printf (_("Really move all photos and videos to the trash?"));
- dlg = gtk_message_dialog_new_with_markup (GTK_WINDOW (cheese_window->window),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
- "<span weight=\"bold\" size=\"larger\">%s</span>",
- prompt);
+ dlg = gtk_message_dialog_new_with_markup (GTK_WINDOW (cheese_window->window),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
+ "<span weight=\"bold\" size=\"larger\">%s</span>",
+ prompt);
g_free (prompt);
gtk_dialog_add_button (GTK_DIALOG (dlg), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (dlg), _("_Move to Trash"), GTK_RESPONSE_OK);
@@ -704,59 +711,62 @@
response = gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
- if (response != GTK_RESPONSE_OK)
+ if (response != GTK_RESPONSE_OK)
return;
- //append all videos
+ /* append all videos */
path_videos = cheese_fileutil_get_video_path (cheese_window->fileutil);
- dir_videos = g_dir_open (path_videos, 0, NULL);
+ dir_videos = g_dir_open (path_videos, 0, NULL);
while ((name = g_dir_read_name (dir_videos)) != NULL)
{
if (g_str_has_suffix (name, VIDEO_NAME_SUFFIX))
{
filename = g_strjoin (G_DIR_SEPARATOR_S, path_videos, name, NULL);
- file = g_file_new_for_path (filename);
+ file = g_file_new_for_path (filename);
files_list = g_list_append (files_list, file);
g_free (filename);
}
}
g_dir_close (dir_videos);
- //append all photos
+
+ /* append all photos */
path_photos = cheese_fileutil_get_photo_path (cheese_window->fileutil);
- dir_photos = g_dir_open (path_photos, 0, NULL);
+ dir_photos = g_dir_open (path_photos, 0, NULL);
while ((name = g_dir_read_name (dir_photos)) != NULL)
{
if (g_str_has_suffix (name, PHOTO_NAME_SUFFIX))
{
filename = g_strjoin (G_DIR_SEPARATOR_S, path_photos, name, NULL);
- file = g_file_new_for_path (filename);
+ file = g_file_new_for_path (filename);
files_list = g_list_append (files_list, file);
g_free (filename);
}
}
- //delete all items
+
+ /* delete all items */
cheese_window_cmd_move_file_to_trash (cheese_window, files_list);
g_list_free (files_list);
g_dir_close (dir_photos);
}
- static void
+static void
cheese_window_delete_media (GtkWidget *widget, CheeseWindow *cheese_window)
{
GList *files_list = NULL;
+
files_list = cheese_thumb_view_get_selected_images_list (CHEESE_THUMB_VIEW (cheese_window->thumb_view));
-
+
cheese_window_cmd_delete_file (cheese_window, files_list, FALSE);
g_list_free (files_list);
}
-
static void
cheese_window_move_media_to_trash (GtkWidget *widget, CheeseWindow *cheese_window)
{
GList *files_list = NULL;
+
files_list = cheese_thumb_view_get_selected_images_list (CHEESE_THUMB_VIEW (cheese_window->thumb_view));
cheese_window_cmd_move_file_to_trash (cheese_window, files_list);
@@ -767,53 +777,54 @@
cheese_window_set_countdown (GtkWidget *widget, CheeseWindow *cheese_window)
{
gboolean countdown = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (widget));
+
g_object_set (cheese_window->gconf, "gconf_prop_countdown", countdown, NULL);
}
static void
cheese_window_cmd_set_about_me_photo (GtkWidget *widget, CheeseWindow *cheese_window)
{
- EContact *contact;
- EBook *book;
- GError *error = NULL;
+ EContact *contact;
+ EBook *book;
+ GError *error = NULL;
GdkPixbuf *pixbuf;
- const int MAX_PHOTO_HEIGHT = 150;
- const int MAX_PHOTO_WIDTH = 150;
- char *filename;
+ const int MAX_PHOTO_HEIGHT = 150;
+ const int MAX_PHOTO_WIDTH = 150;
+ char *filename;
filename = cheese_thumb_view_get_selected_image (CHEESE_THUMB_VIEW (cheese_window->thumb_view));
-
- if (e_book_get_self (&contact, &book, NULL) && filename)
+
+ if (e_book_get_self (&contact, &book, NULL) && filename)
{
char *name = e_contact_get (contact, E_CONTACT_FULL_NAME);
g_print ("Setting Account Photo for %s\n", name);
- pixbuf = gdk_pixbuf_new_from_file_at_scale (filename, MAX_PHOTO_HEIGHT,
+ pixbuf = gdk_pixbuf_new_from_file_at_scale (filename, MAX_PHOTO_HEIGHT,
MAX_PHOTO_WIDTH, TRUE, NULL);
if (contact)
{
EContactPhoto photo;
- guchar **data;
- gsize *length;
+ guchar **data;
+ gsize *length;
- photo.type = E_CONTACT_PHOTO_TYPE_INLINED;
+ photo.type = E_CONTACT_PHOTO_TYPE_INLINED;
photo.data.inlined.mime_type = "image/jpeg";
- data = &photo.data.inlined.data;
- length = &photo.data.inlined.length;
+ data = &photo.data.inlined.data;
+ length = &photo.data.inlined.length;
- gdk_pixbuf_save_to_buffer (pixbuf, (char **) data, length, "png", NULL,
- "compression", "9", NULL);
+ gdk_pixbuf_save_to_buffer (pixbuf, (char **) data, length, "png", NULL,
+ "compression", "9", NULL);
e_contact_set (contact, E_CONTACT_PHOTO, &photo);
- if (!e_book_commit_contact (book, contact, &error))
+ if (!e_book_commit_contact (book, contact, &error))
{
- char *header;
+ char *header;
GtkWidget *dlg;
header = g_strdup_printf (_("Could not set the Account Photo"));
- dlg = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", header);
+ dlg = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", header);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dlg), "%s", error->message);
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
@@ -827,14 +838,14 @@
}
}
-
static void
cheese_window_cmd_command_line (GtkAction *action, CheeseWindow *cheese_window)
{
- GError *error = NULL;
- char *command_line;
+ GError *error = NULL;
+ char *command_line;
const char *action_name;
- GList *files, *l;
+ GList *files, *l;
+
files = cheese_thumb_view_get_selected_images_list (CHEESE_THUMB_VIEW (cheese_window->thumb_view));
char *filename = cheese_thumb_view_get_selected_image (CHEESE_THUMB_VIEW (cheese_window->thumb_view));
@@ -845,7 +856,7 @@
command_line = g_strdup_printf ("gnome-open mailto:?subject='%s'", _("Media files"));
for (l = files; l != NULL; l = l->next)
{
- path = g_file_get_path (l->data);
+ path = g_file_get_path (l->data);
command_line = g_strjoin ("&attachment=", command_line, path, NULL);
g_free (path);
g_object_unref (l->data);
@@ -859,7 +870,7 @@
command_line = g_strdup_printf ("nautilus-sendto");
for (l = files; l != NULL; l = l->next)
{
- path = g_file_get_path (l->data);
+ path = g_file_get_path (l->data);
command_line = g_strjoin (" ", command_line, path, NULL);
g_free (path);
g_object_unref (l->data);
@@ -869,7 +880,7 @@
}
else if (strcmp (action_name, "ExportToFSpot") == 0)
{
- char *dirname = g_path_get_dirname (filename);
+ char *dirname = g_path_get_dirname (filename);
command_line = g_strdup_printf ("f-spot -i %s", dirname);
g_free (dirname);
}
@@ -879,7 +890,7 @@
command_line = g_strdup_printf ("postr");
for (l = files; l != NULL; l = l->next)
{
- path = g_file_get_path (l->data);
+ path = g_file_get_path (l->data);
command_line = g_strjoin (" ", command_line, path, NULL);
g_free (path);
g_object_unref (l->data);
@@ -901,21 +912,20 @@
g_free (command_line);
}
-
static void
cheese_window_cmd_help_contents (GtkAction *action, CheeseWindow *cheese_window)
{
- GError *error = NULL;
+ GError *error = NULL;
gboolean ret;
ret = g_app_info_launch_default_for_uri ("ghelp:cheese", NULL, &error);
- if (ret == FALSE)
+ if (ret == FALSE)
{
GtkWidget *d;
- d = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
+ d = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
_("Unable to open help file for Cheese"));
gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
@@ -967,6 +977,7 @@
};
const char *translators;
+
translators = _("translator-credits");
const char *license[] = {
@@ -1005,7 +1016,7 @@
}
static void
-cheese_window_selection_changed_cb (GtkIconView *iconview,
+cheese_window_selection_changed_cb (GtkIconView *iconview,
CheeseWindow *cheese_window)
{
if (cheese_thumb_view_get_n_selected (CHEESE_THUMB_VIEW (cheese_window->thumb_view)) > 0)
@@ -1029,7 +1040,7 @@
path = gtk_icon_view_get_path_at_pos (GTK_ICON_VIEW (iconview),
(int) event->x, (int) event->y);
if (path == NULL) return FALSE;
-
+
if (event->type == GDK_BUTTON_PRESS && event->button == 1)
{
if (cheese_thumb_view_get_n_selected (CHEESE_THUMB_VIEW (cheese_window->thumb_view)) > 1)
@@ -1045,12 +1056,12 @@
if (event)
{
- button = event->button;
+ button = event->button;
event_time = event->time;
}
else
{
- button = 0;
+ button = 0;
event_time = gtk_get_current_event_time ();
}
@@ -1062,8 +1073,8 @@
gtk_icon_view_set_cursor (GTK_ICON_VIEW (cheese_window->thumb_view), path, NULL, FALSE);
}
- GList *l, *files;
- gchar *file;
+ GList *l, *files;
+ gchar *file;
gboolean list_has_videos = FALSE;
files = cheese_thumb_view_get_selected_images_list (CHEESE_THUMB_VIEW (cheese_window->thumb_view));
@@ -1092,7 +1103,7 @@
gtk_action_group_set_sensitive (cheese_window->actions_fspot, TRUE);
gtk_action_group_set_sensitive (cheese_window->actions_account_photo, TRUE);
}
-
+
gtk_menu_popup (GTK_MENU (cheese_window->thumb_view_popup_menu),
NULL, iconview, NULL, NULL, button, event_time);
@@ -1124,10 +1135,9 @@
{
gtk_action_group_set_sensitive (cheese_window->actions_video, TRUE);
}
- cheese_webcam_set_effect (cheese_window->webcam,
+ cheese_webcam_set_effect (cheese_window->webcam,
cheese_effect_chooser_get_selection (CHEESE_EFFECT_CHOOSER (cheese_window->effect_chooser)));
- g_object_set (cheese_window->gconf,
- "gconf_prop_selected_effects",
+ g_object_set (cheese_window->gconf, "gconf_prop_selected_effects",
cheese_effect_chooser_get_selection_string (CHEESE_EFFECT_CHOOSER (cheese_window->effect_chooser)),
NULL);
}
@@ -1145,6 +1155,7 @@
cheese_window_countdown_hide_cb (gpointer data)
{
CheeseWindow *cheese_window = (CheeseWindow *) data;
+
gtk_notebook_set_current_page (GTK_NOTEBOOK (cheese_window->notebook_bar), 0);
gtk_notebook_set_current_page (GTK_NOTEBOOK (cheese_window->fullscreen_bar), 0);
}
@@ -1153,13 +1164,13 @@
cheese_window_countdown_picture_cb (gpointer data)
{
CheeseWindow *cheese_window = (CheeseWindow *) data;
- GError *error = NULL;
+ GError *error = NULL;
GstAudioPlay *audio_play;
- char *file;
+ char *file;
- file = audio_play_get_filename (cheese_window);
+ file = audio_play_get_filename (cheese_window);
audio_play = gst_audio_play_file (file, &error);
- if (!audio_play)
+ if (!audio_play)
{
g_warning ("%s", error ? error->message : "Unknown error");
g_error_free (error);
@@ -1174,19 +1185,19 @@
static void
cheese_window_no_camera_message_area_response (GtkWidget *widget, gint response_id, GtkWidget *cheese_window)
{
- GError *error = NULL;
+ GError *error = NULL;
gboolean ret;
if (response_id == GTK_RESPONSE_HELP)
{
ret = g_app_info_launch_default_for_uri ("ghelp:cheese?faq", NULL, &error);
- if (ret == FALSE)
+ if (ret == FALSE)
{
GtkWidget *d;
- d = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
+ d = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
_("Unable to open help file for Cheese"));
gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
@@ -1204,23 +1215,24 @@
gtk_action_group_set_sensitive (cheese_window->actions_effects, TRUE);
gtk_action_group_set_sensitive (cheese_window->actions_toggle, TRUE);
gtk_widget_set_sensitive (cheese_window->take_picture, FALSE);
- gchar * str = g_strconcat ("<b>", _("_Start Recording"), "</b>", NULL);
+ gchar *str = g_strconcat ("<b>", _("_Start Recording"), "</b>", NULL);
gtk_label_set_text_with_mnemonic (GTK_LABEL (cheese_window->label_take_photo), str);
gtk_label_set_text_with_mnemonic (GTK_LABEL (cheese_window->label_take_photo_fullscreen), str);
g_free (str);
gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo), TRUE);
gtk_image_set_from_stock (GTK_IMAGE (cheese_window->image_take_photo), GTK_STOCK_MEDIA_RECORD, GTK_ICON_SIZE_BUTTON);
gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo_fullscreen), TRUE);
- gtk_image_set_from_stock (GTK_IMAGE (cheese_window->image_take_photo_fullscreen), GTK_STOCK_MEDIA_RECORD, GTK_ICON_SIZE_BUTTON);
-
+ gtk_image_set_from_stock (GTK_IMAGE (cheese_window->image_take_photo_fullscreen),
+ GTK_STOCK_MEDIA_RECORD, GTK_ICON_SIZE_BUTTON);
+
cheese_window->recording = FALSE;
}
}
static gboolean
cheese_window_escape_key_cb (CheeseWindow *cheese_window,
- GtkAccelGroup *accel_group,
- guint keyval, GdkModifierType modifier)
+ GtkAccelGroup *accel_group,
+ guint keyval, GdkModifierType modifier)
{
if (cheese_window->isFullscreen)
{
@@ -1231,15 +1243,15 @@
return TRUE;
}
}
-
+
cheese_countdown_cancel ((CheeseCountdown *) cheese_window->countdown);
cheese_countdown_cancel ((CheeseCountdown *) cheese_window->countdown_fullscreen);
-
+
if (cheese_window->webcam_mode == WEBCAM_MODE_PHOTO)
{
gtk_notebook_set_current_page (GTK_NOTEBOOK (cheese_window->notebook_bar), 0);
gtk_notebook_set_current_page (GTK_NOTEBOOK (cheese_window->fullscreen_bar), 0);
-
+
gtk_widget_set_sensitive (cheese_window->take_picture, TRUE);
gtk_widget_set_sensitive (cheese_window->take_picture_fullscreen, TRUE);
}
@@ -1254,7 +1266,7 @@
cheese_window_action_button_clicked_cb (GtkWidget *widget, CheeseWindow *cheese_window)
{
char *str;
-
+
if (cheese_window->webcam_mode == WEBCAM_MODE_PHOTO)
{
gboolean countdown;
@@ -1268,8 +1280,9 @@
cheese_window_countdown_hide_cb,
(gpointer) cheese_window);
gtk_notebook_set_current_page (GTK_NOTEBOOK (cheese_window->fullscreen_bar), 1);
- //show bar, start timeout
- //ATTENTION: if the countdown is longer than FULLSCREEN_TIMEOUT, the bar will disapear before the countdown ends
+
+ /* show bar, start timeout
+ * ATTENTION: if the countdown is longer than FULLSCREEN_TIMEOUT, the bar will disapear before the countdown ends */
cheese_window_fullscreen_show_bar (cheese_window);
cheese_window_fullscreen_set_timeout (cheese_window);
}
@@ -1289,7 +1302,8 @@
gtk_widget_set_sensitive (cheese_window->take_picture, FALSE);
gtk_widget_set_sensitive (cheese_window->take_picture_fullscreen, FALSE);
- // FIXME: set menu inactive
+
+ /* FIXME: set menu inactive */
}
else if (cheese_window->webcam_mode == WEBCAM_MODE_VIDEO)
{
@@ -1304,9 +1318,11 @@
gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo), TRUE);
gtk_image_set_from_stock (GTK_IMAGE (cheese_window->image_take_photo), GTK_STOCK_MEDIA_STOP, GTK_ICON_SIZE_BUTTON);
gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo_fullscreen), TRUE);
- gtk_image_set_from_stock (GTK_IMAGE (cheese_window->image_take_photo_fullscreen), GTK_STOCK_MEDIA_STOP, GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_stock (GTK_IMAGE (cheese_window->image_take_photo_fullscreen),
+ GTK_STOCK_MEDIA_STOP, GTK_ICON_SIZE_BUTTON);
- cheese_window->video_filename = cheese_fileutil_get_new_media_filename (cheese_window->fileutil, WEBCAM_MODE_VIDEO);
+ cheese_window->video_filename = cheese_fileutil_get_new_media_filename (cheese_window->fileutil,
+ WEBCAM_MODE_VIDEO);
cheese_webcam_start_video_recording (cheese_window->webcam, cheese_window->video_filename);
cheese_window->recording = TRUE;
@@ -1318,7 +1334,7 @@
}
}
-static void
+static void
cheese_window_preferences_cb (GtkAction *action, CheeseWindow *cheese_window)
{
cheese_prefs_dialog_run (cheese_window->window, cheese_window->gconf,
@@ -1326,17 +1342,18 @@
}
static const GtkActionEntry action_entries_main[] = {
- {"Cheese", NULL, N_("_Cheese")},
-
- {"Edit", NULL, N_("_Edit")},
- {"RemoveAll", NULL, N_("Move All to Trash"), NULL, NULL, G_CALLBACK (cheese_window_move_all_media_to_trash)},
-
- {"Help", NULL, N_("_Help")},
-
- {"Quit", GTK_STOCK_QUIT, NULL, NULL, NULL, G_CALLBACK (cheese_window_cmd_close)},
- {"HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", N_("Help on this Application"), G_CALLBACK (cheese_window_cmd_help_contents)},
- {"About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK (cheese_window_cmd_about)},
+ {"Cheese", NULL, N_("_Cheese") },
+ {"Edit", NULL, N_("_Edit") },
+ {"RemoveAll", NULL, N_("Move All to Trash"), NULL, NULL,
+ G_CALLBACK (cheese_window_move_all_media_to_trash)},
+
+ {"Help", NULL, N_("_Help") },
+
+ {"Quit", GTK_STOCK_QUIT, NULL, NULL, NULL, G_CALLBACK (cheese_window_cmd_close)},
+ {"HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", N_("Help on this Application"),
+ G_CALLBACK (cheese_window_cmd_help_contents)},
+ {"About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK (cheese_window_cmd_about)},
};
static const GtkToggleActionEntry action_entries_countdown[] = {
@@ -1361,10 +1378,14 @@
};
static const GtkActionEntry action_entries_file[] = {
- {"Open", GTK_STOCK_OPEN, N_("_Open"), "<control>O", NULL, G_CALLBACK (cheese_window_cmd_open)},
- {"SaveAs", GTK_STOCK_SAVE_AS, N_("Save _As..."), "<control>S", NULL, G_CALLBACK (cheese_window_cmd_save_as)},
- {"MoveToTrash", "user-trash", N_("Move to _Trash"), "Delete", NULL, G_CALLBACK (cheese_window_move_media_to_trash)},
- {"Delete", NULL, N_("Delete"), "<shift>Delete", NULL, G_CALLBACK (cheese_window_delete_media)},
+ {"Open", GTK_STOCK_OPEN, N_("_Open"), "<control>O", NULL,
+ G_CALLBACK (cheese_window_cmd_open)},
+ {"SaveAs", GTK_STOCK_SAVE_AS, N_("Save _As..."), "<control>S", NULL,
+ G_CALLBACK (cheese_window_cmd_save_as)},
+ {"MoveToTrash", "user-trash", N_("Move to _Trash"), "Delete", NULL,
+ G_CALLBACK (cheese_window_move_media_to_trash)},
+ {"Delete", NULL, N_("Delete"), "<shift>Delete", NULL,
+ G_CALLBACK (cheese_window_delete_media)},
};
static const GtkActionEntry action_entries_photo[] = {
@@ -1399,9 +1420,11 @@
cheese_window_activate_radio_action (GtkAction *action, GtkRadioAction *current, CheeseWindow *cheese_window)
{
gchar *str;
+
if (strcmp (gtk_action_get_name (GTK_ACTION (current)), "Photo") == 0)
{
cheese_window->webcam_mode = WEBCAM_MODE_PHOTO;
+
str = g_strconcat ("<b>", _("_Take a Photo"), "</b>", NULL);
gtk_label_set_text_with_mnemonic (GTK_LABEL (cheese_window->label_take_photo), g_strdup (str));
gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo), TRUE);
@@ -1413,7 +1436,7 @@
else
{
cheese_window->webcam_mode = WEBCAM_MODE_VIDEO;
-
+
str = g_strconcat ("<b>", _("_Start recording"), "</b>", NULL);
gtk_label_set_text_with_mnemonic (GTK_LABEL (cheese_window->label_take_photo), g_strdup (str));
gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo), TRUE);
@@ -1425,8 +1448,8 @@
g_free (str);
}
-GtkActionGroup*
-cheese_window_action_group_new (CheeseWindow *cheese_window, char *name,
+GtkActionGroup *
+cheese_window_action_group_new (CheeseWindow *cheese_window, char *name,
const GtkActionEntry *action_entries, int num_action_entries)
{
GtkActionGroup *action_group;
@@ -1440,8 +1463,8 @@
return action_group;
}
-GtkActionGroup*
-cheese_window_toggle_action_group_new (CheeseWindow *cheese_window, char *name,
+GtkActionGroup *
+cheese_window_toggle_action_group_new (CheeseWindow *cheese_window, char *name,
const GtkToggleActionEntry *action_entries, int num_action_entries)
{
GtkActionGroup *action_group;
@@ -1455,8 +1478,8 @@
return action_group;
}
-GtkActionGroup*
-cheese_window_radio_action_group_new (CheeseWindow *cheese_window, char *name,
+GtkActionGroup *
+cheese_window_radio_action_group_new (CheeseWindow *cheese_window, char *name,
const GtkRadioActionEntry *action_entries, int num_action_entries)
{
GtkActionGroup *action_group;
@@ -1465,7 +1488,7 @@
gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
gtk_action_group_add_radio_actions (action_group, action_entries,
num_action_entries, 0,
- G_CALLBACK (cheese_window_activate_radio_action),
+ G_CALLBACK (cheese_window_activate_radio_action),
cheese_window);
gtk_ui_manager_insert_action_group (cheese_window->ui_manager, action_group, 0);
@@ -1474,7 +1497,7 @@
static void
cheese_window_set_message_area (CheeseWindow *cheese_window,
- GtkWidget *message_area)
+ GtkWidget *message_area)
{
if (cheese_window->message_area == message_area)
return;
@@ -1494,68 +1517,72 @@
static void
cheese_window_create_window (CheeseWindow *cheese_window)
{
- GError *error=NULL;
- char *path;
- GtkBuilder* builder;
+ GError *error = NULL;
+ char *path;
+ GtkBuilder *builder;
#ifdef HILDON
HildonProgram *program = hildon_program_get_instance ();
- GtkWidget *menu;
- GtkWidget *menuitem;
+ GtkWidget *menu;
+ GtkWidget *menuitem;
#else
GtkWidget *menubar;
-#endif
-
+#endif
+
cheese_window->message_area = NULL;
builder = gtk_builder_new ();
- gtk_builder_add_from_file (builder, PACKAGE_DATADIR"/cheese.ui", &error);
+ gtk_builder_add_from_file (builder, PACKAGE_DATADIR "/cheese.ui", &error);
if (error)
{
- g_error ("building ui from %s failed: %s", PACKAGE_DATADIR"/cheese.ui", error->message);
+ g_error ("building ui from %s failed: %s", PACKAGE_DATADIR "/cheese.ui", error->message);
g_clear_error (&error);
}
- cheese_window->window = GTK_WIDGET (gtk_builder_get_object (builder, "cheese_window"));
- cheese_window->button_effects = GTK_WIDGET (gtk_builder_get_object (builder, "button_effects"));
- cheese_window->button_photo = GTK_WIDGET (gtk_builder_get_object (builder, "button_photo"));
- cheese_window->button_video = GTK_WIDGET (gtk_builder_get_object (builder, "button_video"));
- cheese_window->image_take_photo = GTK_WIDGET (gtk_builder_get_object (builder, "image_take_photo"));
- cheese_window->label_effects = GTK_WIDGET (gtk_builder_get_object (builder, "label_effects"));
- cheese_window->label_photo = GTK_WIDGET (gtk_builder_get_object (builder, "label_photo"));
- cheese_window->label_take_photo = GTK_WIDGET (gtk_builder_get_object (builder, "label_take_photo"));
- cheese_window->label_video = GTK_WIDGET (gtk_builder_get_object (builder, "label_video"));
- cheese_window->main_vbox = GTK_WIDGET (gtk_builder_get_object (builder, "main_vbox"));
- cheese_window->video_vbox = GTK_WIDGET (gtk_builder_get_object (builder, "video_vbox"));
- cheese_window->notebook = GTK_WIDGET (gtk_builder_get_object (builder, "notebook"));
- cheese_window->notebook_bar = GTK_WIDGET (gtk_builder_get_object (builder, "notebook_bar"));
- cheese_window->screen = GTK_WIDGET (gtk_builder_get_object (builder, "video_screen"));
- cheese_window->take_picture = GTK_WIDGET (gtk_builder_get_object (builder, "take_picture"));
- cheese_window->thumb_scrollwindow = GTK_WIDGET (gtk_builder_get_object (builder, "thumb_scrollwindow"));
- cheese_window->throbber_frame = GTK_WIDGET (gtk_builder_get_object (builder, "throbber_frame"));
- cheese_window->countdown_frame = GTK_WIDGET (gtk_builder_get_object (builder, "countdown_frame"));
- cheese_window->effect_frame = GTK_WIDGET (gtk_builder_get_object (builder, "effect_frame"));
- cheese_window->message_area_frame = GTK_WIDGET (gtk_builder_get_object (builder, "message_area_frame"));
-
- cheese_window->fullscreen_popup = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_popup"));
- cheese_window->fullscreen_bar = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_notebook_bar"));
- cheese_window->button_effects_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "button_effects_fullscreen"));
- cheese_window->button_photo_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "button_photo_fullscreen"));
- cheese_window->button_video_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "button_video_fullscreen"));
- cheese_window->take_picture_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "take_picture_fullscreen"));
- cheese_window->label_take_photo_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "label_take_photo_fullscreen"));
- cheese_window->image_take_photo_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "image_take_photo_fullscreen"));
- cheese_window->label_photo_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "label_photo_fullscreen"));
- cheese_window->label_video_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "label_video_fullscreen"));
- cheese_window->countdown_frame_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "countdown_frame_fullscreen"));
- cheese_window->button_exit_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "button_exit_fullscreen"));
+ cheese_window->window = GTK_WIDGET (gtk_builder_get_object (builder, "cheese_window"));
+ cheese_window->button_effects = GTK_WIDGET (gtk_builder_get_object (builder, "button_effects"));
+ cheese_window->button_photo = GTK_WIDGET (gtk_builder_get_object (builder, "button_photo"));
+ cheese_window->button_video = GTK_WIDGET (gtk_builder_get_object (builder, "button_video"));
+ cheese_window->image_take_photo = GTK_WIDGET (gtk_builder_get_object (builder, "image_take_photo"));
+ cheese_window->label_effects = GTK_WIDGET (gtk_builder_get_object (builder, "label_effects"));
+ cheese_window->label_photo = GTK_WIDGET (gtk_builder_get_object (builder, "label_photo"));
+ cheese_window->label_take_photo = GTK_WIDGET (gtk_builder_get_object (builder, "label_take_photo"));
+ cheese_window->label_video = GTK_WIDGET (gtk_builder_get_object (builder, "label_video"));
+ cheese_window->main_vbox = GTK_WIDGET (gtk_builder_get_object (builder, "main_vbox"));
+ cheese_window->video_vbox = GTK_WIDGET (gtk_builder_get_object (builder, "video_vbox"));
+ cheese_window->notebook = GTK_WIDGET (gtk_builder_get_object (builder, "notebook"));
+ cheese_window->notebook_bar = GTK_WIDGET (gtk_builder_get_object (builder, "notebook_bar"));
+ cheese_window->screen = GTK_WIDGET (gtk_builder_get_object (builder, "video_screen"));
+ cheese_window->take_picture = GTK_WIDGET (gtk_builder_get_object (builder, "take_picture"));
+ cheese_window->thumb_scrollwindow = GTK_WIDGET (gtk_builder_get_object (builder, "thumb_scrollwindow"));
+ cheese_window->throbber_frame = GTK_WIDGET (gtk_builder_get_object (builder, "throbber_frame"));
+ cheese_window->countdown_frame = GTK_WIDGET (gtk_builder_get_object (builder, "countdown_frame"));
+ cheese_window->effect_frame = GTK_WIDGET (gtk_builder_get_object (builder, "effect_frame"));
+ cheese_window->message_area_frame = GTK_WIDGET (gtk_builder_get_object (builder, "message_area_frame"));
+ cheese_window->fullscreen_popup = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_popup"));
+ cheese_window->fullscreen_bar = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_notebook_bar"));
+ cheese_window->button_effects_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "button_effects_fullscreen"));
+ cheese_window->button_photo_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "button_photo_fullscreen"));
+ cheese_window->button_video_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "button_video_fullscreen"));
+ cheese_window->take_picture_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "take_picture_fullscreen"));
+ cheese_window->label_take_photo_fullscreen =
+ GTK_WIDGET (gtk_builder_get_object (builder, "label_take_photo_fullscreen"));
+ cheese_window->image_take_photo_fullscreen =
+ GTK_WIDGET (gtk_builder_get_object (builder, "image_take_photo_fullscreen"));
+ cheese_window->label_photo_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "label_photo_fullscreen"));
+ cheese_window->label_video_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "label_video_fullscreen"));
+ cheese_window->countdown_frame_fullscreen =
+ GTK_WIDGET (gtk_builder_get_object (builder, "countdown_frame_fullscreen"));
+ cheese_window->button_exit_fullscreen = GTK_WIDGET (gtk_builder_get_object (builder, "button_exit_fullscreen"));
- //configure the popup position and size
+ /* configure the popup position and size */
GdkScreen *screen = gtk_window_get_screen (GTK_WINDOW (cheese_window->fullscreen_popup));
- gtk_window_set_default_size (GTK_WINDOW (cheese_window->fullscreen_popup), gdk_screen_get_width (screen), FULLSCREEN_POPUP_HEIGHT);
- gtk_window_move (GTK_WINDOW (cheese_window->fullscreen_popup), 0, gdk_screen_get_height (screen) - FULLSCREEN_POPUP_HEIGHT);
+ gtk_window_set_default_size (GTK_WINDOW (cheese_window->fullscreen_popup),
+ gdk_screen_get_width (screen), FULLSCREEN_POPUP_HEIGHT);
+ gtk_window_move (GTK_WINDOW (cheese_window->fullscreen_popup), 0,
+ gdk_screen_get_height (screen) - FULLSCREEN_POPUP_HEIGHT);
g_signal_connect (cheese_window->fullscreen_popup,
"enter-notify-event",
@@ -1568,20 +1595,22 @@
#ifdef HILDON
/* Reparent widgets in case we use hildon. This saves us maintaining two
- GtkBuilder ui files
- */
- cheese_window->window = hildon_window_new ();
+ * GtkBuilder ui files
+ */
+ cheese_window->window = hildon_window_new ();
cheese_window->main_hbox = gtk_hbox_new (FALSE, 0);
hildon_program_add_window (program, HILDON_WINDOW (cheese_window->window));
- gtk_container_add (GTK_CONTAINER (cheese_window->window), cheese_window->main_hbox);
+ gtk_container_add (GTK_CONTAINER (cheese_window->window), cheese_window->main_hbox);
gtk_widget_ref (cheese_window->thumb_scrollwindow);
gtk_widget_ref (cheese_window->video_vbox);
gtk_container_remove (GTK_CONTAINER (cheese_window->video_vbox), cheese_window->thumb_scrollwindow);
- gtk_container_remove (GTK_CONTAINER (cheese_window->main_vbox),cheese_window->video_vbox);
+ gtk_container_remove (GTK_CONTAINER (cheese_window->main_vbox), cheese_window->video_vbox);
gtk_box_pack_start (GTK_BOX (cheese_window->main_hbox), cheese_window->video_vbox, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (cheese_window->main_hbox), GTK_WIDGET (cheese_window->thumb_scrollwindow), FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (cheese_window->main_hbox), GTK_WIDGET (cheese_window->thumb_scrollwindow),
+ FALSE, FALSE, 0);
gtk_widget_destroy (cheese_window->main_vbox);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (cheese_window->thumb_scrollwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (cheese_window->thumb_scrollwindow),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_widget_unref (cheese_window->thumb_scrollwindow);
gtk_widget_unref (cheese_window->video_vbox);
#endif
@@ -1598,7 +1627,7 @@
gtk_widget_set_sensitive (GTK_WIDGET (cheese_window->take_picture_fullscreen), FALSE);
cheese_window->thumb_view = cheese_thumb_view_new ();
- cheese_window->thumb_nav = eog_thumb_nav_new (cheese_window->thumb_view, TRUE);
+ cheese_window->thumb_nav = eog_thumb_nav_new (cheese_window->thumb_view, TRUE);
gtk_container_add (GTK_CONTAINER (cheese_window->thumb_scrollwindow), cheese_window->thumb_nav);
char *gconf_effects;
@@ -1615,7 +1644,7 @@
cheese_window->countdown = cheese_countdown_new ();
gtk_container_add (GTK_CONTAINER (cheese_window->countdown_frame), cheese_window->countdown);
gtk_widget_show (cheese_window->countdown);
-
+
cheese_window->countdown_fullscreen = cheese_countdown_new ();
gtk_container_add (GTK_CONTAINER (cheese_window->countdown_frame_fullscreen), cheese_window->countdown_fullscreen);
@@ -1623,56 +1652,56 @@
cheese_window->ui_manager = gtk_ui_manager_new ();
- cheese_window->actions_main = cheese_window_action_group_new (cheese_window,
- "ActionsMain",
- action_entries_main,
+ cheese_window->actions_main = cheese_window_action_group_new (cheese_window,
+ "ActionsMain",
+ action_entries_main,
G_N_ELEMENTS (action_entries_main));
- cheese_window->actions_toggle = cheese_window_radio_action_group_new (cheese_window,
- "ActionsRadio",
- action_entries_toggle,
+ cheese_window->actions_toggle = cheese_window_radio_action_group_new (cheese_window,
+ "ActionsRadio",
+ action_entries_toggle,
G_N_ELEMENTS (action_entries_toggle));
- cheese_window->actions_effects = cheese_window_toggle_action_group_new (cheese_window,
- "ActionsEffects",
- action_entries_effects,
+ cheese_window->actions_effects = cheese_window_toggle_action_group_new (cheese_window,
+ "ActionsEffects",
+ action_entries_effects,
G_N_ELEMENTS (action_entries_effects));
- cheese_window->actions_fullscreen = cheese_window_toggle_action_group_new (cheese_window,
- "ActionsFullscreen",
- action_entries_fullscreen,
+ cheese_window->actions_fullscreen = cheese_window_toggle_action_group_new (cheese_window,
+ "ActionsFullscreen",
+ action_entries_fullscreen,
G_N_ELEMENTS (action_entries_fullscreen));
- cheese_window->actions_preferences = cheese_window_action_group_new (cheese_window,
- "ActionsPreferences",
- action_entries_preferences,
+ cheese_window->actions_preferences = cheese_window_action_group_new (cheese_window,
+ "ActionsPreferences",
+ action_entries_preferences,
G_N_ELEMENTS (action_entries_preferences));
- cheese_window->actions_file = cheese_window_action_group_new (cheese_window,
- "ActionsFile",
- action_entries_file,
+ cheese_window->actions_file = cheese_window_action_group_new (cheese_window,
+ "ActionsFile",
+ action_entries_file,
G_N_ELEMENTS (action_entries_file));
- cheese_window->actions_photo = cheese_window_action_group_new (cheese_window,
- "ActionsPhoto",
- action_entries_photo,
+ cheese_window->actions_photo = cheese_window_action_group_new (cheese_window,
+ "ActionsPhoto",
+ action_entries_photo,
G_N_ELEMENTS (action_entries_photo));
- cheese_window->actions_countdown = cheese_window_toggle_action_group_new (cheese_window,
- "ActionsCountdown",
- action_entries_countdown,
+ cheese_window->actions_countdown = cheese_window_toggle_action_group_new (cheese_window,
+ "ActionsCountdown",
+ action_entries_countdown,
G_N_ELEMENTS (action_entries_countdown));
- cheese_window->actions_video = cheese_window_toggle_action_group_new (cheese_window,
- "ActionsVideo",
- action_entries_video,
+ cheese_window->actions_video = cheese_window_toggle_action_group_new (cheese_window,
+ "ActionsVideo",
+ action_entries_video,
G_N_ELEMENTS (action_entries_video));
gtk_action_group_set_sensitive (cheese_window->actions_video, FALSE);
- cheese_window->actions_account_photo = cheese_window_action_group_new (cheese_window,
- "ActionsAccountPhoto",
- action_entries_account_photo,
+ cheese_window->actions_account_photo = cheese_window_action_group_new (cheese_window,
+ "ActionsAccountPhoto",
+ action_entries_account_photo,
G_N_ELEMENTS (action_entries_account_photo));
- cheese_window->actions_mail = cheese_window_action_group_new (cheese_window,
- "ActionsMail",
- action_entries_mail,
+ cheese_window->actions_mail = cheese_window_action_group_new (cheese_window,
+ "ActionsMail",
+ action_entries_mail,
G_N_ELEMENTS (action_entries_mail));
- cheese_window->actions_sendto = cheese_window_action_group_new (cheese_window,
- "ActionsSendTo",
- action_entries_sendto,
+ cheese_window->actions_sendto = cheese_window_action_group_new (cheese_window,
+ "ActionsSendTo",
+ action_entries_sendto,
G_N_ELEMENTS (action_entries_sendto));
/* handling and activation of send to/send mail actions. We only show one send mail action */
@@ -1691,33 +1720,33 @@
}
g_free (path);
- cheese_window->actions_fspot = cheese_window_action_group_new (cheese_window,
- "ActionsFSpot",
- action_entries_fspot,
+ cheese_window->actions_fspot = cheese_window_action_group_new (cheese_window,
+ "ActionsFSpot",
+ action_entries_fspot,
G_N_ELEMENTS (action_entries_fspot));
path = g_find_program_in_path ("f-spot");
gtk_action_group_set_visible (cheese_window->actions_fspot, path != NULL);
g_free (path);
- cheese_window->actions_flickr = cheese_window_action_group_new (cheese_window,
- "ActionsFlickr",
- action_entries_flickr,
+ cheese_window->actions_flickr = cheese_window_action_group_new (cheese_window,
+ "ActionsFlickr",
+ action_entries_flickr,
G_N_ELEMENTS (action_entries_flickr));
path = g_find_program_in_path ("postr");
gtk_action_group_set_visible (cheese_window->actions_flickr, path != NULL);
g_free (path);
- gtk_ui_manager_add_ui_from_file (cheese_window->ui_manager, PACKAGE_DATADIR"/cheese-ui.xml", &error);
+ gtk_ui_manager_add_ui_from_file (cheese_window->ui_manager, PACKAGE_DATADIR "/cheese-ui.xml", &error);
if (error)
{
- g_critical ("building menus from %s failed: %s", PACKAGE_DATADIR"/cheese-ui.xml", error->message);
+ g_critical ("building menus from %s failed: %s", PACKAGE_DATADIR "/cheese-ui.xml", error->message);
g_error_free (error);
}
GtkAction *action = gtk_ui_manager_get_action (cheese_window->ui_manager, "/MainMenu/Cheese/CountdownToggle");
- gboolean countdown;
+ gboolean countdown;
g_object_get (cheese_window->gconf, "gconf_prop_countdown", &countdown, NULL);
if (countdown)
{
@@ -1728,31 +1757,31 @@
gboolean enable_delete;
g_object_get (cheese_window->gconf, "gconf_prop_enable_delete", &enable_delete, NULL);
gtk_action_set_visible (GTK_ACTION (action), enable_delete);
-
+
#ifdef HILDON
- menu = gtk_menu_new ();
+ menu = gtk_menu_new ();
menuitem = gtk_menu_item_new_with_label (_("Quit"));
- g_signal_connect (menuitem,"activate",
+ g_signal_connect (menuitem, "activate",
GTK_SIGNAL_FUNC (cheese_window_cmd_close),
cheese_window);
gtk_menu_append (menu, menuitem);
-
+
menuitem = gtk_menu_item_new_with_label (_("About"));
- g_signal_connect (menuitem,"activate",
- GTK_SIGNAL_FUNC (cheese_window_cmd_about),
+ g_signal_connect (menuitem, "activate",
+ GTK_SIGNAL_FUNC (cheese_window_cmd_about),
cheese_window);
gtk_menu_append (menu, menuitem);
-
- hildon_window_set_menu (HILDON_WINDOW (cheese_window->window),GTK_MENU (menu));
+
+ hildon_window_set_menu (HILDON_WINDOW (cheese_window->window), GTK_MENU (menu));
#else
menubar = gtk_ui_manager_get_widget (cheese_window->ui_manager, "/MainMenu");
gtk_box_pack_start (GTK_BOX (cheese_window->main_vbox), menubar, FALSE, FALSE, 0);
#endif
- cheese_window->thumb_view_popup_menu = gtk_ui_manager_get_widget (cheese_window->ui_manager,
+ cheese_window->thumb_view_popup_menu = gtk_ui_manager_get_widget (cheese_window->ui_manager,
"/ThumbnailPopup");
- gtk_window_add_accel_group (GTK_WINDOW (cheese_window->window),
+ gtk_window_add_accel_group (GTK_WINDOW (cheese_window->window),
gtk_ui_manager_get_accel_group (cheese_window->ui_manager));
gtk_accel_group_connect (gtk_ui_manager_get_accel_group (cheese_window->ui_manager),
GDK_Escape, 0, 0,
@@ -1764,11 +1793,11 @@
action = gtk_ui_manager_get_action (cheese_window->ui_manager, "/MainMenu/Edit/Effects");
gtk_action_connect_proxy (GTK_ACTION (action), GTK_WIDGET (cheese_window->button_effects));
gtk_action_connect_proxy (GTK_ACTION (action), GTK_WIDGET (cheese_window->button_effects_fullscreen));
-
+
action = gtk_ui_manager_get_action (cheese_window->ui_manager, "/MainMenu/Cheese/Photo");
gtk_action_connect_proxy (GTK_ACTION (action), GTK_WIDGET (cheese_window->button_photo));
gtk_action_connect_proxy (GTK_ACTION (action), GTK_WIDGET (cheese_window->button_photo_fullscreen));
-
+
action = gtk_ui_manager_get_action (cheese_window->ui_manager, "/MainMenu/Cheese/Video");
gtk_action_connect_proxy (GTK_ACTION (action), GTK_WIDGET (cheese_window->button_video));
gtk_action_connect_proxy (GTK_ACTION (action), GTK_WIDGET (cheese_window->button_video_fullscreen));
@@ -1777,7 +1806,7 @@
/* Default handlers for closing the application */
g_signal_connect (cheese_window->window, "destroy",
G_CALLBACK (cheese_window_cmd_close), cheese_window);
- g_signal_connect (cheese_window->window, "delete_event",
+ g_signal_connect (cheese_window->window, "delete_event",
G_CALLBACK (cheese_window_delete_event_cb), NULL);
g_signal_connect (cheese_window->take_picture, "clicked",
@@ -1790,20 +1819,21 @@
G_CALLBACK (cheese_window_button_press_event_cb), cheese_window);
}
-void
+void
setup_camera (CheeseWindow *cheese_window)
{
- char *webcam_device = NULL;
- int x_resolution;
- int y_resolution;
+ char *webcam_device = NULL;
+ int x_resolution;
+ int y_resolution;
GtkWidget *message_area;
-
+
GError *error;
+
g_object_get (cheese_window->gconf, "gconf_prop_x_resolution", &x_resolution,
"gconf_prop_y_resolution", &y_resolution, "gconf_prop_webcam", &webcam_device, NULL);
gdk_threads_enter ();
- cheese_window->webcam = cheese_webcam_new (cheese_window->screen,
+ cheese_window->webcam = cheese_webcam_new (cheese_window->screen,
webcam_device, x_resolution,
y_resolution);
gdk_threads_leave ();
@@ -1815,17 +1845,17 @@
if (error != NULL)
{
GtkWidget *dialog;
- gchar *primary, *secondary;
-
- primary = g_strdup (_("Check your gstreamer installation"));
+ gchar *primary, *secondary;
+
+ primary = g_strdup (_("Check your gstreamer installation"));
secondary = g_strdup (error->message);
gdk_threads_enter ();
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
"%s", primary);
gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
secondary);
@@ -1835,7 +1865,7 @@
g_free (primary);
g_free (secondary);
- // Clean up and exit
+ /* Clean up and exit */
cheese_window_cmd_close (NULL, cheese_window);
gdk_threads_leave ();
@@ -1848,7 +1878,7 @@
g_signal_connect (cheese_window->webcam, "video-saved",
G_CALLBACK (cheese_window_video_saved_cb), cheese_window);
- cheese_webcam_set_effect (cheese_window->webcam,
+ cheese_webcam_set_effect (cheese_window->webcam,
cheese_effect_chooser_get_selection (CHEESE_EFFECT_CHOOSER (cheese_window->effect_chooser)));
cheese_webcam_play (cheese_window->webcam);
@@ -1880,28 +1910,29 @@
cheese_window = g_new0 (CheeseWindow, 1);
cheese_window->startup_hal_dev_udi = hal_dev_udi;
- cheese_window->gconf = cheese_gconf_new ();
- cheese_window->audio_play_counter = 0;
- cheese_window->fileutil = cheese_fileutil_new ();
- cheese_window->isFullscreen = FALSE;
-
+ cheese_window->gconf = cheese_gconf_new ();
+ cheese_window->audio_play_counter = 0;
+ cheese_window->fileutil = cheese_fileutil_new ();
+ cheese_window->isFullscreen = FALSE;
+
cheese_window->server = dbus_server;
- //save a pointer to the cheese window in cheese dbus
+
+ /* save a pointer to the cheese window in cheese dbus */
cheese_dbus_set_window (cheese_window);
-
+
cheese_window->fullscreen_timeout_source = NULL;
cheese_window_create_window (cheese_window);
gtk_action_group_set_sensitive (cheese_window->actions_effects, FALSE);
-
+
gtk_widget_show_all (cheese_window->window);
ephy_spinner_start (EPHY_SPINNER (cheese_window->throbber));
gtk_notebook_set_current_page (GTK_NOTEBOOK (cheese_window->notebook), 2);
cheese_window->webcam_mode = WEBCAM_MODE_PHOTO;
- cheese_window->recording = FALSE;
-
+ cheese_window->recording = FALSE;
+
/* Run cam setup in its own thread */
GError *error = NULL;
if (!g_thread_create ((GThreadFunc) setup_camera, cheese_window, FALSE, &error))
Modified: trunk/src/cheese-window.h
==============================================================================
--- trunk/src/cheese-window.h (original)
+++ trunk/src/cheese-window.h Sat Aug 23 17:07:43 2008
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
*
* Licensed under the GNU General Public License Version 2
*
Modified: trunk/src/cheese.c
==============================================================================
--- trunk/src/cheese.c (original)
+++ trunk/src/cheese.c Sat Aug 23 17:07:43 2008
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2007,2008 daniel g. siegel <dgsiegel gmail com>
- * Copyright (C) 2007,2008 Jaap Haitsma <jaap haitsma org>
- * Copyright (C) 2008 Felix Kaser <f kaser gmx net>
+ * Copyright  2007,2008 daniel g. siegel <dgsiegel gmail com>
+ * Copyright  2007,2008 Jaap Haitsma <jaap haitsma org>
+ * Copyright  2008 Felix Kaser <f kaser gmx net>
*
* Licensed under the GNU General Public License Version 2
*
@@ -20,7 +20,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <cheese-config.h>
+ #include <cheese-config.h>
#endif
#include <stdio.h>
@@ -40,27 +40,28 @@
char *hal_device_id;
} CheeseOptions;
-void cheese_print_handler (char *string)
+void
+cheese_print_handler (char *string)
{
static FILE *fp = NULL;
- GDir *dir;
- char *filename, *path;
-
+ GDir *dir;
+ char *filename, *path;
+
CheeseFileUtil *fileutil = cheese_fileutil_new ();
-
+
if (fp == NULL)
{
path = cheese_fileutil_get_log_path (fileutil);
-
+
dir = g_dir_open (path, 0, NULL);
if (!dir)
{
return;
}
-
+
filename = g_build_filename (path, "log", NULL);
- fp = fopen (filename, "w");
+ fp = fopen (filename, "w");
g_object_unref (fileutil);
g_free (filename);
@@ -71,22 +72,22 @@
if (CheeseOptions.verbose)
fprintf (stdout, "%s", string);
-
}
int
main (int argc, char **argv)
{
GOptionContext *context;
- CheeseDbus *dbus_server;
-
+ CheeseDbus *dbus_server;
+
GOptionEntry options[] = {
- { "verbose", 'v', 0, G_OPTION_ARG_NONE, &CheeseOptions.verbose, _("Be verbose"), NULL},
- { "hal-device", 'd', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &CheeseOptions.hal_device_id, NULL, NULL},
- { NULL }
+ {"verbose", 'v', 0, G_OPTION_ARG_NONE, &CheeseOptions.verbose, _("Be verbose"), NULL},
+ {"hal-device", 'd', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &CheeseOptions.hal_device_id, NULL, NULL},
+ {NULL}
};
+
CheeseOptions.hal_device_id = NULL;
-
+
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
@@ -122,7 +123,7 @@
APPNAME_DATA_DIR G_DIR_SEPARATOR_S "icons");
cheese_window_init (CheeseOptions.hal_device_id, dbus_server);
-
+
gdk_threads_enter ();
gtk_main ();
gdk_threads_leave ();
Modified: trunk/tools/cheese-indent.cfg
==============================================================================
--- trunk/tools/cheese-indent.cfg (original)
+++ trunk/tools/cheese-indent.cfg Sat Aug 23 17:07:43 2008
@@ -155,13 +155,13 @@
# 0=Part of the type
# 1=Part of the variable
# 2=Dangling
-align_var_def_star_style = 1 # number
+align_var_def_star_style = 2 # number
# How to align the '&' in variable definitions.
# 0=Part of the type
# 1=Part of the variable
# 2=Dangling
-align_var_def_amp_style = 1 # number
+align_var_def_amp_style = 2 # number
# Align variable definitions in prototypes and functions
align_func_params = true # false/true
@@ -178,6 +178,46 @@
# The span for aligning on '#define' bodies (0=don't align)
align_pp_define_span = 1 # number
+# Controls the positioning of the '*' in typedefs. Just try it.
+# 0: Align on typdef type, ignore '*'
+# 1: The '*' is part of type name: typedef int *pint;
+# 2: The '*' is part of the type, but dangling: typedef int *pint;
+align_typedef_star_style = 2 # number
+
+# Controls the positioning of the '&' in typedefs. Just try it.
+# 0: Align on typdef type, ignore '&'
+# 1: The '&' is part of type name: typedef int &pint;
+# 2: The '&' is part of the type, but dangling: typedef int &pint;
+align_typedef_amp_style = 2 # number
+
+# Whether to align macros wrapped with a backslash and a newline.
+# This will not work right if the macro contains a multi-line comment.
+align_nl_cont = true # false/true
+
+# The span for aligning struct/union (0=don't align)
+align_var_struct_span = 1 # number
+
+# The threshold for aligning struct/union member definitions (0=no limit)
+align_var_struct_thresh = 1 # number
+
+# The gap for aligning struct/union member definitions
+align_var_struct_gap = 1 # number
+
+# The span for aligning struct initializer values (0=don't align)
+align_struct_init_span = 1 # number
+
+# The gap for aligning variable definitions
+align_var_def_gap = 1 # number
+
+# The span for aligning on '=' in assignments (0=don't align)
+align_assign_span = 1 # number
+
+# The span for aligning on '=' in enums (0=don't align)
+align_enum_equ_span = 1 # number
+
+# The span for aligning variable definitions (0=don't align)
+align_var_def_span = 1 # number
+
# Add or remove newline at the end of the file
nl_end_of_file = force # ignore/add/remove/force
@@ -214,7 +254,7 @@
nl_else_brace = force # ignore/add/remove/force
# Add or remove newline between 'else' and 'if'
-nl_else_if = force # ignore/add/remove/force
+nl_else_if = remove # ignore/add/remove/force
# Add or remove newline between 'for' and '{'
nl_for_brace = force # ignore/add/remove/force
@@ -276,6 +316,9 @@
# Don't touch one-line braced assignments - 'foo_t f = { 1, 2 };'
nl_assign_leave_one_liners = true # false/true
+# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif'
+nl_squeeze_ifdef = true # false/true
+
# Whether to remove blank lines after '{'
eat_blanks_after_open_brace = true # false/true
@@ -291,6 +334,9 @@
# Whether to group cpp-comments that look like they are in a block
cmt_cpp_group = false # false/true
+# Whether to change cpp-comments into c-comments
+cmt_cpp_to_c = true # false/true
+
# If pp_indent_at_level=false, specifies the number of columns to indent per
# level. Default=1.
pp_indent_count = indent_columns # number
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]