[bijiben] search: do not use any completion



commit 7e4c12ee8f2c08fc418c0869ac9310e2c51eddd5
Author: Pierre-Yves Luyten <py luyten fr>
Date:   Mon Oct 7 01:05:33 2013 +0200

    search: do not use any completion
    
    The completion user needs is only visual feedback.
    Seeing titles appearing on the search bar only confused.
    See 709325

 src/bjb-controller.c     |   48 ----------------------------------------------
 src/bjb-controller.h     |    2 -
 src/bjb-search-toolbar.c |   12 -----------
 3 files changed, 0 insertions(+), 62 deletions(-)
---
diff --git a/src/bjb-controller.c b/src/bjb-controller.c
index 9d88065..54f454c 100644
--- a/src/bjb-controller.c
+++ b/src/bjb-controller.c
@@ -45,7 +45,6 @@ struct _BjbControllerPrivate
   gchar          *needle ;
   BijiCollection *collection;
   GtkTreeModel   *model ;
-  GtkTreeModel   *completion;
 
   BjbWindowBase  *window;
 
@@ -114,8 +113,6 @@ bjb_controller_init (BjbController *self)
   priv->collection = NULL;
   priv->connected = FALSE;
 
-  completion  = gtk_list_store_new (1, G_TYPE_STRING);
-  priv->completion = GTK_TREE_MODEL (completion);
 }
 
 static void
@@ -133,7 +130,6 @@ bjb_controller_finalize (GObject *object)
 
   g_object_unref (priv->model);
 
-  g_object_unref (priv->completion);
   g_free (priv->needle);
   g_list_free (priv->items_to_show);
 
@@ -515,38 +511,6 @@ on_needle_changed (BjbController *self)
   g_signal_emit (self, bjb_controller_signals[SEARCH_CHANGED], 0);
 }
 
-static void
-add_item_to_completion (BijiItem *item, BjbController *self)
-{
-  GtkListStore *store;
-  GtkTreeIter iter;
-
-  store = GTK_LIST_STORE (self->priv->completion);
-
-  // Search Tag.
-  gtk_list_store_append (store, &iter);
-  gtk_list_store_set (store, 
-                      &iter, 
-                      0, 
-                      biji_item_get_title (item),
-                      -1);
-}
-
-static void
-refresh_completion(BjbController *self)
-{
-  GList *items;
-
-  gtk_list_store_clear (GTK_LIST_STORE (self->priv->completion));
-  items = biji_note_book_get_items (self->priv->book);
-
-  if (items)
-  {
-    g_list_foreach (items, (GFunc) add_item_to_completion, self);
-    g_list_free (items);
-  }
-}
-
 
 /* Depending on the change at data level,
  * the view has to be totaly refreshed or just amended */
@@ -624,8 +588,6 @@ on_book_changed (BijiNoteBook           *book,
         bjb_window_base_set_active (self->priv->window, TRUE);
   }
 
-  /* FIXME we refresh the whole completion model each time */
-  refresh_completion(self);
   g_mutex_unlock (&priv->mutex);
 }
 
@@ -747,10 +709,6 @@ void
 bjb_controller_set_book (BjbController *self, BijiNoteBook  *book )
 {
   self->priv->book = book ;
-  
-  /* Only update completion.
-   * Notes model is updated when needle changes */
-  refresh_completion(self);
 }
 
 void
@@ -778,12 +736,6 @@ bjb_controller_get_model  (BjbController *self)
   return self->priv->model ;
 }
 
-GtkTreeModel *
-bjb_controller_get_completion(BjbController *self)
-{
-  return self->priv->completion ;
-}
-
 
 gboolean
 bjb_controller_shows_item (BjbController *self)
diff --git a/src/bjb-controller.h b/src/bjb-controller.h
index 666ffd3..c2d55d5 100644
--- a/src/bjb-controller.h
+++ b/src/bjb-controller.h
@@ -68,8 +68,6 @@ gchar * bjb_controller_get_needle (BjbController *self ) ;
 
 GtkTreeModel * bjb_controller_get_model  (BjbController *self) ;
 
-GtkTreeModel * bjb_controller_get_completion(BjbController *self);
-
 void bjb_controller_disconnect (BjbController *self);
 
 gboolean bjb_controller_shows_item (BjbController *self);
diff --git a/src/bjb-search-toolbar.c b/src/bjb-search-toolbar.c
index af1d7da..50f701f 100644
--- a/src/bjb-search-toolbar.c
+++ b/src/bjb-search-toolbar.c
@@ -51,7 +51,6 @@ struct _BjbSearchToolbarPrivate
   GdTaggedEntry     *entry;
   gchar             *needle;
   GtkEntryBuffer    *entry_buf;
-  GtkTreeModel      *completion_model;
   BjbController     *controller;
 
   /* Signals */
@@ -293,7 +292,6 @@ bjb_search_toolbar_connect (BjbSearchToolbar *self)
 static void
 bjb_search_toolbar_constructed (GObject *obj)
 {
-  GtkEntryCompletion      *completion ;
   BjbSearchToolbar        *self = BJB_SEARCH_TOOLBAR(obj);
   BjbSearchToolbarPrivate *priv = self->priv ;
 
@@ -301,16 +299,6 @@ bjb_search_toolbar_constructed (GObject *obj)
 
   /* Get the needle from controller */
   priv->needle = bjb_controller_get_needle (priv->controller);
-
-  /* Comletion model for buffer */
-  completion = gtk_entry_completion_new ();
-  gtk_entry_set_completion (GTK_ENTRY (priv->entry), completion);
-  g_object_unref (completion);
-  priv->completion_model = bjb_controller_get_completion (priv->controller);
-
-  gtk_entry_completion_set_model (completion, priv->completion_model);  
-  gtk_entry_completion_set_text_column (completion, 0);
-
   priv->entry_buf = gtk_entry_get_buffer (GTK_ENTRY (priv->entry));
 
   if (priv->needle && g_strcmp0 (priv->needle, "") != 0)


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