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

« back to all changes in this revision

Viewing changes to libempathy-gtk/empathy-presence-chooser.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:
21
21
 * Authors: Richard Hult <richard@imendio.com>
22
22
 *          Martyn Russell <martyn@imendio.com>
23
23
 *          Xavier Claessens <xclaesse@gmail.com>
24
 
 *          Davyd Madeley <davyd.madeley@collabora.co.uk>
 
24
 *          Danielle Madeley <danielle.madeley@collabora.co.uk>
25
25
 */
26
26
 
27
27
#include "config.h"
37
37
#include <telepathy-glib/util.h>
38
38
 
39
39
#include <libempathy/empathy-connectivity.h>
40
 
#include <libempathy/empathy-idle.h>
 
40
#include <libempathy/empathy-presence-manager.h>
41
41
#include <libempathy/empathy-utils.h>
42
42
#include <libempathy/empathy-status-presets.h>
43
43
 
99
99
} PresenceChooserEntryType;
100
100
 
101
101
typedef struct {
102
 
        EmpathyIdle *idle;
 
102
        EmpathyPresenceManager *presence_mgr;
103
103
        EmpathyConnectivity *connectivity;
104
104
 
105
105
        gboolean     editing_status;
126
126
                         { TP_CONNECTION_PRESENCE_TYPE_UNSET, },
127
127
                        };
128
128
 
 
129
static void            presence_chooser_constructed            (GObject                    *object);
129
130
static void            presence_chooser_finalize               (GObject                    *object);
130
131
static void            presence_chooser_presence_changed_cb    (EmpathyPresenceChooser      *chooser);
131
132
static void            presence_chooser_menu_add_item          (GtkWidget                  *menu,
138
139
static void            presence_chooser_custom_activate_cb     (GtkWidget                  *item,
139
140
                                                                gpointer                    user_data);
140
141
 
141
 
G_DEFINE_TYPE (EmpathyPresenceChooser, empathy_presence_chooser, GTK_TYPE_COMBO_BOX_ENTRY);
 
142
G_DEFINE_TYPE (EmpathyPresenceChooser, empathy_presence_chooser, GTK_TYPE_COMBO_BOX);
142
143
 
143
144
static void
144
145
empathy_presence_chooser_class_init (EmpathyPresenceChooserClass *klass)
145
146
{
146
147
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
147
148
 
 
149
        object_class->constructed = presence_chooser_constructed;
148
150
        object_class->finalize = presence_chooser_finalize;
149
151
 
150
152
        g_type_class_add_private (object_class, sizeof (EmpathyPresenceChooserPriv));
431
433
 
432
434
        DEBUG ("Sending state to MC-> %d (%s)", priv->state, status);
433
435
 
434
 
        empathy_idle_set_presence (priv->idle, priv->state, status);
 
436
        empathy_presence_manager_set_presence (priv->presence_mgr, priv->state, status);
435
437
}
436
438
 
437
439
static void
480
482
                mc_set_custom_state (self);
481
483
        }
482
484
        else {
483
 
                PresenceChooserEntryType type;
484
485
                TpConnectionPresenceType state;
485
486
                char *status;
486
487
 
487
 
                type = presence_chooser_get_entry_type (self);
488
488
                state = get_state_and_status (self, &status);
489
489
 
490
490
                if (!empathy_status_presets_is_valid (state)) {
525
525
{
526
526
        EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
527
527
 
528
 
        if (priv->editing_status && event->keyval == GDK_Escape) {
 
528
        if (priv->editing_status && event->keyval == GDK_KEY_Escape) {
529
529
                /* the user pressed Escape, undo the editing */
530
530
                presence_chooser_reset_status (self);
531
531
                return TRUE;
532
532
        }
533
 
        else if (event->keyval == GDK_Up || event->keyval == GDK_Down) {
 
533
        else if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_Down) {
534
534
                /* ignore */
535
535
                return TRUE;
536
536
        }
662
662
                                    COL_STATUS_TEXT, &status,
663
663
                                    -1);
664
664
 
665
 
                empathy_idle_set_presence (priv->idle, priv->state, status);
 
665
                empathy_presence_manager_set_presence (priv->presence_mgr, priv->state, status);
666
666
 
667
667
                g_free (status);
668
668
        }
848
848
{
849
849
        EmpathyPresenceChooserPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (chooser,
850
850
                EMPATHY_TYPE_PRESENCE_CHOOSER, EmpathyPresenceChooserPriv);
851
 
        GtkWidget *entry;
852
 
        GtkCellRenderer *renderer;
853
851
 
854
852
        chooser->priv = priv;
855
853
 
856
854
        /* Create the not-favorite icon */
857
855
        priv->not_favorite_pixbuf = create_not_favorite_pixbuf ();
 
856
}
 
857
 
 
858
static void
 
859
presence_chooser_constructed (GObject *object)
 
860
{
 
861
        EmpathyPresenceChooser *chooser = EMPATHY_PRESENCE_CHOOSER (object);
 
862
        EmpathyPresenceChooserPriv *priv = chooser->priv;
 
863
        GtkWidget *entry;
 
864
        GtkCellRenderer *renderer;
858
865
 
859
866
        tp_g_signal_connect_object (gtk_icon_theme_get_default (), "changed",
860
867
                                     G_CALLBACK (icon_theme_changed_cb),
862
869
 
863
870
        presence_chooser_create_model (chooser);
864
871
 
865
 
        gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (chooser),
 
872
        gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (chooser),
866
873
                                             COL_STATUS_TEXT);
867
874
        gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (chooser),
868
875
                                              combo_row_separator_func,
913
920
                        G_CALLBACK (presence_chooser_entry_focus_out_cb),
914
921
                        chooser);
915
922
 
916
 
        priv->idle = empathy_idle_dup_singleton ();
 
923
        priv->presence_mgr = empathy_presence_manager_dup_singleton ();
917
924
 
918
925
        priv->account_manager = tp_account_manager_dup ();
919
926
        g_signal_connect_swapped (priv->account_manager,
961
968
        if (priv->account_manager != NULL)
962
969
                g_object_unref (priv->account_manager);
963
970
 
964
 
        g_signal_handlers_disconnect_by_func (priv->idle,
 
971
        g_signal_handlers_disconnect_by_func (priv->presence_mgr,
965
972
                                              presence_chooser_presence_changed_cb,
966
973
                                              object);
967
 
        g_object_unref (priv->idle);
 
974
        g_object_unref (priv->presence_mgr);
968
975
 
969
976
        g_object_unref (priv->connectivity);
970
977
        if (priv->not_favorite_pixbuf != NULL)
983
990
GtkWidget *
984
991
empathy_presence_chooser_new (void)
985
992
{
986
 
        return g_object_new (EMPATHY_TYPE_PRESENCE_CHOOSER, NULL);
 
993
        /* FIXME, why can't this go in init ()? */
 
994
        return g_object_new (EMPATHY_TYPE_PRESENCE_CHOOSER,
 
995
                "has-entry", TRUE,
 
996
                NULL);
987
997
}
988
998
 
989
999
static void
1185
1195
presence_chooser_set_state (TpConnectionPresenceType state,
1186
1196
                            const gchar *status)
1187
1197
{
1188
 
        EmpathyIdle *idle;
 
1198
        EmpathyPresenceManager *presence_mgr;
1189
1199
 
1190
 
        idle = empathy_idle_dup_singleton ();
1191
 
        empathy_idle_set_presence (idle, state, status);
1192
 
        g_object_unref (idle);
 
1200
        presence_mgr = empathy_presence_manager_dup_singleton ();
 
1201
        empathy_presence_manager_set_presence (presence_mgr, state, status);
 
1202
        g_object_unref (presence_mgr);
1193
1203
}
1194
1204
 
1195
1205
static void