Browse Source

Add new API function xfce_panel_plugin_remove().

With this function a plugin can remove itself from the panel
without user intervention.
upstream/xfce4-panel-4.10.1
Nick Schermer 12 years ago
parent
commit
c4d4a22467
  1. 2
      common/panel-dbus.h
  2. 1
      docs/references/libxfce4panel-sections.txt
  3. 6
      libxfce4panel/libxfce4panel-deprecated.h
  4. 2
      libxfce4panel/libxfce4panel.symbols
  5. 4
      libxfce4panel/xfce-panel-plugin-provider.c
  6. 4
      libxfce4panel/xfce-panel-plugin-provider.h
  7. 34
      libxfce4panel/xfce-panel-plugin.c
  8. 2
      libxfce4panel/xfce-panel-plugin.h
  9. 2
      panel/panel-application.c
  10. 2
      panel/panel-dialogs.c
  11. 16
      panel/panel-plugin-external-46.c
  12. 8
      panel/panel-plugin-external.c
  13. 4
      wrapper/main.c

2
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"

1
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

6
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: \

2
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

4
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);
}

4
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,

34
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));
@ -1695,6 +1694,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.

2
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);

2
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);

2
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));
}

16
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);
}

8
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);
}

4
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

Loading…
Cancel
Save