[gnome-calendar] view iface: remove manager property



commit d15c4a5c1b519a55920bab17cfd36d047832ccca
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Thu Jan 15 01:36:17 2015 -0500

    view iface: remove manager property
    
    There's no reason at all why manager should be a property inside the
    views. It won't benefit of bindings or anything else inherent to GObject
    property system.

 src/gcal-month-view.c |   21 +++++++++++----------
 src/gcal-month-view.h |   15 +++++++--------
 src/gcal-view.c       |    8 --------
 src/gcal-week-view.c  |   24 ++++++++++++------------
 src/gcal-week-view.h  |   15 +++++++--------
 src/gcal-window.c     |   23 +++++++++--------------
 6 files changed, 46 insertions(+), 60 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index 114d619..338468b 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -82,7 +82,6 @@ enum
 {
   PROP_0,
   PROP_DATE,  /* active-date inherited property */
-  PROP_MANAGER  /* manager inherited property */
 };
 
 static gint           gather_button_event_data              (GcalMonthView  *view,
@@ -527,7 +526,6 @@ gcal_month_view_class_init (GcalMonthViewClass *klass)
   subscriber_view_class->clear_state = gcal_month_view_clear_state;
 
   g_object_class_override_property (object_class, PROP_DATE, "active-date");
-  g_object_class_override_property (object_class, PROP_MANAGER, "manager");
 }
 
 static void
@@ -632,11 +630,6 @@ gcal_month_view_set_property (GObject       *object,
         gtk_widget_queue_draw (GTK_WIDGET (object));
         break;
       }
-    case PROP_MANAGER:
-      {
-        priv->manager = g_value_get_pointer (value);
-        break;
-      }
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -1666,7 +1659,6 @@ gcal_month_view_get_right_header (GcalView *view)
 /* Public API */
 /**
  * gcal_month_view_new:
- * @manager: App singleton #GcalManager instance
  *
  * Since: 0.1
  * Create a new month view widget
@@ -1674,9 +1666,18 @@ gcal_month_view_get_right_header (GcalView *view)
  * Returns: (transfer full):
  **/
 GtkWidget*
-gcal_month_view_new (GcalManager *manager)
+gcal_month_view_new (void)
+{
+  return g_object_new (GCAL_TYPE_MONTH_VIEW, NULL);
+}
+
+void
+gcal_month_view_set_manager (GcalMonthView *month_view,
+                             GcalManager   *manager)
 {
-  return g_object_new (GCAL_TYPE_MONTH_VIEW, "manager", manager, NULL);
+  GcalMonthViewPrivate *priv = gcal_month_view_get_instance_private (month_view);
+
+  priv->manager = manager;
 }
 
 /**
diff --git a/src/gcal-month-view.h b/src/gcal-month-view.h
index bb83f03..2784415 100644
--- a/src/gcal-month-view.h
+++ b/src/gcal-month-view.h
@@ -45,15 +45,14 @@ struct _GcalMonthViewClass
   GcalSubscriberViewClass parent_class;
 };
 
-GType          gcal_month_view_get_type         (void);
-
-GtkWidget*     gcal_month_view_new              (GcalManager *manager);
-
-void           gcal_month_view_set_first_weekday (GcalMonthView *view,
-                                                 gint           day_nr);
-
+GType          gcal_month_view_get_type           (void);
+GtkWidget*     gcal_month_view_new                (void);
+void           gcal_month_view_set_manager        (GcalMonthView *month_view,
+                                                   GcalManager   *manager);
+void           gcal_month_view_set_first_weekday  (GcalMonthView *view,
+                                                   gint           day_nr);
 void           gcal_month_view_set_use_24h_format (GcalMonthView *view,
-                                                  gboolean       use_24h);
+                                                   gboolean       use_24h);
 
 G_END_DECLS
 
diff --git a/src/gcal-view.c b/src/gcal-view.c
index c9e7626..dbb11e4 100644
--- a/src/gcal-view.c
+++ b/src/gcal-view.c
@@ -39,14 +39,6 @@ gcal_view_base_init (gpointer g_iface)
                               ICAL_TIME_TYPE,
                               G_PARAM_READWRITE));
 
-      g_object_interface_install_property (
-          g_iface,
-          g_param_spec_pointer ("manager",
-                                "The manager object",
-                                "A weak reference to the app manager object",
-                                G_PARAM_CONSTRUCT_ONLY |
-                                G_PARAM_READWRITE));
-
       g_signal_new ("create-event",
                     GCAL_TYPE_VIEW,
                     G_SIGNAL_RUN_LAST,
diff --git a/src/gcal-week-view.c b/src/gcal-week-view.c
index 9b6ccb6..50e214a 100644
--- a/src/gcal-week-view.c
+++ b/src/gcal-week-view.c
@@ -38,8 +38,7 @@ static const double dashed [] =
 enum
 {
   PROP_0,
-  PROP_DATE,
-  PROP_MANAGER
+  PROP_DATE
 };
 
 struct _GcalWeekViewChild
@@ -548,8 +547,6 @@ gcal_week_view_class_init (GcalWeekViewClass *klass)
 
   g_object_class_override_property (object_class,
                                     PROP_DATE, "active-date");
-  g_object_class_override_property (object_class,
-                                    PROP_MANAGER, "manager");
 }
 
 static void
@@ -655,11 +652,6 @@ gcal_week_view_set_property (GObject       *object,
         gtk_widget_queue_draw (GTK_WIDGET (object));
         break;
       }
-    case PROP_MANAGER:
-      {
-        priv->manager = g_value_get_pointer (value);
-        break;
-      }
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -1422,16 +1414,24 @@ gcal_week_view_get_by_uuid (GcalSubscriberView *subscriber_view,
 /* Public API */
 /**
  * gcal_week_view_new:
- * @manager: App singleton #GcalManager instance
  *
  * Create a week-view widget
  *
  * Returns: (transfer full):
  **/
 GtkWidget*
-gcal_week_view_new (GcalManager *manager)
+gcal_week_view_new (void)
 {
-  return g_object_new (GCAL_TYPE_WEEK_VIEW, "manager", manager, NULL);
+  return g_object_new (GCAL_TYPE_WEEK_VIEW, NULL);
+}
+
+void
+gcal_week_view_set_manager (GcalWeekView *week_view,
+                            GcalManager  *manager)
+{
+  GcalWeekViewPrivate *priv = gcal_week_view_get_instance_private (week_view);
+
+  priv->manager = manager;
 }
 
 /**
diff --git a/src/gcal-week-view.h b/src/gcal-week-view.h
index f28504f..120abb4 100644
--- a/src/gcal-week-view.h
+++ b/src/gcal-week-view.h
@@ -46,15 +46,14 @@ struct _GcalWeekViewClass
   GcalSubscriberViewClass parent_class;
 };
 
-GType          gcal_week_view_get_type         (void);
-
-GtkWidget*     gcal_week_view_new              (GcalManager *manager);
-
-void           gcal_week_view_set_first_weekday (GcalWeekView *view,
-                                                gint          day_nr);
-
+GType          gcal_week_view_get_type           (void);
+GtkWidget*     gcal_week_view_new                (void);
+void           gcal_week_view_set_manager        (GcalWeekView *view,
+                                                  GcalManager  *manager);
+void           gcal_week_view_set_first_weekday  (GcalWeekView *view,
+                                                  gint          day_nr);
 void           gcal_week_view_set_use_24h_format (GcalWeekView *view,
-                                                 gboolean      use_24h);
+                                                  gboolean      use_24h);
 
 G_END_DECLS
 
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 65c8fcd..19d72ed 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -1277,24 +1277,19 @@ gcal_window_constructed (GObject *object)
   g_signal_connect (gtk_bin_get_child (GTK_BIN (priv->search_bar)), "notify::child-revealed",
                     G_CALLBACK (search_bar_revealer_toggled), object);
 
-  priv->views[GCAL_WINDOW_VIEW_WEEK] =
-    gcal_week_view_new (priv->manager);
-  gcal_week_view_set_first_weekday (
-      GCAL_WEEK_VIEW (priv->views[GCAL_WINDOW_VIEW_WEEK]),
-      get_first_weekday ());
-  gcal_week_view_set_use_24h_format (
-      GCAL_WEEK_VIEW (priv->views[GCAL_WINDOW_VIEW_WEEK]),
-      use_24h_format);
-  gtk_stack_add_titled (GTK_STACK (priv->views_stack),
-                        priv->views[GCAL_WINDOW_VIEW_WEEK],
-                        "week", _("Week"));
-
-  priv->views[GCAL_WINDOW_VIEW_MONTH] = gcal_month_view_new (priv->manager);
+  priv->views[GCAL_WINDOW_VIEW_WEEK] = gcal_week_view_new ();
+  gcal_week_view_set_manager (GCAL_WEEK_VIEW (priv->views[GCAL_WINDOW_VIEW_WEEK]), priv->manager);
+  gcal_week_view_set_first_weekday (GCAL_WEEK_VIEW (priv->views[GCAL_WINDOW_VIEW_WEEK]), get_first_weekday 
());
+  gcal_week_view_set_use_24h_format (GCAL_WEEK_VIEW (priv->views[GCAL_WINDOW_VIEW_WEEK]), use_24h_format);
+  gtk_stack_add_titled (GTK_STACK (priv->views_stack), priv->views[GCAL_WINDOW_VIEW_WEEK], "week", 
_("Week"));
+
+  priv->views[GCAL_WINDOW_VIEW_MONTH] = gcal_month_view_new ();
+  gcal_month_view_set_manager (GCAL_MONTH_VIEW (priv->views[GCAL_WINDOW_VIEW_MONTH]), priv->manager);
   gcal_month_view_set_first_weekday (GCAL_MONTH_VIEW (priv->views[GCAL_WINDOW_VIEW_MONTH]), 
get_first_weekday ());
   gcal_month_view_set_use_24h_format (GCAL_MONTH_VIEW (priv->views[GCAL_WINDOW_VIEW_MONTH]), use_24h_format);
   gtk_stack_add_titled (GTK_STACK (priv->views_stack), priv->views[GCAL_WINDOW_VIEW_MONTH], "month", 
_("Month"));
 
-  priv->views[GCAL_WINDOW_VIEW_YEAR] = GTK_WIDGET (gcal_year_view_new ());
+  priv->views[GCAL_WINDOW_VIEW_YEAR] = g_object_new (GCAL_TYPE_YEAR_VIEW, NULL);
   gcal_year_view_set_manager (GCAL_YEAR_VIEW (priv->views[GCAL_WINDOW_VIEW_YEAR]), priv->manager);
   gtk_stack_add_titled (GTK_STACK (priv->views_stack), priv->views[GCAL_WINDOW_VIEW_YEAR], "year", 
_("Year"));
 


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