[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 85/473: Add scrolling to sidebar.

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:54:15 CET 2015


This is an automated email from the git hooks/post-receive script.

gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit cb2264d0cedfff229786d702c4b610774717a26e
Author: Graeme Gott <graeme at gottcode.org>
Date:   Fri Jul 12 09:33:34 2013 -0400

    Add scrolling to sidebar.
---
 src/menu.cpp |   21 ++++++++++++++++-----
 src/menu.hpp |    1 +
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/menu.cpp b/src/menu.cpp
index 0be2210..e2e0a40 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -163,11 +163,21 @@ Menu::Menu(XfceRc* settings) :
 
 	// Create box for packing sidebar
 	m_sidebar_box = GTK_BOX(gtk_vbox_new(false, 0));
-	gtk_box_pack_start(m_contents_box, GTK_WIDGET(m_sidebar_box), false, false, 0);
 	gtk_box_pack_start(m_sidebar_box, GTK_WIDGET(m_favorites_button->get_button()), false, false, 0);
 	gtk_box_pack_start(m_sidebar_box, GTK_WIDGET(m_recent_button->get_button()), false, false, 0);
 	gtk_box_pack_start(m_sidebar_box, gtk_hseparator_new(), false, true, 0);
 
+	m_sidebar = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL, NULL));
+	gtk_box_pack_start(m_contents_box, GTK_WIDGET(m_sidebar), false, false, 0);
+	gtk_scrolled_window_set_shadow_type(m_sidebar, GTK_SHADOW_NONE);
+	gtk_scrolled_window_set_policy(m_sidebar, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+
+	GtkWidget* viewport = gtk_viewport_new(gtk_scrolled_window_get_hadjustment(m_sidebar),
+		gtk_scrolled_window_get_vadjustment(m_sidebar));
+	gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
+	gtk_container_add(GTK_CONTAINER(m_sidebar), viewport);
+	gtk_container_add(GTK_CONTAINER(viewport), GTK_WIDGET(m_sidebar_box));
+
 	// Populate app menu
 	m_applications->load_applications();
 
@@ -371,7 +381,7 @@ void Menu::show(GtkWidget* parent, bool horizontal)
 			gtk_box_reorder_child(m_title_box, GTK_WIDGET(m_resizer->get_widget()), 4);
 
 			gtk_box_reorder_child(m_contents_box, GTK_WIDGET(m_panels_box), 1);
-			gtk_box_reorder_child(m_contents_box, GTK_WIDGET(m_sidebar_box), 2);
+			gtk_box_reorder_child(m_contents_box, GTK_WIDGET(m_sidebar), 2);
 		}
 		else
 		{
@@ -384,7 +394,7 @@ void Menu::show(GtkWidget* parent, bool horizontal)
 			gtk_box_reorder_child(m_title_box, GTK_WIDGET(m_resizer->get_widget()), 0);
 
 			gtk_box_reorder_child(m_contents_box, GTK_WIDGET(m_panels_box), 2);
-			gtk_box_reorder_child(m_contents_box, GTK_WIDGET(m_sidebar_box), 1);
+			gtk_box_reorder_child(m_contents_box, GTK_WIDGET(m_sidebar), 1);
 		}
 	}
 
@@ -575,6 +585,7 @@ gboolean Menu::on_key_press_event(GtkWidget* widget, GdkEventKey* event)
 			&& (event->keyval != GDK_Control_L) && (event->keyval != GDK_Control_R)
 			&& !(event->state & GDK_SHIFT_MASK) && !(event->state & GDK_CONTROL_MASK)
 			&& (event->keyval != GDK_Tab) && (event->keyval != GDK_Return)
+			&& (event->keyval != GDK_Page_Up) && (event->keyval != GDK_Page_Down)
 			&& (event->keyval != GDK_KEY_Menu))
 	{
 		gtk_widget_grab_focus(search_entry);
@@ -678,7 +689,7 @@ void Menu::search()
 	if (visible)
 	{
 		// Show search results
-		gtk_widget_hide(GTK_WIDGET(m_sidebar_box));
+		gtk_widget_hide(GTK_WIDGET(m_sidebar));
 		gtk_widget_hide(GTK_WIDGET(m_panels_box));
 		gtk_widget_show(m_search_results->get_widget());
 	}
@@ -687,7 +698,7 @@ void Menu::search()
 		// Show active panel
 		gtk_widget_hide(m_search_results->get_widget());
 		gtk_widget_show(GTK_WIDGET(m_panels_box));
-		gtk_widget_show(GTK_WIDGET(m_sidebar_box));
+		gtk_widget_show(GTK_WIDGET(m_sidebar));
 	}
 
 	// Apply filter
diff --git a/src/menu.hpp b/src/menu.hpp
index 66ce596..9394e79 100644
--- a/src/menu.hpp
+++ b/src/menu.hpp
@@ -122,6 +122,7 @@ private:
 	RecentPage* m_recent;
 	ApplicationsPage* m_applications;
 
+	GtkScrolledWindow* m_sidebar;
 	SectionButton* m_favorites_button;
 	SectionButton* m_recent_button;
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list