~ubuntu-branches/ubuntu/vivid/ekiga/vivid-proposed

« back to all changes in this revision

Viewing changes to lib/engine/gui/gtk-frontend/presentity-view.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kilian Krause
  • Date: 2011-07-17 00:24:50 UTC
  • mfrom: (5.1.5 upstream) (7.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110717002450-ytg3wsrc1ptd3153
Tags: 3.3.1-1
* New upstream release.
 - Required libpt-dev 2.10 and libopal-dev 3.10
* Fix debian/watch to catch new version
* Remove libnotify0.7.patch - included upstream
* Add libboost-dev and libboost-signals-dev to Build-Depends
* debian/rules: Don't install *.la files for new internal shared libs
* Fix Vcs URIs to point to correct desktop/experimental/ekiga tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
/* Ekiga -- A VoIP and Video-Conferencing application
3
 
 * Copyright (C) 2000-2008 Damien Sandras
 
3
 * Copyright (C) 2000-2009 Damien Sandras <dsandras@seconix.com>
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or modify
6
6
 * it under the terms of the GNU General Public License as published by
37
37
 
38
38
#include "presentity-view.h"
39
39
 
40
 
class PresentityViewHelper;
41
 
 
42
40
struct _PresentityViewPrivate
43
41
{
44
42
  Ekiga::Presentity* presentity;
45
 
  sigc::connection updated_conn;
46
 
  sigc::connection removed_conn;
 
43
  boost::signals::connection updated_conn;
 
44
  boost::signals::connection removed_conn;
47
45
 
48
46
  /* we contain those, so no need to unref them */
49
47
  GtkWidget* presence_image;
50
48
  GtkWidget* name_status;
51
 
  GtkWidget* avatar_image;
52
49
};
53
50
 
54
51
enum {
55
52
  PRESENTITY_VIEW_PROP_PRESENTITY = 1
56
53
};
57
54
 
58
 
static GObjectClass* parent_class = NULL;
 
55
G_DEFINE_TYPE (PresentityView, presentity_view, GTK_TYPE_HBOX);
59
56
 
60
57
/* declaration of callbacks */
61
58
 
90
87
 
91
88
  gtk_label_set_markup (GTK_LABEL (self->priv->name_status), txt);
92
89
  g_free (txt);
93
 
  gtk_image_set_from_stock (GTK_IMAGE (self->priv->avatar_image),
94
 
                            self->priv->presentity->get_avatar ().c_str (),
95
 
                            GTK_ICON_SIZE_MENU);
96
90
}
97
91
 
98
92
static void
107
101
presentity_view_set_presentity (PresentityView* self,
108
102
                                Ekiga::Presentity* presentity)
109
103
{
110
 
  g_return_if_fail (self->priv->presentity == NULL);
 
104
  g_return_if_fail ( !self->priv->presentity);
111
105
 
112
106
  self->priv->presentity = presentity;
113
 
  self->priv->updated_conn = self->priv->presentity->updated.connect (sigc::bind (sigc::ptr_fun (on_presentity_updated), self));
114
 
  self->priv->removed_conn = self->priv->presentity->removed.connect (sigc::bind (sigc::ptr_fun (on_presentity_removed), self));
 
107
  self->priv->updated_conn = self->priv->presentity->updated.connect (boost::bind (&on_presentity_updated, self));
 
108
  self->priv->removed_conn = self->priv->presentity->removed.connect (boost::bind (&on_presentity_removed, self));
115
109
 
116
110
  on_presentity_updated (self);
117
111
}
132
126
static void
133
127
presentity_view_finalize (GObject* obj)
134
128
{
135
 
  PresentityView* self = NULL;
136
 
 
137
 
  self = (PresentityView*)obj;
 
129
  PresentityView* self = (PresentityView*)obj;
138
130
 
139
131
  presentity_view_unset_presentity (self);
140
132
 
141
133
  delete self->priv;
142
134
  self->priv = NULL;
143
135
 
144
 
  parent_class->finalize (obj);
 
136
  G_OBJECT_CLASS (presentity_view_parent_class)->finalize (obj);
145
137
}
146
138
 
147
139
static void
170
162
}
171
163
 
172
164
static void
173
 
presentity_view_class_init (gpointer g_class,
174
 
                            G_GNUC_UNUSED gpointer class_data)
 
165
presentity_view_class_init (PresentityViewClass* klass)
175
166
{
176
 
  GObjectClass* gobject_class = NULL;
 
167
  GObjectClass* gobject_class = G_OBJECT_CLASS (klass);
177
168
  GParamSpec* spec = NULL;
178
169
 
179
 
  parent_class = (GObjectClass*)g_type_class_peek_parent (g_class);
180
 
 
181
 
  gobject_class = (GObjectClass*)g_class;
182
170
  gobject_class->finalize = presentity_view_finalize;
183
171
  gobject_class->set_property = presentity_view_set_property;
184
172
 
192
180
}
193
181
 
194
182
static void
195
 
presentity_view_init (GTypeInstance* instance,
196
 
                      G_GNUC_UNUSED gpointer g_class)
 
183
presentity_view_init (PresentityView* self)
197
184
{
198
 
  PresentityView* self = NULL;
199
 
 
200
 
  self = (PresentityView*)instance;
201
 
 
202
185
  self->priv = new PresentityViewPrivate;
 
186
 
203
187
  self->priv->presentity = NULL;
204
188
 
205
189
  self->priv->presence_image = gtk_image_new ();
211
195
  gtk_box_pack_start (GTK_BOX (self), self->priv->name_status,
212
196
                      FALSE, TRUE, 2);
213
197
  gtk_widget_show (self->priv->name_status);
214
 
 
215
 
  self->priv->avatar_image = gtk_image_new ();
216
 
  gtk_box_pack_start (GTK_BOX (self), self->priv->avatar_image,
217
 
                      FALSE, FALSE, 2);
218
 
  gtk_widget_show (self->priv->avatar_image);
219
 
}
220
 
 
221
 
 
222
 
GType
223
 
presentity_view_get_type ()
224
 
{
225
 
  static GType result = 0;
226
 
 
227
 
  if (result == 0) {
228
 
 
229
 
    static const GTypeInfo info = {
230
 
      sizeof (PresentityViewClass),
231
 
      NULL,
232
 
      NULL,
233
 
      presentity_view_class_init,
234
 
      NULL,
235
 
      NULL,
236
 
      sizeof (PresentityView),
237
 
      0,
238
 
      presentity_view_init,
239
 
      NULL
240
 
    };
241
 
 
242
 
    result = g_type_register_static (GTK_TYPE_HBOX,
243
 
                                     "PresentityView",
244
 
                                     &info, (GTypeFlags) 0);
245
 
  }
246
 
 
247
 
  return result;
248
198
}
249
199
 
250
200
/* public api */
251
201
 
252
202
GtkWidget*
253
 
presentity_view_new (Ekiga::Presentity& presentity)
 
203
presentity_view_new (Ekiga::PresentityPtr presentity)
254
204
{
255
205
  return (GtkWidget*)g_object_new (TYPE_PRESENTITY_VIEW,
256
 
                                   "presentity", &presentity,
 
206
                                   "presentity", presentity.get (),
257
207
                                   NULL);
258
208
}