[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 10/473: Add external command to popup menu. Closes #1.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:53:00 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 e71dc4617ed14c394087796999c133062501f957
Author: Graeme Gott <graeme at gottcode.org>
Date: Sat Jun 22 15:04:13 2013 -0400
Add external command to popup menu. Closes #1.
---
CMakeLists.txt | 12 ++++++++++++
INSTALL | 6 +++++-
src/panel_plugin.cpp | 16 ++++++++++++++++
src/panel_plugin.hpp | 1 +
xfce4-popup-whiskermenu.in | 3 +++
5 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 98b43ca..62ad66c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,14 @@ cmake_policy(VERSION 2.8)
project(whiskermenu)
+if(NOT DEFINED BIN_INSTALL_DIR)
+ if (DEFINED CMAKE_INSTALL_BINDIR)
+ set(BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR})
+ else()
+ set(BIN_INSTALL_DIR bin)
+ endif()
+endif()
+
if(NOT DEFINED LIB_INSTALL_DIR)
if (DEFINED CMAKE_INSTALL_LIBDIR)
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
@@ -34,3 +42,7 @@ endif()
add_subdirectory(src)
add_subdirectory(po)
add_subdirectory(icons)
+
+configure_file(${PROJECT_SOURCE_DIR}/xfce4-popup-whiskermenu.in
+ ${PROJECT_BINARY_DIR}/xfce4-popup-whiskermenu ESCAPE_QUOTES @ONLY)
+install(PROGRAMS ${PROJECT_BINARY_DIR}/xfce4-popup-whiskermenu DESTINATION ${BIN_INSTALL_DIR})
diff --git a/INSTALL b/INSTALL
index ed39829..e4454af 100644
--- a/INSTALL
+++ b/INSTALL
@@ -45,7 +45,11 @@ More CMake Options
Choose the base location where the plugin is installed
(defaults to /usr/local).
--DINSTALL_LIB_DIR=<path>
+-DBIN_INSTALL_DIR=<path>
+ Choose where binaries are installed
+ (defaults to $CMAKE_INSTALL_PREFIX/bin).
+
+-DLIB_INSTALL_DIR=<path>
Choose where libraries are installed
(defaults to $CMAKE_INSTALL_PREFIX/lib).
diff --git a/src/panel_plugin.cpp b/src/panel_plugin.cpp
index b90f720..a895623 100644
--- a/src/panel_plugin.cpp
+++ b/src/panel_plugin.cpp
@@ -82,6 +82,7 @@ PanelPlugin::PanelPlugin(XfcePanelPlugin* plugin) :
// Connect plugin signals to functions
g_signal_connect(plugin, "free-data", G_CALLBACK(whiskermenu_free), this);
g_signal_connect_slot(plugin, "configure-plugin", &PanelPlugin::configure, this);
+ g_signal_connect_slot(plugin, "remote-event", &PanelPlugin::remote_event, this);
g_signal_connect_slot(plugin, "save", &PanelPlugin::save, this);
g_signal_connect_slot(plugin, "size-changed", &PanelPlugin::size_changed, this);
xfce_panel_plugin_menu_show_configure(plugin);
@@ -173,6 +174,21 @@ void PanelPlugin::configure()
//-----------------------------------------------------------------------------
+gboolean PanelPlugin::remote_event(XfcePanelPlugin*, gchar* name, GValue*)
+{
+ if (strcmp(name, "popup") || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_button)))
+ {
+ return false;
+ }
+
+ m_menu->show(m_button, xfce_panel_plugin_get_orientation(m_plugin) == GTK_ORIENTATION_HORIZONTAL);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_button), true);
+
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+
void PanelPlugin::save()
{
gchar* file = xfce_panel_plugin_save_location(m_plugin, true);
diff --git a/src/panel_plugin.hpp b/src/panel_plugin.hpp
index 1ab78ad..c178bca 100644
--- a/src/panel_plugin.hpp
+++ b/src/panel_plugin.hpp
@@ -55,6 +55,7 @@ private:
void menu_hidden();
void menu_shown();
void configure();
+ gboolean remote_event(XfcePanelPlugin* plugin, gchar* name, GValue* value);
void save();
gboolean size_changed(XfcePanelPlugin*, gint size);
diff --git a/xfce4-popup-whiskermenu.in b/xfce4-popup-whiskermenu.in
new file mode 100644
index 0000000..411cdaa
--- /dev/null
+++ b/xfce4-popup-whiskermenu.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+ at CMAKE_INSTALL_PREFIX@/@BIN_INSTALL_DIR@/xfce4-panel --plugin-event=whiskermenu:popup
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list