Browse Source

Improve the handling of removing external plugins.

Add a quick signal back to the code and improve the internal
handling so the objects are better isolated.
upstream/xfce4-panel-4.10.1
Nick Schermer 13 years ago
parent
commit
f153e9cfd9
  1. 1
      common/panel-dbus.h
  2. 5
      panel/panel-application.c
  3. 8
      panel/panel-plugin-external-46.c
  4. 24
      panel/panel-plugin-external.c
  5. 2
      wrapper/main.c
  6. 2
      wrapper/wrapper-plug.c

1
common/panel-dbus.h

@ -38,6 +38,7 @@
#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"
#define SIGNAL_WRAPPER_QUIT SIGNAL_PREFIX_S "j"
/* special types for dbus communication */
#define PANEL_TYPE_DBUS_SET_MESSAGE dbus_g_type_get_struct ("GValueArray", \

5
panel/panel-application.c

@ -507,9 +507,8 @@ panel_application_plugin_provider_signal (XfcePanelPluginProvider *provide
unique_id = xfce_panel_plugin_provider_get_unique_id (provider);
name = g_strdup (xfce_panel_plugin_provider_get_name (provider));
/* destroy the plugin if it's a panel plugin (ie. not external) */
if (XFCE_IS_PANEL_PLUGIN (provider))
gtk_widget_destroy (GTK_WIDGET (provider));
/* destroy the plugin */
gtk_widget_destroy (GTK_WIDGET (provider));
/* remove the plugin configuration */
panel_application_plugin_delete_config (application, name, unique_id);

8
panel/panel-plugin-external-46.c

@ -409,14 +409,6 @@ panel_plugin_external_46_client_event (GtkWidget *widget,
switch (provider_signal)
{
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;

24
panel/panel-plugin-external.c

@ -62,6 +62,7 @@ static void panel_plugin_external_set_property (GObject
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void panel_plugin_external_destroy (GtkObject *object);
static void panel_plugin_external_realize (GtkWidget *widget);
static gboolean panel_plugin_external_plug_removed (GtkSocket *socket);
static void panel_plugin_external_plug_added (GtkSocket *socket);
@ -173,6 +174,7 @@ static void
panel_plugin_external_class_init (PanelPluginExternalClass *klass)
{
GObjectClass *gobject_class;
GtkObjectClass *gtkobject_class;
GtkWidgetClass *gtkwidget_class;
GtkSocketClass *gtksocket_class;
@ -182,6 +184,9 @@ panel_plugin_external_class_init (PanelPluginExternalClass *klass)
gobject_class->set_property = panel_plugin_external_set_property;
gobject_class->get_property = panel_plugin_external_get_property;
gtkobject_class = GTK_OBJECT_CLASS (klass);
gtkobject_class->destroy = panel_plugin_external_destroy;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->realize = panel_plugin_external_realize;
@ -393,6 +398,17 @@ panel_plugin_external_set_property (GObject *object,
static void
panel_plugin_external_destroy (GtkObject *object)
{
panel_plugin_external_queue_add_noop (PANEL_PLUGIN_EXTERNAL (object),
TRUE, SIGNAL_WRAPPER_QUIT);
(*GTK_OBJECT_CLASS (panel_plugin_external_parent_class)->destroy) (object);
}
static void
panel_plugin_external_realize (GtkWidget *widget)
{
@ -560,14 +576,6 @@ panel_plugin_external_dbus_provider_signal (PanelPluginExternal *exte
switch (provider_signal)
{
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;

2
wrapper/main.c

@ -108,6 +108,8 @@ wrapper_gproxy_set (DBusGProxy *dbus_gproxy,
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 if (strcmp (property, SIGNAL_WRAPPER_QUIT) == 0)
gtk_main_quit ();
else
panel_assert_not_reached ();
}

2
wrapper/wrapper-plug.c

@ -31,7 +31,7 @@
static gboolean wrapper_plug_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static void wrapper_plug_set_colormap (WrapperPlug *plug);
static void wrapper_plug_set_colormap (WrapperPlug *plug);

Loading…
Cancel
Save