[gnome-calendar] month-view: add helper method
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] month-view: add helper method
- Date: Thu, 18 Dec 2014 21:32:01 +0000 (UTC)
commit 170501bbddc859150eb0c79d49b0d1eb160476c3
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Thu Dec 18 14:50:29 2014 -0500
month-view: add helper method
src/gcal-month-view.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index 7ed7538..62af3a8 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -94,6 +94,9 @@ enum
static void event_opened (GcalEventWidget *event_widget,
gpointer user_data);
+static void setup_child (GtkWidget *child_widget,
+ GtkWidget *parent);
+
static gint get_cell_and_center_from_position (GcalMonthView *view,
gdouble x,
gdouble y,
@@ -192,6 +195,14 @@ event_opened (GcalEventWidget *event_widget,
event_widget);
}
+static void
+setup_child (GtkWidget *child_widget,
+ GtkWidget *parent)
+{
+ gtk_widget_set_parent (child_widget, parent);
+ g_signal_connect (child_widget, "activate", G_CALLBACK (event_opened), parent);
+}
+
static gint
get_cell_and_center_from_position (GcalMonthView *view,
gdouble x,
@@ -722,8 +733,7 @@ gcal_month_view_size_allocate (GtkWidget *widget,
{
child_widget = gcal_event_widget_clone (GCAL_EVENT_WIDGET (child_widget));
- gtk_widget_set_parent (child_widget, widget);
- g_signal_connect (child_widget, "activate", G_CALLBACK (event_opened), widget);
+ setup_child (child_widget, widget);
gtk_widget_show (child_widget);
aux = g_hash_table_lookup (priv->children, uuid);
@@ -1354,8 +1364,7 @@ gcal_month_view_add (GtkContainer *container,
g_free (date);
}
- gtk_widget_set_parent (widget, GTK_WIDGET (container));
- g_signal_connect (widget, "activate", G_CALLBACK (event_opened), container);
+ setup_child (widget, GTK_WIDGET (container));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]