[gnome-control-center/wip/feborges/new-search-panel: 14/14] search: Add notification advertising the reordering shortcuts



commit 555cac76ef35263623cc07d6edead3df23eb70f1
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Aug 9 16:17:47 2017 +0200

    search: Add notification advertising the reordering shortcuts
    
    When a list row is selected, reveal a notification instructing
    how to reorder the list with the keyboard shortcuts.
    
    "Use Alt+↑ and Alt+↓ to move rows"
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775958

 panels/search/cc-search-panel.c |   12 ++++++++++++
 panels/search/search.ui         |   24 +++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/panels/search/cc-search-panel.c b/panels/search/cc-search-panel.c
index 85c71a3..eb479dc 100644
--- a/panels/search/cc-search-panel.c
+++ b/panels/search/cc-search-panel.c
@@ -34,6 +34,7 @@ struct _CcSearchPanelPrivate
 {
   GtkBuilder *builder;
   GtkWidget  *list_box;
+  GtkWidget  *notification;
 
   GCancellable *load_cancellable;
   GSettings  *search_settings;
@@ -868,6 +869,14 @@ populate_search_providers (CcSearchPanel *self)
 }
 
 static void
+on_row_selected (GtkListBox *list_box,
+                 GtkListBoxRow *row,
+                 CcSearchPanel *self)
+{
+  gtk_revealer_set_reveal_child (GTK_REVEALER (self->priv->notification), TRUE);
+}
+
+static void
 cc_search_panel_dispose (GObject *object)
 {
   CcSearchPanelPrivate *priv = CC_SEARCH_PANEL (object)->priv;
@@ -992,6 +1001,9 @@ cc_search_panel_init (CcSearchPanel *self)
   gtk_container_add (GTK_CONTAINER (frame), widget);
   self->priv->list_box = widget;
   gtk_widget_show (widget);
+  g_signal_connect (widget, "row-selected", G_CALLBACK (on_row_selected), self);
+
+  self->priv->notification = WID ("notification");
 
   /* Drag and Drop */
   gtk_drag_dest_set (self->priv->list_box,
diff --git a/panels/search/search.ui b/panels/search/search.ui
index 4f446dc..2d97564 100644
--- a/panels/search/search.ui
+++ b/panels/search/search.ui
@@ -1,7 +1,27 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkScrolledWindow" id="search_vbox">
+<object class="GtkOverlay" id="search_vbox">
+  <property name="visible">True</property>
+  <child type="overlay">
+    <object class="GtkRevealer" id="notification">
+      <property name="visible">True</property>
+      <property name="halign">center</property>
+      <property name="valign">start</property>
+      <property name="border-width">6</property>
+      <child>
+        <object class="GtkLabel">
+          <property name="visible">True</property>
+          <property name="label" translatable="yes">Use Alt+↑ and Alt+↓ to move rows</property>
+          <style>
+            <class name="app-notification"/>
+          </style>
+        </object>
+      </child>
+    </object>
+  </child>
+  <child>
+  <object class="GtkScrolledWindow" id="scrolled_window">
     <property name="visible">True</property>
     <property name="hscrollbar_policy">never</property>
     <property name="min_content_height">450</property>
@@ -85,4 +105,6 @@
       </object>
     </child>
  </object>
+  </child>
+</object>
 </interface>


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