~bcurtiswx/ubuntu/precise/empathy/3.4.2.3-0ubuntu1

« back to all changes in this revision

Viewing changes to libempathy-gtk/empathy-log-window.c

  • Committer: Package Import Robot
  • Author(s): Ken VanDine
  • Date: 2011-12-21 15:12:56 UTC
  • mfrom: (1.1.84)
  • Revision ID: package-import@ubuntu.com-20111221151256-9b1pny75wphfmqd6
Tags: 3.3.3-0ubuntu1
* New upstream version
  - Require folks >= 0.6.6 (LP: #907501)
* debian/control
  - bump build depends for folks to >= 0.6.6
* debian/watch
  - use the .xz file

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
#include "empathy-theme-manager.h"
63
63
#include "empathy-ui-utils.h"
64
64
#include "empathy-webkit-utils.h"
 
65
#include "empathy-geometry.h"
65
66
 
66
67
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
67
68
#include <libempathy/empathy-debug.h>
773
774
 
774
775
  log_window_update_buttons_sensitivity (self);
775
776
  gtk_widget_show (GTK_WIDGET (self));
 
777
 
 
778
  empathy_geometry_bind (GTK_WINDOW (self), "log-window");
776
779
}
777
780
 
778
781
GtkWidget *
2070
2073
}
2071
2074
 
2072
2075
static void
 
2076
do_update_buttons_sensitivity (EmpathyLogWindow *self)
 
2077
{
 
2078
  EmpathyCapabilities capabilities;
 
2079
  gboolean profile, chat, call, video;
 
2080
 
 
2081
  tp_clear_object (&self->priv->button_video_binding);
 
2082
 
 
2083
  if (self->priv->selected_contact != NULL)
 
2084
    {
 
2085
      capabilities = empathy_contact_get_capabilities (
 
2086
          self->priv->selected_contact);
 
2087
 
 
2088
      profile = chat = TRUE;
 
2089
      call = capabilities & EMPATHY_CAPABILITIES_AUDIO;
 
2090
      video = capabilities & EMPATHY_CAPABILITIES_VIDEO;
 
2091
    }
 
2092
  else
 
2093
    {
 
2094
      profile = chat = call = video = FALSE;
 
2095
    }
 
2096
 
 
2097
  gtk_widget_set_sensitive (self->priv->button_profile, profile);
 
2098
  gtk_widget_set_sensitive (self->priv->button_chat, chat);
 
2099
  gtk_widget_set_sensitive (self->priv->button_call, call);
 
2100
 
 
2101
  if (video)
 
2102
    {
 
2103
      self->priv->button_video_binding = g_object_bind_property (
 
2104
          self->priv->camera_monitor, "available",
 
2105
          self->priv->button_video, "sensitive",
 
2106
          G_BINDING_SYNC_CREATE);
 
2107
    }
 
2108
  else
 
2109
    {
 
2110
      /* Don't override the binding */
 
2111
      gtk_widget_set_sensitive (self->priv->button_video, video);
 
2112
    }
 
2113
}
 
2114
 
 
2115
static void
 
2116
contact_capabilities_changed_cb (EmpathyContact *contact,
 
2117
    GParamSpec *spec,
 
2118
    EmpathyLogWindow *self)
 
2119
{
 
2120
  do_update_buttons_sensitivity (self);
 
2121
}
 
2122
 
 
2123
static void
2073
2124
log_window_update_buttons_sensitivity (EmpathyLogWindow *self)
2074
2125
{
2075
2126
  GtkTreeView *view;
2076
2127
  GtkTreeModel *model;
2077
2128
  GtkTreeSelection *selection;
2078
 
  EmpathyCapabilities capabilities;
2079
2129
  TpAccount *account;
2080
2130
  TplEntity *target;
2081
2131
  GtkTreeIter iter;
2082
2132
  GList *paths;
2083
2133
  GtkTreePath *path;
2084
 
  gboolean profile, chat, call, video;
2085
 
 
2086
 
  profile = chat = call = video = FALSE;
2087
 
 
2088
 
  tp_clear_object (&self->priv->button_video_binding);
2089
 
  tp_clear_object (&self->priv->selected_contact);
 
2134
 
 
2135
  if (self->priv->selected_contact != NULL)
 
2136
    {
 
2137
      g_signal_handlers_disconnect_by_func (self->priv->selected_contact,
 
2138
          contact_capabilities_changed_cb, self);
 
2139
 
 
2140
      tp_clear_object (&self->priv->selected_contact);
 
2141
    }
2090
2142
 
2091
2143
  view = GTK_TREE_VIEW (self->priv->treeview_who);
2092
2144
  model = gtk_tree_view_get_model (view);
2093
2145
  selection = gtk_tree_view_get_selection (view);
2094
2146
 
2095
 
  profile = chat = call = video = FALSE;
2096
 
 
2097
2147
  if (!gtk_tree_model_get_iter_first (model, &iter))
2098
2148
    goto events;
2099
2149
 
2121
2171
  g_object_unref (account);
2122
2172
  g_object_unref (target);
2123
2173
 
2124
 
  capabilities = empathy_contact_get_capabilities (self->priv->selected_contact);
2125
 
 
2126
 
  profile = chat = TRUE;
2127
 
  call = capabilities & EMPATHY_CAPABILITIES_AUDIO;
2128
 
  video = capabilities & EMPATHY_CAPABILITIES_VIDEO;
2129
 
 
2130
2174
  goto out;
2131
2175
 
2132
2176
 events:
2136
2180
 
2137
2181
  if (self->priv->events_contact != NULL)
2138
2182
    self->priv->selected_contact = g_object_ref (self->priv->events_contact);
2139
 
  else
2140
 
    goto out;
2141
 
 
2142
 
  capabilities = empathy_contact_get_capabilities (self->priv->selected_contact);
2143
 
 
2144
 
  profile = chat = TRUE;
2145
 
  call = capabilities & EMPATHY_CAPABILITIES_AUDIO;
2146
 
  video = capabilities & EMPATHY_CAPABILITIES_VIDEO;
2147
 
 
2148
 
  if (video)
2149
 
    self->priv->button_video_binding = g_object_bind_property (
2150
 
        self->priv->camera_monitor, "available",
2151
 
        self->priv->button_video, "sensitive",
2152
 
        G_BINDING_SYNC_CREATE);
2153
2183
 
2154
2184
 out:
2155
 
  gtk_widget_set_sensitive (self->priv->button_profile, profile);
2156
 
  gtk_widget_set_sensitive (self->priv->button_chat, chat);
2157
 
  gtk_widget_set_sensitive (self->priv->button_call, call);
 
2185
  if (self->priv->selected_contact != NULL)
 
2186
    {
 
2187
      tp_g_signal_connect_object (self->priv->selected_contact,
 
2188
          "notify::capabilities", G_CALLBACK (contact_capabilities_changed_cb),
 
2189
          self, 0);
 
2190
    }
2158
2191
 
2159
 
  /* Don't override the binding */
2160
 
  if (!video)
2161
 
    gtk_widget_set_sensitive (self->priv->button_video, video);
 
2192
  do_update_buttons_sensitivity (self);
2162
2193
}
2163
2194
 
2164
2195
static void