[gnome-calendar] edit-dialog: fix time widgets sensitive when all day
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] edit-dialog: fix time widgets sensitive when all day
- Date: Wed, 23 Aug 2017 22:16:46 +0000 (UTC)
commit 6004123ba27e5eb82000792f6ac5231807b3baa2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Aug 24 07:16:15 2017 +0900
edit-dialog: fix time widgets sensitive when all day
data/ui/edit-dialog.ui | 2 --
src/gcal-edit-dialog.c | 19 +++++++++++++------
2 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/data/ui/edit-dialog.ui b/data/ui/edit-dialog.ui
index e6f169a..26cc430 100644
--- a/data/ui/edit-dialog.ui
+++ b/data/ui/edit-dialog.ui
@@ -311,7 +311,6 @@
<object class="GcalTimeSelector" id="start_time_selector">
<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="sync_datetimes" object="GcalEditDialog"
swapped="yes" />
</object>
</child>
@@ -326,7 +325,6 @@
<object class="GcalTimeSelector" id="end_time_selector">
<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="sync_datetimes" object="GcalEditDialog"
swapped="yes" />
</object>
</child>
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 82bb824..2a55f59 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -260,14 +260,21 @@ static void
gcal_edit_dialog_set_writable (GcalEditDialog *dialog,
gboolean writable)
{
- if (dialog->writable != writable)
- {
- dialog->writable = writable;
+ gboolean all_day;
- gtk_button_set_label (GTK_BUTTON (dialog->done_button), writable ? _("Save") : _("Done"));
+ if (dialog->writable == writable)
+ return;
- g_object_notify (G_OBJECT (dialog), "writable");
- }
+ all_day = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->all_day_check));
+
+ gtk_widget_set_sensitive (dialog->start_time_selector, !all_day && writable);
+ gtk_widget_set_sensitive (dialog->end_time_selector, !all_day && writable);
+
+ gtk_button_set_label (GTK_BUTTON (dialog->done_button), writable ? _("Save") : _("Done"));
+
+ dialog->writable = writable;
+
+ g_object_notify (G_OBJECT (dialog), "writable");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]