[gnome-calendar] edit-dialog: use UI file to connect signals
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] edit-dialog: use UI file to connect signals
- Date: Tue, 13 Jan 2015 19:02:41 +0000 (UTC)
commit 54232803983df09df0f0db2487b9ea8f56ea981f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Jan 13 17:02:07 2015 -0200
edit-dialog: use UI file to connect signals
Fixes bug #739313.
data/ui/edit-dialog.ui | 10 ++++++++
src/gcal-edit-dialog.c | 59 +++++++----------------------------------------
2 files changed, 19 insertions(+), 50 deletions(-)
---
diff --git a/data/ui/edit-dialog.ui b/data/ui/edit-dialog.ui
index e17a682..951aeb0 100644
--- a/data/ui/edit-dialog.ui
+++ b/data/ui/edit-dialog.ui
@@ -21,6 +21,7 @@
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <signal name="clicked" handler="gcal_edit_dialog_action_button_clicked" object="GcalEditDialog"
swapped="no"/>
</object>
</child>
<child>
@@ -37,6 +38,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <signal name="clicked" handler="gcal_edit_dialog_action_button_clicked" object="GcalEditDialog"
swapped="no"/>
<style>
<class name="suggested-action"/>
</style>
@@ -152,6 +154,7 @@
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="activates_default">True</property>
+ <signal name="notify::text" handler="update_summary" object="GcalEditDialog" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
@@ -186,6 +189,7 @@
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="label" translatable="yes">All day</property>
+ <signal name="toggled" handler="gcal_edit_dialog_all_day_changed" object="GcalEditDialog"
swapped="no"/>
</object>
<packing>
<property name="left_attach">3</property>
@@ -199,6 +203,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="secondary_icon_name">find-location-symbolic</property>
+ <signal name="notify::text" handler="update_location" object="GcalEditDialog" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
@@ -241,6 +246,7 @@
<object class="GcalDateSelector" id="start_date_selector">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <signal name="modified" handler="update_date" object="GcalEditDialog" swapped="no"/>
</object>
<packing>
<property name="position">1</property>
@@ -250,6 +256,7 @@
<object class="GcalTimeSelector" id="start_time_selector">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <signal name="modified" handler="update_time" object="GcalEditDialog" swapped="no"/>
</object>
<packing>
<property name="position">2</property>
@@ -274,6 +281,7 @@
<object class="GcalDateSelector" id="end_date_selector">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <signal name="modified" handler="update_date" object="GcalEditDialog" swapped="no"/>
</object>
<packing>
<property name="position">1</property>
@@ -283,6 +291,7 @@
<object class="GcalTimeSelector" id="end_time_selector">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <signal name="modified" handler="update_time" object="GcalEditDialog" swapped="no"/>
</object>
<packing>
<property name="position">2</property>
@@ -299,6 +308,7 @@
<object class="GtkButton" id="delete_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <signal name="clicked" handler="gcal_edit_dialog_action_button_clicked"
object="GcalEditDialog" swapped="no"/>
<child>
<object class="GtkLabel" id="delete_label">
<property name="visible">True</property>
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 7093360..fa7898e 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -483,6 +483,14 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, lock);
gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, source_image);
gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, sources_popover);
+
+ /* callbacks */
+ gtk_widget_class_bind_template_callback (widget_class, gcal_edit_dialog_action_button_clicked);
+ gtk_widget_class_bind_template_callback (widget_class, gcal_edit_dialog_all_day_changed);
+ gtk_widget_class_bind_template_callback (widget_class, update_summary);
+ gtk_widget_class_bind_template_callback (widget_class, update_location);
+ gtk_widget_class_bind_template_callback (widget_class, update_date);
+ gtk_widget_class_bind_template_callback (widget_class, update_time);
}
static void
@@ -547,65 +555,16 @@ gcal_edit_dialog_constructed (GObject* object)
g_object_set_data (G_OBJECT (priv->cancel_button),
"response",
GINT_TO_POINTER (GTK_RESPONSE_CANCEL));
- g_signal_connect (priv->cancel_button,
- "clicked",
- G_CALLBACK (gcal_edit_dialog_action_button_clicked),
- object);
g_object_set_data (G_OBJECT (priv->delete_button),
"response",
GINT_TO_POINTER (GCAL_RESPONSE_DELETE_EVENT));
- g_signal_connect (priv->delete_button,
- "clicked",
- G_CALLBACK (gcal_edit_dialog_action_button_clicked),
- object);
g_object_set_data (G_OBJECT (priv->done_button),
"response",
GINT_TO_POINTER (GCAL_RESPONSE_SAVE_EVENT));
- g_signal_connect (priv->done_button,
- "clicked",
- G_CALLBACK (gcal_edit_dialog_action_button_clicked),
- object);
- /* signals handlers */
- g_signal_connect (priv->all_day_check,
- "toggled",
- G_CALLBACK (gcal_edit_dialog_all_day_changed),
+ g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->notes_text)), "changed", G_CALLBACK
(update_notes),
object);
- g_signal_connect (priv->summary_entry,
- "notify::text",
- G_CALLBACK (update_summary),
- object);
-
- g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->notes_text)),
- "changed",
- G_CALLBACK (update_notes),
- object);
-
- g_signal_connect (priv->location_entry,
- "notify::text",
- G_CALLBACK (update_location),
- object);
-
- g_signal_connect (priv->start_date_selector,
- "modified",
- G_CALLBACK (update_date),
- object);
-
- g_signal_connect (priv->end_date_selector,
- "modified",
- G_CALLBACK (update_date),
- object);
-
- g_signal_connect (priv->start_time_selector,
- "modified",
- G_CALLBACK (update_time),
- object);
-
- g_signal_connect (priv->end_time_selector,
- "modified",
- G_CALLBACK (update_time),
- object);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]