[gnome-calendar] edit-dialog: update style



commit 3eec69c559ee5b58e4bfb6837403a9bc9b9719ca
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Aug 24 07:07:36 2017 +0900

    edit-dialog: update style
    
    Calendar matured its code style over time and
    edit dialog kept the old style.

 data/ui/edit-dialog.ui |    8 +-
 src/gcal-edit-dialog.c |  578 ++++++++++++++++++++++-------------------------
 2 files changed, 275 insertions(+), 311 deletions(-)
---
diff --git a/data/ui/edit-dialog.ui b/data/ui/edit-dialog.ui
index 9a8985d..e6f169a 100644
--- a/data/ui/edit-dialog.ui
+++ b/data/ui/edit-dialog.ui
@@ -18,7 +18,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"/>
+            <signal name="clicked" handler="action_button_clicked" object="GcalEditDialog" swapped="no"/>
           </object>
         </child>
         <child>
@@ -111,7 +111,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"/>
+            <signal name="clicked" handler="action_button_clicked" object="GcalEditDialog" swapped="no"/>
             <style>
               <class name="suggested-action"/>
             </style>
@@ -347,7 +347,7 @@
                 <property name="draw_indicator">True</property>
                 <property name="label" translatable="yes">All Day</property>
                 <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <signal name="toggled" handler="gcal_edit_dialog_all_day_changed" object="GcalEditDialog" 
swapped="no"/>
+                <signal name="toggled" handler="all_day_changed_cb" object="GcalEditDialog" swapped="no"/>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -545,7 +545,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="margin-top">12</property>
-                <signal name="clicked" handler="gcal_edit_dialog_action_button_clicked" 
object="GcalEditDialog" swapped="no"/>
+                <signal name="clicked" handler="action_button_clicked" object="GcalEditDialog" swapped="no"/>
                 <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
                 <child>
                   <object class="GtkLabel" id="delete_label">
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 3211dbc..82bb824 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -112,35 +112,10 @@ struct _GcalEditDialog
   gboolean          setting_event;
 };
 
-static void        fill_sources_menu                             (GcalEditDialog    *dialog);
-
 static void        on_calendar_selected                          (GSimpleAction     *menu_item,
                                                                   GVariant          *value,
                                                                   gpointer           user_data);
 
-static void        update_location                               (GtkEntry          *entry,
-                                                                  GParamSpec        *pspec,
-                                                                  gpointer           user_data);
-
-static void        update_summary                                (GtkEntry          *entry,
-                                                                  GParamSpec        *pspec,
-                                                                  gpointer           user_data);
-
-static void        gcal_edit_dialog_constructed                  (GObject           *object);
-
-static void        gcal_edit_dialog_finalize                     (GObject           *object);
-
-static void        gcal_edit_dialog_set_writable                 (GcalEditDialog    *dialog,
-                                                                  gboolean           writable);
-
-static void        gcal_edit_dialog_clear_data                   (GcalEditDialog    *dialog);
-
-static void        gcal_edit_dialog_action_button_clicked        (GtkWidget         *widget,
-                                                                  gpointer           user_data);
-
-static void        gcal_edit_dialog_all_day_changed              (GtkWidget         *widget,
-                                                                  gpointer           user_data);
-
 static void        add_alarm_button_clicked                      (GtkWidget         *button,
                                                                   GcalEditDialog    *self);
 
@@ -282,6 +257,20 @@ on_calendar_selected (GSimpleAction *action,
 }
 
 static void
+gcal_edit_dialog_set_writable (GcalEditDialog *dialog,
+                               gboolean        writable)
+{
+  if (dialog->writable != writable)
+    {
+      dialog->writable = writable;
+
+      gtk_button_set_label (GTK_BUTTON (dialog->done_button), writable ? _("Save") : _("Done"));
+
+      g_object_notify (G_OBJECT (dialog), "writable");
+    }
+}
+
+static void
 remove_recurrence_properties (GcalEvent *event)
 {
   ECalComponent *comp;
@@ -419,59 +408,151 @@ out:
 }
 
 static void
-gcal_edit_dialog_get_property (GObject    *object,
-                               guint       prop_id,
-                               GValue     *value,
-                               GParamSpec *pspec)
+action_button_clicked (GtkWidget *widget,
+                       gpointer   user_data)
 {
-  GcalEditDialog *self = GCAL_EDIT_DIALOG (object);
+  GcalEditDialog *dialog;
 
-  switch (prop_id)
+  GCAL_ENTRY;
+
+  dialog = GCAL_EDIT_DIALOG (user_data);
+
+  if (widget == dialog->cancel_button || (widget == dialog->done_button && !dialog->writable))
     {
-    case PROP_EVENT:
-      g_value_set_object (value, self->event);
-      break;
+      gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
+    }
+  else if (widget == dialog->delete_button)
+    {
+      gtk_dialog_response (GTK_DIALOG (dialog), GCAL_RESPONSE_DELETE_EVENT);
+    }
+  else
+    {
+      GcalRecurrenceFrequency freq;
+      GcalRecurrence *old_recur;
+      GDateTime *start_date, *end_date;
+      gboolean all_day;
+      gchar *note_text;
 
-    case PROP_MANAGER:
-      g_value_set_object (value, self->manager);
-      break;
+      /* Update summary */
+      gcal_event_set_summary (dialog->event, gtk_entry_get_text (GTK_ENTRY (dialog->summary_entry)));
 
-    case PROP_WRITABLE:
-      g_value_set_boolean (value, self->writable);
-      break;
+      /* Update description */
+      g_object_get (G_OBJECT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->notes_text))),
+                    "text", &note_text,
+                    NULL);
 
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    }
-}
+      gcal_event_set_description (dialog->event, note_text);
+      g_free (note_text);
 
-static void
-gcal_edit_dialog_set_property (GObject      *object,
-                               guint         prop_id,
-                               const GValue *value,
-                               GParamSpec   *pspec)
-{
-  GcalEditDialog *self = GCAL_EDIT_DIALOG (object);
+      /* Update all day */
+      all_day = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->all_day_check));
 
-  switch (prop_id)
-    {
-    case PROP_EVENT:
-      gcal_edit_dialog_set_event (self, g_value_get_object (value));
-      break;
+      gcal_event_set_all_day (dialog->event, all_day);
 
-    case PROP_MANAGER:
-      gcal_edit_dialog_set_manager (self, g_value_get_object (value));
-      break;
+      /* By definition, all day events are always UTC */
+      if (all_day)
+        {
+          GTimeZone *utc = g_time_zone_new_utc ();
 
-    case PROP_WRITABLE:
-      gcal_edit_dialog_set_writable (self, g_value_get_boolean (value));
-      break;
+          gcal_event_set_timezone (dialog->event, utc);
 
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+          g_clear_pointer (&utc, g_time_zone_unref);
+        }
+
+      /*
+       * Update start & end dates. The dates are already translated to the current
+       * timezone.
+       */
+      start_date = gcal_edit_dialog_get_date_start (dialog);
+      end_date = gcal_edit_dialog_get_date_end (dialog);
+
+      /*
+       * The end date for multi-day events is exclusive, so we bump it by a day.
+       * This fixes the discrepancy between the end day of the event and how it
+       * is displayed in the month view. See bug 769300.
+       */
+      if (all_day)
+        {
+          GDateTime *fake_end_date = g_date_time_add_days (end_date, 1);
+
+          g_clear_pointer (&end_date, g_date_time_unref);
+          end_date = fake_end_date;
+        }
+
+      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);
+
+      /* Check Repeat popover and set recurrence-rules accordingly */
+      old_recur = gcal_event_get_recurrence (dialog->event);
+      freq = gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->repeat_combo));
+
+      if (freq != GCAL_RECURRENCE_NO_REPEAT)
+        {
+          GcalRecurrence *recur;
+
+          recur = gcal_recurrence_new ();
+          recur->frequency = freq;
+          recur->limit_type = gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->repeat_duration_combo));
+
+          if (recur->limit_type == GCAL_RECURRENCE_UNTIL)
+            recur->limit.until = gcal_date_selector_get_date (GCAL_DATE_SELECTOR 
(dialog->until_date_selector));
+          else if (recur->limit_type == GCAL_RECURRENCE_COUNT)
+            recur->limit.count = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON 
(dialog->number_of_occurrences_spin));
+
+          /* Only apply the new recurrence if it's different from the old one */
+          if (!gcal_recurrence_is_equal (old_recur, recur))
+            {
+              /* Remove the previous recurrence... */
+              remove_recurrence_properties (dialog->event);
+
+              /* ... and set the new one */
+              gcal_event_set_recurrence (dialog->event, recur);
+
+              dialog->recurrence_changed = TRUE;
+            }
+
+          g_clear_pointer (&recur, gcal_recurrence_free);
+        }
+      else
+        {
+          /* When NO_REPEAT is set, make sure to remove the old recurrent */
+          remove_recurrence_properties (dialog->event);
+
+          /* If the recurrence from an recurrent event was removed, mark it as changed */
+          if (old_recur && old_recur->frequency != GCAL_RECURRENCE_NO_REPEAT)
+            dialog->recurrence_changed = TRUE;
+        }
+
+      /* Update the source if needed */
+      if (dialog->selected_source &&
+          gcal_event_get_source (dialog->event) != dialog->selected_source)
+        {
+          if (dialog->event_is_new)
+            {
+              gcal_event_set_source (dialog->event, dialog->selected_source);
+            }
+          else
+            {
+              gcal_manager_move_event_to_source (dialog->manager,
+                                                 dialog->event,
+                                                 dialog->selected_source);
+            }
+        }
+
+      dialog->selected_source = NULL;
+
+      /* Send the response */
+      gtk_dialog_response (GTK_DIALOG (dialog),
+                           dialog->event_is_new ? GCAL_RESPONSE_CREATE_EVENT : GCAL_RESPONSE_SAVE_EVENT);
     }
+
+  GCAL_EXIT;
 }
 
+
 static void
 repeat_duration_changed (GtkComboBox    *widget,
                          GcalEditDialog *self)
@@ -518,18 +599,126 @@ repeat_type_changed (GtkComboBox    *combobox,
 }
 
 static void
+all_day_changed_cb (GtkToggleButton *button,
+                    GcalEditDialog  *self)
+{
+  gboolean active = gtk_toggle_button_get_active (button);
+
+  gtk_widget_set_sensitive (self->start_time_selector, !active);
+  gtk_widget_set_sensitive (self->end_time_selector, !active);
+}
+
+
+static void
+gcal_edit_dialog_finalize (GObject *object)
+{
+  GcalEditDialog *dialog;
+
+  GCAL_ENTRY;
+
+  dialog = GCAL_EDIT_DIALOG (object);
+
+  g_clear_object (&dialog->action_group);
+  g_clear_object (&dialog->manager);
+  g_clear_object (&dialog->event);
+
+  G_OBJECT_CLASS (gcal_edit_dialog_parent_class)->finalize (object);
+
+  GCAL_EXIT;
+}
+
+static void
+gcal_edit_dialog_constructed (GObject* object)
+{
+  GcalEditDialog *self;
+
+  self = GCAL_EDIT_DIALOG (object);
+
+  /* chaining up */
+  G_OBJECT_CLASS (gcal_edit_dialog_parent_class)->constructed (object);
+
+  gtk_window_set_title (GTK_WINDOW (object), "");
+
+  /* titlebar */
+  gtk_window_set_titlebar (GTK_WINDOW (object), self->titlebar);
+
+  /* Actions */
+  self->action_group = g_simple_action_group_new ();
+  g_action_map_add_action_entries (G_ACTION_MAP (self->action_group),
+                                   action_entries,
+                                   G_N_ELEMENTS (action_entries),
+                                   self);
+
+  gtk_widget_insert_action_group (GTK_WIDGET (self),
+                                  "edit",
+                                  G_ACTION_GROUP (self->action_group));
+}
+
+static void
+gcal_edit_dialog_get_property (GObject    *object,
+                               guint       prop_id,
+                               GValue     *value,
+                               GParamSpec *pspec)
+{
+  GcalEditDialog *self = GCAL_EDIT_DIALOG (object);
+
+  switch (prop_id)
+    {
+    case PROP_EVENT:
+      g_value_set_object (value, self->event);
+      break;
+
+    case PROP_MANAGER:
+      g_value_set_object (value, self->manager);
+      break;
+
+    case PROP_WRITABLE:
+      g_value_set_boolean (value, self->writable);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gcal_edit_dialog_set_property (GObject      *object,
+                               guint         prop_id,
+                               const GValue *value,
+                               GParamSpec   *pspec)
+{
+  GcalEditDialog *self = GCAL_EDIT_DIALOG (object);
+
+  switch (prop_id)
+    {
+    case PROP_EVENT:
+      gcal_edit_dialog_set_event (self, g_value_get_object (value));
+      break;
+
+    case PROP_MANAGER:
+      gcal_edit_dialog_set_manager (self, g_value_get_object (value));
+      break;
+
+    case PROP_WRITABLE:
+      gcal_edit_dialog_set_writable (self, g_value_get_boolean (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
 gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
 {
-  GObjectClass *object_class;
-  GtkWidgetClass *widget_class;
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class = G_OBJECT_CLASS (klass);
+  object_class->finalize = gcal_edit_dialog_finalize;
+  object_class->constructed = gcal_edit_dialog_constructed;
   object_class->get_property = gcal_edit_dialog_get_property;
   object_class->set_property = gcal_edit_dialog_set_property;
-  object_class->constructed = gcal_edit_dialog_constructed;
-  object_class->finalize = gcal_edit_dialog_finalize;
 
-  widget_class = GTK_WIDGET_CLASS (klass);
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/edit-dialog.ui");
 
   /**
@@ -611,10 +800,10 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
 
 
   /* callbacks */
+  gtk_widget_class_bind_template_callback (widget_class, action_button_clicked);
   gtk_widget_class_bind_template_callback (widget_class, add_alarm_button_clicked);
   gtk_widget_class_bind_template_callback (widget_class, fix_reminders_label_height_cb);
-  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, all_day_changed_cb);
   gtk_widget_class_bind_template_callback (widget_class, repeat_duration_changed);
   gtk_widget_class_bind_template_callback (widget_class, repeat_type_changed);
   gtk_widget_class_bind_template_callback (widget_class, sync_datetimes);
@@ -636,249 +825,24 @@ gcal_edit_dialog_init (GcalEditDialog *self)
 }
 
 static void
-gcal_edit_dialog_constructed (GObject* object)
-{
-  GcalEditDialog *self;
-
-  self = GCAL_EDIT_DIALOG (object);
-
-  /* chaining up */
-  G_OBJECT_CLASS (gcal_edit_dialog_parent_class)->constructed (object);
-
-  gtk_window_set_title (GTK_WINDOW (object), "");
-
-  /* titlebar */
-  gtk_window_set_titlebar (GTK_WINDOW (object), self->titlebar);
-
-  /* Actions */
-  self->action_group = g_simple_action_group_new ();
-  g_action_map_add_action_entries (G_ACTION_MAP (self->action_group),
-                                   action_entries,
-                                   G_N_ELEMENTS (action_entries),
-                                   self);
-
-  gtk_widget_insert_action_group (GTK_WIDGET (self),
-                                  "edit",
-                                  G_ACTION_GROUP (self->action_group));
-}
-
-static void
-gcal_edit_dialog_finalize (GObject *object)
-{
-  GcalEditDialog *dialog;
-
-  GCAL_ENTRY;
-
-  dialog = GCAL_EDIT_DIALOG (object);
-
-  g_clear_object (&dialog->action_group);
-  g_clear_object (&dialog->manager);
-  g_clear_object (&dialog->event);
-
-  G_OBJECT_CLASS (gcal_edit_dialog_parent_class)->finalize (object);
-
-  GCAL_EXIT;
-}
-
-static void
-gcal_edit_dialog_set_writable (GcalEditDialog *dialog,
-                               gboolean        writable)
-{
-  if (dialog->writable != writable)
-    {
-      dialog->writable = writable;
-
-      gtk_button_set_label (GTK_BUTTON (dialog->done_button), writable ? _("Save") : _("Done"));
-
-      g_object_notify (G_OBJECT (dialog), "writable");
-    }
-}
-
-static void
 gcal_edit_dialog_clear_data (GcalEditDialog *dialog)
 {
   /* summary */
-  g_signal_handlers_block_by_func (dialog->summary_entry,
-                                   update_summary,
-                                   dialog);
-  gtk_entry_set_text (GTK_ENTRY (dialog->summary_entry), "");
-  g_signal_handlers_unblock_by_func (dialog->summary_entry,
-                                     update_summary,
-                                     dialog);
-
-  /* location */
-  g_signal_handlers_block_by_func (dialog->location_entry,
-                                   update_location,
-                                   dialog);
-  gtk_entry_set_text (GTK_ENTRY (dialog->location_entry), "");
-  g_signal_handlers_unblock_by_func (dialog->location_entry,
-                                     update_location,
-                                     dialog);
-
-  /* notes */
-  gtk_text_buffer_set_text (
-      gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->notes_text)),
-      "",
-      -1);
-}
-
-static void
-gcal_edit_dialog_action_button_clicked (GtkWidget *widget,
-                                        gpointer   user_data)
-{
-  GcalEditDialog *dialog;
-
-  GCAL_ENTRY;
-
-  dialog = GCAL_EDIT_DIALOG (user_data);
+  g_signal_handlers_block_by_func (dialog->summary_entry, update_summary, dialog);
 
-  if (widget == dialog->cancel_button || (widget == dialog->done_button && !dialog->writable))
-    {
-      gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
-    }
-  else if (widget == dialog->delete_button)
-    {
-      gtk_dialog_response (GTK_DIALOG (dialog), GCAL_RESPONSE_DELETE_EVENT);
-    }
-  else
-    {
-      GcalRecurrenceFrequency freq;
-      GcalRecurrence *old_recur;
-      GDateTime *start_date, *end_date;
-      gboolean all_day;
-      gchar *note_text;
-
-      /* Update summary */
-      gcal_event_set_summary (dialog->event, gtk_entry_get_text (GTK_ENTRY (dialog->summary_entry)));
-
-      /* Update description */
-      g_object_get (G_OBJECT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->notes_text))),
-                    "text", &note_text,
-                    NULL);
-
-      gcal_event_set_description (dialog->event, note_text);
-      g_free (note_text);
-
-      /* Update all day */
-      all_day = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->all_day_check));
-
-      gcal_event_set_all_day (dialog->event, all_day);
-
-      /* By definition, all day events are always UTC */
-      if (all_day)
-        {
-          GTimeZone *utc = g_time_zone_new_utc ();
-
-          gcal_event_set_timezone (dialog->event, utc);
-
-          g_clear_pointer (&utc, g_time_zone_unref);
-        }
-
-      /*
-       * Update start & end dates. The dates are already translated to the current
-       * timezone.
-       */
-      start_date = gcal_edit_dialog_get_date_start (dialog);
-      end_date = gcal_edit_dialog_get_date_end (dialog);
-
-      /*
-       * The end date for multi-day events is exclusive, so we bump it by a day.
-       * This fixes the discrepancy between the end day of the event and how it
-       * is displayed in the month view. See bug 769300.
-       */
-      if (all_day)
-        {
-          GDateTime *fake_end_date = g_date_time_add_days (end_date, 1);
-
-          g_clear_pointer (&end_date, g_date_time_unref);
-          end_date = fake_end_date;
-        }
-
-      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);
-
-      /* Check Repeat popover and set recurrence-rules accordingly */
-      old_recur = gcal_event_get_recurrence (dialog->event);
-      freq = gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->repeat_combo));
-
-      if (freq != GCAL_RECURRENCE_NO_REPEAT)
-        {
-          GcalRecurrence *recur;
-
-          recur = gcal_recurrence_new ();
-          recur->frequency = freq;
-          recur->limit_type = gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->repeat_duration_combo));
-
-          if (recur->limit_type == GCAL_RECURRENCE_UNTIL)
-            recur->limit.until = gcal_date_selector_get_date (GCAL_DATE_SELECTOR 
(dialog->until_date_selector));
-          else if (recur->limit_type == GCAL_RECURRENCE_COUNT)
-            recur->limit.count = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON 
(dialog->number_of_occurrences_spin));
-
-          /* Only apply the new recurrence if it's different from the old one */
-          if (!gcal_recurrence_is_equal (old_recur, recur))
-            {
-              /* Remove the previous recurrence... */
-              remove_recurrence_properties (dialog->event);
-
-              /* ... and set the new one */
-              gcal_event_set_recurrence (dialog->event, recur);
-
-              dialog->recurrence_changed = TRUE;
-            }
-
-          g_clear_pointer (&recur, gcal_recurrence_free);
-        }
-      else
-        {
-          /* When NO_REPEAT is set, make sure to remove the old recurrent */
-          remove_recurrence_properties (dialog->event);
-
-          /* If the recurrence from an recurrent event was removed, mark it as changed */
-          if (old_recur && old_recur->frequency != GCAL_RECURRENCE_NO_REPEAT)
-            dialog->recurrence_changed = TRUE;
-        }
-
-      /* Update the source if needed */
-      if (dialog->selected_source &&
-          gcal_event_get_source (dialog->event) != dialog->selected_source)
-        {
-          if (dialog->event_is_new)
-            {
-              gcal_event_set_source (dialog->event, dialog->selected_source);
-            }
-          else
-            {
-              gcal_manager_move_event_to_source (dialog->manager,
-                                                 dialog->event,
-                                                 dialog->selected_source);
-            }
-        }
-
-      dialog->selected_source = NULL;
+  gtk_entry_set_text (GTK_ENTRY (dialog->summary_entry), "");
 
-      /* Send the response */
-      gtk_dialog_response (GTK_DIALOG (dialog),
-                           dialog->event_is_new ? GCAL_RESPONSE_CREATE_EVENT : GCAL_RESPONSE_SAVE_EVENT);
-    }
+  g_signal_handlers_unblock_by_func (dialog->summary_entry, update_summary, dialog);
 
-  GCAL_EXIT;
-}
+  /* location */
+  g_signal_handlers_block_by_func (dialog->location_entry, update_location, dialog);
 
-static void
-gcal_edit_dialog_all_day_changed (GtkWidget *widget,
-                                  gpointer   user_data)
-{
-  GcalEditDialog *dialog;
-  gboolean active;
+  gtk_entry_set_text (GTK_ENTRY (dialog->location_entry), "");
 
-  dialog = GCAL_EDIT_DIALOG (user_data);
-  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->all_day_check));
+  g_signal_handlers_unblock_by_func (dialog->location_entry, update_location, dialog);
 
-  gtk_widget_set_sensitive (dialog->start_time_selector, !active);
-  gtk_widget_set_sensitive (dialog->end_time_selector, !active);
+  /* notes */
+  gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->notes_text)), "", -1);
 }
 
 /*
@@ -1345,7 +1309,7 @@ gcal_edit_dialog_set_event (GcalEditDialog *dialog,
 
   date_end = gcal_event_get_date_end (event);
   /*
-   * This is subtracting what has been added in gcal_edit_dialog_action_button_clicked ().
+   * This is subtracting what has been added in action_button_clicked ().
    * See bug 769300.
    */
   date_end = all_day ? g_date_time_add_days (date_end, -1) : g_date_time_to_local (date_end);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]