[gnome-calendar/search-improvements] subscriber-view: use ::setup_child protected func
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/search-improvements] subscriber-view: use ::setup_child protected func
- Date: Mon, 5 Jan 2015 22:32:22 +0000 (UTC)
commit 02348accc5e438258ca1f75b351ef66a6d134be8
Author: Erick PĂ©rez Castellanos <erick red gmail com>
Date: Tue Dec 30 10:12:44 2014 -0500
subscriber-view: use ::setup_child protected func
src/gcal-month-view.c | 2 +-
src/gcal-subscriber-view.c | 22 +++++++++++++++++++---
src/gcal-subscriber-view.h | 4 ++++
src/gcal-year-view.c | 15 +--------------
4 files changed, 25 insertions(+), 18 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index 46ff4d3..3b98dc5 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -219,7 +219,7 @@ event_opened (GcalEventWidget *event_widget,
priv = gcal_month_view_get_instance_private (GCAL_MONTH_VIEW (user_data));
gtk_widget_hide (priv->overflow_popover);
- g_signal_emit_by_name (GCAL_VIEW (user_data), "event-activated", event_widget);
+ g_signal_emit_by_name (GCAL_SUBSCRIBER_VIEW (user_data), "event-activated", event_widget);
}
static void
diff --git a/src/gcal-subscriber-view.c b/src/gcal-subscriber-view.c
index cfb048d..eabe3ca 100644
--- a/src/gcal-subscriber-view.c
+++ b/src/gcal-subscriber-view.c
@@ -32,6 +32,9 @@ enum
static guint signals[NUM_SIGNALS] = { 0, };
+static void event_activated (GcalEventWidget
*widget,
+ gpointer
user_data);
+
static void gcal_data_model_subscriber_interface_init (ECalDataModelSubscriberInterface
*iface);
static void gcal_subscriber_view_finalize (GObject
*object);
@@ -75,6 +78,13 @@ G_DEFINE_TYPE_WITH_CODE (GcalSubscriberView, gcal_subscriber_view, GTK_TYPE_CONT
G_IMPLEMENT_INTERFACE (E_TYPE_CAL_DATA_MODEL_SUBSCRIBER,
gcal_data_model_subscriber_interface_init));
+static void
+event_activated (GcalEventWidget *widget,
+ gpointer user_data)
+{
+ /* FIXME: clear_widget marks + popover + any state */
+ g_signal_emit (GCAL_SUBSCRIBER_VIEW (user_data), signals[EVENT_ACTIVATED], 0, widget);
+}
static void
gcal_subscriber_view_class_init (GcalSubscriberViewClass *klass)
@@ -181,9 +191,7 @@ gcal_subscriber_view_add (GtkContainer *container,
g_hash_table_insert (priv->single_cell_children, GINT_TO_POINTER (cell_idx), l);
}
- /* setup child */
- gtk_widget_set_parent (widget, GTK_WIDGET (container));
- //g_signal_connect (widget, "activate", G_CALLBACK (event_opened), container);
+ _gcal_subscriber_view_setup_child (GCAL_SUBSCRIBER_VIEW (container), widget);
}
static void
@@ -429,3 +437,11 @@ gcal_subscriber_view_get_child_by_uuid (GcalSubscriberView *subscriber_view,
return 0;
}
+
+void
+_gcal_subscriber_view_setup_child (GcalSubscriberView *subscriber_view,
+ GtkWidget *child_widget)
+{
+ gtk_widget_set_parent (child_widget, GTK_WIDGET (subscriber_view));
+ g_signal_connect (child_widget, "activate", G_CALLBACK (event_activated), subscriber_view);
+}
diff --git a/src/gcal-subscriber-view.h b/src/gcal-subscriber-view.h
index 3675533..b3831c8 100644
--- a/src/gcal-subscriber-view.h
+++ b/src/gcal-subscriber-view.h
@@ -65,6 +65,10 @@ GType gcal_subscriber_view_get_type (void);
GtkWidget* gcal_subscriber_view_get_child_by_uuid (GcalSubscriberView *subscriber_view,
const gchar *uuid);
+/* protected */
+void _gcal_subscriber_view_setup_child (GcalSubscriberView *subscriber_view,
+ GtkWidget *child_widget);
+
G_END_DECLS
#endif /* __GCAL_SUBSCRIBER_VIEW_H__ */
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 6a894eb..42505cc 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -52,9 +52,6 @@ enum
PROP_MANAGER //manager inherited property
};
-static void event_opened (GcalEventWidget *event_widget,
- gpointer user_data);
-
static gboolean get_widget_parts (gint first_cell,
gint last_cell,
gint natural_height,
@@ -124,15 +121,6 @@ G_DEFINE_TYPE_WITH_CODE (GcalYearView, gcal_year_view, GCAL_TYPE_SUBSCRIBER_VIEW
G_IMPLEMENT_INTERFACE (GCAL_TYPE_VIEW,gcal_view_interface_init));
-static void
-event_opened (GcalEventWidget *event_widget,
- gpointer user_data)
-{
- g_signal_emit_by_name (GCAL_VIEW (user_data),
- "event-activated",
- event_widget);
-}
-
static gboolean
get_widget_parts (gint first_cell,
gint last_cell,
@@ -551,8 +539,7 @@ gcal_year_view_size_allocate (GtkWidget *widget,
{
child_widget = gcal_event_widget_clone (GCAL_EVENT_WIDGET (child_widget));
- //setup_child (child_widget, widget);
- gtk_widget_set_parent (child_widget, widget); /* FIXME */
+ _gcal_subscriber_view_setup_child (GCAL_SUBSCRIBER_VIEW (widget), child_widget);
gtk_widget_show (child_widget);
aux = g_hash_table_lookup (ppriv->children, uuid);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]