[Xfce4-commits] <xfce4-panel:devel> Add help item to the Xfce Panel submenu of plugins.
Nick Schermer
noreply at xfce.org
Tue Feb 23 17:20:05 CET 2010
Updating branch refs/heads/devel
to c97fe0e3c5d2c7a0701f1292b7ef4d105eb8670a (commit)
from 948ef3bc7842b52bc7ef739e2e97f2ff7fa695aa (commit)
commit c97fe0e3c5d2c7a0701f1292b7ef4d105eb8670a
Author: Nick Schermer <nick at xfce.org>
Date: Tue Feb 23 13:19:32 2010 +0100
Add help item to the Xfce Panel submenu of plugins.
libxfce4panel/xfce-panel-plugin-provider.h | 1 +
libxfce4panel/xfce-panel-plugin.c | 21 +++++++++++++++++++++
panel/panel-application.c | 6 ++++++
panel/panel-window.c | 16 ++++++++++++++++
4 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/libxfce4panel/xfce-panel-plugin-provider.h b/libxfce4panel/xfce-panel-plugin-provider.h
index 9c37e3f..3f230ee 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.h
+++ b/libxfce4panel/xfce-panel-plugin-provider.h
@@ -85,6 +85,7 @@ typedef enum /*< skip >*/
PROVIDER_SIGNAL_PANEL_QUIT,
PROVIDER_SIGNAL_PANEL_RESTART,
PROVIDER_SIGNAL_PANEL_ABOUT,
+ PROVIDER_SIGNAL_PANEL_HELP,
PROVIDER_SIGNAL_SHOW_CONFIGURE,
PROVIDER_SIGNAL_SHOW_ABOUT,
PROVIDER_SIGNAL_FOCUS_PLUGIN
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 54a93ab..8d6cdf2 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -933,6 +933,20 @@ xfce_panel_plugin_menu_panel_about (XfcePanelPlugin *plugin)
+static void
+xfce_panel_plugin_menu_panel_help (XfcePanelPlugin *plugin)
+{
+ panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin));
+ panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (plugin));
+ panel_return_if_fail (XFCE_PANEL_PLUGIN_CONSTRUCTED (plugin));
+
+ /* open the manual of the panel */
+ xfce_panel_plugin_provider_emit_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin),
+ PROVIDER_SIGNAL_PANEL_HELP);
+}
+
+
+
static GtkMenu *
xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin)
{
@@ -1070,6 +1084,13 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin)
gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item);
gtk_widget_show (item);
+ /* help item */
+ item = gtk_image_menu_item_new_from_stock (GTK_STOCK_HELP, NULL);
+ g_signal_connect_swapped (G_OBJECT (item), "activate",
+ G_CALLBACK (xfce_panel_plugin_menu_panel_help), plugin);
+ gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item);
+ gtk_widget_show (item);
+
/* about item */
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL);
g_signal_connect_swapped (G_OBJECT (item), "activate",
diff --git a/panel/panel-application.c b/panel/panel-application.c
index 041b974..4b62817 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -33,6 +33,7 @@
#include <common/panel-private.h>
#include <common/panel-xfconf.h>
#include <common/panel-debug.h>
+#include <common/panel-builder.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>
@@ -553,6 +554,11 @@ panel_application_plugin_provider_signal (XfcePanelPluginProvider *provide
panel_dialogs_show_about ();
break;
+ case PROVIDER_SIGNAL_PANEL_HELP:
+ /* try to launch help browser */
+ panel_builder_show_help (NULL, NULL, NULL);
+ break;
+
case PROVIDER_SIGNAL_FOCUS_PLUGIN:
/* focus the panel window (as part of focusing a widget within the plugin) */
gtk_window_present_with_time (GTK_WINDOW (window), GDK_CURRENT_TIME);
diff --git a/panel/panel-window.c b/panel/panel-window.c
index 67903b1..f58e9f9 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -30,6 +30,7 @@
#include <exo/exo.h>
#include <common/panel-private.h>
#include <common/panel-debug.h>
+#include <common/panel-builder.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>
#include <panel/panel-base-window.h>
@@ -2019,6 +2020,14 @@ panel_window_menu_quit (gpointer boolean)
static void
+panel_window_menu_help (void)
+{
+ panel_builder_show_help (NULL, NULL, NULL);
+}
+
+
+
+static void
panel_window_menu_deactivate (GtkMenu *menu,
PanelWindow *window)
{
@@ -2112,6 +2121,13 @@ panel_window_menu_popup (PanelWindow *window,
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
+ /* help item */
+ item = gtk_image_menu_item_new_from_stock (GTK_STOCK_HELP, NULL);
+ g_signal_connect (G_OBJECT (item), "activate",
+ G_CALLBACK (panel_window_menu_help), NULL);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ gtk_widget_show (item);
+
/* about item */
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL);
g_signal_connect (G_OBJECT (item), "activate",
More information about the Xfce4-commits
mailing list