[empathy] user-info: move from Empathy to tp-account-widgets



commit fad2ecd3f071c671425954638081c641ff603503
Author: Marco Barisione <marco barisione collabora co uk>
Date:   Tue Jul 30 14:09:13 2013 +0100

    user-info: move from Empathy to tp-account-widgets
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699492

 libempathy-gtk/Makefile.am                         |    2 -
 libempathy-gtk/empathy-user-info.h                 |   75 ------------------
 src/empathy-accounts-dialog.c                      |    8 +-
 tp-account-widgets/Makefile.am                     |    2 +
 .../tpaw-user-info.c                               |   80 ++++++++++----------
 tp-account-widgets/tpaw-user-info.h                |   74 ++++++++++++++++++
 6 files changed, 120 insertions(+), 121 deletions(-)
---
diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am
index 9c849a7..19e07d5 100644
--- a/libempathy-gtk/Makefile.am
+++ b/libempathy-gtk/Makefile.am
@@ -81,7 +81,6 @@ libempathy_gtk_handwritten_source =                   \
        empathy-theme-manager.c                 \
        empathy-tls-dialog.c                    \
        empathy-ui-utils.c                      \
-       empathy-user-info.c                     \
        empathy-plist.c                         \
        empathy-theme-adium.c                   \
        empathy-webkit-utils.c                  \
@@ -143,7 +142,6 @@ libempathy_gtk_headers =                    \
        empathy-theme-manager.h                 \
        empathy-tls-dialog.h                    \
        empathy-ui-utils.h                      \
-       empathy-user-info.h                     \
        empathy-plist.h                         \
        empathy-theme-adium.h                   \
        empathy-webkit-utils.h                  \
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 53f6997..ca5d57f 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -30,6 +30,7 @@
 #include <glib/gi18n-lib.h>
 #include <tp-account-widgets/tpaw-account-widget.h>
 #include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-user-info.h>
 #include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-accounts-common.h"
@@ -39,7 +40,6 @@
 #include "empathy-new-account-dialog.h"
 #include "empathy-pkg-kit.h"
 #include "empathy-ui-utils.h"
-#include "empathy-user-info.h"
 #include "empathy-utils.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
@@ -701,7 +701,7 @@ account_dialog_create_dialog_content (EmpathyAccountsDialog *dialog,
   gtk_widget_show (priv->dialog_content);
 
   alig = gtk_alignment_new (0.5, 0, 1, 1);
-  priv->user_info = empathy_user_info_new (account);
+  priv->user_info = tpaw_user_info_new (account);
   gtk_container_add (GTK_CONTAINER (alig), priv->user_info);
   gtk_box_pack_start (GTK_BOX (priv->dialog_content), alig, TRUE, TRUE, 0);
   gtk_widget_show (alig);
@@ -925,7 +925,7 @@ accounts_dialog_update_settings (EmpathyAccountsDialog *dialog,
 
   if (priv->user_info != NULL)
     {
-      empathy_user_info_apply_async ((EmpathyUserInfo *) priv->user_info,
+      tpaw_user_info_apply_async ((TpawUserInfo *) priv->user_info,
           NULL, NULL);
       priv->user_info = NULL;
     }
@@ -2431,7 +2431,7 @@ do_dispose (GObject *obj)
 
   if (priv->user_info != NULL)
     {
-      empathy_user_info_apply_async ((EmpathyUserInfo *) priv->user_info,
+      tpaw_user_info_apply_async ((TpawUserInfo *) priv->user_info,
           NULL, NULL);
       priv->user_info = NULL;
     }
diff --git a/tp-account-widgets/Makefile.am b/tp-account-widgets/Makefile.am
index 21a10fe..fa79032 100644
--- a/tp-account-widgets/Makefile.am
+++ b/tp-account-widgets/Makefile.am
@@ -44,6 +44,7 @@ libtp_account_widgets_sources =               \
        tpaw-live-search.c                      \
        tpaw-string-parser.c                    \
        tpaw-time.c                             \
+       tpaw-user-info.c                        \
        tpaw-utils.c                            \
        totem-subtitle-encoding.c               \
        $(NULL)
@@ -71,6 +72,7 @@ libtp_account_widgets_headers =                       \
        tpaw-live-search.h                      \
        tpaw-string-parser.h                    \
        tpaw-time.h                             \
+       tpaw-user-info.h                        \
        tpaw-utils.h                            \
        totem-subtitle-encoding.h               \
        $(NULL)
diff --git a/libempathy-gtk/empathy-user-info.c b/tp-account-widgets/tpaw-user-info.c
similarity index 90%
rename from libempathy-gtk/empathy-user-info.c
rename to tp-account-widgets/tpaw-user-info.c
index 1177adc..9a4843f 100644
--- a/libempathy-gtk/empathy-user-info.c
+++ b/tp-account-widgets/tpaw-user-info.c
@@ -1,5 +1,5 @@
 /*
- * empathy-user-info.c - Source for EmpathyUserInfo
+ * tpaw-user-info.c - Source for TpawUserInfo
  *
  * Copyright (C) 2012 - Collabora Ltd.
  *
@@ -18,7 +18,7 @@
  */
 
 #include "config.h"
-#include "empathy-user-info.h"
+#include "tpaw-user-info.h"
 
 #include <glib/gi18n-lib.h>
 #include <tp-account-widgets/tpaw-avatar-chooser.h>
@@ -31,9 +31,9 @@
 #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
 #include "empathy-debug.h"
 
-G_DEFINE_TYPE (EmpathyUserInfo, empathy_user_info, GTK_TYPE_GRID)
+G_DEFINE_TYPE (TpawUserInfo, tpaw_user_info, GTK_TYPE_GRID)
 
-struct _EmpathyUserInfoPrivate
+struct _TpawUserInfoPrivate
 {
   TpAccount *account;
 
@@ -59,7 +59,7 @@ enum
 
 static void
 contact_info_changed_cb (GtkEntry *entry,
-    EmpathyUserInfo *self)
+    TpawUserInfo *self)
 {
   const gchar *strv[] = { NULL, NULL };
   TpContactInfoField *field;
@@ -79,7 +79,7 @@ contact_info_changed_cb (GtkEntry *entry,
 static void
 bday_changed_cb (TpawCalendarButton *button,
     GDate *date,
-    EmpathyUserInfo *self)
+    TpawUserInfo *self)
 {
   const gchar *strv[] = { NULL, NULL };
   TpContactInfoField *field;
@@ -171,7 +171,7 @@ add_row (GtkGrid *grid,
 }
 
 static guint
-fill_contact_info_grid (EmpathyUserInfo *self)
+fill_contact_info_grid (TpawUserInfo *self)
 {
   TpConnection *connection;
   TpContact *contact;
@@ -251,7 +251,7 @@ fill_contact_info_grid (EmpathyUserInfo *self)
           NULL, NULL);
       if (!has_field)
         {
-          /* Empathy doesn't display this field so we can't change it.
+          /* We don't display this field so we can't change it.
            * But we put it in the details_to_set list so it won't be erased
            * when calling SetContactInfo (bgo #630427) */
           DEBUG ("Unhandled ContactInfo field spec: %s", field->field_name);
@@ -335,7 +335,7 @@ request_contact_info_cb (GObject *object,
     GAsyncResult *res,
     gpointer user_data)
 {
-  EmpathyUserInfo *self = user_data;
+  TpawUserInfo *self = user_data;
   TpContact *contact = TP_CONTACT (object);
   guint n_rows;
   GError *error = NULL;
@@ -360,7 +360,7 @@ request_contact_info_cb (GObject *object,
 }
 
 static void
-reload_contact_info (EmpathyUserInfo *self)
+reload_contact_info (TpawUserInfo *self)
 {
   TpConnection *connection;
   TpContact *contact = NULL;
@@ -426,7 +426,7 @@ reload_contact_info (EmpathyUserInfo *self)
 }
 
 static void
-connection_notify_cb (EmpathyUserInfo *self)
+connection_notify_cb (TpawUserInfo *self)
 {
   TpConnection *connection = tp_account_get_connection (self->priv->account);
 
@@ -442,7 +442,7 @@ connection_notify_cb (EmpathyUserInfo *self)
 static void
 identifier_notify_cb (TpAccount *account,
     GParamSpec *param_spec,
-    EmpathyUserInfo *self)
+    TpawUserInfo *self)
 {
   gtk_label_set_label (GTK_LABEL (self->priv->identifier_label),
       tp_account_get_normalized_name (self->priv->account));
@@ -451,20 +451,20 @@ identifier_notify_cb (TpAccount *account,
 static void
 nickname_notify_cb (TpAccount *account,
     GParamSpec *param_spec,
-    EmpathyUserInfo *self)
+    TpawUserInfo *self)
 {
   gtk_entry_set_text (GTK_ENTRY (self->priv->nickname_entry),
       tp_account_get_nickname (self->priv->account));
 }
 
 static void
-empathy_user_info_constructed (GObject *object)
+tpaw_user_info_constructed (GObject *object)
 {
-  EmpathyUserInfo *self = (EmpathyUserInfo *) object;
+  TpawUserInfo *self = (TpawUserInfo *) object;
   GtkGrid *grid = (GtkGrid *) self;
   GtkWidget *title;
 
-  G_OBJECT_CLASS (empathy_user_info_parent_class)->constructed (object);
+  G_OBJECT_CLASS (tpaw_user_info_parent_class)->constructed (object);
 
   gtk_grid_set_column_spacing (grid, 6);
   gtk_grid_set_row_spacing (grid, 6);
@@ -513,9 +513,9 @@ empathy_user_info_constructed (GObject *object)
 }
 
 static void
-empathy_user_info_dispose (GObject *object)
+tpaw_user_info_dispose (GObject *object)
 {
-  EmpathyUserInfo *self = (EmpathyUserInfo *) object;
+  TpawUserInfo *self = (TpawUserInfo *) object;
 
   if (self->priv->account != NULL)
     {
@@ -531,16 +531,16 @@ empathy_user_info_dispose (GObject *object)
     g_cancellable_cancel (self->priv->details_cancellable);
   g_clear_object (&self->priv->details_cancellable);
 
-  G_OBJECT_CLASS (empathy_user_info_parent_class)->dispose (object);
+  G_OBJECT_CLASS (tpaw_user_info_parent_class)->dispose (object);
 }
 
 static void
-empathy_user_info_get_property (GObject *object,
+tpaw_user_info_get_property (GObject *object,
     guint property_id,
     GValue *value,
     GParamSpec *pspec)
 {
-  EmpathyUserInfo *self = (EmpathyUserInfo *) object;
+  TpawUserInfo *self = (TpawUserInfo *) object;
 
   switch (property_id)
     {
@@ -554,12 +554,12 @@ empathy_user_info_get_property (GObject *object,
 }
 
 static void
-empathy_user_info_set_property (GObject *object,
+tpaw_user_info_set_property (GObject *object,
     guint property_id,
     const GValue *value,
     GParamSpec *pspec)
 {
-  EmpathyUserInfo *self = (EmpathyUserInfo *) object;
+  TpawUserInfo *self = (TpawUserInfo *) object;
 
   switch (property_id)
     {
@@ -574,24 +574,24 @@ empathy_user_info_set_property (GObject *object,
 }
 
 static void
-empathy_user_info_init (EmpathyUserInfo *self)
+tpaw_user_info_init (TpawUserInfo *self)
 {
   self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      EMPATHY_TYPE_USER_INFO, EmpathyUserInfoPrivate);
+      TPAW_TYPE_USER_INFO, TpawUserInfoPrivate);
 }
 
 static void
-empathy_user_info_class_init (EmpathyUserInfoClass *klass)
+tpaw_user_info_class_init (TpawUserInfoClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GParamSpec *param_spec;
 
-  object_class->constructed = empathy_user_info_constructed;
-  object_class->dispose = empathy_user_info_dispose;
-  object_class->get_property = empathy_user_info_get_property;
-  object_class->set_property = empathy_user_info_set_property;
+  object_class->constructed = tpaw_user_info_constructed;
+  object_class->dispose = tpaw_user_info_dispose;
+  object_class->get_property = tpaw_user_info_get_property;
+  object_class->set_property = tpaw_user_info_set_property;
 
-  g_type_class_add_private (object_class, sizeof (EmpathyUserInfoPrivate));
+  g_type_class_add_private (object_class, sizeof (TpawUserInfoPrivate));
 
   param_spec = g_param_spec_object ("account",
       "account",
@@ -602,19 +602,19 @@ empathy_user_info_class_init (EmpathyUserInfoClass *klass)
 }
 
 GtkWidget *
-empathy_user_info_new (TpAccount *account)
+tpaw_user_info_new (TpAccount *account)
 {
   g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL);
 
-  return g_object_new (EMPATHY_TYPE_USER_INFO,
+  return g_object_new (TPAW_TYPE_USER_INFO,
       "account", account,
       NULL);
 }
 
 void
-empathy_user_info_discard (EmpathyUserInfo *self)
+tpaw_user_info_discard (TpawUserInfo *self)
 {
-  g_return_if_fail (EMPATHY_IS_USER_INFO (self));
+  g_return_if_fail (TPAW_IS_USER_INFO (self));
 
   reload_contact_info (self);
   gtk_entry_set_text ((GtkEntry *) self->priv->nickname_entry,
@@ -701,7 +701,7 @@ field_value_is_empty (TpContactInfoField *field)
 }
 
 void
-empathy_user_info_apply_async (EmpathyUserInfo *self,
+tpaw_user_info_apply_async (TpawUserInfo *self,
     GAsyncReadyCallback callback,
     gpointer user_data)
 {
@@ -710,10 +710,10 @@ empathy_user_info_apply_async (EmpathyUserInfo *self,
   guint count = 0;
   GList *l, *next;
 
-  g_return_if_fail (EMPATHY_IS_USER_INFO (self));
+  g_return_if_fail (TPAW_IS_USER_INFO (self));
 
   result = g_simple_async_result_new ((GObject *) self, callback, user_data,
-      empathy_user_info_apply_async);
+      tpaw_user_info_apply_async);
 
   /* Apply avatar */
   tpaw_avatar_chooser_apply_async (
@@ -768,9 +768,9 @@ empathy_user_info_apply_async (EmpathyUserInfo *self,
 }
 
 gboolean
-empathy_user_info_apply_finish (EmpathyUserInfo *self,
+tpaw_user_info_apply_finish (TpawUserInfo *self,
     GAsyncResult *result,
     GError **error)
 {
-  empathy_implement_finish_void (self, empathy_user_info_apply_async);
+  empathy_implement_finish_void (self, tpaw_user_info_apply_async);
 }
diff --git a/tp-account-widgets/tpaw-user-info.h b/tp-account-widgets/tpaw-user-info.h
new file mode 100644
index 0000000..4548849
--- /dev/null
+++ b/tp-account-widgets/tpaw-user-info.h
@@ -0,0 +1,74 @@
+/*
+ * tpaw-user-info.h - Header for TpawUserInfo
+ *
+ * Copyright (C) 2012 - Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with This library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __TPAW_USER_INFO_H__
+#define __TPAW_USER_INFO_H__
+
+#include <gtk/gtk.h>
+#include <telepathy-glib/telepathy-glib.h>
+
+G_BEGIN_DECLS
+
+#define TPAW_TYPE_USER_INFO \
+    (tpaw_user_info_get_type ())
+#define TPAW_USER_INFO(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPAW_TYPE_USER_INFO, \
+        TpawUserInfo))
+#define TPAW_USER_INFO_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_CAST ((klass), TPAW_TYPE_USER_INFO, \
+        TpawUserInfoClass))
+#define TPAW_IS_USER_INFO(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPAW_TYPE_USER_INFO))
+#define TPAW_IS_USER_INFO_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE ((klass), TPAW_TYPE_USER_INFO))
+#define TPAW_USER_INFO_GET_CLASS(obj) \
+    (G_TYPE_INSTANCE_GET_CLASS ((obj), TPAW_TYPE_USER_INFO, \
+        TpawUserInfoClass))
+
+typedef struct _TpawUserInfo TpawUserInfo;
+typedef struct _TpawUserInfoClass TpawUserInfoClass;
+typedef struct _TpawUserInfoPrivate TpawUserInfoPrivate;
+
+struct _TpawUserInfo {
+  GtkGrid parent;
+
+  TpawUserInfoPrivate *priv;
+};
+
+struct _TpawUserInfoClass {
+  GtkGridClass parent_class;
+};
+
+GType tpaw_user_info_get_type (void) G_GNUC_CONST;
+
+GtkWidget *tpaw_user_info_new (TpAccount *account);
+
+void tpaw_user_info_discard (TpawUserInfo *self);
+
+void tpaw_user_info_apply_async (TpawUserInfo *self,
+    GAsyncReadyCallback callback,
+    gpointer user_data);
+gboolean tpaw_user_info_apply_finish (TpawUserInfo *self,
+    GAsyncResult *result,
+    GError **error);
+
+
+G_END_DECLS
+
+#endif /* __TPAW_USER_INFO_H__ */


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