[Xfce4-commits] <xfce4-panel:devel> Add new API function xfce_panel_plugin_remove().
Nick Schermer
noreply at xfce.org
Thu Jan 21 18:02:01 CET 2010
Updating branch refs/heads/devel
to 3bfc7b23c66f6139ebef99f7a151b17c18a573b2 (commit)
from 20b3086a57cc150076e8041e3269b00e7f32f0b1 (commit)
commit 3bfc7b23c66f6139ebef99f7a151b17c18a573b2
Author: Nick Schermer <nick at xfce.org>
Date: Thu Jan 21 17:59:54 2010 +0100
Add new API function xfce_panel_plugin_remove().
With this function a plugin can remove itself from the panel
without user intervention.
common/panel-dbus.h | 2 +-
docs/references/libxfce4panel-sections.txt | 1 +
libxfce4panel/libxfce4panel-deprecated.h | 6 ++--
libxfce4panel/libxfce4panel.symbols | 2 +-
libxfce4panel/xfce-panel-plugin-provider.c | 4 +-
libxfce4panel/xfce-panel-plugin-provider.h | 4 +-
libxfce4panel/xfce-panel-plugin.c | 34 +++++++++++++++++++++++----
libxfce4panel/xfce-panel-plugin.h | 2 +
panel/panel-application.c | 2 +-
panel/panel-dialogs.c | 2 +-
panel/panel-plugin-external-46.c | 16 ++++++------
panel/panel-plugin-external.c | 8 +++---
wrapper/main.c | 4 +-
13 files changed, 57 insertions(+), 30 deletions(-)
diff --git a/common/panel-dbus.h b/common/panel-dbus.h
index 66c2f2e..ea941e9 100644
--- a/common/panel-dbus.h
+++ b/common/panel-dbus.h
@@ -35,7 +35,7 @@
#define SIGNAL_SAVE SIGNAL_PREFIX_S "d"
#define SIGNAL_SHOW_CONFIGURE SIGNAL_PREFIX_S "e"
#define SIGNAL_SHOW_ABOUT SIGNAL_PREFIX_S "f"
-#define SIGNAL_REMOVE SIGNAL_PREFIX_S "g"
+#define SIGNAL_REMOVED SIGNAL_PREFIX_S "g"
#define SIGNAL_WRAPPER_SET_SENSITIVE SIGNAL_PREFIX_S "h"
#define SIGNAL_WRAPPER_BACKGROUND_ALPHA SIGNAL_PREFIX_S "i"
diff --git a/docs/references/libxfce4panel-sections.txt b/docs/references/libxfce4panel-sections.txt
index 28566d4..dac9d86 100644
--- a/docs/references/libxfce4panel-sections.txt
+++ b/docs/references/libxfce4panel-sections.txt
@@ -118,6 +118,7 @@ xfce_panel_plugin_add_action_widget
xfce_panel_plugin_menu_insert_item
xfce_panel_plugin_menu_show_configure
xfce_panel_plugin_menu_show_about
+xfce_panel_plugin_remove
xfce_panel_plugin_block_menu
xfce_panel_plugin_unblock_menu
xfce_panel_plugin_register_menu
diff --git a/libxfce4panel/libxfce4panel-deprecated.h b/libxfce4panel/libxfce4panel-deprecated.h
index 7bc7f35..bb1e537 100644
--- a/libxfce4panel/libxfce4panel-deprecated.h
+++ b/libxfce4panel/libxfce4panel-deprecated.h
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
enum /*< skip >*/
{
- PANEL_CLIENT_EVENT_REMOVE,
+ PANEL_CLIENT_EVENT_REMOVED,
PANEL_CLIENT_EVENT_SAVE,
PANEL_CLIENT_EVENT_SET_BACKGROUND_ALPHA,
PANEL_CLIENT_EVENT_SET_ORIENTATION,
@@ -103,8 +103,8 @@ enum /*< skip >*/
\
switch (message) \
{ \
- case PANEL_CLIENT_EVENT_REMOVE: \
- xfce_panel_plugin_provider_remove (provider); \
+ case PANEL_CLIENT_EVENT_REMOVED: \
+ xfce_panel_plugin_provider_removed (provider); \
break; \
\
case PANEL_CLIENT_EVENT_SAVE: \
diff --git a/libxfce4panel/libxfce4panel.symbols b/libxfce4panel/libxfce4panel.symbols
index 6c339a2..29a0e36 100644
--- a/libxfce4panel/libxfce4panel.symbols
+++ b/libxfce4panel/libxfce4panel.symbols
@@ -130,7 +130,7 @@ xfce_panel_plugin_provider_get_show_configure
xfce_panel_plugin_provider_show_configure
xfce_panel_plugin_provider_get_show_about
xfce_panel_plugin_provider_show_about
-xfce_panel_plugin_provider_remove
+xfce_panel_plugin_provider_removed
xfce_panel_plugin_provider_remote_event
#endif
#endif
diff --git a/libxfce4panel/xfce-panel-plugin-provider.c b/libxfce4panel/xfce-panel-plugin-provider.c
index 089d224..9587e9a 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.c
+++ b/libxfce4panel/xfce-panel-plugin-provider.c
@@ -199,11 +199,11 @@ xfce_panel_plugin_provider_show_about (XfcePanelPluginProvider *provider)
void
-xfce_panel_plugin_provider_remove (XfcePanelPluginProvider *provider)
+xfce_panel_plugin_provider_removed (XfcePanelPluginProvider *provider)
{
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
- (*XFCE_PANEL_PLUGIN_PROVIDER_GET_INTERFACE (provider)->remove) (provider);
+ (*XFCE_PANEL_PLUGIN_PROVIDER_GET_INTERFACE (provider)->removed) (provider);
}
diff --git a/libxfce4panel/xfce-panel-plugin-provider.h b/libxfce4panel/xfce-panel-plugin-provider.h
index f84f665..6af499f 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.h
+++ b/libxfce4panel/xfce-panel-plugin-provider.h
@@ -61,7 +61,7 @@ struct _XfcePanelPluginProviderInterface
void (*show_configure) (XfcePanelPluginProvider *provider);
gboolean (*get_show_about) (XfcePanelPluginProvider *provider);
void (*show_about) (XfcePanelPluginProvider *provider);
- void (*remove) (XfcePanelPluginProvider *provider);
+ void (*removed) (XfcePanelPluginProvider *provider);
gboolean (*remote_event) (XfcePanelPluginProvider *provider,
const gchar *name,
const GValue *value);
@@ -142,7 +142,7 @@ gboolean xfce_panel_plugin_provider_get_show_about (XfcePanelP
void xfce_panel_plugin_provider_show_about (XfcePanelPluginProvider *provider);
-void xfce_panel_plugin_provider_remove (XfcePanelPluginProvider *provider);
+void xfce_panel_plugin_provider_removed (XfcePanelPluginProvider *provider);
gboolean xfce_panel_plugin_provider_remote_event (XfcePanelPluginProvider *provider,
const gchar *name,
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index a2d6a40..eafb5dc 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -92,7 +92,7 @@ static gboolean xfce_panel_plugin_get_show_configure (XfcePanelPluginPr
static void xfce_panel_plugin_show_configure (XfcePanelPluginProvider *provider);
static gboolean xfce_panel_plugin_get_show_about (XfcePanelPluginProvider *provider);
static void xfce_panel_plugin_show_about (XfcePanelPluginProvider *provider);
-static void xfce_panel_plugin_remove (XfcePanelPluginProvider *provider);
+static void xfce_panel_plugin_removed (XfcePanelPluginProvider *provider);
static gboolean xfce_panel_plugin_remote_event (XfcePanelPluginProvider *provider,
const gchar *name,
const GValue *value);
@@ -578,7 +578,7 @@ xfce_panel_plugin_provider_init (XfcePanelPluginProviderInterface *iface)
iface->show_configure = xfce_panel_plugin_show_configure;
iface->get_show_about = xfce_panel_plugin_get_show_about;
iface->show_about = xfce_panel_plugin_show_about;
- iface->remove = xfce_panel_plugin_remove;
+ iface->removed = xfce_panel_plugin_removed;
iface->remote_event = xfce_panel_plugin_remote_event;
}
@@ -830,8 +830,7 @@ xfce_panel_plugin_menu_remove (XfcePanelPlugin *plugin)
gtk_widget_hide (dialog);
/* ask the panel or wrapper to remove the plugin */
- xfce_panel_plugin_provider_emit_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin),
- PROVIDER_SIGNAL_REMOVE_PLUGIN);
+ xfce_panel_plugin_remove (plugin);
}
/* destroy window */
@@ -1245,7 +1244,7 @@ xfce_panel_plugin_show_about (XfcePanelPluginProvider *provider)
static void
-xfce_panel_plugin_remove (XfcePanelPluginProvider *provider)
+xfce_panel_plugin_removed (XfcePanelPluginProvider *provider)
{
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (provider));
@@ -1696,6 +1695,31 @@ xfce_panel_plugin_menu_show_about (XfcePanelPlugin *plugin)
/**
+ * xfce_panel_plugin_remove:
+ * @plugin : an #XfcePanelPlugin.
+ *
+ * Remove this plugin from the panel and remove all its configuration.
+ *
+ * Plugins should not use this function to implement their own
+ * menu item or button to remove theirselfs from the panel, but only
+ * in case the there are problems with the plugin in the panel. Always
+ * try to inform the user why this occured.
+ *
+ * Since: 4.8.0
+ **/
+void
+xfce_panel_plugin_remove (XfcePanelPlugin *plugin)
+{
+ g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin));
+
+ /* ask the panel or wrapper to remove the plugin */
+ xfce_panel_plugin_provider_emit_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin),
+ PROVIDER_SIGNAL_REMOVE_PLUGIN);
+}
+
+
+
+/**
* xfce_panel_plugin_block_menu:
* @plugin : an #XfcePanelPlugin.
*
diff --git a/libxfce4panel/xfce-panel-plugin.h b/libxfce4panel/xfce-panel-plugin.h
index 2c7af6c..399e39a 100644
--- a/libxfce4panel/xfce-panel-plugin.h
+++ b/libxfce4panel/xfce-panel-plugin.h
@@ -136,6 +136,8 @@ void xfce_panel_plugin_menu_show_configure (XfcePanelPlugin *
void xfce_panel_plugin_menu_show_about (XfcePanelPlugin *plugin);
+void xfce_panel_plugin_remove (XfcePanelPlugin *plugin);
+
void xfce_panel_plugin_block_menu (XfcePanelPlugin *plugin);
void xfce_panel_plugin_unblock_menu (XfcePanelPlugin *plugin);
diff --git a/panel/panel-application.c b/panel/panel-application.c
index 5b330a4..e877ba8 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -501,7 +501,7 @@ panel_application_plugin_provider_signal (XfcePanelPluginProvider *provide
case PROVIDER_SIGNAL_REMOVE_PLUGIN:
/* give plugin the opportunity to cleanup special configuration */
- xfce_panel_plugin_provider_remove (provider);
+ xfce_panel_plugin_provider_removed (provider);
/* store the provider's unique id and name (lost after destroy) */
unique_id = xfce_panel_plugin_provider_get_unique_id (provider);
diff --git a/panel/panel-dialogs.c b/panel/panel-dialogs.c
index 66267b4..35f67db 100644
--- a/panel/panel-dialogs.c
+++ b/panel/panel-dialogs.c
@@ -78,7 +78,7 @@ panel_dialogs_choose_panel_combo_changed (GtkComboBox *combo,
/* select active panel */
idx = gtk_combo_box_get_active (combo);
- panel_application_window_select (application,
+ panel_application_window_select (application,
panel_application_get_nth_window (application, idx));
}
diff --git a/panel/panel-plugin-external-46.c b/panel/panel-plugin-external-46.c
index dd31b9d..99cf462 100644
--- a/panel/panel-plugin-external-46.c
+++ b/panel/panel-plugin-external-46.c
@@ -81,7 +81,7 @@ static gboolean panel_plugin_external_46_get_show_configure (XfcePanelPlu
static void panel_plugin_external_46_show_configure (XfcePanelPluginProvider *provider);
static gboolean panel_plugin_external_46_get_show_about (XfcePanelPluginProvider *provider);
static void panel_plugin_external_46_show_about (XfcePanelPluginProvider *provider);
-static void panel_plugin_external_46_remove (XfcePanelPluginProvider *provider);
+static void panel_plugin_external_46_removed (XfcePanelPluginProvider *provider);
static gboolean panel_plugin_external_46_remote_event (XfcePanelPluginProvider *provider,
const gchar *name,
const GValue *value);
@@ -174,7 +174,7 @@ panel_plugin_external_46_class_init (PanelPluginExternal46Class *klass)
g_object_class_install_property (gobject_class,
PROP_UNIQUE_ID,
- g_param_spec_int ("unique-id",
+ g_param_spec_int ("unique-id",
NULL, NULL,
-1, G_MAXINT, -1,
EXO_PARAM_READWRITE
@@ -182,7 +182,7 @@ panel_plugin_external_46_class_init (PanelPluginExternal46Class *klass)
g_object_class_install_property (gobject_class,
PROP_MODULE,
- g_param_spec_object ("module",
+ g_param_spec_object ("module",
NULL, NULL,
PANEL_TYPE_MODULE,
EXO_PARAM_READWRITE
@@ -190,7 +190,7 @@ panel_plugin_external_46_class_init (PanelPluginExternal46Class *klass)
g_object_class_install_property (gobject_class,
PROP_ARGUMENTS,
- g_param_spec_boxed ("arguments",
+ g_param_spec_boxed ("arguments",
NULL, NULL,
G_TYPE_STRV,
EXO_PARAM_READWRITE
@@ -233,7 +233,7 @@ panel_plugin_external_46_provider_init (XfcePanelPluginProviderInterface *iface)
iface->show_configure = panel_plugin_external_46_show_configure;
iface->get_show_about = panel_plugin_external_46_get_show_about;
iface->show_about = panel_plugin_external_46_show_about;
- iface->remove = panel_plugin_external_46_remove;
+ iface->removed = panel_plugin_external_46_removed;
iface->remote_event = panel_plugin_external_46_remote_event;
}
@@ -523,7 +523,7 @@ panel_plugin_external_46_plug_added (GtkSocket *socket)
for (li = external->queue; li != NULL; li = li->next)
{
item = li->data;
- panel_plugin_external_46_send_client_event (external,
+ panel_plugin_external_46_send_client_event (external,
item->message,
item->value);
g_slice_free (QueueItem, item);
@@ -719,13 +719,13 @@ panel_plugin_external_46_show_about (XfcePanelPluginProvider *provider)
static void
-panel_plugin_external_46_remove (XfcePanelPluginProvider *provider)
+panel_plugin_external_46_removed (XfcePanelPluginProvider *provider)
{
panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL_46 (provider));
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
panel_plugin_external_46_queue_add (PANEL_PLUGIN_EXTERNAL_46 (provider),
- PANEL_CLIENT_EVENT_REMOVE,
+ PANEL_CLIENT_EVENT_REMOVED,
FALSE);
}
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index 65dd2f3..390221b 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -94,7 +94,7 @@ static gboolean panel_plugin_external_get_show_configure (XfcePanelPlugin
static void panel_plugin_external_show_configure (XfcePanelPluginProvider *provider);
static gboolean panel_plugin_external_get_show_about (XfcePanelPluginProvider *provider);
static void panel_plugin_external_show_about (XfcePanelPluginProvider *provider);
-static void panel_plugin_external_remove (XfcePanelPluginProvider *provider);
+static void panel_plugin_external_removed (XfcePanelPluginProvider *provider);
static gboolean panel_plugin_external_remote_event (XfcePanelPluginProvider *provider,
const gchar *name,
const GValue *value);
@@ -261,7 +261,7 @@ panel_plugin_external_provider_init (XfcePanelPluginProviderInterface *iface)
iface->show_configure = panel_plugin_external_show_configure;
iface->get_show_about = panel_plugin_external_get_show_about;
iface->show_about = panel_plugin_external_show_about;
- iface->remove = panel_plugin_external_remove;
+ iface->removed = panel_plugin_external_removed;
iface->remote_event = panel_plugin_external_remote_event;
}
@@ -805,14 +805,14 @@ panel_plugin_external_show_about (XfcePanelPluginProvider *provider)
static void
-panel_plugin_external_remove (XfcePanelPluginProvider *provider)
+panel_plugin_external_removed (XfcePanelPluginProvider *provider)
{
panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (provider));
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
/* send signal to wrapper */
panel_plugin_external_queue_add_noop (PANEL_PLUGIN_EXTERNAL (provider),
- FALSE, SIGNAL_REMOVE);
+ FALSE, SIGNAL_REMOVED);
}
diff --git a/wrapper/main.c b/wrapper/main.c
index da9af43..533ff03 100644
--- a/wrapper/main.c
+++ b/wrapper/main.c
@@ -104,8 +104,8 @@ wrapper_gproxy_set (DBusGProxy *dbus_gproxy,
xfce_panel_plugin_provider_show_configure (provider);
else if (strcmp (property, SIGNAL_SHOW_ABOUT) == 0)
xfce_panel_plugin_provider_show_about (provider);
- else if (strcmp (property, SIGNAL_REMOVE) == 0)
- xfce_panel_plugin_provider_remove (provider);
+ else if (strcmp (property, SIGNAL_REMOVED) == 0)
+ xfce_panel_plugin_provider_removed (provider);
else if (strcmp (property, SIGNAL_WRAPPER_SET_SENSITIVE) == 0)
gtk_widget_set_sensitive (GTK_WIDGET (provider), g_value_get_boolean (value));
else
More information about the Xfce4-commits
mailing list