[gnome-initial-setup] language: Update the designs involving filter entry and "Show All"



commit c85d53c50914ca15ee75912cb1463e21b5b276e1
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Nov 14 18:59:38 2012 -0500

    language: Update the designs involving filter entry and "Show All"
    
    Only show the filter entry when "Show All" is checked. The supposed flow:
    
     * User scans list for his language, doesn't find it.
     * Clicks "Show All", maybe scans
     * Uses filter entry
    
    So the filter entry isn't necessary in the short list case, and the
    "Show All" checkbox neednt be unchecked.

 TODO                                               |    2 --
 .../pages/language/gis-language-page.c             |   20 +++++++++++++++++---
 .../pages/language/gis-language-page.ui            |    2 +-
 3 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/TODO b/TODO
index 03bd677..6ee94ad 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,6 @@
 * Language
 **  the dialog moves around when a different language is selected
 **  replace the check box with a button?
-**  don't keep the check box/button once it has been activated - the search box should expand to the width of the list
-**  only show the search box when show all is active
 **  language list - only show the varient (eg - United Kingdom) if there is more than one language that needs
 **  do we need the "use" prefix?
 * EULAs
diff --git a/gnome-initial-setup/pages/language/gis-language-page.c b/gnome-initial-setup/pages/language/gis-language-page.c
index 7813cef..76a1603 100644
--- a/gnome-initial-setup/pages/language/gis-language-page.c
+++ b/gnome-initial-setup/pages/language/gis-language-page.c
@@ -58,6 +58,7 @@ struct _GisLanguagePagePrivate
   GtkWidget *page;
   GtkWidget *filter_entry;
   GtkTreeModel *liststore;
+  GtkTreeModelFilter *filter;
 };
 
 #define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE (page)->builder,(name)))
@@ -258,6 +259,18 @@ selection_changed (GtkTreeSelection *selection,
 }
 
 static void
+show_all_toggled (GtkCheckButton  *button,
+                  GisLanguagePage *page)
+{
+  GisLanguagePagePrivate *priv = page->priv;
+
+  gtk_widget_hide (GTK_WIDGET (button));
+  gtk_widget_show (priv->filter_entry);
+
+  gtk_tree_model_filter_refilter (priv->filter);
+}
+
+static void
 gis_language_page_constructed (GObject *object)
 {
   GisLanguagePage *page = GIS_LANGUAGE_PAGE (object);
@@ -287,15 +300,16 @@ gis_language_page_constructed (GObject *object)
   treeview = OBJ (GtkTreeView *, "language-list");
 
   filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (liststore), NULL);
+  priv->filter = GTK_TREE_MODEL_FILTER (filter);
   gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter),
                                           language_visible, page, NULL);
   gtk_tree_view_set_model (treeview, filter);
 
   add_all_languages (GTK_LIST_STORE (priv->liststore));
 
-  g_signal_connect_swapped (priv->show_all, "toggled",
-                            G_CALLBACK (gtk_tree_model_filter_refilter),
-                            filter);
+  g_signal_connect (priv->show_all, "toggled",
+                    G_CALLBACK (show_all_toggled),
+                    page);
 
   g_signal_connect_swapped (priv->filter_entry, "changed",
                             G_CALLBACK (gtk_tree_model_filter_refilter),
diff --git a/gnome-initial-setup/pages/language/gis-language-page.ui b/gnome-initial-setup/pages/language/gis-language-page.ui
index 86565b0..60812e3 100644
--- a/gnome-initial-setup/pages/language/gis-language-page.ui
+++ b/gnome-initial-setup/pages/language/gis-language-page.ui
@@ -54,7 +54,7 @@
         </child>
         <child>
           <object class="GtkSearchEntry" id="language-filter-entry">
-            <property name="visible">True</property>
+            <property name="visible">False</property>
             <property name="hexpand">True</property>
           </object>
         </child>



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