2009-03-06 Claudio Saavedra <csaavedra@igalia.com>
authorClaudio Saavedra <csaavedra@igalia.com>
Fri, 6 Mar 2009 17:07:28 +0000 (17:07 +0000)
committerClaudio Saavedra <csaavedra@igalia.com>
Fri, 6 Mar 2009 17:07:28 +0000 (17:07 +0000)
* src/hildon-picker-dialog.c (hildon_picker_dialog_init):
add a current_text field to store the text entered in the
touch selector entry.
(_clean_current_selection): clean up the current text as well.
(_save_current_selection), (_restore_current_selection):
Save/restore the text in the entry if the selector is a
HildonTouchSelectorEntry.

Fixes: NB#102541 (value entered in the touch selector entry is not
shown when opened for second time)

ChangeLog
src/hildon-picker-dialog.c

index 0775bb4..6de37fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2009-03-06  Claudio Saavedra  <csaavedra@igalia.com>
 
+       * src/hildon-picker-dialog.c (hildon_picker_dialog_init):
+       add a current_text field to store the text entered in the
+       touch selector entry.
+       (_clean_current_selection): clean up the current text as well.
+       (_save_current_selection), (_restore_current_selection):
+       Save/restore the text in the entry if the selector is a
+       HildonTouchSelectorEntry.
+
+       Fixes: NB#102541 (value entered in the touch selector entry is not
+       shown when opened for second time)
+
+2009-03-06  Claudio Saavedra  <csaavedra@igalia.com>
+
        * doc/hildon-sections.txt:
        * src/hildon-touch-selector-entry.c
        (+hildon_touch_selector_entry_get_entry):
index 9006b3a..3fa11b3 100644 (file)
@@ -45,6 +45,7 @@
 #include <libintl.h>
 
 #include "hildon-touch-selector.h"
+#include "hildon-touch-selector-entry.h"
 #include "hildon-picker-dialog.h"
 
 #define _(String)  dgettext("hildon-libs", String)
@@ -65,6 +66,7 @@ struct _HildonPickerDialogPrivate
 
   gboolean center_on_show;
   GSList *current_selection;
+  gchar *current_text;
 };
 
 /* properties */
@@ -214,6 +216,7 @@ hildon_picker_dialog_init (HildonPickerDialog * dialog)
   dialog->priv->signal_columns_changed_id = 0;
   dialog->priv->center_on_show = TRUE;
   dialog->priv->current_selection = NULL;
+  dialog->priv->current_text = NULL;
 
   g_signal_connect (G_OBJECT (dialog),
                     "response", G_CALLBACK (_on_dialog_response),
@@ -421,6 +424,10 @@ _clean_current_selection (HildonPickerDialog *dialog)
     g_slist_free (dialog->priv->current_selection);
     dialog->priv->current_selection = NULL;
   }
+  if (dialog->priv->current_text) {
+    g_free (dialog->priv->current_text);
+    dialog->priv->current_text = NULL;
+  }
 }
 
 static void
@@ -439,6 +446,10 @@ _save_current_selection (HildonPickerDialog *dialog)
       = g_slist_append (dialog->priv->current_selection,
                         hildon_touch_selector_get_selected_rows (selector, i));
   }
+  if (HILDON_IS_TOUCH_SELECTOR_ENTRY (selector)) {
+         HildonEntry *entry = hildon_touch_selector_entry_get_entry (HILDON_TOUCH_SELECTOR_ENTRY (selector));
+         dialog->priv->current_text = g_strdup (hildon_entry_get_text (entry));
+  }
 }
 
 static void
@@ -481,6 +492,10 @@ _restore_current_selection (HildonPickerDialog *dialog)
       hildon_touch_selector_select_iter (selector, i, &tree_iter, FALSE);
     }
   }
+  if (HILDON_IS_TOUCH_SELECTOR_ENTRY (selector) && dialog->priv->current_text != NULL) {
+    HildonEntry *entry = hildon_touch_selector_entry_get_entry (HILDON_TOUCH_SELECTOR_ENTRY (selector));
+    hildon_entry_set_text (entry, dialog->priv->current_text);
+  }
   if (dialog->priv->signal_changed_id)
     g_signal_handler_unblock (selector, dialog->priv->signal_changed_id);
 }