[Xfce4-commits] <xfce4-panel:devel> * Make show_configure and show_about in the external plugin using the provider signal.
Nick Schermer
nick at xfce.org
Tue Aug 11 20:26:17 CEST 2009
Updating branch refs/heads/devel
to 8b4e778547b4a37c8130db06c2d0737f1e0b60ea (commit)
from 54861e7472ad01f77935413a48e01a11b2d84f82 (commit)
commit 8b4e778547b4a37c8130db06c2d0737f1e0b60ea
Author: Nick Schermer <nick at xfce.org>
Date: Tue Nov 11 19:13:26 2008 +0100
* Make show_configure and show_about in the external plugin
using the provider signal.
libxfce4panel/xfce-panel-plugin-provider.h | 6 +++-
libxfce4panel/xfce-panel-plugin.c | 8 +++++
panel/panel-plugin-external.c | 40 ++++++++++++++++++++-------
3 files changed, 41 insertions(+), 13 deletions(-)
diff --git a/libxfce4panel/xfce-panel-plugin-provider.h b/libxfce4panel/xfce-panel-plugin-provider.h
index 068e50c..195e710 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.h
+++ b/libxfce4panel/xfce-panel-plugin-provider.h
@@ -70,14 +70,16 @@ struct _XfcePanelPluginProviderIface
* through the wrapper) */
enum _XfcePanelPluginProviderSignal
{
- PROVIDER_SIGNAL_MOVE_PLUGIN,
+ PROVIDER_SIGNAL_MOVE_PLUGIN = 0,
PROVIDER_SIGNAL_EXPAND_PLUGIN,
PROVIDER_SIGNAL_COLLAPSE_PLUGIN,
PROVIDER_SIGNAL_LOCK_PANEL,
PROVIDER_SIGNAL_UNLOCK_PANEL,
PROVIDER_SIGNAL_REMOVE_PLUGIN,
PROVIDER_SIGNAL_ADD_NEW_ITEMS,
- PROVIDER_SIGNAL_PANEL_PREFERENCES
+ PROVIDER_SIGNAL_PANEL_PREFERENCES,
+ PROVIDER_SIGNAL_SHOW_CONFIGURE,
+ PROVIDER_SIGNAL_SHOW_ABOUT
};
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 4178024..4bde552 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -1223,6 +1223,10 @@ xfce_panel_plugin_menu_show_configure (XfcePanelPlugin *plugin)
if (G_LIKELY (item))
gtk_widget_show (item);
}
+
+ /* emit signal, used by the external plugin */
+ xfce_panel_plugin_provider_send_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin),
+ PROVIDER_SIGNAL_SHOW_CONFIGURE);
}
@@ -1253,6 +1257,10 @@ xfce_panel_plugin_menu_show_about (XfcePanelPlugin *plugin)
if (G_LIKELY (item))
gtk_widget_show (item);
}
+
+ /* emit signal, used by the external plugin */
+ xfce_panel_plugin_provider_send_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin),
+ PROVIDER_SIGNAL_SHOW_ABOUT);
}
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index 4baf62f..05a931d 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -103,6 +103,10 @@ struct _PanelPluginExternal
/* counter to count the number of restart */
guint n_restarts;
+
+ /* some info we store here */
+ guint show_configure : 1;
+ guint show_about : 1;
};
typedef struct
@@ -150,6 +154,8 @@ panel_plugin_external_init (PanelPluginExternal *external)
external->dbus_queue = NULL;
external->plug_embedded = FALSE;
external->n_restarts = 0;
+ external->show_configure = FALSE;
+ external->show_about = FALSE;
/* signal to pass gtk_widget_set_sensitive() changes to the remote window */
g_signal_connect (G_OBJECT (external), "notify::sensitive", G_CALLBACK (panel_plugin_external_set_sensitive), NULL);
@@ -350,7 +356,7 @@ panel_plugin_external_plug_removed (GtkSocket *socket)
g_message ("Automatically restarting plugin %s-%d, try %d",
panel_module_get_internal_name (external->module),
external->unique_id, external->n_restarts);
- }
+ }
/* handle the response */
if (response == GTK_RESPONSE_OK)
@@ -425,14 +431,28 @@ panel_plugin_external_provider_signal (XfcePanelPluginProvider *provider,
panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (provider));
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
- /* only handle the remove signal, everything else is handles in panel-application */
- if (signal == PROVIDER_SIGNAL_REMOVE_PLUGIN)
+ /* we handle some signals here, everything else is handled in
+ * panel-application */
+ switch (signal)
{
- /* we're forced removing the plugin, don't ask for a restart */
- external->plug_embedded = FALSE;
+ case PROVIDER_SIGNAL_REMOVE_PLUGIN:
+ /* we're forced removing the plugin, don't ask for a restart */
+ external->plug_embedded = FALSE;
+
+ /* destroy ourselfs, unrealize will close the plugin */
+ gtk_widget_destroy (GTK_WIDGET (external));
+ break;
+
+ case PROVIDER_SIGNAL_SHOW_CONFIGURE:
+ external->show_configure = TRUE;
+ break;
+
+ case PROVIDER_SIGNAL_SHOW_ABOUT:
+ external->show_about = TRUE;
+ break;
- /* destroy ourselfs, unrealize will close the plugin */
- gtk_widget_destroy (GTK_WIDGET (external));
+ default:
+ break;
}
}
@@ -604,8 +624,7 @@ panel_plugin_external_get_show_configure (XfcePanelPluginProvider *provider)
panel_return_val_if_fail (PANEL_IS_PLUGIN_EXTERNAL (provider), FALSE);
panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), FALSE);
- /* TODO */
- return TRUE;
+ return PANEL_PLUGIN_EXTERNAL (provider)->show_configure;
}
@@ -629,8 +648,7 @@ panel_plugin_external_get_show_about (XfcePanelPluginProvider *provider)
panel_return_val_if_fail (PANEL_IS_PLUGIN_EXTERNAL (provider), FALSE);
panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), FALSE);
- /* TODO */
- return TRUE;
+ return PANEL_PLUGIN_EXTERNAL (provider)->show_about;
}
More information about the Xfce4-commits
mailing list