+2004-10-25 Anders Carlsson <andersca@gnome.org>
+
+ * gtk/gtkentry.c: (gtk_entry_completion_timeout):
+ * gtk/gtkentrycompletion.c: (gtk_entry_completion_set_model),
+ (gtk_entry_completion_get_model), (gtk_entry_completion_complete):
+ Really handle a NULL model, fixes #137211 for real.
+
+ * gtk/gtkfilechooserentry.c:
+ (gtk_file_chooser_entry_maybe_update_directory):
+ Remove _clear, #137211 is fixed.
+
+ * tests/testentrycompletion.c: (main):
+ Add completion with an empty model.
+
2004-10-25 Carlos Garnacho Parro <carlosg@gnome.org>
Fix for #118764, David Bordoley:
* gtk/.cvsignore: Ignore gtk-update-icon-cache.
* tests/.cvsignore: Ignore testimage.
->>>>>>> 1.5960
2004-10-25 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderercombo.c (find_text): Don't leak text. (#156325,
+2004-10-25 Anders Carlsson <andersca@gnome.org>
+
+ * gtk/gtkentry.c: (gtk_entry_completion_timeout):
+ * gtk/gtkentrycompletion.c: (gtk_entry_completion_set_model),
+ (gtk_entry_completion_get_model), (gtk_entry_completion_complete):
+ Really handle a NULL model, fixes #137211 for real.
+
+ * gtk/gtkfilechooserentry.c:
+ (gtk_file_chooser_entry_maybe_update_directory):
+ Remove _clear, #137211 is fixed.
+
+ * tests/testentrycompletion.c: (main):
+ Add completion with an empty model.
+
2004-10-25 Carlos Garnacho Parro <carlosg@gnome.org>
Fix for #118764, David Bordoley:
* gtk/.cvsignore: Ignore gtk-update-icon-cache.
* tests/.cvsignore: Ignore testimage.
->>>>>>> 1.5960
2004-10-25 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderercombo.c (find_text): Don't leak text. (#156325,
+2004-10-25 Anders Carlsson <andersca@gnome.org>
+
+ * gtk/gtkentry.c: (gtk_entry_completion_timeout):
+ * gtk/gtkentrycompletion.c: (gtk_entry_completion_set_model),
+ (gtk_entry_completion_get_model), (gtk_entry_completion_complete):
+ Really handle a NULL model, fixes #137211 for real.
+
+ * gtk/gtkfilechooserentry.c:
+ (gtk_file_chooser_entry_maybe_update_directory):
+ Remove _clear, #137211 is fixed.
+
+ * tests/testentrycompletion.c: (main):
+ Add completion with an empty model.
+
2004-10-25 Carlos Garnacho Parro <carlosg@gnome.org>
Fix for #118764, David Bordoley:
* gtk/.cvsignore: Ignore gtk-update-icon-cache.
* tests/.cvsignore: Ignore testimage.
->>>>>>> 1.5960
2004-10-25 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderercombo.c (find_text): Don't leak text. (#156325,
+2004-10-25 Anders Carlsson <andersca@gnome.org>
+
+ * gtk/gtkentry.c: (gtk_entry_completion_timeout):
+ * gtk/gtkentrycompletion.c: (gtk_entry_completion_set_model),
+ (gtk_entry_completion_get_model), (gtk_entry_completion_complete):
+ Really handle a NULL model, fixes #137211 for real.
+
+ * gtk/gtkfilechooserentry.c:
+ (gtk_file_chooser_entry_maybe_update_directory):
+ Remove _clear, #137211 is fixed.
+
+ * tests/testentrycompletion.c: (main):
+ Add completion with an empty model.
+
2004-10-25 Carlos Garnacho Parro <carlosg@gnome.org>
Fix for #118764, David Bordoley:
* gtk/.cvsignore: Ignore gtk-update-icon-cache.
* tests/.cvsignore: Ignore testimage.
->>>>>>> 1.5960
2004-10-25 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderercombo.c (find_text): Don't leak text. (#156325,
completion->priv->completion_timeout = 0;
- if (g_utf8_strlen (gtk_entry_get_text (GTK_ENTRY (completion->priv->entry)), -1)
+ if (completion->priv->filter_model &&
+ g_utf8_strlen (gtk_entry_get_text (GTK_ENTRY (completion->priv->entry)), -1)
>= completion->priv->minimum_key_length)
{
gint matches;
g_return_if_fail (GTK_IS_ENTRY_COMPLETION (completion));
g_return_if_fail (model == NULL || GTK_IS_TREE_MODEL (model));
+ if (!model)
+ {
+ gtk_tree_view_set_model (GTK_TREE_VIEW (completion->priv->tree_view),
+ NULL);
+ _gtk_entry_completion_popdown (completion);
+ completion->priv->filter_model = NULL;
+ return;
+ }
+
/* code will unref the old filter model (if any) */
completion->priv->filter_model =
GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (model, NULL));
{
g_return_val_if_fail (GTK_IS_ENTRY_COMPLETION (completion), NULL);
+ if (!completion->priv->filter_model)
+ return NULL;
+
return gtk_tree_model_filter_get_model (completion->priv->filter_model);
}
gchar *tmp;
g_return_if_fail (GTK_IS_ENTRY_COMPLETION (completion));
- g_return_if_fail (completion->priv->filter_model != NULL);
+ if (!completion->priv->filter_model)
+ return;
+
if (completion->priv->case_normalized_key)
g_free (completion->priv->case_normalized_key);
}
if (chooser_entry->completion_store)
{
- gtk_list_store_clear (GTK_LIST_STORE (chooser_entry->completion_store));
- /* FIXME: Uncomment this line and get rid of the _clear above
- * after #137211 is fixed */
- /* gtk_entry_completion_set_model (gtk_entry_get_completion (GTK_ENTRY (chooser_entry)), NULL);*/
+ gtk_entry_completion_set_model (gtk_entry_get_completion (GTK_ENTRY (chooser_entry)), NULL);
g_object_unref (chooser_entry->completion_store);
chooser_entry->completion_store = NULL;
}
GtkTreeIter iter;
gint n_completions = G_N_ELEMENTS (dynamic_completions);
gint n;
-
+ static GtkListStore *old_store = NULL;
GtkListStore *store = GTK_LIST_STORE (gtk_entry_completion_get_model (completion));
- if ((timer_count / n_completions) % 2 == 0)
+ if (timer_count % 10 == 0)
{
- n = timer_count % n_completions;
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, dynamic_completions[n], -1);
-
+ if (!old_store)
+ {
+ g_print ("removing model!\n");
+
+ old_store = g_object_ref (gtk_entry_completion_get_model (completion));
+ gtk_entry_completion_set_model (completion, NULL);
+ }
+ else
+ {
+ g_print ("readding model!\n");
+
+ gtk_entry_completion_set_model (completion, old_store);
+ g_object_unref (old_store);
+ old_store = NULL;
+ }
+
+ timer_count ++;
+ return TRUE;
}
- else
+
+ if (!old_store)
{
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
- gtk_list_store_remove (store, &iter);
+ if ((timer_count / n_completions) % 2 == 0)
+ {
+ n = timer_count % n_completions;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, dynamic_completions[n], -1);
+
+ }
+ else
+ {
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
+ gtk_list_store_remove (store, &iter);
+ }
}
timer_count++;
/* Fill the completion dynamically */
g_timeout_add (1000, (GSourceFunc) animation_timer, completion);
+ /* Fourth entry */
+ gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Model-less entry completion"), FALSE, FALSE, 0);
+
+ entry = gtk_entry_new ();
+ gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
+
+ /* Create the completion object */
+ completion = gtk_entry_completion_new ();
+
+ /* Assign the completion to the entry */
+ gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+ g_object_unref (completion);
+
gtk_widget_show_all (window);
gtk_main ();