~ubuntu-branches/ubuntu/precise/empathy/precise

« back to all changes in this revision

Viewing changes to libempathy-gtk/empathy-presence-chooser.c

Tags: upstream-0.21.90
ImportĀ upstreamĀ versionĀ 0.21.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#include <libempathy/empathy-idle.h>
38
38
#include <libempathy/empathy-utils.h>
39
39
#include <libempathy/empathy-debug.h>
40
 
#include <libempathy/empathy-marshal.h>
 
40
#include <libempathy/empathy-status-presets.h>
41
41
 
42
42
#include "empathy-ui-utils.h"
43
43
#include "empathy-images.h"
44
44
#include "empathy-presence-chooser.h"
45
 
#include "empathy-status-presets.h"
46
45
 
47
46
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_PRESENCE_CHOOSER, EmpathyPresenceChooserPriv))
48
47
 
381
380
                /* If we didn't get any match at all, it means the last state
382
381
                 * was a custom one. Just switch to the first one.
383
382
                 */
384
 
                status = empathy_presence_state_get_default_status (states[0]);
 
383
                status = empathy_presence_get_default_message (states[0]);
385
384
 
386
385
                presence_chooser_reset_scroll_timeout (chooser);
387
386
                empathy_idle_set_presence (priv->idle, states[0], status);
404
403
                StateAndStatus *sas;
405
404
                const gchar    *status;
406
405
 
407
 
                status = empathy_presence_state_get_default_status (states[i]);
 
406
                status = empathy_presence_get_default_message (states[i]);
408
407
                sas = presence_chooser_state_and_status_new (states[i], status);
409
408
                list = g_list_prepend (list, sas);
410
409
 
455
454
        }
456
455
 
457
456
        gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
458
 
                                      empathy_icon_name_for_presence_state (state),
 
457
                                      empathy_icon_name_for_presence (state),
459
458
                                      GTK_ICON_SIZE_MENU);
460
459
 
461
460
        on = !on;
500
499
        }
501
500
 
502
501
        gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
503
 
                                      empathy_icon_name_for_presence_state (state),
 
502
                                      empathy_icon_name_for_presence (state),
504
503
                                      GTK_ICON_SIZE_MENU);
505
504
 
506
505
        priv->last_state = state;
665
664
        for (i = 0; i < G_N_ELEMENTS (states); i += 2) {
666
665
                GList       *list, *l;
667
666
 
668
 
                status = empathy_presence_state_get_default_status (states[i]);
 
667
                status = empathy_presence_get_default_message (states[i]);
669
668
                presence_chooser_menu_add_item (menu,
670
669
                                                status,
671
670
                                                states[i]);
714
713
        const gchar *icon_name;
715
714
 
716
715
        item = gtk_image_menu_item_new_with_label (str);
717
 
        icon_name = empathy_icon_name_for_presence_state (state);
 
716
        icon_name = empathy_icon_name_for_presence (state);
718
717
 
719
718
        g_signal_connect (item, "activate",
720
719
                          G_CALLBACK (presence_chooser_noncustom_activate_cb),
808
807
 
809
808
        gtk_combo_box_set_model (GTK_COMBO_BOX (dialog->comboboxentry_message),
810
809
                                 GTK_TREE_MODEL (store));
 
810
 
 
811
        g_object_unref (store);
811
812
}
812
813
 
813
814
static void
889
890
 
890
891
                gtk_list_store_append (store, &iter);
891
892
                gtk_list_store_set (store, &iter,
892
 
                                    COL_ICON, empathy_icon_name_for_presence_state (states[i]),
893
 
                                    COL_LABEL, empathy_presence_state_get_default_status (states[i]),
 
893
                                    COL_ICON, empathy_icon_name_for_presence (states[i]),
 
894
                                    COL_LABEL, empathy_presence_get_default_message (states[i]),
894
895
                                    COL_PRESENCE, states[i],
895
896
                                    -1);
896
897
        }
899
900
}
900
901
 
901
902
static void
 
903
presence_chooser_dialog_response_cb (GtkWidget           *widget,
 
904
                                     gint                 response,
 
905
                                     CustomMessageDialog *dialog)
 
906
{
 
907
        if (response == GTK_RESPONSE_APPLY) {
 
908
                McPresence   state;
 
909
                const gchar *text;
 
910
 
 
911
                state = presence_chooser_dialog_get_selected (dialog);
 
912
                text = gtk_entry_get_text (GTK_ENTRY (dialog->entry_message));
 
913
 
 
914
                presence_chooser_set_state (state, text);
 
915
        }
 
916
 
 
917
        gtk_widget_destroy (widget);
 
918
}
 
919
 
 
920
static void
902
921
presence_chooser_dialog_destroy_cb (GtkWidget           *widget,
903
922
                                    CustomMessageDialog *dialog)
904
923
{
905
 
        McPresence   state;
906
 
        const gchar *text;
907
 
 
908
 
        state = presence_chooser_dialog_get_selected (dialog);
909
 
        text = gtk_entry_get_text (GTK_ENTRY (dialog->entry_message));
910
 
 
911
 
        presence_chooser_set_state (state, text);
912
924
 
913
925
        g_free (dialog);
914
926
        message_dialog = NULL;
936
948
        empathy_glade_connect (glade,
937
949
                               message_dialog,
938
950
                               "custom_message_dialog", "destroy", presence_chooser_dialog_destroy_cb,
939
 
                               "custom_message_dialog", "response", gtk_widget_destroy,
 
951
                               "custom_message_dialog", "response", presence_chooser_dialog_response_cb,
940
952
                               "combobox_status", "changed", presence_chooser_dialog_status_changed_cb,
941
953
                               "checkbutton_save", "toggled", presence_chooser_dialog_save_toggled_cb,
942
954
                               NULL);