[darcs-to-svn @ Fix setting presence]
authorXavier Claessens <xclaesse@src.gnome.org>
Wed, 2 May 2007 12:38:49 +0000 (12:38 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Wed, 2 May 2007 12:38:49 +0000 (12:38 +0000)
svn path=/trunk/; revision=23

14 files changed:
contact-list/empathy-contact-list-main.c
libempathy-gtk/empathy-main-window.c
libempathy-gtk/gossip-presence-chooser.c
libempathy-gtk/gossip-presence-chooser.h
libempathy-gtk/gossip-status-presets.c
libempathy-gtk/gossip-status-presets.h
libempathy-gtk/gossip-stock.c
libempathy-gtk/gossip-stock.h
libempathy-gtk/gossip-ui-utils.c
libempathy-gtk/gossip-ui-utils.h
libempathy/empathy-contact-list.c
libempathy/gossip-contact.c
libempathy/gossip-presence.c
libempathy/gossip-presence.h

index b43b1c2..fa8d91b 100644 (file)
@@ -51,9 +51,10 @@ main (int argc, char *argv[])
 
        gtk_init (&argc, &argv);
 
-       window = empathy_main_window_show ();
-       gossip_stock_init (window);
+       /* FIXME: This is a horrible hack */
+       gossip_stock_init (gtk_window_new (GTK_WINDOW_TOPLEVEL));
 
+       window = empathy_main_window_show ();
        g_signal_connect (window, "destroy",
                          G_CALLBACK (destroy_cb),
                          NULL);
index ca4577f..77d5409 100644 (file)
@@ -27,6 +27,9 @@
 #include <glade/glade.h>
 #include <glib/gi18n.h>
 
+#include <libtelepathy/tp-helpers.h>
+#include <libmissioncontrol/mission-control.h>
+
 #include <libempathy/gossip-conf.h>
 #include <libempathy/gossip-contact.h>
 #include <libempathy/gossip-debug.h>
 #define GEOMETRY_NAME "main-window"
 
 typedef struct {
-       GossipContactList     *contact_list;
+       GossipContactList *contact_list;
+       MissionControl    *mc;
 
        /* Main widgets */
-       GtkWidget             *window;
-       GtkWidget             *main_vbox;
+       GtkWidget         *window;
+       GtkWidget         *main_vbox;
 
        /* Tooltips for all widgets */
-       GtkTooltips           *tooltips;
+       GtkTooltips       *tooltips;
 
        /* Menu widgets */
-       GtkWidget             *chat_connect;
-       GtkWidget             *chat_disconnect;
-       GtkWidget             *chat_search;
-       GtkWidget             *room;
-       GtkWidget             *room_menu;
-       GtkWidget             *room_sep;
-       GtkWidget             *room_join_favorites;
-       GtkWidget             *edit_context;
-       GtkWidget             *edit_context_separator;
+       GtkWidget         *chat_connect;
+       GtkWidget         *chat_disconnect;
+       GtkWidget         *chat_search;
+       GtkWidget         *room;
+       GtkWidget         *room_menu;
+       GtkWidget         *room_sep;
+       GtkWidget         *room_join_favorites;
+       GtkWidget         *edit_context;
+       GtkWidget         *edit_context_separator;
 
        /* Throbber */
-       GtkWidget             *throbber;
+       GtkWidget         *throbber;
 
        /* Widgets that are enabled when we're connected/disconnected */
-       GList                 *widgets_connected;
-       GList                 *widgets_disconnected;
+       GList             *widgets_connected;
+       GList             *widgets_disconnected;
 
        /* Status popup */
-       GtkWidget             *presence_toolbar;
-       GtkWidget             *presence_chooser;
+       GtkWidget         *presence_toolbar;
+       GtkWidget         *presence_chooser;
 
        /* Misc */
-       guint                  size_timeout_id;
+       guint              size_timeout_id;
 } EmpathyMainWindow;
 
 static void     main_window_destroy_cb                     (GtkWidget           *widget,
@@ -137,8 +141,11 @@ static void     main_window_accels_save                    (void);
 static void     main_window_connection_items_setup         (EmpathyMainWindow   *window,
                                                            GladeXML            *glade);
 //static void     main_window_connection_items_update        (void);
+static void     main_window_presence_changed_cb            (DBusGProxy          *proxy,
+                                                           McPresence           state,
+                                                           EmpathyMainWindow   *window);
 static void     main_window_presence_chooser_changed_cb    (GtkWidget           *chooser,
-                                                           GossipPresenceState  state,
+                                                           McPresence           state,
                                                            const gchar         *status,
                                                            EmpathyMainWindow   *window);
 static gboolean main_window_configure_event_timeout_cb     (EmpathyMainWindow   *window);
@@ -166,6 +173,7 @@ empathy_main_window_show (void)
        GtkWidget                *ebox;
        GtkToolItem              *item;
        gchar                    *str;
+       McPresence                state;
        gboolean                  show_offline;
        gboolean                  show_avatars;
        gboolean                  compact_contact_list;
@@ -232,11 +240,26 @@ empathy_main_window_show (void)
        gtk_widget_hide (window->edit_context);
        gtk_widget_hide (window->edit_context_separator);
 
-       /* Set up presence chooser */
+       /* Set up presence chooser
+        * FIXME: Update status message not yet supported by MC 
+        */
+       window->mc = mission_control_new (tp_get_bus ());
        window->presence_chooser = gossip_presence_chooser_new ();
        gtk_widget_show (window->presence_chooser);
        gossip_presence_chooser_set_flash_interval (GOSSIP_PRESENCE_CHOOSER (window->presence_chooser),
                                                    FLASH_TIMEOUT);
+       state = mission_control_get_presence (window->mc, NULL);
+       gossip_presence_chooser_set_state (GOSSIP_PRESENCE_CHOOSER (window->presence_chooser),
+                                          state);
+       dbus_g_proxy_connect_signal (DBUS_G_PROXY (window->mc),
+                                    "PresenceStatusRequested",
+                                    G_CALLBACK (main_window_presence_changed_cb),
+                                    window, NULL);
+       g_signal_connect (window->presence_chooser,
+                         "changed",
+                         G_CALLBACK (main_window_presence_chooser_changed_cb),
+                         window);
+
 
        item = gtk_tool_item_new ();
        gtk_widget_show (GTK_WIDGET (item));
@@ -245,11 +268,6 @@ empathy_main_window_show (void)
        gtk_tool_item_set_expand (item, TRUE);
        gtk_toolbar_insert (GTK_TOOLBAR (window->presence_toolbar), item, -1);
 
-       g_signal_connect (window->presence_chooser,
-                         "changed",
-                         G_CALLBACK (main_window_presence_chooser_changed_cb),
-                         window);
-
        window->widgets_connected = g_list_prepend (window->widgets_connected,
                                                  window->presence_chooser);
 
@@ -358,6 +376,7 @@ main_window_destroy_cb (GtkWidget         *widget,
        g_list_free (window->widgets_disconnected);
 
        g_object_unref (window->tooltips);
+       g_object_unref (window->mc);
 
        g_free (window);
 }
@@ -763,12 +782,23 @@ main_window_connection_items_update (void)
 #endif
 
 static void
-main_window_presence_chooser_changed_cb (GtkWidget           *chooser,
-                                        GossipPresenceState  state,
-                                        const gchar         *status,
-                                        EmpathyMainWindow   *window)
+main_window_presence_changed_cb (DBusGProxy        *proxy,
+                                McPresence         state,
+                                EmpathyMainWindow *window)
+{
+       gossip_debug (DEBUG_DOMAIN, "presence changed to %d", state);
+       gossip_presence_chooser_set_state (GOSSIP_PRESENCE_CHOOSER (window->presence_chooser),
+                                          state);
+}
+
+static void
+main_window_presence_chooser_changed_cb (GtkWidget         *chooser,
+                                        McPresence         state,
+                                        const gchar       *status,
+                                        EmpathyMainWindow *window)
 {
        gossip_status_presets_set_default (state, status);
+       mission_control_set_presence (window->mc, state, status, NULL, NULL);
 }
 
 static gboolean
index 3a2806a..ecb41db 100644 (file)
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_PRESENCE_CHOOSER, GossipPresenceChooserPriv))
 
 typedef struct {
-       GtkWidget           *hbox;
-       GtkWidget           *image;
-       GtkWidget           *label;
+       GtkWidget  *hbox;
+       GtkWidget  *image;
+       GtkWidget  *label;
+       GtkWidget  *menu;
 
-       GtkWidget           *menu;
+       McPresence  last_state;
 
-       GossipPresenceState  last_state;
-
-       guint                flash_interval;
-
-       GossipPresenceState  flash_state_1;
-       GossipPresenceState  flash_state_2;
-
-       guint                flash_timeout_id;
+       guint       flash_interval;
+       McPresence  flash_state_1;
+       McPresence  flash_state_2;
+       guint       flash_timeout_id;
 
        /* The handle the kind of unnessecary scroll support. */
-       guint                scroll_timeout_id;
-       GossipPresenceState  scroll_state;
-       gchar               *scroll_status;
+       guint       scroll_timeout_id;
+       McPresence  scroll_state;
+       gchar      *scroll_status;
 } GossipPresenceChooserPriv;
 
+/* States for listed in the menu */
+static McPresence states[] = {MC_PRESENCE_AVAILABLE,
+                             MC_PRESENCE_DO_NOT_DISTURB,
+                             MC_PRESENCE_AWAY};
+
 static void     presence_chooser_finalize               (GObject               *object);
 static void     presence_chooser_reset_scroll_timeout   (GossipPresenceChooser *chooser);
 static void     presence_chooser_set_state              (GossipPresenceChooser *chooser,
-                                                        GossipPresenceState    state,
+                                                        McPresence             state,
                                                         const gchar           *status,
                                                         gboolean               save);
 static void     presence_chooser_dialog_response_cb     (GtkWidget             *dialog,
                                                         gint                   response,
                                                         GossipPresenceChooser *chooser);
 static void     presence_chooser_show_dialog            (GossipPresenceChooser *chooser,
-                                                        GossipPresenceState    state);
+                                                        McPresence             state);
 static void     presence_chooser_custom_activate_cb     (GtkWidget             *item,
                                                         GossipPresenceChooser *chooser);
 static void     presence_chooser_clear_response_cb      (GtkWidget             *widget,
@@ -83,7 +85,7 @@ static void     presence_chooser_clear_activate_cb      (GtkWidget             *
 static void     presence_chooser_menu_add_item          (GossipPresenceChooser *chooser,
                                                         GtkWidget             *menu,
                                                         const gchar           *str,
-                                                        GossipPresenceState    state,
+                                                        McPresence             state,
                                                         gboolean               custom);
 static void     presence_chooser_menu_align_func        (GtkMenu               *menu,
                                                         gint                  *x,
@@ -225,7 +227,7 @@ presence_chooser_reset_scroll_timeout (GossipPresenceChooser *chooser)
 
 static void
 presence_chooser_set_state (GossipPresenceChooser *chooser,
-                           GossipPresenceState    state,
+                           McPresence             state,
                            const gchar           *status,
                            gboolean               save)
 {
@@ -262,7 +264,7 @@ presence_chooser_dialog_response_cb (GtkWidget             *dialog,
                GtkListStore        *store;
                GtkTreeModel        *model;
                GtkTreeIter          iter;
-               GossipPresenceState  state;
+               McPresence           state;
                const gchar         *status;
                gboolean             save;
                gboolean             duplicate = FALSE;
@@ -309,11 +311,11 @@ presence_chooser_dialog_response_cb (GtkWidget             *dialog,
 
 static void
 presence_chooser_show_dialog (GossipPresenceChooser *chooser,
-                             GossipPresenceState    state)
+                             McPresence             state)
 {
        GossipPresenceChooserPriv *priv;
-       static GtkWidget          *dialog;
-       static GtkListStore       *store[3] = { NULL, NULL, NULL };
+       static GtkWidget          *dialog = NULL;
+       static GtkListStore       *store[LAST_MC_PRESENCE];
        GladeXML                  *glade;
        GtkWidget                 *image;
        GtkWidget                 *combo;
@@ -327,6 +329,12 @@ presence_chooser_show_dialog (GossipPresenceChooser *chooser,
        if (dialog) {
                gtk_widget_destroy (dialog);
                dialog = NULL;
+       } else {
+               guint i;
+
+               for (i = 0; i < LAST_MC_PRESENCE; i++) {
+                       store[i] = NULL;
+               }
        }
 
        glade = gossip_glade_get_file ("gossip-presence-chooser.glade",
@@ -390,7 +398,7 @@ static void
 presence_chooser_custom_activate_cb (GtkWidget             *item,
                                     GossipPresenceChooser *chooser)
 {
-       GossipPresenceState state;
+       McPresence state;
 
        state = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "state"));
 
@@ -401,12 +409,11 @@ static void
 presence_chooser_noncustom_activate_cb (GtkWidget             *item,
                                        GossipPresenceChooser *chooser)
 {
-       GossipPresenceState  state;
-       const gchar         *status;
+       McPresence   state;
+       const gchar *status;
 
        status = g_object_get_data (G_OBJECT (item), "status");
        state = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "state"));
-
        presence_chooser_reset_scroll_timeout (chooser);
        g_signal_emit (chooser, signals[CHANGED], 0, state, status);
 }
@@ -474,7 +481,7 @@ static void
 presence_chooser_menu_add_item (GossipPresenceChooser *chooser,
                                GtkWidget             *menu,
                                const gchar           *str,
-                               GossipPresenceState    state,
+                               McPresence             state,
                                gboolean               custom)
 {
        GtkWidget   *item;
@@ -482,25 +489,7 @@ presence_chooser_menu_add_item (GossipPresenceChooser *chooser,
        const gchar *stock;
 
        item = gtk_image_menu_item_new_with_label (str);
-
-       switch (state) {
-       case GOSSIP_PRESENCE_STATE_AVAILABLE:
-               stock = GOSSIP_STOCK_AVAILABLE;
-               break;
-
-       case GOSSIP_PRESENCE_STATE_BUSY:
-               stock = GOSSIP_STOCK_BUSY;
-               break;
-
-       case GOSSIP_PRESENCE_STATE_AWAY:
-               stock = GOSSIP_STOCK_AWAY;
-               break;
-
-       default:
-               g_assert_not_reached ();
-               stock = NULL;
-               break;
-       }
+       stock = gossip_stock_for_state (state);
 
        if (custom) {
                g_signal_connect (
@@ -680,13 +669,13 @@ presence_chooser_button_press_event_cb (GtkWidget      *chooser,
 }
 
 typedef struct {
-       GossipPresenceState  state;
-       const gchar         *status;
+       McPresence   state;
+       const gchar *status;
 } StateAndStatus;
 
 static StateAndStatus *
-presence_chooser_state_and_status_new (GossipPresenceState  state,
-                                      const gchar         *status)
+presence_chooser_state_and_status_new (McPresence   state,
+                                      const gchar *status)
 {
        StateAndStatus *sas;
 
@@ -701,46 +690,25 @@ presence_chooser_state_and_status_new (GossipPresenceState  state,
 static GList *
 presence_chooser_get_presets (GossipPresenceChooser *chooser)
 {
-       GList          *list, *presets, *p;
-       StateAndStatus *sas;
-
-       list = NULL;
-
-       sas = presence_chooser_state_and_status_new (
-               GOSSIP_PRESENCE_STATE_AVAILABLE, _("Available"));
-       list = g_list_append (list, sas);
-
-       presets = gossip_status_presets_get (GOSSIP_PRESENCE_STATE_AVAILABLE, 5);
-       for (p = presets; p; p = p->next) {
-               sas = presence_chooser_state_and_status_new (
-                       GOSSIP_PRESENCE_STATE_AVAILABLE, p->data);
-               list = g_list_append (list, sas);
-       }
-       g_list_free (presets);
+       GList      *list = NULL;
+       guint       i;
 
-       sas = presence_chooser_state_and_status_new (
-               GOSSIP_PRESENCE_STATE_BUSY, _("Busy"));
-       list = g_list_append (list, sas);
+       for (i = 0; i < G_N_ELEMENTS (states); i++) {
+               GList          *presets, *p;
+               StateAndStatus *sas;
+               const gchar    *status;
 
-       presets = gossip_status_presets_get (GOSSIP_PRESENCE_STATE_BUSY, 5);
-       for (p = presets; p; p = p->next) {
-               sas = presence_chooser_state_and_status_new (
-                       GOSSIP_PRESENCE_STATE_BUSY, p->data);
-               list = g_list_append (list, sas);
-       }
-       g_list_free (presets);
-
-       sas = presence_chooser_state_and_status_new (
-               GOSSIP_PRESENCE_STATE_AWAY, _("Away"));
-       list = g_list_append (list, sas);
-
-       presets = gossip_status_presets_get (GOSSIP_PRESENCE_STATE_AWAY, 5);
-       for (p = presets; p; p = p->next) {
-               sas = presence_chooser_state_and_status_new (
-                       GOSSIP_PRESENCE_STATE_AWAY, p->data);
+               status = gossip_presence_state_get_default_status (states[i]);
+               sas = presence_chooser_state_and_status_new (states[i], status);
                list = g_list_append (list, sas);
+       
+               presets = gossip_status_presets_get (states[i], 5);
+               for (p = presets; p; p = p->next) {
+                       sas = presence_chooser_state_and_status_new (states[i], p->data);
+                       list = g_list_append (list, sas);
+               }
+               g_list_free (presets);
        }
-       g_list_free (presets);
 
        return list;
 }
@@ -839,7 +807,7 @@ presence_chooser_scroll_event_cb (GtkWidget      *chooser,
                 */
                presence_chooser_reset_scroll_timeout (GOSSIP_PRESENCE_CHOOSER (chooser));
                g_signal_emit (chooser, signals[CHANGED], 0,
-                              GOSSIP_PRESENCE_STATE_AVAILABLE,
+                              MC_PRESENCE_AVAILABLE,
                               _("Available"));
        }
 
@@ -864,94 +832,43 @@ gossip_presence_chooser_create_menu (GossipPresenceChooser *chooser)
 {
        GtkWidget *menu;
        GtkWidget *item;
-       GList     *list, *l;
+       guint      i;
 
        menu = gtk_menu_new ();
 
-       presence_chooser_menu_add_item (chooser,
-                                       menu,
-                                       _("Available"),
-                                       GOSSIP_PRESENCE_STATE_AVAILABLE,
-                                       FALSE);
+       for (i = 0; i < G_N_ELEMENTS (states); i++) {
+               GList       *list, *l;
+               const gchar *status;
 
-       list = gossip_status_presets_get (GOSSIP_PRESENCE_STATE_AVAILABLE, 5);
-       for (l = list; l; l = l->next) {
+               status = gossip_presence_state_get_default_status (states[i]);
                presence_chooser_menu_add_item (chooser,
                                                menu,
-                                               l->data,
-                                               GOSSIP_PRESENCE_STATE_AVAILABLE,
+                                               status,
+                                               states[i],
                                                FALSE);
-       }
-
-       g_list_free (list);
-
-       presence_chooser_menu_add_item (chooser,
-                                       menu,
-                                       _("Custom message..."),
-                                       GOSSIP_PRESENCE_STATE_AVAILABLE,
-                                       TRUE);
-
-       /* Separator. */
-       item = gtk_menu_item_new ();
-       gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-       gtk_widget_show (item);
-
-       presence_chooser_menu_add_item (chooser,
-                                       menu,
-                                       _("Busy"),
-                                       GOSSIP_PRESENCE_STATE_BUSY,
-                                       FALSE);
-
-       list = gossip_status_presets_get (GOSSIP_PRESENCE_STATE_BUSY, 5);
-       for (l = list; l; l = l->next) {
-               presence_chooser_menu_add_item (chooser,
-                                               menu,
-                                               l->data,
-                                               GOSSIP_PRESENCE_STATE_BUSY,
-                                               FALSE);
-       }
-
-       g_list_free (list);
-
-       presence_chooser_menu_add_item (chooser,
-                                       menu,
-                                       _("Custom message..."),
-                                       GOSSIP_PRESENCE_STATE_BUSY,
-                                       TRUE);
-
-       /* Separator. */
-       item = gtk_menu_item_new ();
-       gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-       gtk_widget_show (item);
 
-       presence_chooser_menu_add_item (chooser,
-                                       menu,
-                                       _("Away"),
-                                       GOSSIP_PRESENCE_STATE_AWAY,
-                                       FALSE);
+               list = gossip_status_presets_get (states[i], 5);
+               for (l = list; l; l = l->next) {
+                       presence_chooser_menu_add_item (chooser,
+                                                       menu,
+                                                       l->data,
+                                                       states[i],
+                                                       FALSE);
+               }
+               g_list_free (list);
 
-       list = gossip_status_presets_get (GOSSIP_PRESENCE_STATE_AWAY, 5);
-       for (l = list; l; l = l->next) {
                presence_chooser_menu_add_item (chooser,
                                                menu,
-                                               l->data,
-                                               GOSSIP_PRESENCE_STATE_AWAY,
-                                               FALSE);
+                                               _("Custom message..."),
+                                               states[i],
+                                               TRUE);
+
+               /* Separator. */
+               item = gtk_menu_item_new ();
+               gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+               gtk_widget_show (item);
        }
 
-       g_list_free (list);
-
-       presence_chooser_menu_add_item (chooser,
-                                       menu,
-                                       _("Custom message..."),
-                                       GOSSIP_PRESENCE_STATE_AWAY,
-                                       TRUE);
-
-       /* Separator. */
-       item = gtk_menu_item_new ();
-       gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-       gtk_widget_show (item);
-
        item = gtk_menu_item_new_with_label (_("Clear List..."));
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        gtk_widget_show (item);
@@ -966,7 +883,7 @@ gossip_presence_chooser_create_menu (GossipPresenceChooser *chooser)
 
 void
 gossip_presence_chooser_set_state (GossipPresenceChooser *chooser,
-                                  GossipPresenceState    state)
+                                  McPresence             state)
 {
        GossipPresenceChooserPriv *priv;
 
@@ -1008,7 +925,7 @@ static gboolean
 presence_chooser_flash_timeout_cb (GossipPresenceChooser *chooser)
 {
        GossipPresenceChooserPriv *priv;
-       GossipPresenceState        state;
+       McPresence                 state;
        GdkPixbuf                 *pixbuf;
        static gboolean            on = FALSE;
 
@@ -1031,8 +948,8 @@ presence_chooser_flash_timeout_cb (GossipPresenceChooser *chooser)
 
 void
 gossip_presence_chooser_flash_start (GossipPresenceChooser *chooser,
-                                    GossipPresenceState    state_1,
-                                    GossipPresenceState    state_2)
+                                    McPresence             state_1,
+                                    McPresence             state_2)
 {
        GossipPresenceChooserPriv *priv;
 
@@ -1054,7 +971,7 @@ gossip_presence_chooser_flash_start (GossipPresenceChooser *chooser,
 
 void
 gossip_presence_chooser_flash_stop (GossipPresenceChooser *chooser,
-                                   GossipPresenceState    state)
+                                   McPresence             state)
 {
        GossipPresenceChooserPriv *priv;
        GdkPixbuf                 *pixbuf;
@@ -1090,3 +1007,4 @@ gossip_presence_chooser_is_flashing (GossipPresenceChooser *chooser)
 
        return FALSE;
 }
+
index b1da7d1..a3f9d50 100644 (file)
@@ -53,17 +53,17 @@ GtkWidget *gossip_presence_chooser_new                (void);
 GtkWidget *gossip_presence_chooser_create_menu        (GossipPresenceChooser *chooser);
 
 void       gossip_presence_chooser_set_state          (GossipPresenceChooser *chooser,
-                                                      GossipPresenceState    state);
+                                                      McPresence             state);
 void       gossip_presence_chooser_set_status         (GossipPresenceChooser *chooser,
                                                       const gchar           *status);
 void       gossip_presence_chooser_set_flash_interval (GossipPresenceChooser *chooser,
                                                       guint                  ms);
 
 void       gossip_presence_chooser_flash_start        (GossipPresenceChooser *chooser,
-                                                      GossipPresenceState    state_1,
-                                                      GossipPresenceState    state_2);
+                                                      McPresence             state_1,
+                                                      McPresence             state_2);
 void       gossip_presence_chooser_flash_stop         (GossipPresenceChooser *chooser,
-                                                      GossipPresenceState    state);
+                                                      McPresence             state);
 gboolean   gossip_presence_chooser_is_flashing        (GossipPresenceChooser *chooser);
 
 G_END_DECLS
index 8c18cba..fce8a08 100644 (file)
 #define STATUS_PRESETS_MAX_EACH     15
 
 typedef struct {
-       gchar               *status;
-       GossipPresenceState  state;
+       gchar      *status;
+       McPresence  state;
 } StatusPreset;
 
-static StatusPreset *status_preset_new               (GossipPresenceState  state,
-                                                     const gchar         *status);
-static void          status_preset_free              (StatusPreset        *status);
-static void          status_presets_file_parse       (const gchar         *filename);
-static gboolean      status_presets_file_save        (void);
-const gchar *        status_presets_get_state_as_str (GossipPresenceState  state);
-static void          status_presets_set_default      (GossipPresenceState  state,
-                                                     const gchar         *status);
+static StatusPreset *status_preset_new          (McPresence    state,
+                                                const gchar  *status);
+static void     status_preset_free              (StatusPreset *status);
+static void     status_presets_file_parse       (const gchar  *filename);
+const gchar *   status_presets_get_state_as_str (McPresence    state);
+static gboolean status_presets_file_save        (void);
+static void     status_presets_set_default      (McPresence    state,
+                                                const gchar  *status);
 
 static GList        *presets = NULL;
 static StatusPreset *default_preset = NULL;
 
 static StatusPreset *
-status_preset_new (GossipPresenceState  state,
-                  const gchar         *status)
+status_preset_new (McPresence   state,
+                  const gchar *status)
 {
        StatusPreset *preset;
 
@@ -115,11 +115,11 @@ status_presets_file_parse (const gchar *filename)
        while (node) {
                if (strcmp ((gchar *) node->name, "status") == 0 ||
                    strcmp ((gchar *) node->name, "default") == 0) {
-                       GossipPresenceState  state;
-                       gchar               *status;
-                       gchar               *state_str;
-                       StatusPreset        *preset;
-                       gboolean             is_default = FALSE;
+                       McPresence    state;
+                       gchar        *status;
+                       gchar        *state_str;
+                       StatusPreset *preset;
+                       gboolean      is_default = FALSE;
 
                        if (strcmp ((gchar *) node->name, "default") == 0) {
                                is_default = TRUE;
@@ -129,20 +129,7 @@ status_presets_file_parse (const gchar *filename)
                        state_str = (gchar *) xmlGetProp (node, "presence");
 
                        if (state_str) {
-                               if (strcmp (state_str, "available") == 0) {
-                                       state = GOSSIP_PRESENCE_STATE_AVAILABLE;
-                               }
-                               else if (strcmp (state_str, "busy") == 0) {
-                                       state = GOSSIP_PRESENCE_STATE_BUSY;
-                               }
-                               else if (strcmp (state_str, "away") == 0) {
-                                       state = GOSSIP_PRESENCE_STATE_AWAY;
-                               }
-                               else if (strcmp (state_str, "ext_away") == 0) {
-                                       state = GOSSIP_PRESENCE_STATE_EXT_AWAY;
-                               } else {
-                                       state = GOSSIP_PRESENCE_STATE_AVAILABLE;
-                               }
+                               state = gossip_presence_state_from_str (state_str);
 
                                if (is_default) {
                                        gossip_debug (DEBUG_DOMAIN,
@@ -165,7 +152,7 @@ status_presets_file_parse (const gchar *filename)
 
        /* Use the default if not set */
        if (!default_preset) {
-               status_presets_set_default (GOSSIP_PRESENCE_STATE_AVAILABLE, NULL);
+               status_presets_set_default (MC_PRESENCE_AVAILABLE, NULL);
        }
 
        gossip_debug (DEBUG_DOMAIN, "Parsed %d status presets", g_list_length (presets));
@@ -200,16 +187,16 @@ gossip_status_presets_get_all (void)
 }
 
 const gchar *
-status_presets_get_state_as_str (GossipPresenceState state)
+status_presets_get_state_as_str (McPresence state)
 {
        switch (state) {
-       case GOSSIP_PRESENCE_STATE_AVAILABLE:
+       case MC_PRESENCE_AVAILABLE:
                return "available";
-       case GOSSIP_PRESENCE_STATE_BUSY:
+       case MC_PRESENCE_DO_NOT_DISTURB:
                return "busy";
-       case GOSSIP_PRESENCE_STATE_AWAY:
+       case MC_PRESENCE_AWAY:
                return "away";
-       case GOSSIP_PRESENCE_STATE_EXT_AWAY:
+       case MC_PRESENCE_EXTENDED_AWAY:
                return "ext_away";
        default:
                return "unknown";
@@ -224,7 +211,12 @@ status_presets_file_save (void)
        GList      *l;
        gchar      *dir;
        gchar      *file;
-       gint        count[4] = { 0, 0, 0, 0};
+       gint        count[LAST_MC_PRESENCE];
+       gint        i;
+
+       for (i = 0; i < LAST_MC_PRESENCE; i++) {
+               count[i] = 0;
+       }
 
        dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
        g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
@@ -277,8 +269,8 @@ status_presets_file_save (void)
 }
 
 GList *
-gossip_status_presets_get (GossipPresenceState state,
-                          gint                max_number)
+gossip_status_presets_get (McPresence state,
+                          gint       max_number)
 {
        GList *list = NULL;
        GList *l;
@@ -306,8 +298,8 @@ gossip_status_presets_get (GossipPresenceState state,
 }
 
 void
-gossip_status_presets_set_last (GossipPresenceState  state,
-                               const gchar         *status)
+gossip_status_presets_set_last (McPresence   state,
+                               const gchar *status)
 {
        GList        *l;
        StatusPreset *preset;
@@ -357,16 +349,16 @@ gossip_status_presets_reset (void)
 
        presets = NULL;
 
-       status_presets_set_default (GOSSIP_PRESENCE_STATE_AVAILABLE, NULL);
+       status_presets_set_default (MC_PRESENCE_AVAILABLE, NULL);
 
        status_presets_file_save ();
 }
 
-GossipPresenceState
+McPresence
 gossip_status_presets_get_default_state (void)
 {
        if (!default_preset) {
-               return GOSSIP_PRESENCE_STATE_AVAILABLE;
+               return MC_PRESENCE_AVAILABLE;
        }
 
        return default_preset->state;
@@ -384,8 +376,8 @@ gossip_status_presets_get_default_status (void)
 }
 
 static void
-status_presets_set_default (GossipPresenceState  state,
-                           const gchar         *status)
+status_presets_set_default (McPresence   state,
+                           const gchar *status)
 {
        if (default_preset) {
                status_preset_free (default_preset);
@@ -395,8 +387,8 @@ status_presets_set_default (GossipPresenceState  state,
 }
 
 void
-gossip_status_presets_set_default (GossipPresenceState  state,
-                                  const gchar         *status)
+gossip_status_presets_set_default (McPresence   state,
+                                  const gchar *status)
 {
        status_presets_set_default (state, status);
        status_presets_file_save ();
index 41a197a..4b2d925 100644 (file)
 
 G_BEGIN_DECLS
 
-void                gossip_status_presets_get_all            (void);
-GList *             gossip_status_presets_get                (GossipPresenceState  state,
-                                                             gint                 max_number);
-void                gossip_status_presets_set_last           (GossipPresenceState  state,
-                                                             const gchar         *status);
-void                gossip_status_presets_reset              (void);
-
-/* Default */
-GossipPresenceState gossip_status_presets_get_default_state  (void);
-const gchar *       gossip_status_presets_get_default_status (void);
-void                gossip_status_presets_set_default        (GossipPresenceState  state,
-                                                             const gchar         *status);
-void                gossip_status_presets_clear_default      (void);
+void          gossip_status_presets_get_all            (void);
+GList *       gossip_status_presets_get                (McPresence   state,
+                                                       gint         max_number);
+void          gossip_status_presets_set_last           (McPresence   state,
+                                                       const gchar *status);
+void          gossip_status_presets_reset              (void);
+McPresence    gossip_status_presets_get_default_state  (void);
+const gchar * gossip_status_presets_get_default_status (void);
+void          gossip_status_presets_set_default        (McPresence   state,
+                                                       const gchar *status);
+void          gossip_status_presets_clear_default      (void);
 
 G_END_DECLS
 
index f43949e..1490e65 100644 (file)
@@ -103,3 +103,27 @@ gossip_stock_render (const gchar *stock,
        return gtk_widget_render_icon (main_widget, stock, size, NULL);
 }
 
+const gchar *
+gossip_stock_for_state (McPresence state)
+{
+       switch (state) {
+       case MC_PRESENCE_AVAILABLE:
+               return GOSSIP_STOCK_AVAILABLE;
+       case MC_PRESENCE_DO_NOT_DISTURB:
+               return GOSSIP_STOCK_BUSY;
+       case MC_PRESENCE_AWAY:
+               return GOSSIP_STOCK_AWAY;
+       case MC_PRESENCE_EXTENDED_AWAY:
+               return GOSSIP_STOCK_EXT_AWAY;
+       case MC_PRESENCE_HIDDEN:
+       case MC_PRESENCE_OFFLINE:
+       case MC_PRESENCE_UNSET:
+               return GOSSIP_STOCK_OFFLINE;
+       default:
+               g_assert_not_reached ();
+       }
+
+       return NULL;
+}
+
+
index 412acee..8cf66eb 100644 (file)
@@ -28,6 +28,8 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 
+#include <libmissioncontrol/mission-control.h>
+
 G_BEGIN_DECLS
 
 #define GOSSIP_STOCK_OFFLINE             "gossip-offline"
@@ -50,10 +52,11 @@ G_BEGIN_DECLS
 
 #define GOSSIP_STOCK_GROUP_MESSAGE       "gossip-group-message"
 
-void        gossip_stock_init     (GtkWidget   *widget);
-void        gossip_stock_finalize (void);
-GdkPixbuf * gossip_stock_render   (const gchar *stock,
-                                  GtkIconSize  size);
+void          gossip_stock_init      (GtkWidget   *widget);
+void          gossip_stock_finalize  (void);
+GdkPixbuf *   gossip_stock_render    (const gchar *stock,
+                                     GtkIconSize  size);
+const gchar * gossip_stock_for_state (McPresence   state);
 
 G_END_DECLS
 
index 8287961..b6dfb8f 100644 (file)
@@ -353,28 +353,11 @@ gossip_pixbuf_from_account (McAccount   *account,
 }
 
 GdkPixbuf *
-gossip_pixbuf_for_presence_state (GossipPresenceState state)
+gossip_pixbuf_for_presence_state (McPresence state)
 {
-       const gchar *stock = NULL;
+       const gchar *stock;
 
-       switch (state) {
-       case GOSSIP_PRESENCE_STATE_AVAILABLE:
-               stock = GOSSIP_STOCK_AVAILABLE;
-               break;
-       case GOSSIP_PRESENCE_STATE_BUSY:
-               stock = GOSSIP_STOCK_BUSY;
-               break;
-       case GOSSIP_PRESENCE_STATE_AWAY:
-               stock = GOSSIP_STOCK_AWAY;
-               break;
-       case GOSSIP_PRESENCE_STATE_EXT_AWAY:
-               stock = GOSSIP_STOCK_EXT_AWAY;
-               break;
-       case GOSSIP_PRESENCE_STATE_HIDDEN:
-       case GOSSIP_PRESENCE_STATE_UNAVAILABLE:
-               stock = GOSSIP_STOCK_OFFLINE;
-               break;
-       }
+       stock = gossip_stock_for_state (state);
 
        return gossip_stock_render (stock, GTK_ICON_SIZE_MENU);
 }
@@ -382,7 +365,7 @@ gossip_pixbuf_for_presence_state (GossipPresenceState state)
 GdkPixbuf *
 gossip_pixbuf_for_presence (GossipPresence *presence)
 {
-       GossipPresenceState state;
+       McPresence state;
 
        g_return_val_if_fail (GOSSIP_IS_PRESENCE (presence),
                              gossip_pixbuf_offline ());
index fe9a156..1e1bb1e 100644 (file)
@@ -73,7 +73,7 @@ GdkPixbuf *     gossip_pixbuf_from_profile               (McProfile           *a
                                                          GtkIconSize          icon_size);
 GdkPixbuf *     gossip_pixbuf_from_account               (McAccount           *account,
                                                          GtkIconSize          icon_size);
-GdkPixbuf *     gossip_pixbuf_for_presence_state         (GossipPresenceState  state);
+GdkPixbuf *     gossip_pixbuf_for_presence_state         (McPresence           state);
 GdkPixbuf *     gossip_pixbuf_for_presence               (GossipPresence      *presence);
 GdkPixbuf *     gossip_pixbuf_for_contact                (GossipContact       *contact);
 GdkPixbuf *     gossip_pixbuf_offline                    (void);
index 1a86400..9ed83df 100644 (file)
@@ -192,7 +192,6 @@ static void                   contact_list_parse_presence_foreach   (guint
 static void                   contact_list_presences_table_foreach  (const gchar                   *state_str,
                                                                     GHashTable                    *presences_table,
                                                                     GossipPresence               **presence);
-static GossipPresenceState    contact_list_presence_state_from_str  (const gchar                   *str);
 
 enum {
        CONTACT_ADDED,
@@ -1728,9 +1727,11 @@ contact_list_parse_presence_foreach (guint               handle,
                              (GHFunc) contact_list_presences_table_foreach,
                              &presence);
 
-       gossip_debug (DEBUG_DOMAIN, "Presence changed for %s (%d)",
+       gossip_debug (DEBUG_DOMAIN, "Presence changed for %s (%d) to %s (%d)",
                      gossip_contact_get_name (contact),
-                     handle);
+                     handle,
+                     presence ? gossip_presence_get_status (presence) : "unset",
+                     presence ? gossip_presence_get_state (presence) : MC_PRESENCE_UNSET);
 
        contact_list_block_contact (list, contact);
        gossip_contact_set_presence (contact, presence);
@@ -1742,19 +1743,19 @@ contact_list_presences_table_foreach (const gchar     *state_str,
                                      GHashTable      *presences_table,
                                      GossipPresence **presence)
 {
-       GossipPresenceState  state;
-       const GValue        *message;
+       McPresence    state;
+       const GValue *message;
+
+       state = gossip_presence_state_from_str (state_str);
+       if ((state == MC_PRESENCE_UNSET) || (state == MC_PRESENCE_OFFLINE)) {
+               return;
+       }
 
        if (*presence) {
                g_object_unref (*presence);
                *presence = NULL;
        }
 
-       state = contact_list_presence_state_from_str (state_str);
-       if (state == GOSSIP_PRESENCE_STATE_UNAVAILABLE) {
-               return;
-       }
-
        *presence = gossip_presence_new ();
        gossip_presence_set_state (*presence, state);
 
@@ -1765,26 +1766,3 @@ contact_list_presences_table_foreach (const gchar     *state_str,
        }
 }
 
-static GossipPresenceState
-contact_list_presence_state_from_str (const gchar *str)
-{
-       if (strcmp (str, "available") == 0) {
-               return GOSSIP_PRESENCE_STATE_AVAILABLE;
-       } else if ((strcmp (str, "dnd") == 0) || (strcmp (str, "busy") == 0)) {
-               return GOSSIP_PRESENCE_STATE_BUSY;
-       } else if ((strcmp (str, "away") == 0) || (strcmp (str, "brb") == 0)) {
-               return GOSSIP_PRESENCE_STATE_AWAY;
-       } else if (strcmp (str, "xa") == 0) {
-               return GOSSIP_PRESENCE_STATE_EXT_AWAY;
-       } else if (strcmp (str, "hidden") == 0) {
-               return GOSSIP_PRESENCE_STATE_HIDDEN;
-       } else if (strcmp (str, "offline") == 0) {
-               return GOSSIP_PRESENCE_STATE_UNAVAILABLE;
-       } else if (strcmp (str, "chat") == 0) {
-               /* We don't support chat, so treat it like available. */
-               return GOSSIP_PRESENCE_STATE_AVAILABLE;
-       }
-
-       return GOSSIP_PRESENCE_STATE_AVAILABLE;
-}
-
index fc05690..68be90c 100644 (file)
@@ -642,7 +642,7 @@ gossip_contact_get_status (GossipContact *contact)
 
                status = gossip_presence_get_status (priv->presence);
                if (!status) {
-                       GossipPresenceState state;
+                       McPresence state;
 
                        state = gossip_presence_get_state (priv->presence);
                        status = gossip_presence_state_get_default_status (state);
index 2857b76..1b04abc 100644 (file)
 typedef struct _GossipPresencePriv GossipPresencePriv;
 
 struct _GossipPresencePriv {
-       GossipPresenceState  state;
-       gchar               *status;
-       GossipTime           timestamp;
+       McPresence  state;
+       gchar      *status;
+       GossipTime  timestamp;
 };
 
-static void         presence_finalize           (GObject             *object);
-static void         presence_get_property       (GObject             *object,
-                                                guint                param_id,
-                                                GValue              *value,
-                                                GParamSpec          *pspec);
-static void         presence_set_property       (GObject             *object,
-                                                guint                param_id,
-                                                const GValue        *value,
-                                                GParamSpec          *pspec);
+static void         presence_finalize     (GObject      *object);
+static void         presence_get_property (GObject      *object,
+                                          guint         param_id,
+                                          GValue       *value,
+                                          GParamSpec   *pspec);
+static void         presence_set_property (GObject      *object,
+                                          guint         param_id,
+                                          const GValue *value,
+                                          GParamSpec   *pspec);
 
 enum {
        PROP_0,
@@ -73,9 +73,9 @@ gossip_presence_class_init (GossipPresenceClass *class)
                                         g_param_spec_int ("state",
                                                           "Presence State",
                                                           "The current state of the presence",
-                                                          GOSSIP_PRESENCE_STATE_AVAILABLE,
-                                                          GOSSIP_PRESENCE_STATE_EXT_AWAY,
-                                                          GOSSIP_PRESENCE_STATE_AVAILABLE,
+                                                          MC_PRESENCE_UNSET,
+                                                          LAST_MC_PRESENCE,
+                                                          MC_PRESENCE_AVAILABLE,
                                                           G_PARAM_READWRITE));
        g_object_class_install_property (object_class,
                                         PROP_STATUS,
@@ -95,7 +95,7 @@ gossip_presence_init (GossipPresence *presence)
 
        priv = GET_PRIV (presence);
 
-       priv->state = GOSSIP_PRESENCE_STATE_AVAILABLE;
+       priv->state = MC_PRESENCE_AVAILABLE;
        priv->status = NULL;
        priv->timestamp = gossip_time_get_current ();
 }
@@ -166,8 +166,8 @@ gossip_presence_new (void)
 }
 
 GossipPresence *
-gossip_presence_new_full (GossipPresenceState  state,
-                         const gchar         *status)
+gossip_presence_new_full (McPresence   state,
+                         const gchar *status)
 {
        return g_object_new (GOSSIP_TYPE_PRESENCE,
                             "state", state,
@@ -188,13 +188,13 @@ gossip_presence_get_status (GossipPresence *presence)
        return priv->status;
 }
 
-GossipPresenceState
+McPresence
 gossip_presence_get_state (GossipPresence *presence)
 {
        GossipPresencePriv *priv;
 
        g_return_val_if_fail (GOSSIP_IS_PRESENCE (presence),
-                             GOSSIP_PRESENCE_STATE_AVAILABLE);
+                             MC_PRESENCE_AVAILABLE);
 
        priv = GET_PRIV (presence);
 
@@ -202,8 +202,8 @@ gossip_presence_get_state (GossipPresence *presence)
 }
 
 void
-gossip_presence_set_state (GossipPresence      *presence,
-                          GossipPresenceState  state)
+gossip_presence_set_state (GossipPresence *presence,
+                          McPresence      state)
 {
        GossipPresencePriv *priv;
 
@@ -267,26 +267,47 @@ gossip_presence_sort_func (gconstpointer a,
 }
 
 const gchar *
-gossip_presence_state_get_default_status (GossipPresenceState state)
+gossip_presence_state_get_default_status (McPresence state)
 {
        switch (state) {
-       case GOSSIP_PRESENCE_STATE_AVAILABLE:
+       case MC_PRESENCE_AVAILABLE:
                return _("Available");
-               break;
-
-       case GOSSIP_PRESENCE_STATE_BUSY:
+       case MC_PRESENCE_DO_NOT_DISTURB:
                return _("Busy");
-               break;
-
-       case GOSSIP_PRESENCE_STATE_AWAY:
-       case GOSSIP_PRESENCE_STATE_EXT_AWAY:
+       case MC_PRESENCE_AWAY:
+       case MC_PRESENCE_EXTENDED_AWAY:
                return _("Away");
-               break;
-
-       case GOSSIP_PRESENCE_STATE_HIDDEN:
-       case GOSSIP_PRESENCE_STATE_UNAVAILABLE:
+       case MC_PRESENCE_HIDDEN:
                return _("Unavailable");
+       case MC_PRESENCE_OFFLINE:
+               return _("Offline");
+       default:
+               return NULL;
        }
 
-       return _("Available");
+       return NULL;
 }
+
+McPresence
+gossip_presence_state_from_str (const gchar *str)
+{
+       if (strcmp (str, "available") == 0) {
+               return MC_PRESENCE_AVAILABLE;
+       } else if ((strcmp (str, "dnd") == 0) || (strcmp (str, "busy") == 0)) {
+               return MC_PRESENCE_DO_NOT_DISTURB;
+       } else if ((strcmp (str, "away") == 0) || (strcmp (str, "brb") == 0)) {
+               return MC_PRESENCE_AWAY;
+       } else if ((strcmp (str, "xa") == 0) || (strcmp (str, "ext_away") == 0)) {
+               return MC_PRESENCE_EXTENDED_AWAY;
+       } else if (strcmp (str, "hidden") == 0) {
+               return MC_PRESENCE_HIDDEN;
+       } else if (strcmp (str, "offline") == 0) {
+               return MC_PRESENCE_OFFLINE;
+       } else if (strcmp (str, "chat") == 0) {
+               /* We don't support chat, so treat it like available. */
+               return MC_PRESENCE_AVAILABLE;
+       }
+
+       return MC_PRESENCE_AVAILABLE;
+}
+
index 12648e6..4aa2aa6 100644 (file)
@@ -22,6 +22,7 @@
 #define __GOSSIP_PRESENCE_H__
 
 #include <glib-object.h>
+#include <libmissioncontrol/mission-control.h>
 
 G_BEGIN_DECLS
 
@@ -43,29 +44,21 @@ struct _GossipPresenceClass {
        GObjectClass parent_class;
 };
 
-typedef enum {
-       GOSSIP_PRESENCE_STATE_AVAILABLE,
-       GOSSIP_PRESENCE_STATE_BUSY,
-       GOSSIP_PRESENCE_STATE_AWAY,
-       GOSSIP_PRESENCE_STATE_EXT_AWAY,
-       GOSSIP_PRESENCE_STATE_HIDDEN,      /* When you appear offline to others */
-       GOSSIP_PRESENCE_STATE_UNAVAILABLE,
-} GossipPresenceState;
-
 GType               gossip_presence_get_type                 (void) G_GNUC_CONST;
 
 GossipPresence *    gossip_presence_new                      (void);
-GossipPresence *    gossip_presence_new_full                 (GossipPresenceState  state,
-                                                             const gchar         *status);
-GossipPresenceState gossip_presence_get_state                (GossipPresence      *presence);
-const gchar *       gossip_presence_get_status               (GossipPresence      *presence);
-void                gossip_presence_set_state                (GossipPresence      *presence,
-                                                             GossipPresenceState  state);
-void                gossip_presence_set_status               (GossipPresence      *presence,
-                                                             const gchar         *status);
-gint                gossip_presence_sort_func                (gconstpointer        a,
-                                                             gconstpointer        b);
-const gchar *       gossip_presence_state_get_default_status (GossipPresenceState  state);
+GossipPresence *    gossip_presence_new_full                 (McPresence      state,
+                                                             const gchar    *status);
+McPresence          gossip_presence_get_state                (GossipPresence *presence);
+const gchar *       gossip_presence_get_status               (GossipPresence *presence);
+void                gossip_presence_set_state                (GossipPresence *presence,
+                                                             McPresence      state);
+void                gossip_presence_set_status               (GossipPresence *presence,
+                                                             const gchar    *status);
+gint                gossip_presence_sort_func                (gconstpointer   a,
+                                                             gconstpointer   b);
+const gchar *       gossip_presence_state_get_default_status (McPresence      state);
+McPresence          gossip_presence_state_from_str           (const gchar    *str);
 
 G_END_DECLS