[gnome-calendar/calendar-management] sources-dialog: properly install the GcalSourceManagerDialog::manager property
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/calendar-management] sources-dialog: properly install the GcalSourceManagerDialog::manager property
- Date: Wed, 14 Jan 2015 02:32:12 +0000 (UTC)
commit 9fc5714c1f919c4cfd63dd3bde9184199fa508d2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jan 14 00:28:16 2015 -0200
sources-dialog: properly install the GcalSourceManagerDialog::manager property
src/gcal-source-manager-dialog.c | 34 +++++++++++++++++++++++++++-------
src/gcal-source-manager-dialog.h | 4 +++-
2 files changed, 30 insertions(+), 8 deletions(-)
---
diff --git a/src/gcal-source-manager-dialog.c b/src/gcal-source-manager-dialog.c
index 7cf6ac6..7dca1aa 100644
--- a/src/gcal-source-manager-dialog.c
+++ b/src/gcal-source-manager-dialog.c
@@ -18,22 +18,24 @@
#include "gcal-source-manager-dialog.h"
+#include "gcal-manager.h"
+
struct _GcalSourceManagerDialogPrivate
{
-
+ GcalManager *manager; /* weak ref */
};
enum {
PROP_0,
- LAST_PROP
+ PROP_MANAGER
};
G_DEFINE_TYPE_WITH_PRIVATE (GcalSourceManagerDialog, gcal_source_manager_dialog, GTK_TYPE_DIALOG)
GcalSourceManagerDialog *
-gcal_source_manager_dialog_new (void)
+gcal_source_manager_dialog_new (GcalManager *manager)
{
- return g_object_new (GCAL_TYPE_SOURCE_MANAGER_DIALOG, NULL);
+ return g_object_new (GCAL_TYPE_SOURCE_MANAGER_DIALOG, "manager", manager, NULL);
}
static void
@@ -63,12 +65,18 @@ gcal_source_manager_dialog_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GcalSourceManagerDialog *self = GCAL_SOURCE_MANAGER_DIALOG (object);
+ GcalSourceManagerDialogPrivate *priv;
+
+ priv = gcal_source_manager_dialog_get_instance_private (GCAL_SOURCE_MANAGER_DIALOG (object));
switch (prop_id)
{
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ case PROP_MANAGER:
+ priv->manager = g_value_get_pointer (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
@@ -81,6 +89,18 @@ gcal_source_manager_dialog_class_init (GcalSourceManagerDialogClass *klass)
object_class->get_property = gcal_source_manager_dialog_get_property;
object_class->set_property = gcal_source_manager_dialog_set_property;
+ /**
+ * GcalSourceManagerDialog::manager:
+ *
+ * The singleton instance of #GcalManager.
+ *
+ */
+ 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));
+
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
"/org/gnome/calendar/source-manager-dialog.ui");
}
diff --git a/src/gcal-source-manager-dialog.h b/src/gcal-source-manager-dialog.h
index 446d243..4391797 100644
--- a/src/gcal-source-manager-dialog.h
+++ b/src/gcal-source-manager-dialog.h
@@ -20,6 +20,8 @@
#include <gtk/gtk.h>
+#include "gcal-manager.h"
+
G_BEGIN_DECLS
#define GCAL_TYPE_SOURCE_MANAGER_DIALOG (gcal_source_manager_dialog_get_type())
@@ -46,7 +48,7 @@ struct _GcalSourceManagerDialogClass
GType gcal_source_manager_dialog_get_type (void);
-GcalSourceManagerDialog* gcal_source_manager_dialog_new (void);
+GcalSourceManagerDialog* gcal_source_manager_dialog_new (GcalManager *manager);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]