~ubuntu-branches/ubuntu/precise/empathy/precise-proposed-201205180810

« back to all changes in this revision

Viewing changes to libempathy-gtk/empathy-contact-list-store.c

  • Committer: Bazaar Package Importer
  • Author(s): Brian Curtis, Brian Curtis, Ken VanDine
  • Date: 2011-06-01 10:35:24 UTC
  • mfrom: (1.1.70 upstream) (6.3.44 experimental)
  • Revision ID: james.westby@ubuntu.com-20110601103524-wx3wgp71394730jt
Tags: 3.1.1-1ubuntu1
[ Brian Curtis ]
* Merge with Debian experimental, remaining Ubuntu changes:
* debian/control:
  - Drop geoclue/mapping build-depends (they are in Universe)
  - Add Vcz-Bzr link
  - Add Suggests on telepathy-idle
  - Bump telepathy-butterfly, telepathy-haze to recommends
  - Don't recommend the freedesktop sound theme we have an ubuntu one
  - Add build depend for libunity-dev
* debian/rules:
  - Use autoreconf.mk
  - Disable map and location
* debian/empathy.install:
  - Install message indicator configuration
* debian/indicators/empathy:
  - Message indicator configuration
* debian/patches/01_lpi.patch:
  - Add Launchpad integration
* debian/patches/10_use_notify_osd_icons.patch:
  - Use the notify-osd image for new messages
* debian/patches/34_start_raised_execpt_in_session.patch
  - If not started with the session, we should always raise
* debian/patches/36_chat_window_default_size.patch:
  - Make the default chat window size larger
* debian/patches/37_facebook_default.patch:
  - Make facebook the default chat account type
* debian/patches/38_lp_569289.patch
  - Set freenode as default IRC network for new IRC accounts 
* debian/patches/41_unity_launcher_progress.patch
  - Display file transfer progress in the unity launcher

[ Ken VanDine ]
* debian/control
  - build depend on libgcr-3-dev instead of libgcr-dev
  - dropped build depends for libindicate, we will use telepathy-indicator
  - Depend on dconf-gsettings-backend | gsettings-backend
  - Added a Recommends for telepathy-indicator
* +debian/empathy.gsettings-override
  - Added an override for notifications-focus
* debian/patches/series
  - commented out 23_idomessagedialog_for_voip_and_ft.patch, until ido has 
    been ported to gtk3

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include <telepathy-glib/util.h>
35
35
 
36
36
#include <libempathy/empathy-utils.h>
 
37
#include <libempathy/empathy-tp-chat.h>
37
38
#include <libempathy/empathy-enum-types.h>
38
39
#include <libempathy/empathy-contact-manager.h>
39
40
 
40
41
#include "empathy-contact-list-store.h"
41
42
#include "empathy-ui-utils.h"
42
43
#include "empathy-gtk-enum-types.h"
 
44
#include "empathy-images.h"
43
45
 
44
46
#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
45
47
#include <libempathy/empathy-debug.h>
181
183
 
182
184
G_DEFINE_TYPE (EmpathyContactListStore, empathy_contact_list_store, GTK_TYPE_TREE_STORE);
183
185
 
 
186
static void
 
187
contact_list_store_chat_state_changed_cb (TpChannel *self,
 
188
                                     guint contact_handle,
 
189
                                     guint state,
 
190
                                     gpointer store)
 
191
{
 
192
        EmpathyContactListStorePriv *priv = GET_PRIV (store);
 
193
        GList *contacts, *l;
 
194
 
 
195
        contacts = empathy_contact_list_get_members (priv->list);
 
196
 
 
197
        for (l = contacts; l != NULL; l = l->next) {
 
198
                EmpathyContact *contact = EMPATHY_CONTACT (l->data);
 
199
 
 
200
                if (empathy_contact_get_handle (contact) == contact_handle) {
 
201
                        contact_list_store_contact_update (store, contact);
 
202
                        break;
 
203
                }
 
204
        }
 
205
 
 
206
        g_list_foreach (contacts, (GFunc) g_object_unref, NULL);
 
207
        g_list_free (contacts);
 
208
}
 
209
 
184
210
static gboolean
185
211
contact_list_store_iface_setup (gpointer user_data)
186
212
{
206
232
                          G_CALLBACK (contact_list_store_groups_changed_cb),
207
233
                          store);
208
234
 
 
235
        if (EMPATHY_IS_TP_CHAT (priv->list)) {
 
236
                TpChannel *channel;
 
237
 
 
238
                channel = empathy_tp_chat_get_channel (EMPATHY_TP_CHAT (priv->list));
 
239
                if (!tp_proxy_is_prepared (channel, TP_CHANNEL_FEATURE_CHAT_STATES)) {
 
240
                        DEBUG ("Chat state feature not prepared");
 
241
                } else {
 
242
                        g_signal_connect (channel,
 
243
                                          "chat-state-changed",
 
244
                                          G_CALLBACK (contact_list_store_chat_state_changed_cb),
 
245
                                          store);
 
246
                }
 
247
        }
 
248
 
209
249
        /* Add contacts already created. */
210
250
        contacts = empathy_contact_list_get_members (priv->list);
211
251
        for (l = contacts; l; l = l->next) {
411
451
                                 const GValue *value,
412
452
                                 GParamSpec   *pspec)
413
453
{
414
 
        EmpathyContactListStorePriv *priv;
415
 
 
416
 
        priv = GET_PRIV (object);
417
 
 
418
454
        switch (param_id) {
419
455
        case PROP_CONTACT_LIST:
420
456
                contact_list_store_set_contact_list (EMPATHY_CONTACT_LIST_STORE (object),
890
926
                                       gboolean                 is_member,
891
927
                                       EmpathyContactListStore *store)
892
928
{
893
 
        EmpathyContactListStorePriv *priv;
894
 
 
895
 
        priv = GET_PRIV (store);
896
 
 
897
929
        DEBUG ("Contact %s (%d) %s",
898
930
                empathy_contact_get_id (contact),
899
931
                empathy_contact_get_handle (contact),
912
944
                                          gboolean                 is_favourite,
913
945
                                          EmpathyContactListStore *store)
914
946
{
915
 
        EmpathyContactListStorePriv *priv;
916
 
 
917
 
        priv = GET_PRIV (store);
918
 
 
919
947
        DEBUG ("Contact %s (%d) is %s a favourite",
920
948
                empathy_contact_get_id (contact),
921
949
                empathy_contact_get_handle (contact),
933
961
                                      gchar                   *message,
934
962
                                      EmpathyContactListStore *store)
935
963
{
936
 
        EmpathyContactListStorePriv *priv;
937
 
 
938
 
        priv = GET_PRIV (store);
939
 
 
940
964
        DEBUG ("Contact %s (%d) renamed to %s (%d)",
941
965
                empathy_contact_get_id (old_contact),
942
966
                empathy_contact_get_handle (old_contact),
1082
1106
contact_list_store_remove_contact (EmpathyContactListStore *store,
1083
1107
                                   EmpathyContact          *contact)
1084
1108
{
1085
 
        EmpathyContactListStorePriv *priv;
1086
1109
        GtkTreeModel               *model;
1087
1110
        GList                      *iters, *l;
1088
1111
 
1089
 
        priv = GET_PRIV (store);
1090
 
 
1091
1112
        iters = contact_list_store_find_contact (store, contact);
1092
1113
        if (!iters) {
1093
1114
                return;
1292
1313
                                       gboolean                active,
1293
1314
                                       gboolean                set_changed)
1294
1315
{
1295
 
        EmpathyContactListStorePriv *priv;
1296
1316
        GtkTreeModel               *model;
1297
1317
        GList                      *iters, *l;
1298
1318
 
1299
 
        priv = GET_PRIV (store);
1300
1319
        model = GTK_TREE_MODEL (store);
1301
1320
 
1302
1321
        iters = contact_list_store_find_contact (store, contact);
1415
1434
                              gboolean               *created,
1416
1435
                              gboolean               is_fake_group)
1417
1436
{
1418
 
        EmpathyContactListStorePriv *priv;
1419
1437
        GtkTreeModel                *model;
1420
1438
        GtkTreeIter                  iter_group;
1421
1439
        GtkTreeIter                  iter_separator;
1422
1440
        FindGroup                    fg;
1423
1441
 
1424
 
        priv = GET_PRIV (store);
1425
 
 
1426
1442
        memset (&fg, 0, sizeof (fg));
1427
1443
 
1428
1444
        fg.name = name;
1595
1611
 
1596
1612
        /* protocol */
1597
1613
        ret_val = strcmp (tp_account_get_protocol (account_a),
1598
 
                          tp_account_get_protocol (account_a));
 
1614
                          tp_account_get_protocol (account_b));
1599
1615
 
1600
1616
        if (ret_val != 0)
1601
1617
                goto out;
1602
1618
 
1603
1619
        /* account ID */
1604
1620
        ret_val = strcmp (tp_proxy_get_object_path (account_a),
1605
 
                          tp_proxy_get_object_path (account_a));
 
1621
                          tp_proxy_get_object_path (account_b));
1606
1622
 
1607
1623
out:
1608
1624
        return ret_val;
1736
1752
contact_list_store_find_contact (EmpathyContactListStore *store,
1737
1753
                                 EmpathyContact          *contact)
1738
1754
{
1739
 
        EmpathyContactListStorePriv *priv;
1740
1755
        GtkTreeModel              *model;
1741
1756
        GList                     *l = NULL;
1742
1757
        FindContact                fc;
1743
1758
 
1744
 
        priv = GET_PRIV (store);
1745
 
 
1746
1759
        memset (&fc, 0, sizeof (fc));
1747
1760
 
1748
1761
        fc.contact = contact;
1835
1848
                                            EmpathyContact *contact)
1836
1849
{
1837
1850
        GdkPixbuf                   *pixbuf_status = NULL;
 
1851
        EmpathyContactListStorePriv *priv;
1838
1852
        const gchar                 *status_icon_name = NULL;
1839
 
 
1840
 
        status_icon_name = empathy_icon_name_for_contact (contact);
 
1853
        gboolean                     composing = FALSE;
 
1854
 
 
1855
        priv = GET_PRIV (store);
 
1856
 
 
1857
        if (EMPATHY_IS_TP_CHAT (priv->list)) {
 
1858
                if (empathy_tp_chat_get_chat_state (EMPATHY_TP_CHAT (priv->list),
 
1859
                      contact) ==
 
1860
                        TP_CHANNEL_CHAT_STATE_COMPOSING)
 
1861
                composing = TRUE;
 
1862
        }
 
1863
 
 
1864
        if (composing) {
 
1865
                status_icon_name = EMPATHY_IMAGE_TYPING;
 
1866
        } else {
 
1867
                status_icon_name = empathy_icon_name_for_contact (contact);
 
1868
        }
 
1869
 
1841
1870
        if (status_icon_name == NULL)
1842
1871
                return NULL;
1843
1872