edit-dialog: use UI file to connect signals

Fixes bug #739313.
This commit is contained in:
Georges Basile Stavracas Neto
2015-01-13 17:02:07 -02:00
parent c799acf482
commit 5423280398
2 changed files with 20 additions and 51 deletions
+10
View File
@@ -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>
+10 -51
View File
@@ -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),
g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->notes_text)), "changed", G_CALLBACK (update_notes),
object);
/* signals handlers */
g_signal_connect (priv->all_day_check,
"toggled",
G_CALLBACK (gcal_edit_dialog_all_day_changed),
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