[gnome-calendar] edit-dialog: don't keep an internal cached version of the summary



commit b8a4812f3b4bf07abe5bdc8eed47f035b4e573fb
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Oct 27 23:20:49 2014 -0200

    edit-dialog: don't keep an internal cached version of the summary
    
    This is part of the Edit dialog's redesign.
    
    Fixes bug #739268.

 src/gcal-edit-dialog.c |   38 +++++++++++++++++++++++++++-----------
 1 files changed, 27 insertions(+), 11 deletions(-)
---
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 1626a0d..2c77799 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -29,8 +29,6 @@ typedef struct _SimpleEventStore SimpleEventStore;
 
 struct _SimpleEventStore
 {
-  gchar         *summary;
-
   gboolean       all_day;
   icaltimetype  *start_date;
   icaltimetype  *end_date;
@@ -77,6 +75,10 @@ typedef struct
   gboolean          setting_event;
 } GcalEditDialogPrivate;
 
+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);
@@ -103,6 +105,23 @@ static gboolean    gcal_edit_dialog_source_changed        (GcalEditDialog    *di
 G_DEFINE_TYPE_WITH_PRIVATE (GcalEditDialog, gcal_edit_dialog, GTK_TYPE_DIALOG)
 
 static void
+update_summary (GtkEntry   *entry,
+                GParamSpec *pspec,
+                gpointer    user_data)
+{
+  GcalEditDialogPrivate *priv;
+
+  ECalComponentText summary;
+
+  priv = gcal_edit_dialog_get_instance_private (GCAL_EDIT_DIALOG (user_data));
+
+  summary.value = g_strdup (gtk_entry_get_text (entry));
+  summary.altrep = summary.value;
+
+  e_cal_component_set_summary (priv->component, &summary);
+}
+
+static void
 gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
 {
   GObjectClass *object_class;
@@ -213,6 +232,11 @@ gcal_edit_dialog_constructed (GObject* object)
                     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 (priv->start_date_entry,
                     "modified",
                     G_CALLBACK (gcal_edit_dialog_date_entry_modified),
@@ -629,10 +653,8 @@ gcal_edit_dialog_set_event_data (GcalEditDialog *dialog,
   /* Load new event data */
   /* summary */
   e_cal_component_get_summary (priv->component, &e_summary);
-  priv->ev_store->summary = g_strdup (e_summary.value);
   gtk_entry_set_text (GTK_ENTRY (priv->summary_entry),
-                      priv->ev_store->summary != NULL ?
-                      priv->ev_store->summary : "");
+                      e_summary.value != NULL ? e_summary.value : "");
 
   /* dialog titlebar's title & subtitle */
   extension = E_SOURCE_SELECTABLE (e_source_get_extension (data->source, E_SOURCE_EXTENSION_CALENDAR));
@@ -784,12 +806,6 @@ gcal_edit_dialog_get_modified_properties (GcalEditDialog *dialog)
 
   res = NULL;
 
-  if (g_strcmp0 (priv->ev_store->summary,
-                 gtk_entry_get_text (GTK_ENTRY (priv->summary_entry))) != 0)
-    {
-      res = g_list_append (res, GINT_TO_POINTER (EVENT_SUMMARY));
-    }
-
   if (gcal_edit_dialog_date_changed (dialog, TRUE))
     {
       res = g_list_append (res, GINT_TO_POINTER (EVENT_START_DATE));


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