[empathy] tpaw-utils: move EMP_STR_EMPTY to tp-aw and rename it



commit 7eae2e49e62834cfff13cc2ee10b37eaff38a6fb
Author: Marco Barisione <marco barisione collabora co uk>
Date:   Fri May 10 16:58:34 2013 +0100

    tpaw-utils: move EMP_STR_EMPTY to tp-aw and rename it
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699492

 libempathy-gtk/empathy-base-password-dialog.c      |    5 ++-
 libempathy-gtk/empathy-cell-renderer-text.c        |    6 +++-
 libempathy-gtk/empathy-chat.c                      |   23 ++++++++++---------
 libempathy-gtk/empathy-contact-widget.c            |    3 +-
 libempathy-gtk/empathy-geometry.c                  |    5 ++-
 libempathy-gtk/empathy-groups-widget.c             |    5 ++-
 libempathy-gtk/empathy-individual-store.c          |    3 +-
 libempathy-gtk/empathy-individual-view.c           |    2 +-
 libempathy-gtk/empathy-individual-widget.c         |    3 +-
 libempathy-gtk/empathy-log-window.c                |    5 ++-
 libempathy-gtk/empathy-presence-chooser.c          |    3 +-
 libempathy-gtk/empathy-search-bar.c                |    7 +++--
 libempathy-gtk/empathy-smiley-manager.c            |    6 +++-
 libempathy/empathy-chatroom.c                      |    4 ++-
 libempathy/empathy-contact.c                       |   16 +++++++------
 libempathy/empathy-ft-handler.c                    |    5 ++-
 libempathy/empathy-presence-manager.c              |    4 ++-
 libempathy/empathy-tp-chat.c                       |    4 ++-
 libempathy/empathy-utils.h                         |    1 -
 src/empathy-chat-window.c                          |    7 +++--
 src/empathy-debug-window.c                         |    7 +++--
 src/empathy-event-manager.c                        |    3 +-
 src/empathy-import-pidgin.c                        |    3 +-
 src/empathy-import-utils.c                         |    3 +-
 src/empathy-new-chatroom-dialog.c                  |    5 ++-
 src/empathy-status-icon.c                          |    2 +-
 tp-account-widgets/tpaw-account-widget.c           |   12 +++++-----
 .../tpaw-irc-network-chooser-dialog.c              |    3 +-
 tp-account-widgets/tpaw-live-search.c              |    7 +++--
 tp-account-widgets/tpaw-utils.h                    |    2 +
 30 files changed, 98 insertions(+), 66 deletions(-)
---
diff --git a/libempathy-gtk/empathy-base-password-dialog.c b/libempathy-gtk/empathy-base-password-dialog.c
index 9cbb178..f080cb7 100644
--- a/libempathy-gtk/empathy-base-password-dialog.c
+++ b/libempathy-gtk/empathy-base-password-dialog.c
@@ -21,6 +21,7 @@
 #include "empathy-base-password-dialog.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-utils.h"
 
@@ -108,10 +109,10 @@ password_entry_changed_cb (GtkEditable *entry,
   str = gtk_entry_get_text (GTK_ENTRY (entry));
 
   gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
-      GTK_ENTRY_ICON_SECONDARY, !EMP_STR_EMPTY (str));
+      GTK_ENTRY_ICON_SECONDARY, !TPAW_STR_EMPTY (str));
 
   gtk_widget_set_sensitive (self->ok_button,
-      !EMP_STR_EMPTY (str));
+      !TPAW_STR_EMPTY (str));
 }
 
 static void
diff --git a/libempathy-gtk/empathy-cell-renderer-text.c b/libempathy-gtk/empathy-cell-renderer-text.c
index 44bbd7e..8b488f1 100644
--- a/libempathy-gtk/empathy-cell-renderer-text.c
+++ b/libempathy-gtk/empathy-cell-renderer-text.c
@@ -24,6 +24,8 @@
 #include "config.h"
 #include "empathy-cell-renderer-text.h"
 
+#include <tp-account-widgets/tpaw-utils.h>
+
 #include "empathy-utils.h"
 
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCellRendererText)
@@ -349,7 +351,7 @@ cell_renderer_text_update_text (EmpathyCellRendererText *cell,
        }
 
        if (priv->compact) {
-               if (EMP_STR_EMPTY (priv->status)) {
+               if (TPAW_STR_EMPTY (priv->status)) {
                        str = g_strdup (priv->name);
                } else {
                        str = g_strdup_printf ("%s %s", priv->name, priv->status);
@@ -358,7 +360,7 @@ cell_renderer_text_update_text (EmpathyCellRendererText *cell,
                const gchar *status = priv->status;
                gboolean on_a_phone = FALSE;
 
-               if (EMP_STR_EMPTY (priv->status)) {
+               if (TPAW_STR_EMPTY (priv->status)) {
                        status = empathy_presence_get_default_message (priv->presence_type);
                }
 
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index d8ea5e3..a7364e4 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -35,6 +35,7 @@
 #include <glib/gi18n-lib.h>
 #include <tp-account-widgets/tpaw-keyring.h>
 #include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-client-factory.h"
 #include "empathy-gsettings.h"
@@ -328,7 +329,7 @@ chat_new_connection_cb (TpAccount   *account,
 
        if (priv->tp_chat != NULL || account != priv->account ||
            priv->handle_type == TP_HANDLE_TYPE_NONE ||
-           EMP_STR_EMPTY (priv->id))
+           TPAW_STR_EMPTY (priv->id))
                return;
 
        g_object_ref (chat);
@@ -733,7 +734,7 @@ chat_command_msg_cb (GObject *source,
                goto OUT;
        }
 
-       if (!EMP_STR_EMPTY (data->message) && TP_IS_TEXT_CHANNEL (channel)) {
+       if (!TPAW_STR_EMPTY (data->message) && TP_IS_TEXT_CHANNEL (channel)) {
                TpTextChannel *text = (TpTextChannel *) channel;
                TpMessage *msg;
 
@@ -823,7 +824,7 @@ chat_command_join (EmpathyChat *chat,
        * https://bugs.freedesktop.org/show_bug.cgi?id=13422 */
        while (rooms[i] != NULL) {
                /* ignore empty strings */
-               if (!EMP_STR_EMPTY (rooms[i])) {
+               if (!TPAW_STR_EMPTY (rooms[i])) {
                        empathy_chat_join_muc (chat, rooms[i]);
                }
                i++;
@@ -1194,7 +1195,7 @@ chat_command_parse (const gchar *text, guint max_parts)
 
        /* Append last part if not empty */
        item = g_strstrip (g_strdup (text));
-       if (!EMP_STR_EMPTY (item)) {
+       if (!TPAW_STR_EMPTY (item)) {
                g_ptr_array_add (array, item);
                DEBUG ("\tITEM: \"%s\"", item);
        } else {
@@ -1222,7 +1223,7 @@ chat_send (EmpathyChat  *chat,
        TpMessage  *message;
        guint            i;
 
-       if (EMP_STR_EMPTY (msg)) {
+       if (TPAW_STR_EMPTY (msg)) {
                return;
        }
 
@@ -1674,7 +1675,7 @@ chat_subject_changed_cb (EmpathyChat *chat)
                priv->subject = g_strdup (empathy_tp_chat_get_subject (priv->tp_chat));
                g_object_notify (G_OBJECT (chat), "subject");
 
-               if (EMP_STR_EMPTY (priv->subject)) {
+               if (TPAW_STR_EMPTY (priv->subject)) {
                        gtk_widget_hide (priv->hbox_topic);
                } else {
                        gchar *markup_topic;
@@ -1693,7 +1694,7 @@ chat_subject_changed_cb (EmpathyChat *chat)
                if (priv->block_events_timeout_id == 0) {
                        gchar *str = NULL;
 
-                       if (!EMP_STR_EMPTY (priv->subject)) {
+                       if (!TPAW_STR_EMPTY (priv->subject)) {
                                const gchar *actor = empathy_tp_chat_get_subject_actor (priv->tp_chat);
 
                                if (tp_str_empty (actor)) {
@@ -2412,7 +2413,7 @@ chat_input_populate_popup_cb (GtkTextView *view,
        /* Add the Send menu item. */
        gtk_text_buffer_get_bounds (buffer, &start, &end);
        str = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
-       if (!EMP_STR_EMPTY (str)) {
+       if (!TPAW_STR_EMPTY (str)) {
                item = gtk_menu_item_new_with_mnemonic (_("_Send"));
                g_signal_connect (G_OBJECT (item), "activate",
                                  G_CALLBACK (chat_text_send_cb), chat);
@@ -2459,7 +2460,7 @@ chat_input_populate_popup_cb (GtkTextView *view,
                str = gtk_text_buffer_get_text (buffer,
                                                &start, &end, FALSE);
        }
-       if (!EMP_STR_EMPTY (str)) {
+       if (!TPAW_STR_EMPTY (str)) {
                chat_spell = chat_spell_new (chat, str, start, end);
                g_object_set_data_full (G_OBJECT (menu),
                                        "chat-spell", chat_spell,
@@ -2852,7 +2853,7 @@ build_part_message (guint           reason,
                g_string_append_printf (s, _("%s has left the room"), name);
        }
 
-       if (!EMP_STR_EMPTY (message)) {
+       if (!TPAW_STR_EMPTY (message)) {
                /* Note to translators: this string is appended to
                 * notifications like "foo has left the room", with the message
                 * given by the user living the room. If this poses a problem,
@@ -3923,7 +3924,7 @@ password_entry_changed_cb (GtkEditable *entry,
        str = gtk_entry_get_text (GTK_ENTRY (entry));
 
        gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
-           GTK_ENTRY_ICON_SECONDARY, !EMP_STR_EMPTY (str));
+           GTK_ENTRY_ICON_SECONDARY, !TPAW_STR_EMPTY (str));
 }
 
 static void
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index d6ce3e1..505dad4 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -25,6 +25,7 @@
 #include <glib/gi18n-lib.h>
 #include <tp-account-widgets/tpaw-builder.h>
 #include <tp-account-widgets/tpaw-string-parser.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-avatar-image.h"
 #include "empathy-client-factory.h"
@@ -505,7 +506,7 @@ contact_widget_change_contact (EmpathyContactWidget *self)
       return;
 
   id = gtk_entry_get_text (GTK_ENTRY (self->priv->widget_id));
-  if (!EMP_STR_EMPTY (id))
+  if (!TPAW_STR_EMPTY (id))
     {
       EmpathyClientFactory *factory;
 
diff --git a/libempathy-gtk/empathy-geometry.c b/libempathy-gtk/empathy-geometry.c
index 452952b..6874cd7 100644
--- a/libempathy-gtk/empathy-geometry.c
+++ b/libempathy-gtk/empathy-geometry.c
@@ -25,6 +25,7 @@
 #include "empathy-geometry.h"
 
 #include <sys/stat.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-ui-utils.h"
 #include "empathy-utils.h"
@@ -211,7 +212,7 @@ empathy_geometry_load (GtkWindow *window,
   gboolean  maximized;
 
   g_return_if_fail (GTK_IS_WINDOW (window));
-  g_return_if_fail (!EMP_STR_EMPTY (name));
+  g_return_if_fail (!TPAW_STR_EMPTY (name));
 
   /* escape the name so that unwanted characters such as # are removed */
   escaped_name = g_uri_escape_string (name, NULL, TRUE);
@@ -294,7 +295,7 @@ empathy_geometry_bind (GtkWindow *window,
   gboolean connect_sigs = FALSE;
 
   g_return_if_fail (GTK_IS_WINDOW (window));
-  g_return_if_fail (!EMP_STR_EMPTY (name));
+  g_return_if_fail (!TPAW_STR_EMPTY (name));
 
   /* Check if this window is already bound */
   names = g_object_get_data (G_OBJECT (window), GEOMETRY_NAME_KEY);
diff --git a/libempathy-gtk/empathy-groups-widget.c b/libempathy-gtk/empathy-groups-widget.c
index d1a6feb..b7f4b25 100644
--- a/libempathy-gtk/empathy-groups-widget.c
+++ b/libempathy-gtk/empathy-groups-widget.c
@@ -23,6 +23,7 @@
 #include "empathy-groups-widget.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-utils.h"
 #include "empathy-connection-aggregator.h"
@@ -117,7 +118,7 @@ model_find_name (EmpathyGroupsWidget *self,
   EmpathyGroupsWidgetPriv *priv = GET_PRIV (self);
   FindNameData data;
 
-  if (EMP_STR_EMPTY (name))
+  if (TPAW_STR_EMPTY (name))
     return FALSE;
 
   data.widget = self;
@@ -192,7 +193,7 @@ add_group_entry_changed_cb (GtkEditable *editable,
   else
     {
       gtk_widget_set_sensitive (GTK_WIDGET (priv->add_group_button),
-          !EMP_STR_EMPTY (group));
+          !TPAW_STR_EMPTY (group));
     }
 }
 
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index 1fc0076..9b685ee 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -28,6 +28,7 @@
 #include "empathy-individual-store.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-gtk-enum-types.h"
 #include "empathy-ui-utils.h"
@@ -283,7 +284,7 @@ empathy_individual_store_add_individual (EmpathyIndividualStore *self,
   GeeSet *group_set = NULL;
   gboolean grouped = FALSE;
 
-  if (EMP_STR_EMPTY (folks_alias_details_get_alias (
+  if (TPAW_STR_EMPTY (folks_alias_details_get_alias (
           FOLKS_ALIAS_DETAILS (individual))))
     return;
 
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 4344840..22e65a0 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -1596,7 +1596,7 @@ individual_view_row_has_child_toggled_cb (GtkTreeModel *model,
       EMPATHY_INDIVIDUAL_STORE_COL_NAME, &name,
       -1);
 
-  if (!is_group || EMP_STR_EMPTY (name))
+  if (!is_group || TPAW_STR_EMPTY (name))
     {
       g_free (name);
       return;
diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c
index 03490bc..41d9399 100644
--- a/libempathy-gtk/empathy-individual-widget.c
+++ b/libempathy-gtk/empathy-individual-widget.c
@@ -26,6 +26,7 @@
 #include <tp-account-widgets/tpaw-builder.h>
 #include <tp-account-widgets/tpaw-contactinfo-utils.h>
 #include <tp-account-widgets/tpaw-time.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #ifdef HAVE_LIBCHAMPLAIN
 #include <champlain/champlain.h>
@@ -1296,7 +1297,7 @@ notify_presence_cb (gpointer folks_object,
   /* FIXME: Default messages should be moved into libfolks (bgo#627403) */
   message = folks_presence_details_get_presence_message (
       FOLKS_PRESENCE_DETAILS (folks_object));
-  if (EMP_STR_EMPTY (message))
+  if (TPAW_STR_EMPTY (message))
     {
       message = empathy_presence_get_default_message (presence);
     }
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index f294502..7097616 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -30,6 +30,7 @@
 #include <tp-account-widgets/tpaw-builder.h>
 #include <tp-account-widgets/tpaw-images.h>
 #include <tp-account-widgets/tpaw-camera-monitor.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "action-chain-internal.h"
 #include "empathy-account-chooser.h"
@@ -1332,7 +1333,7 @@ log_window_append_call (TplEvent *event,
   GTimeSpan span;
 
   /* If searching, only add the call if the search string appears anywhere */
-  if (!EMP_STR_EMPTY (log_window->priv->last_find))
+  if (!TPAW_STR_EMPTY (log_window->priv->last_find))
     {
       if (strstr (tpl_entity_get_identifier (tpl_event_get_sender (event)),
               log_window->priv->last_find) == NULL &&
@@ -2009,7 +2010,7 @@ log_window_find_populate (EmpathyLogWindow *self,
 
   gtk_list_store_clear (store);
 
-  if (EMP_STR_EMPTY (search_criteria))
+  if (TPAW_STR_EMPTY (search_criteria))
     {
       tp_clear_pointer (&self->priv->hits, tpl_log_manager_search_free);
       webkit_web_view_set_highlight_text_matches (
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index 445f79b..6ff113d 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -28,6 +28,7 @@
 #include "empathy-presence-chooser.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-presence-manager.h"
 #include "empathy-status-presets.h"
@@ -272,7 +273,7 @@ get_state_and_status (EmpathyPresenceChooser *self,
 
        state = tp_account_manager_get_most_available_presence (
                priv->account_manager, NULL, &tmp);
-       if (EMP_STR_EMPTY (tmp)) {
+       if (TPAW_STR_EMPTY (tmp)) {
                /* no message, use the default message */
                g_free (tmp);
                tmp = g_strdup (empathy_presence_get_default_message (state));
diff --git a/libempathy-gtk/empathy-search-bar.c b/libempathy-gtk/empathy-search-bar.c
index 1ffdc1d..3383b9a 100644
--- a/libempathy-gtk/empathy-search-bar.c
+++ b/libempathy-gtk/empathy-search-bar.c
@@ -22,6 +22,7 @@
 
 #include <glib/gi18n-lib.h>
 #include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-ui-utils.h"
 #include "empathy-utils.h"
@@ -72,9 +73,9 @@ empathy_search_bar_update_buttons (EmpathySearchBar *self,
       &can_go_backward, &can_go_forward);
 
   gtk_widget_set_sensitive (priv->search_previous,
-      can_go_backward && !EMP_STR_EMPTY (search));
+      can_go_backward && !TPAW_STR_EMPTY (search));
   gtk_widget_set_sensitive (priv->search_next,
-      can_go_forward && !EMP_STR_EMPTY (search));
+      can_go_forward && !TPAW_STR_EMPTY (search));
 }
 
 static void
@@ -158,7 +159,7 @@ empathy_search_bar_search (EmpathySearchBar *self,
 
   /* (don't) display the not found label */
   gtk_widget_set_visible (priv->search_not_found,
-      !(found || EMP_STR_EMPTY (search)));
+      !(found || TPAW_STR_EMPTY (search)));
 
   /* update the buttons */
   empathy_search_bar_update_buttons (self, search, match_case);
diff --git a/libempathy-gtk/empathy-smiley-manager.c b/libempathy-gtk/empathy-smiley-manager.c
index 2e8ef3a..fcbe560 100644
--- a/libempathy-gtk/empathy-smiley-manager.c
+++ b/libempathy-gtk/empathy-smiley-manager.c
@@ -23,6 +23,8 @@
 #include "config.h"
 #include "empathy-smiley-manager.h"
 
+#include <tp-account-widgets/tpaw-utils.h>
+
 #include "empathy-ui-utils.h"
 #include "empathy-utils.h"
 
@@ -242,8 +244,8 @@ empathy_smiley_manager_add (EmpathySmileyManager *manager,
        va_list    var_args;
 
        g_return_if_fail (EMPATHY_IS_SMILEY_MANAGER (manager));
-       g_return_if_fail (!EMP_STR_EMPTY (icon_name));
-       g_return_if_fail (!EMP_STR_EMPTY (first_str));
+       g_return_if_fail (!TPAW_STR_EMPTY (icon_name));
+       g_return_if_fail (!TPAW_STR_EMPTY (first_str));
 
        pixbuf = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
        if (pixbuf) {
diff --git a/libempathy/empathy-chatroom.c b/libempathy/empathy-chatroom.c
index 32bb4ce..b186b2d 100644
--- a/libempathy/empathy-chatroom.c
+++ b/libempathy/empathy-chatroom.c
@@ -22,6 +22,8 @@
 #include "config.h"
 #include "empathy-chatroom.h"
 
+#include <tp-account-widgets/tpaw-utils.h>
+
 #include "empathy-utils.h"
 
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyChatroom)
@@ -413,7 +415,7 @@ empathy_chatroom_get_name (EmpathyChatroom *chatroom)
 
        priv = GET_PRIV (chatroom);
 
-       if (EMP_STR_EMPTY (priv->name)) {
+       if (TPAW_STR_EMPTY (priv->name)) {
                return priv->room;
        }
 
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 9f8e232..2f381a5 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -22,6 +22,8 @@
 #include "config.h"
 #include "empathy-contact.h"
 
+#include <tp-account-widgets/tpaw-utils.h>
+
 #ifdef HAVE_GEOCODE
 #include <geocode-glib/geocode-glib.h>
 #endif
@@ -462,7 +464,7 @@ empathy_contact_set_id (EmpathyContact *contact,
       priv->id = g_strdup (id);
 
       g_object_notify (G_OBJECT (contact), "id");
-      if (EMP_STR_EMPTY (priv->alias))
+      if (TPAW_STR_EMPTY (priv->alias))
           g_object_notify (G_OBJECT (contact), "alias");
     }
 
@@ -768,7 +770,7 @@ empathy_contact_from_tpl_contact (TpAccount *account,
         }
     }
 
-  if (!EMP_STR_EMPTY (tpl_entity_get_avatar_token (tpl_entity)))
+  if (!TPAW_STR_EMPTY (tpl_entity_get_avatar_token (tpl_entity)))
     contact_load_avatar_cache (retval,
         tpl_entity_get_avatar_token (tpl_entity));
 
@@ -812,12 +814,12 @@ empathy_contact_get_alias (EmpathyContact *contact)
 
   priv = GET_PRIV (contact);
 
-  if (!EMP_STR_EMPTY (priv->alias))
+  if (!TPAW_STR_EMPTY (priv->alias))
     alias = priv->alias;
   else if (priv->tp_contact != NULL)
     alias = tp_contact_get_alias (priv->tp_contact);
 
-  if (!EMP_STR_EMPTY (alias))
+  if (!TPAW_STR_EMPTY (alias))
     return alias;
   else
     return empathy_contact_get_id (contact);
@@ -1185,7 +1187,7 @@ empathy_contact_get_status (EmpathyContact *contact)
   g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), "");
 
   message = empathy_contact_get_presence_message (contact);
-  if (!EMP_STR_EMPTY (message))
+  if (!TPAW_STR_EMPTY (message))
     return message;
 
   return empathy_presence_get_default_message (
@@ -1330,7 +1332,7 @@ contact_get_avatar_filename (EmpathyContact *contact,
   gchar *avatar_file;
   gchar *token_escaped;
 
-  if (EMP_STR_EMPTY (empathy_contact_get_id (contact)))
+  if (TPAW_STR_EMPTY (empathy_contact_get_id (contact)))
     return NULL;
 
   token_escaped = tp_escape_as_identifier (token);
@@ -1363,7 +1365,7 @@ contact_load_avatar_cache (EmpathyContact *contact,
   GError *error = NULL;
 
   g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE);
-  g_return_val_if_fail (!EMP_STR_EMPTY (token), FALSE);
+  g_return_val_if_fail (!TPAW_STR_EMPTY (token), FALSE);
 
   /* Load the avatar from file if it exists */
   filename = contact_get_avatar_filename (contact, token);
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index 049489c..d7e112a 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -26,6 +26,7 @@
 
 #include <glib/gi18n-lib.h>
 #include <tp-account-widgets/tpaw-time.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-utils.h"
 
@@ -601,7 +602,7 @@ check_hash_incoming (EmpathyFTHandler *handler)
   HashingData *hash_data;
   EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
 
-  if (!EMP_STR_EMPTY (priv->content_hash))
+  if (!TPAW_STR_EMPTY (priv->content_hash))
     {
       hash_data = g_slice_new0 (HashingData);
       hash_data->total_bytes = priv->total_bytes;
@@ -1512,7 +1513,7 @@ empathy_ft_handler_incoming_set_destination (EmpathyFTHandler *handler,
   /* check if hash is supported. if it isn't, set use_hash to FALSE
    * anyway, so that clients won't be expecting us to checksum.
    */
-  if (EMP_STR_EMPTY (priv->content_hash) ||
+  if (TPAW_STR_EMPTY (priv->content_hash) ||
       priv->content_hash_type == TP_FILE_HASH_TYPE_NONE)
     priv->use_hash = FALSE;
   else
diff --git a/libempathy/empathy-presence-manager.c b/libempathy/empathy-presence-manager.c
index 1c288fb..6eab7f1 100644
--- a/libempathy/empathy-presence-manager.c
+++ b/libempathy/empathy-presence-manager.c
@@ -21,6 +21,8 @@
 #include "config.h"
 #include "empathy-presence-manager.h"
 
+#include <tp-account-widgets/tpaw-utils.h>
+
 #include "empathy-utils.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
@@ -107,7 +109,7 @@ most_available_presence_changed (TpAccountManager *manager,
 
   g_free (self->priv->status);
   self->priv->state = state;
-  if (EMP_STR_EMPTY (status_message))
+  if (TPAW_STR_EMPTY (status_message))
     self->priv->status = NULL;
   else
     self->priv->status = g_strdup (status_message);
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 4711aff..e0fd4c2 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -21,6 +21,8 @@
 #include "config.h"
 #include "empathy-tp-chat.h"
 
+#include <tp-account-widgets/tpaw-utils.h>
+
 #include "empathy-request-util.h"
 #include "empathy-utils.h"
 
@@ -1115,7 +1117,7 @@ empathy_tp_chat_get_id (EmpathyTpChat *self)
   g_return_val_if_fail (EMPATHY_IS_TP_CHAT (self), NULL);
 
   id = tp_channel_get_identifier ((TpChannel *) self);
-  if (!EMP_STR_EMPTY (id))
+  if (!TPAW_STR_EMPTY (id))
     return id;
   else if (self->priv->remote_contact)
     return empathy_contact_get_id (self->priv->remote_contact);
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index 7310320..40291b9 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -36,7 +36,6 @@
 #include "empathy-contact.h"
 
 #define EMPATHY_GET_PRIV(obj,type) ((type##Priv *) ((type *) obj)->priv)
-#define EMP_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
 
 G_BEGIN_DECLS
 
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index aa9811e..609b52c 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -30,6 +30,7 @@
 
 #include <glib/gi18n.h>
 #include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-about-dialog.h"
 #include "empathy-chat-manager.h"
@@ -962,10 +963,10 @@ chat_window_update_chat_tab_full (EmpathyChat *chat,
       g_free (tmp);
     }
 
-  if (!EMP_STR_EMPTY (status))
+  if (!TPAW_STR_EMPTY (status))
     append_markup_printf (tooltip, "\n<i>%s</i>", status);
 
-  if (!EMP_STR_EMPTY (subject))
+  if (!TPAW_STR_EMPTY (subject))
     append_markup_printf (tooltip, "\n<b>%s</b> %s",
         _("Topic:"), subject);
 
@@ -2783,7 +2784,7 @@ empathy_chat_window_find_chat (TpAccount *account,
 {
   GList *l;
 
-  g_return_val_if_fail (!EMP_STR_EMPTY (id), NULL);
+  g_return_val_if_fail (!TPAW_STR_EMPTY (id), NULL);
 
   for (l = chat_windows; l; l = l->next)
     {
diff --git a/src/empathy-debug-window.c b/src/empathy-debug-window.c
index 4522c6a..fcf5804 100644
--- a/src/empathy-debug-window.c
+++ b/src/empathy-debug-window.c
@@ -24,6 +24,7 @@
 
 #include <glib/gi18n.h>
 #include <libsoup/soup.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-geometry.h"
 #include "empathy-ui-utils.h"
@@ -1005,7 +1006,7 @@ debug_window_name_owner_changed_cb (TpDBusDaemon *proxy,
       return;
     }
 
-  if (EMP_STR_EMPTY (arg1) && !EMP_STR_EMPTY (arg2))
+  if (TPAW_STR_EMPTY (arg1) && !TPAW_STR_EMPTY (arg2))
     {
       GtkTreeIter *found_at_iter = NULL;
       gchar *display_name;
@@ -1085,7 +1086,7 @@ debug_window_name_owner_changed_cb (TpDBusDaemon *proxy,
 
       g_free (display_name);
     }
-  else if (!EMP_STR_EMPTY (arg1) && EMP_STR_EMPTY (arg2))
+  else if (!TPAW_STR_EMPTY (arg1) && TPAW_STR_EMPTY (arg2))
     {
       /* A service died */
       GtkTreeIter *iter = NULL;
@@ -1297,7 +1298,7 @@ debug_window_menu_copy_activate_cb (GtkMenuItem *menu_item,
 
   message = tp_debug_message_get_message (msg);
 
-  if (EMP_STR_EMPTY (message))
+  if (TPAW_STR_EMPTY (message))
     {
       DEBUG ("Log message is empty");
       return;
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index f2d1975..e973ef3 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -24,6 +24,7 @@
 
 #include <glib/gi18n.h>
 #include <tp-account-widgets/tpaw-images.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-call-utils.h"
 #include "empathy-connection-aggregator.h"
@@ -1110,7 +1111,7 @@ check_publish_state (EmpathyEventManager *self,
 
   message = tp_contact_get_publish_request (tp_contact);
 
-  if (!EMP_STR_EMPTY (message))
+  if (!TPAW_STR_EMPTY (message))
     event_msg = g_strdup_printf (_("\nMessage: %s"), message);
   else
     event_msg = NULL;
diff --git a/src/empathy-import-pidgin.c b/src/empathy-import-pidgin.c
index 92adb86..bd05753 100644
--- a/src/empathy-import-pidgin.c
+++ b/src/empathy-import-pidgin.c
@@ -24,6 +24,7 @@
 
 #include <glib/gstdio.h>
 #include <dbus/dbus-protocol.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-import-utils.h"
 #include "empathy-utils.h"
@@ -356,7 +357,7 @@ empathy_import_pidgin_load (void)
            * http://bugzilla.gnome.org/show_bug.cgi?id=579992 */
           if (!tp_strdiff (data->protocol, "jabber"))
             {
-              if (EMP_STR_EMPTY (tp_asv_get_string (data->settings, "server")))
+              if (TPAW_STR_EMPTY (tp_asv_get_string (data->settings, "server")))
                 {
                   g_hash_table_remove (data->settings, "port");
                   g_hash_table_remove (data->settings, "server");
diff --git a/src/empathy-import-utils.c b/src/empathy-import-utils.c
index d95326b..ab7847c 100644
--- a/src/empathy-import-utils.c
+++ b/src/empathy-import-utils.c
@@ -23,6 +23,7 @@
 #include "empathy-import-utils.h"
 
 #include <tp-account-widgets/tpaw-connection-managers.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-import-pidgin.h"
 #include "empathy-utils.h"
@@ -32,7 +33,7 @@ empathy_import_account_data_new (const gchar *source)
 {
   EmpathyImportAccountData *data;
 
-  g_return_val_if_fail (!EMP_STR_EMPTY (source), NULL);
+  g_return_val_if_fail (!TPAW_STR_EMPTY (source), NULL);
 
   data = g_slice_new0 (EmpathyImportAccountData);
   data->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
diff --git a/src/empathy-new-chatroom-dialog.c b/src/empathy-new-chatroom-dialog.c
index ad44d21..7f46cb4 100644
--- a/src/empathy-new-chatroom-dialog.c
+++ b/src/empathy-new-chatroom-dialog.c
@@ -26,6 +26,7 @@
 
 #include <glib/gi18n.h>
 #include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-account-chooser.h"
 #include "empathy-gsettings.h"
@@ -114,7 +115,7 @@ new_chatroom_dialog_join (EmpathyNewChatroomDialog *self)
   account_chooser = EMPATHY_ACCOUNT_CHOOSER (self->priv->account_chooser);
   account = empathy_account_chooser_get_account (account_chooser);
 
-  if (!EMP_STR_EMPTY (server))
+  if (!TPAW_STR_EMPTY (server))
     room_name = g_strconcat (room, "@", server, NULL);
   else
     room_name = g_strdup (room);
@@ -289,7 +290,7 @@ update_join_button_sensitivity (EmpathyNewChatroomDialog *self)
 
   room = gtk_entry_get_text (GTK_ENTRY (self->priv->entry_room));
   protocol = tp_account_get_protocol_name (self->priv->account);
-  if (EMP_STR_EMPTY (room))
+  if (TPAW_STR_EMPTY (room))
     goto out;
 
   if (!tp_strdiff (protocol, "irc") &&
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index 6d273cc..2f71fa1 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -83,7 +83,7 @@ status_icon_update_tooltip (EmpathyStatusIcon *icon)
                type = tp_account_manager_get_most_available_presence (
                        priv->account_manager, NULL, &msg);
 
-               if (!EMP_STR_EMPTY (msg)) {
+               if (!TPAW_STR_EMPTY (msg)) {
                        gtk_status_icon_set_tooltip_text (priv->icon, msg);
                }
                else {
diff --git a/tp-account-widgets/tpaw-account-widget.c b/tp-account-widgets/tpaw-account-widget.c
index a86a32f..767ab1d 100644
--- a/tp-account-widgets/tpaw-account-widget.c
+++ b/tp-account-widgets/tpaw-account-widget.c
@@ -266,7 +266,7 @@ account_widget_entry_changed_common (TpawAccountWidget *self,
   prev_status = tpaw_account_settings_parameter_is_valid (
       self->priv->settings, param_name);
 
-  if (EMP_STR_EMPTY (str))
+  if (TPAW_STR_EMPTY (str))
     {
       tpaw_account_settings_unset (self->priv->settings, param_name);
 
@@ -492,7 +492,7 @@ password_entry_changed_cb (GtkEditable *entry,
   str = gtk_entry_get_text (GTK_ENTRY (entry));
 
   gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
-      GTK_ENTRY_ICON_SECONDARY, !EMP_STR_EMPTY (str));
+      GTK_ENTRY_ICON_SECONDARY, !TPAW_STR_EMPTY (str));
 }
 
 static void
@@ -580,7 +580,7 @@ tpaw_account_widget_setup_widget (TpawAccountWidget *self,
               GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
 
           gtk_entry_set_icon_sensitive (GTK_ENTRY (widget),
-              GTK_ENTRY_ICON_SECONDARY, !EMP_STR_EMPTY (str));
+              GTK_ENTRY_ICON_SECONDARY, !TPAW_STR_EMPTY (str));
 
           g_signal_connect (widget, "icon-release",
               G_CALLBACK (clear_icon_released_cb), self);
@@ -1219,7 +1219,7 @@ suffix_id_widget_changed_cb (GtkWidget *entry,
   account = tpaw_account_settings_dup_string (self->priv->settings,
       "account");
 
-  if (!EMP_STR_EMPTY (account) &&
+  if (!TPAW_STR_EMPTY (account) &&
       !g_str_has_suffix (account, self->priv->jid_suffix))
     {
       gchar *tmp;
@@ -1885,7 +1885,7 @@ account_settings_password_retrieved_cb (GObject *object,
 
   gtk_toggle_button_set_active (
       GTK_TOGGLE_BUTTON (self->priv->remember_password_widget),
-      !EMP_STR_EMPTY (password));
+      !TPAW_STR_EMPTY (password));
 
   self->priv->automatic_change = FALSE;
 
@@ -1976,7 +1976,7 @@ do_constructed (GObject *obj)
            * (bgo #683571) */
           gtk_toggle_button_set_active (
               GTK_TOGGLE_BUTTON (self->priv->remember_password_widget),
-              !EMP_STR_EMPTY (password));
+              !TPAW_STR_EMPTY (password));
 
           /* The password might not have been retrieved from the
            * keyring yet. We should update the remember password
diff --git a/tp-account-widgets/tpaw-irc-network-chooser-dialog.c 
b/tp-account-widgets/tpaw-irc-network-chooser-dialog.c
index daf35a0..1232502 100644
--- a/tp-account-widgets/tpaw-irc-network-chooser-dialog.c
+++ b/tp-account-widgets/tpaw-irc-network-chooser-dialog.c
@@ -27,6 +27,7 @@
 #include "tpaw-irc-network-dialog.h"
 #include "tpaw-irc-network-manager.h"
 #include "tpaw-live-search.h"
+#include "tpaw-utils.h"
 #include "empathy-utils.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT | EMPATHY_DEBUG_IRC
@@ -469,7 +470,7 @@ search_text_notify_cb (TpawLiveSearch *search,
       const gchar *text;
 
       text = tpaw_live_search_get_text (TPAW_LIVE_SEARCH (priv->search));
-      if (!EMP_STR_EMPTY (text))
+      if (!TPAW_STR_EMPTY (text))
         {
           /* We are doing a search, select the first matching network */
           select_iter (self, &filter_iter, TRUE);
diff --git a/tp-account-widgets/tpaw-live-search.c b/tp-account-widgets/tpaw-live-search.c
index 1547a4b..059eac3 100644
--- a/tp-account-widgets/tpaw-live-search.c
+++ b/tp-account-widgets/tpaw-live-search.c
@@ -25,6 +25,7 @@
 #include "tpaw-live-search.h"
 
 #include "empathy-utils.h"
+#include "tpaw-utils.h"
 
 G_DEFINE_TYPE (TpawLiveSearch, tpaw_live_search, GTK_TYPE_HBOX)
 
@@ -133,7 +134,7 @@ tpaw_live_search_strip_utf8_string (const gchar *string)
   GString *word = NULL;
   const gchar *p;
 
-  if (EMP_STR_EMPTY (string))
+  if (TPAW_STR_EMPTY (string))
     return NULL;
 
   for (p = string; *p != '\0'; p = g_utf8_next_char (p))
@@ -175,7 +176,7 @@ live_search_match_prefix (const gchar *string,
   if (prefix == NULL || prefix[0] == 0)
     return TRUE;
 
-  if (EMP_STR_EMPTY (string))
+  if (TPAW_STR_EMPTY (string))
     return FALSE;
 
   prefix_p = prefix;
@@ -289,7 +290,7 @@ live_search_text_changed (GtkEntry *entry,
 
   text = gtk_entry_get_text (entry);
 
-  if (EMP_STR_EMPTY (text))
+  if (TPAW_STR_EMPTY (text))
     gtk_widget_hide (GTK_WIDGET (self));
   else
     gtk_widget_show (GTK_WIDGET (self));
diff --git a/tp-account-widgets/tpaw-utils.h b/tp-account-widgets/tpaw-utils.h
index f8fad91..2b12cfe 100644
--- a/tp-account-widgets/tpaw-utils.h
+++ b/tp-account-widgets/tpaw-utils.h
@@ -39,6 +39,8 @@
 
 G_BEGIN_DECLS
 
+#define TPAW_STR_EMPTY(s) ((s) == NULL || (s)[0] == '\0')
+
 void tpaw_connect_new_account (TpAccount *account,
     TpAccountManager *account_manager);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]