[empathy] calendar-button: move from Empathy to tp-accounts-widgets



commit 7f50fe46dc08956800ee9d63f5191b0d754ca106
Author: Marco Barisione <marco barisione collabora co uk>
Date:   Mon Jul 29 14:20:00 2013 +0100

    calendar-button: move from Empathy to tp-accounts-widgets
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699492

 libempathy-gtk/Makefile.am                         |    2 -
 libempathy-gtk/empathy-calendar-button.h           |   67 --------------------
 libempathy-gtk/empathy-user-info.c                 |   10 ++--
 tests/interactive/test-empathy-calendar-button.c   |    8 +-
 tp-account-widgets/Makefile.am                     |    2 +
 .../tpaw-calendar-button.c                         |   64 +++++++++---------
 tp-account-widgets/tpaw-calendar-button.h          |   67 ++++++++++++++++++++
 7 files changed, 110 insertions(+), 110 deletions(-)
---
diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am
index 0117b15..8665917 100644
--- a/libempathy-gtk/Makefile.am
+++ b/libempathy-gtk/Makefile.am
@@ -33,7 +33,6 @@ libempathy_gtk_handwritten_source =                   \
        empathy-avatar-image.c                  \
        empathy-bad-password-dialog.c           \
        empathy-base-password-dialog.c          \
-       empathy-calendar-button.c \
        empathy-call-utils.c                    \
        empathy-cell-renderer-activatable.c     \
        empathy-cell-renderer-expander.c        \
@@ -96,7 +95,6 @@ libempathy_gtk_headers =                      \
        empathy-avatar-image.h                  \
        empathy-bad-password-dialog.h           \
        empathy-base-password-dialog.h          \
-       empathy-calendar-button.h \
        empathy-call-utils.h                    \
        empathy-cell-renderer-activatable.h     \
        empathy-cell-renderer-expander.h        \
diff --git a/libempathy-gtk/empathy-user-info.c b/libempathy-gtk/empathy-user-info.c
index 0cda19d..82559e1 100644
--- a/libempathy-gtk/empathy-user-info.c
+++ b/libempathy-gtk/empathy-user-info.c
@@ -21,11 +21,11 @@
 #include "empathy-user-info.h"
 
 #include <glib/gi18n-lib.h>
-#include <tp-account-widgets/tpaw-time.h>
+#include <tp-account-widgets/tpaw-calendar-button.h>
 #include <tp-account-widgets/tpaw-contactinfo-utils.h>
+#include <tp-account-widgets/tpaw-time.h>
 
 #include "empathy-avatar-chooser.h"
-#include "empathy-calendar-button.h"
 #include "empathy-utils.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
@@ -77,7 +77,7 @@ contact_info_changed_cb (GtkEntry *entry,
 }
 
 static void
-bday_changed_cb (EmpathyCalendarButton *button,
+bday_changed_cb (TpawCalendarButton *button,
     GDate *date,
     EmpathyUserInfo *self)
 {
@@ -283,7 +283,7 @@ fill_contact_info_grid (EmpathyUserInfo *self)
       /* Add Value */
       if (!tp_strdiff (field->field_name, "bday"))
         {
-          w = empathy_calendar_button_new ();
+          w = tpaw_calendar_button_new ();
 
           if (field->field_value[0])
             {
@@ -292,7 +292,7 @@ fill_contact_info_grid (EmpathyUserInfo *self)
               g_date_set_parse (&date, field->field_value[0]);
               if (g_date_valid (&date))
                 {
-                  empathy_calendar_button_set_date (EMPATHY_CALENDAR_BUTTON (w),
+                  tpaw_calendar_button_set_date (TPAW_CALENDAR_BUTTON (w),
                       &date);
                 }
             }
diff --git a/tests/interactive/test-empathy-calendar-button.c 
b/tests/interactive/test-empathy-calendar-button.c
index 8124109..a3207ee 100644
--- a/tests/interactive/test-empathy-calendar-button.c
+++ b/tests/interactive/test-empathy-calendar-button.c
@@ -21,10 +21,10 @@
 
 #include "config.h"
 
-#include "empathy-calendar-button.h"
+#include <tp-account-widgets/tpaw-calendar-button.h>
 
 static void
-date_changed_cb (EmpathyCalendarButton *button,
+date_changed_cb (TpawCalendarButton *button,
     GDate *date,
     gpointer user_data)
 {
@@ -55,10 +55,10 @@ main (int argc,
   g_signal_connect_swapped (win, "destroy",
       G_CALLBACK (gtk_main_quit), NULL);
 
-  button = empathy_calendar_button_new ();
+  button = tpaw_calendar_button_new ();
 
   date = g_date_new_dmy (30, 11, 1984);
-  empathy_calendar_button_set_date (EMPATHY_CALENDAR_BUTTON (button), date);
+  tpaw_calendar_button_set_date (TPAW_CALENDAR_BUTTON (button), date);
   g_date_free (date);
 
   g_signal_connect (button, "date-changed",
diff --git a/tp-account-widgets/Makefile.am b/tp-account-widgets/Makefile.am
index 5397854..3aafe3d 100644
--- a/tp-account-widgets/Makefile.am
+++ b/tp-account-widgets/Makefile.am
@@ -22,6 +22,7 @@ libtp_account_widgets_sources =               \
        tpaw-account-widget-private.h           \
        tpaw-account-widget-sip.c               \
        tpaw-builder.c                          \
+       tpaw-calendar-button.c                  \
        tpaw-connection-managers.c              \
        tpaw-contactinfo-utils.c                \
        tpaw-keyring.c                          \
@@ -44,6 +45,7 @@ libtp_account_widgets_headers =                       \
        tpaw-account-widget-irc.h               \
        tpaw-account-widget-sip.h               \
        tpaw-builder.h                          \
+       tpaw-calendar-button.h                  \
        tpaw-connection-managers.h              \
        tpaw-contactinfo-utils.h                \
        tpaw-keyring.h                          \
diff --git a/libempathy-gtk/empathy-calendar-button.c b/tp-account-widgets/tpaw-calendar-button.c
similarity index 75%
rename from libempathy-gtk/empathy-calendar-button.c
rename to tp-account-widgets/tpaw-calendar-button.c
index ca96a42..5d52578 100644
--- a/libempathy-gtk/empathy-calendar-button.c
+++ b/tp-account-widgets/tpaw-calendar-button.c
@@ -1,5 +1,5 @@
 /*
- * empathy-calendar-button.c - Source for EmpathyCalendarButton
+ * tpaw-calendar-button.c - Source for TpawCalendarButton
  * Copyright (C) 2012 Collabora Ltd.
  *
  * This library is free software; you can redistribute it and/or
@@ -18,14 +18,14 @@
  */
 
 #include "config.h"
-#include "empathy-calendar-button.h"
+#include "tpaw-calendar-button.h"
 
 #include <glib/gi18n-lib.h>
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER_THING
 #include "empathy-debug.h"
 
-G_DEFINE_TYPE (EmpathyCalendarButton, empathy_calendar_button, GTK_TYPE_BOX)
+G_DEFINE_TYPE (TpawCalendarButton, tpaw_calendar_button, GTK_TYPE_BOX)
 
 /* signal enum */
 enum {
@@ -35,7 +35,7 @@ enum {
 
 static guint signals[LAST_SIGNAL] = {0};
 
-struct _EmpathyCalendarButtonPriv {
+struct _TpawCalendarButtonPriv {
   GDate *date;
 
   GtkWidget *button_date;
@@ -45,17 +45,17 @@ struct _EmpathyCalendarButtonPriv {
 };
 
 static void
-empathy_calendar_button_finalize (GObject *object)
+tpaw_calendar_button_finalize (GObject *object)
 {
-  EmpathyCalendarButton *self = (EmpathyCalendarButton *) object;
+  TpawCalendarButton *self = (TpawCalendarButton *) object;
 
   tp_clear_pointer (&self->priv->date, g_date_free);
 
-  G_OBJECT_CLASS (empathy_calendar_button_parent_class)->finalize (object);
+  G_OBJECT_CLASS (tpaw_calendar_button_parent_class)->finalize (object);
 }
 
 static void
-update_label (EmpathyCalendarButton *self)
+update_label (TpawCalendarButton *self)
 {
   if (self->priv->date == NULL)
     {
@@ -72,11 +72,11 @@ update_label (EmpathyCalendarButton *self)
 }
 
 static void
-empathy_calendar_button_constructed (GObject *object)
+tpaw_calendar_button_constructed (GObject *object)
 {
-  EmpathyCalendarButton *self = (EmpathyCalendarButton *) object;
+  TpawCalendarButton *self = (TpawCalendarButton *) object;
 
-  G_OBJECT_CLASS (empathy_calendar_button_parent_class)->constructed (
+  G_OBJECT_CLASS (tpaw_calendar_button_parent_class)->constructed (
       object);
 
   update_label (self);
@@ -85,7 +85,7 @@ empathy_calendar_button_constructed (GObject *object)
 static void
 dialog_response (GtkDialog *dialog,
     gint response,
-    EmpathyCalendarButton *self)
+    TpawCalendarButton *self)
 {
   GDate *date;
   guint year, month, day;
@@ -97,7 +97,7 @@ dialog_response (GtkDialog *dialog,
       &year, &month, &day);
   date = g_date_new_dmy (day, month + 1, year);
 
-  empathy_calendar_button_set_date (self, date);
+  tpaw_calendar_button_set_date (self, date);
 
   g_date_free (date);
 
@@ -107,7 +107,7 @@ out:
 
 static gboolean
 dialog_destroy (GtkWidget *widget,
-    EmpathyCalendarButton *self)
+    TpawCalendarButton *self)
 {
   self->priv->dialog = NULL;
   self->priv->calendar = NULL;
@@ -116,7 +116,7 @@ dialog_destroy (GtkWidget *widget,
 }
 
 static void
-update_calendar (EmpathyCalendarButton *self)
+update_calendar (TpawCalendarButton *self)
 {
   if (self->priv->calendar == NULL)
     return;
@@ -136,8 +136,8 @@ update_calendar (EmpathyCalendarButton *self)
 }
 
 static void
-empathy_calendar_button_date_clicked (GtkButton *button,
-    EmpathyCalendarButton *self)
+tpaw_calendar_button_date_clicked (GtkButton *button,
+    TpawCalendarButton *self)
 {
   if (self->priv->dialog == NULL)
     {
@@ -174,20 +174,20 @@ empathy_calendar_button_date_clicked (GtkButton *button,
 }
 
 static void
-empathy_calendar_button_clear_clicked (GtkButton *button,
-    EmpathyCalendarButton *self)
+tpaw_calendar_button_clear_clicked (GtkButton *button,
+    TpawCalendarButton *self)
 {
-  empathy_calendar_button_set_date (self, NULL);
+  tpaw_calendar_button_set_date (self, NULL);
 }
 
 static void
-empathy_calendar_button_init (EmpathyCalendarButton *self)
+tpaw_calendar_button_init (TpawCalendarButton *self)
 {
   GtkWidget *image;
   GtkStyleContext *context;
 
   self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      EMPATHY_TYPE_CALENDAR_BUTTON, EmpathyCalendarButtonPriv);
+      TPAW_TYPE_CALENDAR_BUTTON, TpawCalendarButtonPriv);
 
   context = gtk_widget_get_style_context (GTK_WIDGET (self));
   gtk_style_context_add_class (context, GTK_STYLE_CLASS_LINKED);
@@ -196,7 +196,7 @@ empathy_calendar_button_init (EmpathyCalendarButton *self)
   self->priv->button_date = gtk_button_new ();
 
   g_signal_connect (self->priv->button_date, "clicked",
-      G_CALLBACK (empathy_calendar_button_date_clicked), self);
+      G_CALLBACK (tpaw_calendar_button_date_clicked), self);
 
   gtk_button_set_alignment (GTK_BUTTON (self->priv->button_date), 0, 0.5);
 
@@ -212,7 +212,7 @@ empathy_calendar_button_init (EmpathyCalendarButton *self)
   gtk_widget_show (image);
 
   g_signal_connect (self->priv->button_clear, "clicked",
-      G_CALLBACK (empathy_calendar_button_clear_clicked), self);
+      G_CALLBACK (tpaw_calendar_button_clear_clicked), self);
 
   gtk_box_pack_start (GTK_BOX (self), self->priv->button_clear,
       FALSE, FALSE, 0);
@@ -220,14 +220,14 @@ empathy_calendar_button_init (EmpathyCalendarButton *self)
 }
 
 static void
-empathy_calendar_button_class_init (EmpathyCalendarButtonClass *klass)
+tpaw_calendar_button_class_init (TpawCalendarButtonClass *klass)
 {
   GObjectClass *oclass = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (EmpathyCalendarButtonPriv));
+  g_type_class_add_private (klass, sizeof (TpawCalendarButtonPriv));
 
-  oclass->finalize = empathy_calendar_button_finalize;
-  oclass->constructed = empathy_calendar_button_constructed;
+  oclass->finalize = tpaw_calendar_button_finalize;
+  oclass->constructed = tpaw_calendar_button_constructed;
 
   signals[DATE_CHANGED] = g_signal_new ("date-changed",
       G_TYPE_FROM_CLASS (klass),
@@ -238,21 +238,21 @@ empathy_calendar_button_class_init (EmpathyCalendarButtonClass *klass)
 }
 
 GtkWidget *
-empathy_calendar_button_new (void)
+tpaw_calendar_button_new (void)
 {
-  return g_object_new (EMPATHY_TYPE_CALENDAR_BUTTON,
+  return g_object_new (TPAW_TYPE_CALENDAR_BUTTON,
       "orientation", GTK_ORIENTATION_HORIZONTAL,
       NULL);
 }
 
 GDate *
-empathy_calendar_button_get_date (EmpathyCalendarButton *self)
+tpaw_calendar_button_get_date (TpawCalendarButton *self)
 {
   return self->priv->date;
 }
 
 void
-empathy_calendar_button_set_date (EmpathyCalendarButton *self,
+tpaw_calendar_button_set_date (TpawCalendarButton *self,
     GDate *date)
 {
   if (date == self->priv->date)
diff --git a/tp-account-widgets/tpaw-calendar-button.h b/tp-account-widgets/tpaw-calendar-button.h
new file mode 100644
index 0000000..38f2322
--- /dev/null
+++ b/tp-account-widgets/tpaw-calendar-button.h
@@ -0,0 +1,67 @@
+/*
+ * tpaw-calendar-button.h - Header for TpawCalendarButton
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __TPAW_CALENDAR_BUTTON_H__
+#define __TPAW_CALENDAR_BUTTON_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+typedef struct _TpawCalendarButton TpawCalendarButton;
+typedef struct _TpawCalendarButtonClass TpawCalendarButtonClass;
+typedef struct _TpawCalendarButtonPriv TpawCalendarButtonPriv;
+
+struct _TpawCalendarButtonClass {
+    GtkBoxClass parent_class;
+};
+
+struct _TpawCalendarButton {
+    GtkBox parent;
+    TpawCalendarButtonPriv *priv;
+};
+
+GType tpaw_calendar_button_get_type (void);
+
+#define TPAW_TYPE_CALENDAR_BUTTON \
+  (tpaw_calendar_button_get_type ())
+#define TPAW_CALENDAR_BUTTON(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), TPAW_TYPE_CALENDAR_BUTTON, \
+    TpawCalendarButton))
+#define TPAW_CALENDAR_BUTTON_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), TPAW_TYPE_CALENDAR_BUTTON, \
+  TpawCalendarButtonClass))
+#define TPAW_IS_CALENDAR_BUTTON(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj), TPAW_TYPE_CALENDAR_BUTTON))
+#define TPAW_IS_CALENDAR_BUTTON_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass), TPAW_TYPE_CALENDAR_BUTTON))
+#define TPAW_CALENDAR_BUTTON_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), TPAW_TYPE_CALENDAR_BUTTON, \
+  TpawCalendarButtonClass))
+
+GtkWidget * tpaw_calendar_button_new (void);
+
+GDate * tpaw_calendar_button_get_date (TpawCalendarButton *self);
+
+void tpaw_calendar_button_set_date (TpawCalendarButton *self,
+    GDate *date);
+
+G_END_DECLS
+
+#endif /* #ifndef __TPAW_CALENDAR_BUTTON_H__*/


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