aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-log-window.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-12-05 22:06:19 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-12-06 16:30:32 +0800
commitb6c4b1de387c53ad115b6422e2009596a5cb6dd0 (patch)
tree03b58dca76fcd5ff8daf77d7688d9c9b4a61b9e9 /libempathy-gtk/empathy-log-window.c
parentddd662f02c504c229fc1910c31785b35855652e3 (diff)
downloadgsoc2013-empathy-b6c4b1de387c53ad115b6422e2009596a5cb6dd0.tar
gsoc2013-empathy-b6c4b1de387c53ad115b6422e2009596a5cb6dd0.tar.gz
gsoc2013-empathy-b6c4b1de387c53ad115b6422e2009596a5cb6dd0.tar.bz2
gsoc2013-empathy-b6c4b1de387c53ad115b6422e2009596a5cb6dd0.tar.lz
gsoc2013-empathy-b6c4b1de387c53ad115b6422e2009596a5cb6dd0.tar.xz
gsoc2013-empathy-b6c4b1de387c53ad115b6422e2009596a5cb6dd0.tar.zst
gsoc2013-empathy-b6c4b1de387c53ad115b6422e2009596a5cb6dd0.zip
factor out do_update_buttons_sensitivity()
This fix a bug with button_video_binding not being re-installed when a contact supporting video was selected. It was only re-installed when using the contact from the selected event. https://bugzilla.gnome.org/show_bug.cgi?id=665592
Diffstat (limited to 'libempathy-gtk/empathy-log-window.c')
-rw-r--r--libempathy-gtk/empathy-log-window.c75
1 files changed, 41 insertions, 34 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 9fb4f145f..65b39f472 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -2073,30 +2073,63 @@ log_window_search_entry_icon_pressed_cb (GtkEntry *entry,
}
static void
+do_update_buttons_sensitivity (EmpathyLogWindow *self)
+{
+ EmpathyCapabilities capabilities;
+ gboolean profile, chat, call, video;
+
+ tp_clear_object (&self->priv->button_video_binding);
+
+ if (self->priv->selected_contact != NULL)
+ {
+ capabilities = empathy_contact_get_capabilities (
+ self->priv->selected_contact);
+
+ profile = chat = TRUE;
+ call = capabilities & EMPATHY_CAPABILITIES_AUDIO;
+ video = capabilities & EMPATHY_CAPABILITIES_VIDEO;
+ }
+ else
+ {
+ profile = chat = call = video = FALSE;
+ }
+
+ gtk_widget_set_sensitive (self->priv->button_profile, profile);
+ gtk_widget_set_sensitive (self->priv->button_chat, chat);
+ gtk_widget_set_sensitive (self->priv->button_call, call);
+
+ if (video)
+ {
+ self->priv->button_video_binding = g_object_bind_property (
+ self->priv->camera_monitor, "available",
+ self->priv->button_video, "sensitive",
+ G_BINDING_SYNC_CREATE);
+ }
+ else
+ {
+ /* Don't override the binding */
+ gtk_widget_set_sensitive (self->priv->button_video, video);
+ }
+}
+
+static void
log_window_update_buttons_sensitivity (EmpathyLogWindow *self)
{
GtkTreeView *view;
GtkTreeModel *model;
GtkTreeSelection *selection;
- EmpathyCapabilities capabilities;
TpAccount *account;
TplEntity *target;
GtkTreeIter iter;
GList *paths;
GtkTreePath *path;
- gboolean profile, chat, call, video;
- profile = chat = call = video = FALSE;
-
- tp_clear_object (&self->priv->button_video_binding);
tp_clear_object (&self->priv->selected_contact);
view = GTK_TREE_VIEW (self->priv->treeview_who);
model = gtk_tree_view_get_model (view);
selection = gtk_tree_view_get_selection (view);
- profile = chat = call = video = FALSE;
-
if (!gtk_tree_model_get_iter_first (model, &iter))
goto events;
@@ -2124,12 +2157,6 @@ log_window_update_buttons_sensitivity (EmpathyLogWindow *self)
g_object_unref (account);
g_object_unref (target);
- capabilities = empathy_contact_get_capabilities (self->priv->selected_contact);
-
- profile = chat = TRUE;
- call = capabilities & EMPATHY_CAPABILITIES_AUDIO;
- video = capabilities & EMPATHY_CAPABILITIES_VIDEO;
-
goto out;
events:
@@ -2139,29 +2166,9 @@ log_window_update_buttons_sensitivity (EmpathyLogWindow *self)
if (self->priv->events_contact != NULL)
self->priv->selected_contact = g_object_ref (self->priv->events_contact);
- else
- goto out;
-
- capabilities = empathy_contact_get_capabilities (self->priv->selected_contact);
-
- profile = chat = TRUE;
- call = capabilities & EMPATHY_CAPABILITIES_AUDIO;
- video = capabilities & EMPATHY_CAPABILITIES_VIDEO;
-
- if (video)
- self->priv->button_video_binding = g_object_bind_property (
- self->priv->camera_monitor, "available",
- self->priv->button_video, "sensitive",
- G_BINDING_SYNC_CREATE);
out:
- gtk_widget_set_sensitive (self->priv->button_profile, profile);
- gtk_widget_set_sensitive (self->priv->button_chat, chat);
- gtk_widget_set_sensitive (self->priv->button_call, call);
-
- /* Don't override the binding */
- if (!video)
- gtk_widget_set_sensitive (self->priv->button_video, video);
+ do_update_buttons_sensitivity (self);
}
static void