[gnome-calendar] search-view: internal manager is not a property
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] search-view: internal manager is not a property
- Date: Fri, 9 Jan 2015 20:04:57 +0000 (UTC)
commit ea21ffdd70e5de44a4f4413c85f3927752ee1231
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Fri Jan 9 13:37:08 2015 -0500
search-view: internal manager is not a property
The idea here it to include SearchView as a widget in GcalWindow
Builder UI file.
src/gcal-search-view.c | 43 +++++++++++++++++++++----------------------
src/gcal-search-view.h | 4 +++-
src/gcal-window.c | 3 ++-
3 files changed, 26 insertions(+), 24 deletions(-)
---
diff --git a/src/gcal-search-view.c b/src/gcal-search-view.c
index 28cbdc7..e0e750b 100644
--- a/src/gcal-search-view.c
+++ b/src/gcal-search-view.c
@@ -60,7 +60,6 @@ enum
{
PROP_0,
PROP_DATE, /* active-date inherited property */
- PROP_MANAGER /* manager inherited property */
};
enum
@@ -495,19 +494,6 @@ gcal_search_view_class_init (GcalSearchViewClass *klass)
"The active/selected date in the view",
ICAL_TIME_TYPE, G_PARAM_READWRITE));
- /**
- * GcalSearchView::manager:
- *
- * A weak reference to the singleton #GcalManager of this
- * application.
- *
- */
- g_object_class_install_property (object_class, PROP_MANAGER,
- g_param_spec_pointer ("manager",
- "The manager object",
- "A weak reference to the app manager object",
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
-
/* bind things for/from the template class */
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
"/org/gnome/calendar/search-view.ui");
@@ -575,11 +561,6 @@ gcal_search_view_set_property (GObject *object,
priv->date = g_value_dup_boxed (value);
break;
}
- case PROP_MANAGER:
- {
- priv->manager = g_value_get_pointer (value);
- break;
- }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -722,7 +703,6 @@ gcal_search_view_thaw (ECalDataModelSubscriber *subscriber)
/* Public API */
/**
* gcal_search_view_new:
- * @manager: App singleton #GcalManager instance
*
* Since: 0.1
* Create a new month view widget
@@ -730,9 +710,28 @@ gcal_search_view_thaw (ECalDataModelSubscriber *subscriber)
* Returns: (transfer full):
**/
GtkWidget*
-gcal_search_view_new (GcalManager *manager)
+gcal_search_view_new (void)
{
- return g_object_new (GCAL_TYPE_SEARCH_VIEW, "manager", manager, NULL);
+ return g_object_new (GCAL_TYPE_SEARCH_VIEW, NULL);
+}
+
+/**
+ * gcal_search_view_connect:
+ * @search_view: a #GcalSearchView instance
+ * @manager: App singleton #GcalManager instance
+ *
+ * Connect the view to the App singleton manager instance.
+ * This is designed to be called once, after create of the view and before any use.
+ */
+void
+gcal_search_view_connect (GcalSearchView *search_view,
+ GcalManager *manager)
+{
+ GcalSearchViewPrivate *priv;
+
+ priv = gcal_search_view_get_instance_private (search_view);
+ if (manager != NULL && manager != priv->manager)
+ priv->manager = manager;
}
/**
diff --git a/src/gcal-search-view.h b/src/gcal-search-view.h
index 6cdfc7f..d8e05e8 100644
--- a/src/gcal-search-view.h
+++ b/src/gcal-search-view.h
@@ -59,8 +59,10 @@ void gcal_search_view_search (GcalSearchView *view,
const gchar *field,
const gchar *query);
+GtkWidget* gcal_search_view_new (void);
-GtkWidget* gcal_search_view_new (GcalManager *manager);
+void gcal_search_view_connect (GcalSearchView *search_view,
+ GcalManager *manager);
G_END_DECLS
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 39e8f10..9f412d0 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -1306,7 +1306,8 @@ gcal_window_constructed (GObject *object)
"year", _("Year"));
/* search view */
- priv->views[GCAL_WINDOW_VIEW_SEARCH] = gcal_search_view_new (priv->manager);
+ priv->views[GCAL_WINDOW_VIEW_SEARCH] = gcal_search_view_new ();
+ gcal_search_view_connect (GCAL_SEARCH_VIEW (priv->views[GCAL_WINDOW_VIEW_SEARCH]), priv->manager);
g_object_ref_sink (priv->views[GCAL_WINDOW_VIEW_SEARCH]);
gcal_search_view_set_time_format (GCAL_SEARCH_VIEW (priv->views[GCAL_WINDOW_VIEW_SEARCH]), use_24h_format);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]