[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 07/09: Disable panel button contents while loading.

noreply at xfce.org noreply at xfce.org
Sun Apr 15 01:13:26 CEST 2018


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

g   o   t   t   c   o   d   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-whiskermenu-plugin.

commit 88f503e61dc28b8ebe218cce1d0ba2a2bf359816
Author: Graeme Gott <graeme at gottcode.org>
Date:   Mon Oct 23 13:12:34 2017 -0400

    Disable panel button contents while loading.
---
 panel-plugin/plugin.cpp | 14 ++++++++++++--
 panel-plugin/plugin.h   |  1 +
 panel-plugin/window.cpp |  8 +++++++-
 panel-plugin/window.h   |  5 ++++-
 4 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/panel-plugin/plugin.cpp b/panel-plugin/plugin.cpp
index fd7c0c3..1ccf479 100644
--- a/panel-plugin/plugin.cpp
+++ b/panel-plugin/plugin.cpp
@@ -186,6 +186,7 @@ Plugin::Plugin(XfcePanelPlugin* plugin) :
 	{
 		gtk_widget_show(GTK_WIDGET(m_button_icon));
 	}
+	gtk_widget_set_sensitive(GTK_WIDGET(m_button_icon), false);
 
 	m_button_label = GTK_LABEL(gtk_label_new(NULL));
 	gtk_label_set_markup(m_button_label, wm_settings->button_title.c_str());
@@ -194,6 +195,7 @@ Plugin::Plugin(XfcePanelPlugin* plugin) :
 	{
 		gtk_widget_show(GTK_WIDGET(m_button_label));
 	}
+	gtk_widget_set_sensitive(GTK_WIDGET(m_button_label), false);
 
 	// Add plugin to panel
 	gtk_container_add(GTK_CONTAINER(plugin), m_button);
@@ -218,7 +220,7 @@ Plugin::Plugin(XfcePanelPlugin* plugin) :
 	g_signal_connect_slot<GtkWidget*,GdkScreen*>(m_button, "screen-changed", &Plugin::update_size, this);
 
 	// Create menu window
-	m_window = new Window;
+	m_window = new Window(this);
 	g_signal_connect_slot<GtkWidget*>(m_window->get_widget(), "unmap", &Plugin::menu_hidden, this);
 }
 
@@ -338,6 +340,14 @@ void Plugin::set_configure_enabled(bool enabled)
 
 //-----------------------------------------------------------------------------
 
+void Plugin::set_loaded(bool loaded)
+{
+	gtk_widget_set_sensitive(GTK_WIDGET(m_button_icon), loaded);
+	gtk_widget_set_sensitive(GTK_WIDGET(m_button_label), loaded);
+}
+
+//-----------------------------------------------------------------------------
+
 void Plugin::button_toggled(GtkToggleButton* button)
 {
 	if (gtk_toggle_button_get_active(button) == false)
@@ -539,7 +549,7 @@ void Plugin::show_menu(GtkWidget* parent, bool horizontal)
 		if ((m_opacity == 100) || (wm_settings->menu_opacity == 100))
 		{
 			delete m_window;
-			m_window = new Window;
+			m_window = new Window(this);
 			g_signal_connect_slot<GtkWidget*>(m_window->get_widget(), "unmap", &Plugin::menu_hidden, this);
 		}
 		m_opacity = wm_settings->menu_opacity;
diff --git a/panel-plugin/plugin.h b/panel-plugin/plugin.h
index 0906608..b6bbe00 100644
--- a/panel-plugin/plugin.h
+++ b/panel-plugin/plugin.h
@@ -58,6 +58,7 @@ public:
 	void set_button_title(const std::string& title);
 	void set_button_icon_name(const std::string& icon);
 	void set_configure_enabled(bool enabled);
+	void set_loaded(bool loaded);
 
 private:
 	void button_toggled(GtkToggleButton* button);
diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index e6d82d3..fd72908 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -21,6 +21,7 @@
 #include "command.h"
 #include "favorites-page.h"
 #include "launcher-view.h"
+#include "plugin.h"
 #include "profile-picture.h"
 #include "recent-page.h"
 #include "resizer-widget.h"
@@ -82,7 +83,8 @@ static void ungrab_pointer()
 
 //-----------------------------------------------------------------------------
 
-WhiskerMenu::Window::Window() :
+WhiskerMenu::Window::Window(Plugin* plugin) :
+	m_plugin(plugin),
 	m_window(NULL),
 	m_search_cover(GTK_STACK_TRANSITION_TYPE_OVER_DOWN),
 	m_search_uncover(GTK_STACK_TRANSITION_TYPE_UNDER_UP),
@@ -355,6 +357,7 @@ void WhiskerMenu::Window::show(GtkWidget* parent, bool horizontal)
 	}
 	else
 	{
+		m_plugin->set_loaded(false);
 		gtk_stack_set_visible_child_name(m_window_stack, "load");
 		gtk_spinner_start(m_window_load_spinner);
 	}
@@ -713,6 +716,9 @@ void WhiskerMenu::Window::set_loaded()
 
 	// Focus search entry
 	gtk_widget_grab_focus(GTK_WIDGET(m_search_entry));
+
+	// Show panel button
+	m_plugin->set_loaded(true);
 }
 
 //-----------------------------------------------------------------------------
diff --git a/panel-plugin/window.h b/panel-plugin/window.h
index b3c1a91..bb7a4f2 100644
--- a/panel-plugin/window.h
+++ b/panel-plugin/window.h
@@ -28,6 +28,7 @@ namespace WhiskerMenu
 class ApplicationsPage;
 class FavoritesPage;
 class Page;
+class Plugin;
 class ProfilePicture;
 class ResizerWidget;
 class RecentPage;
@@ -37,7 +38,7 @@ class SectionButton;
 class Window
 {
 public:
-	explicit Window();
+	explicit Window(Plugin* plugin);
 	~Window();
 
 	GtkWidget* get_widget() const
@@ -93,6 +94,8 @@ private:
 	void search();
 
 private:
+	Plugin* m_plugin;
+
 	GtkWindow* m_window;
 
 	GtkStack* m_window_stack;

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


More information about the Xfce4-commits mailing list