aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-08-15 18:15:40 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-08-15 20:03:28 +0800
commitb01f42247694b992c91fefab5c70acdfa3770051 (patch)
tree92ff14873866a35f20cee0825e443c346dcce063
parent64b8693b800d880aee7f16e5b353f239a24e02fa (diff)
downloadgsoc2013-empathy-b01f42247694b992c91fefab5c70acdfa3770051.tar
gsoc2013-empathy-b01f42247694b992c91fefab5c70acdfa3770051.tar.gz
gsoc2013-empathy-b01f42247694b992c91fefab5c70acdfa3770051.tar.bz2
gsoc2013-empathy-b01f42247694b992c91fefab5c70acdfa3770051.tar.lz
gsoc2013-empathy-b01f42247694b992c91fefab5c70acdfa3770051.tar.xz
gsoc2013-empathy-b01f42247694b992c91fefab5c70acdfa3770051.tar.zst
gsoc2013-empathy-b01f42247694b992c91fefab5c70acdfa3770051.zip
CameraMenu: select the first camera if the last one isn't available
-rw-r--r--src/empathy-camera-menu.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/empathy-camera-menu.c b/src/empathy-camera-menu.c
index b73337e8b..9cbb9d439 100644
--- a/src/empathy-camera-menu.c
+++ b/src/empathy-camera-menu.c
@@ -246,28 +246,38 @@ empathy_camera_menu_prefs_camera_changed_cb (GSettings *settings,
EmpathyCameraMenu *self)
{
gchar *device = g_settings_get_string (settings, key);
+ GtkRadioAction *action;
+ gboolean found = FALSE;
GList *l;
for (l = self->priv->cameras->head; l != NULL; l = g_list_next (l))
{
- GtkRadioAction *action = l->data;
- const gchar *name = gtk_action_get_name (GTK_ACTION (action));
+ const gchar *name;
+
+ action = l->data;
+ name = gtk_action_get_name (GTK_ACTION (action));
if (!tp_strdiff (device, name))
{
- if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
- {
- g_signal_handlers_block_by_func (settings,
- empathy_camera_menu_prefs_camera_changed_cb, self);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
- g_signal_handlers_unblock_by_func (settings,
- empathy_camera_menu_prefs_camera_changed_cb, self);
- }
-
+ found = TRUE;
break;
}
}
+ /* If the selected camera isn't found, we connect the first
+ * available one */
+ if (!found)
+ action = self->priv->cameras->head->data;
+
+ if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ {
+ g_signal_handlers_block_by_func (settings,
+ empathy_camera_menu_prefs_camera_changed_cb, self);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+ g_signal_handlers_unblock_by_func (settings,
+ empathy_camera_menu_prefs_camera_changed_cb, self);
+ }
+
g_free (device);
}