[empathy] CameraMenu: select the first camera if the last one isn't available
- From: Emilio Pozuelo Monfort <epm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] CameraMenu: select the first camera if the last one isn't available
- Date: Mon, 15 Aug 2011 12:07:17 +0000 (UTC)
commit b01f42247694b992c91fefab5c70acdfa3770051
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date: Mon Aug 15 11:15:40 2011 +0100
CameraMenu: select the first camera if the last one isn't available
src/empathy-camera-menu.c | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/src/empathy-camera-menu.c b/src/empathy-camera-menu.c
index b73337e..9cbb9d4 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]