[gnome-calendar/wip/gbsneto/gcal-event: 3/3] edit-dialog: simplify code
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/gbsneto/gcal-event: 3/3] edit-dialog: simplify code
- Date: Sun, 14 Feb 2016 00:24:46 +0000 (UTC)
commit 9480c63985aef12ff593a842a6036ba25204c7b9
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Feb 13 21:21:20 2016 -0200
edit-dialog: simplify code
We don't need to have 2 functions that do exactly
the same thing.
data/ui/edit-dialog.ui | 8 ++++----
src/gcal-edit-dialog.c | 33 +++------------------------------
2 files changed, 7 insertions(+), 34 deletions(-)
---
diff --git a/data/ui/edit-dialog.ui b/data/ui/edit-dialog.ui
index 88e85de..0dbe17d 100644
--- a/data/ui/edit-dialog.ui
+++ b/data/ui/edit-dialog.ui
@@ -229,7 +229,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="sensitive" bind-source="GcalEditDialog" bind-property="writable"
bind-flags="default" />
- <signal name="notify::date" handler="update_date" object="GcalEditDialog" swapped="yes"/>
+ <signal name="notify::date" handler="update_datetime" object="GcalEditDialog"
swapped="yes"/>
</object>
<packing>
<property name="position">1</property>
@@ -240,7 +240,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="sensitive" bind-source="GcalEditDialog" bind-property="writable"
bind-flags="default" />
- <signal name="notify::time" handler="update_time" object="GcalEditDialog" swapped="yes"/>
+ <signal name="notify::time" handler="update_datetime" object="GcalEditDialog"
swapped="yes"/>
</object>
<packing>
<property name="position">2</property>
@@ -265,7 +265,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="sensitive" bind-source="GcalEditDialog" bind-property="writable"
bind-flags="default" />
- <signal name="notify::date" handler="update_date" object="GcalEditDialog" swapped="yes"/>
+ <signal name="notify::date" handler="update_datetime" object="GcalEditDialog"
swapped="yes"/>
</object>
<packing>
<property name="position">1</property>
@@ -276,7 +276,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="sensitive" bind-source="GcalEditDialog" bind-property="writable"
bind-flags="default" />
- <signal name="notify::time" handler="update_time" object="GcalEditDialog" swapped="yes"/>
+ <signal name="notify::time" handler="update_datetime" object="GcalEditDialog"
swapped="yes"/>
</object>
<packing>
<property name="position">2</property>
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index bfc0924..a293790 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -74,7 +74,7 @@ static void on_calendar_selected (GtkWidget *me
GVariant *value,
gpointer user_data);
-static void update_date (GcalEditDialog *dialog);
+static void update_datetime (GcalEditDialog *dialog);
static void update_location (GtkEntry *entry,
GParamSpec *pspec,
@@ -87,8 +87,6 @@ static void update_summary (GtkEntry *en
GParamSpec *pspec,
gpointer user_data);
-static void update_time (GcalEditDialog *dialog);
-
static void gcal_edit_dialog_constructed (GObject *object);
static void gcal_edit_dialog_finalize (GObject *object);
@@ -215,7 +213,7 @@ on_calendar_selected (GtkWidget *menu_item,
}
static void
-update_date (GcalEditDialog *dialog)
+update_datetime (GcalEditDialog *dialog)
{
GDateTime *start_date;
GDateTime *end_date;
@@ -278,30 +276,6 @@ update_summary (GtkEntry *entry,
}
static void
-update_time (GcalEditDialog *dialog)
-{
- GDateTime *start_date;
- GDateTime *end_date;
-
- if (dialog->setting_event)
- return;
-
- start_date = gcal_edit_dialog_get_date_start (dialog);
- end_date = gcal_edit_dialog_get_date_end (dialog);
-
- // g_debug ("Updating date: %s -> %s",
- // icaltime_as_ical_string (*start_date),
- // icaltime_as_ical_string (*end_date));
-
- /* update component */
- gcal_event_set_date_start (dialog->event, start_date);
- gcal_event_set_date_end (dialog->event, end_date);
-
- g_clear_pointer (&start_date, g_date_time_unref);
- g_clear_pointer (&end_date, g_date_time_unref);
-}
-
-static void
gcal_edit_dialog_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -434,8 +408,7 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
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);
+ gtk_widget_class_bind_template_callback (widget_class, update_datetime);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]