Browse Source

Use integers for the plugin's unique id.

Lot fo changes to support the integer. Also add new macro
IS_STRING for proper string checking.
Drop some Gtk+ 2.12 code checks.
upstream/xfce4-panel-4.10.1
Nick Schermer 12 years ago
parent
commit
479452a633
  1. 12
      libxfce4panel/libxfce4panel.h
  2. 11
      libxfce4panel/xfce-panel-macros.h
  3. 8
      libxfce4panel/xfce-panel-plugin-provider.c
  4. 17
      libxfce4panel/xfce-panel-plugin-provider.h
  5. 63
      libxfce4panel/xfce-panel-plugin.c
  6. 6
      libxfce4panel/xfce-panel-plugin.h
  7. 5
      libxfce4panel/xfce-scaled-image.c
  8. 26
      panel/panel-application.c
  9. 14
      panel/panel-dbus-service-infos.xml
  10. 20
      panel/panel-dbus-service.c
  11. 2
      panel/panel-dbus-service.h
  12. 4
      panel/panel-item-dialog.c
  13. 2
      panel/panel-marshal.list
  14. 37
      panel/panel-module-factory.c
  15. 4
      panel/panel-module-factory.h
  16. 12
      panel/panel-module.c
  17. 2
      panel/panel-module.h
  18. 52
      panel/panel-plugin-external.c
  19. 2
      panel/panel-plugin-external.h
  20. 57
      panel/panel-private.c
  21. 13
      panel/panel-private.h
  22. 10
      panel/panel-window.c
  23. 6
      plugins/tasklist/plugin.c
  24. 63
      wrapper/main.c

12
libxfce4panel/libxfce4panel.h

@ -37,18 +37,18 @@ G_BEGIN_DECLS
#define XFCE_PANEL_PLUGIN_REGISTER_OBJECT(TYPE) \
PANEL_SYMBOL_EXPORT G_MODULE_EXPORT XfcePanelPlugin * \
__xpp_construct_obj (const gchar *name, \
const gchar *id, \
gint unique_id, \
const gchar *display_name, \
gchar **arguments, \
GdkScreen *screen) \
{ \
panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); \
panel_return_val_if_fail (name != NULL && id != NULL, NULL); \
panel_return_val_if_fail (name != NULL && unique_id != -1, NULL); \
panel_return_val_if_fail (g_type_is_a (TYPE, XFCE_TYPE_PANEL_PLUGIN), NULL); \
\
return g_object_new (TYPE, \
"name", name, \
"id", id, \
"unique-id", unique_id, \
"display-name", display_name, \
"arguments", arguments, NULL); \
}
@ -72,7 +72,7 @@ G_BEGIN_DECLS
\
PANEL_SYMBOL_EXPORT G_MODULE_EXPORT XfcePanelPlugin * \
__xpp_construct (const gchar *name, \
const gchar *id, \
gint unique_id, \
const gchar *display_name, \
gchar **arguments, \
GdkScreen *screen) \
@ -80,13 +80,13 @@ G_BEGIN_DECLS
XfcePanelPlugin *plugin = NULL; \
\
panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); \
panel_return_val_if_fail (name != NULL && id != NULL, NULL); \
panel_return_val_if_fail (name != NULL && unique_id != -1, NULL); \
\
CODE \
{ \
plugin = g_object_new (XFCE_TYPE_PANEL_PLUGIN, \
"name", name, \
"id", id, \
"unique-id", unique_id, \
"display-name", display_name, \
"arguments", arguments, NULL); \
\

11
libxfce4panel/xfce-panel-macros.h

@ -74,16 +74,19 @@ G_BEGIN_DECLS
/* make api compatible with 4.4 panel */
#ifndef XFCE_DISABLE_DEPRECATED
/* panel plugin functio for the id, probably not used by anyone */
#define xfce_panel_plugin_get_id(plugin) (g_strdup_printf ("%d", xfce_panel_plugin_get_unique_id (XFCE_PANEL_PLUGIN (plugin))))
/* convenience functions (deprecated) */
#define xfce_create_panel_button xfce_panel_create_button
#define xfce_create_panel_toggle_button xfce_panel_create_toggle_button
#define xfce_allow_panel_customization xfce_panel_allow_customization
/* register definitions (deprecated) */
#define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL XFCE_PANEL_PLUGIN_REGISTER
#define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL_WITH_CHECK XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL XFCE_PANEL_PLUGIN_REGISTER
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_WITH_CHECK XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK
#define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL XFCE_PANEL_PLUGIN_REGISTER
#define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL_WITH_CHECK XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL XFCE_PANEL_PLUGIN_REGISTER
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_WITH_CHECK XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK
/* parameter flags (deprecated) */
#define PANEL_PARAM_READABLE G_PARAM_READABLE | PANEL_PARAM_STATIC_STRINGS

8
libxfce4panel/xfce-panel-plugin-provider.c

@ -87,12 +87,12 @@ xfce_panel_plugin_provider_get_name (XfcePanelPluginProvider *provider)
PANEL_SYMBOL_EXPORT const gchar *
xfce_panel_plugin_provider_get_id (XfcePanelPluginProvider *provider)
PANEL_SYMBOL_EXPORT gint
xfce_panel_plugin_provider_get_unique_id (XfcePanelPluginProvider *provider)
{
panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), NULL);
panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), -1);
return (*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->get_id) (provider);
return (*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->get_unique_id) (provider);
}

17
libxfce4panel/xfce-panel-plugin-provider.h

@ -39,15 +39,18 @@ typedef enum _XfcePanelPluginProviderSignal XfcePanelPluginProviderSignal;
#define PANEL_DBUS_SERVICE_PATH "/org/xfce/Panel"
#define PANEL_DBUS_SERVICE_NAME PANEL_DBUS_SERVICE_INTERFACE
/* relative plugin filename */
#define PANEL_PLUGIN_RELATIVE_PATH "xfce4" G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "%s-%s.rc"
/* relative plugin filename (printf format) */
#define PANEL_PLUGIN_RELATIVE_PATH "xfce4" G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "%s-%d.rc"
/* xfconf property base */
#define PANEL_PLUGIN_PROPERTY_BASE "/plugins/plugin-%s"
/* xfconf property base (printf format) */
#define PANEL_PLUGIN_PROPERTY_BASE "/plugins/plugin-%d"
/* commonly used macro */
#define IS_STRING(string) ((string) != NULL && *(string) != '\0')
/* provider contruct function */
typedef XfcePanelPluginProvider *(*PluginConstructFunc) (const gchar *name,
const gchar *id,
gint id,
const gchar *display_name,
gchar **arguments,
GdkScreen *screen);
@ -63,7 +66,7 @@ struct _XfcePanelPluginProviderIface
/*< public >*/
const gchar *(*get_name) (XfcePanelPluginProvider *provider);
const gchar *(*get_id) (XfcePanelPluginProvider *provider);
gint (*get_unique_id) (XfcePanelPluginProvider *provider);
void (*set_size) (XfcePanelPluginProvider *provider,
gint size);
void (*set_orientation) (XfcePanelPluginProvider *provider,
@ -91,7 +94,7 @@ GType xfce_panel_plugin_provider_get_type (void) G_GNUC_CONST;
const gchar *xfce_panel_plugin_provider_get_name (XfcePanelPluginProvider *provider);
const gchar *xfce_panel_plugin_provider_get_id (XfcePanelPluginProvider *provider);
gint xfce_panel_plugin_provider_get_unique_id (XfcePanelPluginProvider *provider);
void xfce_panel_plugin_provider_set_size (XfcePanelPluginProvider *provider,
gint size);

63
libxfce4panel/xfce-panel-plugin.c

@ -32,7 +32,8 @@
#define XFCE_PANEL_PLUGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFCE_TYPE_PANEL_PLUGIN, XfcePanelPluginPrivate))
typedef const gchar *(*ProviderToPlugin) (XfcePanelPluginProvider *provider);
typedef const gchar *(*ProviderToPluginChar) (XfcePanelPluginProvider *provider);
typedef gint (*ProviderToPluginInt) (XfcePanelPluginProvider *provider);
static void xfce_panel_plugin_class_init (XfcePanelPluginClass *klass);
@ -79,7 +80,7 @@ enum
PROP_NAME,
PROP_DISPLAY_NAME,
PROP_ARGUMENTS,
PROP_ID
PROP_UNIQUE_ID
};
enum
@ -99,7 +100,7 @@ struct _XfcePanelPluginPrivate
/* plugin information */
gchar *name;
gchar *display_name;
gchar *id;
gint unique_id;
gchar *property_base;
gchar **arguments;
gint size;
@ -328,18 +329,17 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
* XfcePanelPlugin:id:
*
* The unique id of the #XfcePanelPlugin. Plugin writer can use it to
* read the unique id, but xfce_panel_plugin_get_id() is recommended
* since that returns a const string.
* read the unique id, but xfce_panel_plugin_get_unique_id() is recommended.
**/
g_object_class_install_property (gobject_class,
PROP_ID,
g_param_spec_string ("id",
"ID",
"Unique plugin ID",
NULL,
G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
| G_PARAM_CONSTRUCT_ONLY));
PROP_UNIQUE_ID,
g_param_spec_int ("unique-id",
"Unique ID",
"Unique plugin ID",
-1, G_MAXINT, -1,
G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
| G_PARAM_CONSTRUCT_ONLY));
/**
* XfcePanelPlugin:arguments:
@ -373,7 +373,7 @@ xfce_panel_plugin_init (XfcePanelPlugin *plugin)
/* initialize plugin value */
plugin->priv->name = NULL;
plugin->priv->display_name = NULL;
plugin->priv->id = NULL;
plugin->priv->unique_id = -1;
plugin->priv->property_base = NULL;
plugin->priv->arguments = NULL;
plugin->priv->size = 0;
@ -395,8 +395,8 @@ xfce_panel_plugin_init (XfcePanelPlugin *plugin)
static void
xfce_panel_plugin_provider_init (XfcePanelPluginProviderIface *iface)
{
iface->get_name = (ProviderToPlugin) xfce_panel_plugin_get_name;
iface->get_id = (ProviderToPlugin) xfce_panel_plugin_get_id;
iface->get_name = (ProviderToPluginChar) xfce_panel_plugin_get_name;
iface->get_unique_id = (ProviderToPluginInt) xfce_panel_plugin_get_unique_id;
iface->set_size = xfce_panel_plugin_set_size;
iface->set_orientation = xfce_panel_plugin_set_orientation;
iface->set_screen_position = xfce_panel_plugin_set_screen_position;
@ -423,8 +423,8 @@ xfce_panel_plugin_get_property (GObject *object,
g_value_set_static_string (value, private->display_name);
break;
case PROP_ID:
g_value_set_static_string (value, private->id);
case PROP_UNIQUE_ID:
g_value_set_int (value, private->unique_id);
break;
case PROP_ARGUMENTS:
@ -457,8 +457,8 @@ xfce_panel_plugin_set_property (GObject *object,
private->display_name = g_value_dup_string (value);
break;
case PROP_ID:
private->id = g_value_dup_string (value);
case PROP_UNIQUE_ID:
private->unique_id = g_value_get_int (value);
break;
case PROP_ARGUMENTS:
@ -504,7 +504,6 @@ xfce_panel_plugin_finalize (GObject *object)
/* cleanup */
g_free (plugin->priv->name);
g_free (plugin->priv->display_name);
g_free (plugin->priv->id);
g_free (plugin->priv->property_base);
g_strfreev (plugin->priv->arguments);
@ -765,12 +764,11 @@ xfce_panel_plugin_relative_filename (XfcePanelPlugin *plugin)
{
panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), NULL);
panel_return_val_if_fail (xfce_panel_plugin_get_name (plugin) != NULL, NULL);
panel_return_val_if_fail (xfce_panel_plugin_get_id (plugin) != NULL, NULL);
panel_return_val_if_fail (xfce_panel_plugin_get_unique_id (plugin) != -1, NULL);
/* return the relative configuration filename */
return g_strdup_printf (PANEL_PLUGIN_RELATIVE_PATH,
xfce_panel_plugin_get_name (plugin),
xfce_panel_plugin_get_id (plugin));
plugin->priv->name, plugin->priv->unique_id);
}
@ -932,18 +930,12 @@ xfce_panel_plugin_get_display_name (XfcePanelPlugin *plugin)
/**
* xfce_panel_plugin_get_id:
* @plugin :
*
* Return value: the unique id of the panel plugin.
**/
PANEL_SYMBOL_EXPORT const gchar *
xfce_panel_plugin_get_id (XfcePanelPlugin *plugin)
gint
xfce_panel_plugin_get_unique_id (XfcePanelPlugin *plugin)
{
g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), NULL);
g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), -1);
return plugin->priv->id;
return plugin->priv->unique_id;
}
@ -963,7 +955,8 @@ xfce_panel_plugin_get_property_base (XfcePanelPlugin *plugin)
/* create the propert if needed */
if (plugin->priv->property_base == NULL)
plugin->priv->property_base = g_strdup_printf (PANEL_PLUGIN_PROPERTY_BASE, plugin->priv->id);
plugin->priv->property_base = g_strdup_printf (PANEL_PLUGIN_PROPERTY_BASE,
plugin->priv->unique_id);
return plugin->priv->property_base;
}

6
libxfce4panel/xfce-panel-plugin.h

@ -64,10 +64,6 @@ struct _XfcePanelPluginClass
void (*reserved2) (void);
void (*reserved3) (void);
void (*reserved4) (void);
void (*reserved5) (void);
void (*reserved6) (void);
void (*reserved7) (void);
void (*reserved8) (void);
};
struct _XfcePanelPlugin
@ -87,7 +83,7 @@ const gchar *xfce_panel_plugin_get_name (XfcePanelPlugin *p
const gchar *xfce_panel_plugin_get_display_name (XfcePanelPlugin *plugin);
const gchar *xfce_panel_plugin_get_id (XfcePanelPlugin *plugin);
gint xfce_panel_plugin_get_unique_id (XfcePanelPlugin *plugin);
const gchar *xfce_panel_plugin_get_property_base (XfcePanelPlugin *plugin);

5
libxfce4panel/xfce-scaled-image.c

@ -25,6 +25,7 @@
#include <gtk/gtk.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>
#define MAX_PIXBUF_SIZE (128)
@ -400,7 +401,7 @@ xfce_scaled_image_set_from_icon_name (XfceScaledImage *image,
xfce_scaled_image_cleanup (image);
/* set the new icon name */
if (G_LIKELY (icon_name && *icon_name != '\0'))
if (G_LIKELY (IS_STRING (icon_name)))
image->icon_name = g_strdup (icon_name);
/* queue a resize */
@ -422,7 +423,7 @@ xfce_scaled_image_set_from_file (XfceScaledImage *image,
/* cleanup */
xfce_scaled_image_cleanup (image);
if (G_LIKELY (filename && *filename != '\0'))
if (G_LIKELY (IS_STRING (filename)))
{
/* try to load the image from the file */
pixbuf = gdk_pixbuf_new_from_file (filename, &error);

26
panel/panel-application.c

@ -57,7 +57,7 @@ static gboolean panel_application_plugin_insert (PanelApplication *a
PanelWindow *window,
GdkScreen *screen,
const gchar *name,
const gchar *id,
gint unique_id,
gchar **arguments,
gint position);
static gboolean panel_application_save_timeout (gpointer user_data);
@ -251,7 +251,8 @@ panel_application_load (PanelApplication *application)
guint i, n_panels;
guint j, n_plugins;
gchar buf[100];
gchar *name, *id;
gchar *name;
gint unique_id;
panel_return_if_fail (PANEL_IS_APPLICATION (application));
panel_return_if_fail (XFCONF_IS_CHANNEL (application->xfconf));
@ -275,15 +276,14 @@ panel_application_load (PanelApplication *application)
{
/* read the plugin id */
g_snprintf (buf, sizeof (buf), "/panels/panel-%u/plugins/plugin-%u/id", i, j);
id = xfconf_channel_get_string (channel, buf, NULL);
unique_id = xfconf_channel_get_int (channel, buf, -1);
panel_application_plugin_insert (application, window,
gtk_window_get_screen (GTK_WINDOW (window)),
name, id, NULL, -1);
name, unique_id, NULL, -1);
/* cleanup */
g_free (name);
g_free (id);
}
}
@ -389,12 +389,12 @@ panel_application_plugin_provider_signal (XfcePanelPluginProvider *provide
case REMOVE_PLUGIN:
/* create the xfconf property base */
property = g_strdup_printf (PANEL_PLUGIN_PROPERTY_BASE,
xfce_panel_plugin_provider_get_id (provider));
xfce_panel_plugin_provider_get_unique_id (provider));
/* build the plugin rc filename */
filename = g_strdup_printf (PANEL_PLUGIN_RELATIVE_PATH,
xfce_panel_plugin_provider_get_name (provider),
xfce_panel_plugin_provider_get_id (provider));
xfce_panel_plugin_provider_get_unique_id (provider));
/* destroy the plugin if it's a panel plugin (ie. not external) */
if (XFCE_IS_PANEL_PLUGIN (provider))
@ -437,7 +437,7 @@ panel_application_plugin_insert (PanelApplication *application,
PanelWindow *window,
GdkScreen *screen,
const gchar *name,
const gchar *id,
gint unique_id,
gchar **arguments,
gint position)
{
@ -451,7 +451,7 @@ panel_application_plugin_insert (PanelApplication *application,
panel_return_val_if_fail (name != NULL, FALSE);
/* create a new panel plugin */
provider = panel_module_factory_create_plugin (application->factory, screen, name, id, arguments);
provider = panel_module_factory_create_plugin (application->factory, screen, name, unique_id, arguments);
if (G_LIKELY (provider != NULL))
{
@ -617,7 +617,7 @@ panel_application_drag_data_received (GtkWidget *itembar,
/* create a new item with a unique id */
succeed = panel_application_plugin_insert (application, window, screen, name,
NULL, NULL, position);
-1, NULL, position);
}
break;
@ -758,7 +758,7 @@ panel_application_save (PanelApplication *application,
/* save the plugin id */
g_snprintf (buf, sizeof (buf), "/panels/panel-%u/plugins/plugin-%u/id", i, j);
xfconf_channel_set_string (channel, buf, xfce_panel_plugin_provider_get_id (provider));
xfconf_channel_set_int (channel, buf, xfce_panel_plugin_provider_get_unique_id (provider));
/* ask the plugin to save */
if (save_plugin_providers)
@ -840,9 +840,9 @@ panel_application_add_new_item (PanelApplication *application,
/* get the window */
window = g_slist_nth_data (application->windows, nth);
/* add the panel to the end of the choosen window */
/* add the plugin to the end of the choosen window */
panel_application_plugin_insert (application, window, gtk_widget_get_screen (GTK_WIDGET (window)),
plugin_name, NULL, arguments, -1);
plugin_name, -1, arguments, -1);
}
else
{

14
panel/panel-dbus-service-infos.xml

@ -75,44 +75,42 @@
</method>
<!--
GetProperty (plugin-name : STRING, property : STRING, value : VARIANT) : VOID
GetProperty (plugin-id : INTEGER, property : STRING, value : VARIANT) : VOID
plugin_name : Plugin id of the plugin requesting the property.
property : Name of the property.
value : GValue with the property value.
-->
<method name="GetProperty">
<arg name="plugin_id" direction="in" type="s" />
<arg name="plugin_id" direction="in" type="i" />
<arg name="property" direction="in" type="s" />
<arg name="value" direction="out" type="v" />
</method>
<!--
SetProperty (plugin-name : STRING, property : STRING, value : VARIANT) : VOID
SetProperty (plugin-id : INTEGER, property : STRING, value : VARIANT) : VOID
plugin_name : Plugin id of the plugin setting the property.
property : Name of the property.
value : GValue with the property value.
-->
<method name="SetProperty">
<arg name="plugin_id" direction="in" type="s" />
<arg name="plugin_id" direction="in" type="i" />
<arg name="property" direction="in" type="s" />
<arg name="value" direction="in" type="v" />
</method>
<!--
PropertyChanged (plugin-name : STRING, property : STRING, value : VARIANT) : VOID
PropertyChanged (plugin-id : INTEGER, property : STRING, value : VARIANT) : VOID
plugin_name : Plugin id of the plugin this signal was send to.
property : Name of the property that has been changed.
value : GValue with the property value.
-->
<signal name="PropertyChanged">
<arg name="plugin_id" type="s" />
<arg name="plugin_id" type="i" />
<arg name="property" type="s" />
<arg name="value" type="v"/>
</signal>
</interface>
</node>

20
panel/panel-dbus-service.c

@ -91,15 +91,15 @@ panel_dbus_service_class_init (PanelDBusServiceClass *klass)
/**
* Emited when a plugin property changes
**/
/* TODO implement this */
/* TODO implement this (update: no idea, what TODO here...) */
dbus_service_signals[PROPERTY_CHANGED] =
g_signal_new (I_("property-changed"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
panel_marshal_VOID__STRING_STRING_BOXED,
panel_marshal_VOID__INT_STRING_BOXED,
G_TYPE_NONE, 3,
G_TYPE_STRING,
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_VALUE);
@ -259,7 +259,7 @@ panel_dbus_service_terminate (PanelDBusService *service,
static gboolean
panel_dbus_service_get_property (PanelDBusService *service,
const gchar *plugin_id,
gint plugin_id,
const gchar *property,
GValue *value,
GError *error)
@ -271,7 +271,7 @@ panel_dbus_service_get_property (PanelDBusService *service,
gboolean succeed = FALSE;
panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
panel_return_val_if_fail (plugin_id != NULL, FALSE);
panel_return_val_if_fail (plugin_id != -1, FALSE);
panel_return_val_if_fail (property != NULL, FALSE);
/* get the module factory */
@ -311,7 +311,7 @@ panel_dbus_service_get_property (PanelDBusService *service,
static gboolean
panel_dbus_service_set_property (PanelDBusService *service,
const gchar *plugin_id,
gint plugin_id,
const gchar *property,
const GValue *value,
GError *error)
@ -320,7 +320,7 @@ panel_dbus_service_set_property (PanelDBusService *service,
XfcePanelPluginProvider *provider;
panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
panel_return_val_if_fail (plugin_id != NULL, FALSE);
panel_return_val_if_fail (plugin_id != -1, FALSE);
panel_return_val_if_fail (property != NULL, FALSE);
panel_return_val_if_fail (value && G_TYPE_CHECK_VALUE (value), FALSE);
@ -367,14 +367,14 @@ panel_dbus_service_get (void)
void
panel_dbus_service_set_plugin_property (const gchar *plugin_id,
panel_dbus_service_set_plugin_property (gint plugin_id,
const gchar *property,
const GValue *value)
{
PanelDBusService *service;
panel_return_if_fail (plugin_id && *plugin_id != '\0');
panel_return_if_fail (property && *property != '\0');
panel_return_if_fail (plugin_id != -1);
panel_return_if_fail (IS_STRING (property));
panel_return_if_fail (value && G_TYPE_CHECK_VALUE (value));
/* get the dbus service */

2
panel/panel-dbus-service.h

@ -36,7 +36,7 @@ GType panel_dbus_service_get_type (void) G_GNUC_CONST;
PanelDBusService *panel_dbus_service_get (void);
void panel_dbus_service_set_plugin_property (const gchar *plugin_id,
void panel_dbus_service_set_plugin_property (gint plugin_id,
const gchar *property,
const GValue *value);

4
panel/panel-item-dialog.c

@ -175,7 +175,7 @@ panel_item_dialog_init (PanelItemDialog *dialog)
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
_widget_set_tooltip_text (entry, _("Enter search phrase here"));
gtk_widget_set_tooltip_text (entry, _("Enter search phrase here"));
gtk_widget_show (entry);
/* scroller */
@ -593,7 +593,7 @@ panel_item_dialog_visible_func (GtkTreeModel *model,
/* get the search string from the entry */
text = gtk_entry_get_text (entry);
if (G_UNLIKELY (text == NULL || *text == '\0'))
if (G_UNLIKELY (!IS_STRING (text)))
return TRUE;
/* get the data from the model */

2
panel/panel-marshal.list

@ -1 +1 @@
VOID:STRING,STRING,BOXED
VOID:INT,STRING,BOXED

37
panel/panel-module-factory.c

@ -113,7 +113,7 @@ panel_module_factory_init (PanelModuleFactory *factory)
/* create hash tables */
factory->modules = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
factory->plugins = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
factory->plugins = g_hash_table_new_full (g_int_hash, g_int_equal, NULL, NULL);
/* load all the modules */
panel_module_factory_load_modules (factory);
@ -210,7 +210,8 @@ panel_module_factory_load_modules (PanelModuleFactory *factory)
g_hash_table_insert (factory->modules, internal_name, module);
/* check if this is the launcher */
if (factory->has_launcher == FALSE && exo_str_is_equal (LAUNCHER_PLUGIN_NAME, internal_name))
if (factory->has_launcher == FALSE
&& exo_str_is_equal (LAUNCHER_PLUGIN_NAME, internal_name))
factory->has_launcher = TRUE;
}
else
@ -330,20 +331,6 @@ panel_module_factory_get_modules_foreach (gpointer key,
static const gchar *
panel_module_factory_get_unique_id (void)
{
static gint counter = 0;
static gchar id[30];
/* create a unique if of the current time and counter */
g_snprintf (id, sizeof (id), "%ld%d", time (NULL), counter++);
return id;
}
GList *
panel_module_factory_get_modules (PanelModuleFactory *factory)
{
@ -380,12 +367,12 @@ panel_module_factory_has_module (PanelModuleFactory *factory,
XfcePanelPluginProvider *
panel_module_factory_get_plugin (PanelModuleFactory *factory,
const gchar *id)
gint unique_id)
{
panel_return_val_if_fail (PANEL_IS_MODULE_FACTORY (factory), NULL);
panel_return_val_if_fail (id != NULL, NULL);
panel_return_val_if_fail (unique_id != -1, NULL);
return g_hash_table_lookup (factory->plugins, id);
return g_hash_table_lookup (factory->plugins, &unique_id);
}
@ -394,11 +381,12 @@ XfcePanelPluginProvider *
panel_module_factory_create_plugin (PanelModuleFactory *factory,
GdkScreen *screen,
const gchar *name,
const gchar *id,
gint unique_id,
gchar **arguments)
{
PanelModule *module;
XfcePanelPluginProvider *provider;
static gint unique_id_counter = 0;
panel_return_val_if_fail (PANEL_IS_MODULE_FACTORY (factory), NULL);
panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
@ -415,15 +403,16 @@ panel_module_factory_create_plugin (PanelModuleFactory *factory,
}
/* make sure this plugin has a unique id */
while (id == NULL || g_hash_table_lookup (factory->plugins, id) != NULL)
id = panel_module_factory_get_unique_id ();
while (unique_id == -1
|| g_hash_table_lookup (factory->plugins, &unique_id) != NULL)
unique_id = ++unique_id_counter;
/* create the new module */
provider = panel_module_create_plugin (module, screen, name, id, arguments);
provider = panel_module_create_plugin (module, screen, name, unique_id, arguments);
/* insert plugin in the hash table */
if (G_LIKELY (provider))
g_hash_table_insert (factory->plugins, g_strdup (id), provider);
g_hash_table_insert (factory->plugins, &unique_id, provider);
return provider;
}

4
panel/panel-module-factory.h

@ -53,12 +53,12 @@ gboolean panel_module_factory_has_module (PanelModuleFa
const gchar *name);
XfcePanelPluginProvider *panel_module_factory_get_plugin (PanelModuleFactory *factory,
const gchar *id);
gint unique_id);
XfcePanelPluginProvider *panel_module_factory_create_plugin (PanelModuleFactory *factory,
GdkScreen *screen,
const gchar *name,
const gchar *id,
gint unique_id,
gchar **arguments);
G_END_DECLS

12
panel/panel-module.c

@ -248,7 +248,7 @@ panel_module_new_from_desktop_file (const gchar *filename,
const gchar *value;
gchar *path;
panel_return_val_if_fail (filename != NULL && *filename != '\0', NULL);
panel_return_val_if_fail (IS_STRING (filename), NULL);
/* open the desktop file */
rc = xfce_rc_simple_open (filename, TRUE);
@ -330,7 +330,7 @@ XfcePanelPluginProvider *
panel_module_create_plugin (PanelModule *module,
GdkScreen *screen,
const gchar *name,
const gchar *id,
gint unique_id,
gchar **arguments)
{
XfcePanelPluginProvider *plugin = NULL;
@ -338,8 +338,8 @@ panel_module_create_plugin (PanelModule *module,
panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
panel_return_val_if_fail (G_IS_TYPE_MODULE (module), NULL);
panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
panel_return_val_if_fail (name != NULL && *name != '\0', NULL);
panel_return_val_if_fail (id != NULL && *id != '\0', NULL);
panel_return_val_if_fail (IS_STRING (name), NULL);
panel_return_val_if_fail (unique_id != -1, NULL);
panel_return_val_if_fail (exo_str_is_equal (name, G_TYPE_MODULE (module)->name), NULL);
/* return null if the module is not usable (unique and already used) */
@ -349,7 +349,7 @@ panel_module_create_plugin (PanelModule *module,
if (module->run_in_wrapper)
{
/* create external plugin */
plugin = panel_plugin_external_new (module, name, id, arguments);
plugin = panel_plugin_external_new (module, name, unique_id, arguments);
}
else
{
@ -362,7 +362,7 @@ panel_module_create_plugin (PanelModule *module,
panel_return_val_if_fail (module->construct_func != NULL, NULL);
/* create a new panel plugin */
plugin = (*module->construct_func) (name, id, module->name, arguments, screen);
plugin = (*module->construct_func) (name, unique_id, module->name, arguments, screen);
}
else
{

2
panel/panel-module.h

@ -46,7 +46,7 @@ PanelModule *panel_module_new_from_desktop_file (const gchar
XfcePanelPluginProvider *panel_module_create_plugin (PanelModule *module,
GdkScreen *screen,
const gchar *name,
const gchar *id,
gint unique_id,
gchar **arguments);
const gchar *panel_module_get_internal_name (PanelModule *module);

52
panel/panel-plugin-external.c

@ -57,7 +57,7 @@ static void panel_plugin_external_plug_added (GtkSocket
static void panel_plugin_external_provider_signal (XfcePanelPluginProvider *provider,
XfcePanelPluginProviderSignal signal);
static const gchar *panel_plugin_external_get_name (XfcePanelPluginProvider *provider);
static const gchar *panel_plugin_external_get_id (XfcePanelPluginProvider *provider);
static gint panel_plugin_external_get_unique_id (XfcePanelPluginProvider *provider);
static void panel_plugin_external_set_size (XfcePanelPluginProvider *provider,
gint size);
static void panel_plugin_external_set_orientation (XfcePanelPluginProvider *provider,
@ -82,7 +82,7 @@ struct _PanelPluginExternal
GtkSocket __parent__;
/* plugin information */
gchar *id;
gint unique_id;
/* startup arguments */
gchar **arguments;
@ -139,7 +139,7 @@ static void
panel_plugin_external_init (PanelPluginExternal *external)
{
/* initialize */
external->id = NULL;
external->unique_id = -1;
external->module = NULL;
external->arguments = NULL;
external->dbus_queue = NULL;
@ -157,7 +157,7 @@ panel_plugin_external_provider_init (XfcePanelPluginProviderIface *iface)
{
iface->provider_signal = panel_plugin_external_provider_signal;
iface->get_name = panel_plugin_external_get_name;
iface->get_id = panel_plugin_external_get_id;
iface->get_unique_id = panel_plugin_external_get_unique_id;
iface->set_size = panel_plugin_external_set_size;
iface->set_orientation = panel_plugin_external_set_orientation;
iface->set_screen_position = panel_plugin_external_set_screen_position;
@ -174,7 +174,6 @@ panel_plugin_external_finalize (GObject *object)
QueuedData *data;
/* cleanup */
g_free (external->id);
g_strfreev (external->arguments);
/* free the queue */
@ -201,15 +200,16 @@ panel_plugin_external_realize (GtkWidget *widget)
gchar **argv;
GError *error = NULL;
gboolean succeed;
gchar *socket_id;
gchar *socket_id, *unique_id;
gint i, argc = 12;
GdkScreen *screen;
/* realize the socket first */
(*GTK_WIDGET_CLASS (panel_plugin_external_parent_class)->realize) (widget);
/* get the socket id in a string */
/* get the socket id and unique id in a string */
socket_id = g_strdup_printf ("%d", gtk_socket_get_id (GTK_SOCKET (widget)));
unique_id = g_strdup_printf ("%d", external->unique_id);
/* add the number of arguments to the argv count */
if (G_UNLIKELY (external->arguments != NULL))
@ -223,7 +223,7 @@ panel_plugin_external_realize (GtkWidget *widget)
argv[1] = "-n";
argv[2] = (gchar *) panel_module_get_internal_name (external->module);
argv[3] = "-i";
argv[4] = (gchar *) external->id;
argv[4] = unique_id;
argv[5] = "-d";
argv[6] = (gchar *) panel_module_get_name (external->module);
argv[7] = "-f";
@ -247,6 +247,7 @@ panel_plugin_external_realize (GtkWidget *widget)
/* cleanup */
g_free (socket_id);
g_free (unique_id);
g_free (argv);
/* handle problem */
@ -273,7 +274,7 @@ panel_plugin_external_unrealize (GtkWidget *widget)
g_value_set_boolean (&value, FALSE);
/* send (don't queue here) */
panel_dbus_service_set_plugin_property (external->id, "Quit", &value);
panel_dbus_service_set_plugin_property (external->unique_id, "Quit", &value);
/* unset */
g_value_unset (&value);
@ -335,9 +336,9 @@ panel_plugin_external_plug_removed (GtkSocket *socket)
response = GTK_RESPONSE_OK;
/* print a message we did an autorestart */
g_message ("Automatically restarting plugin %s-%s, try %d",
g_message ("Automatically restarting plugin %s-%d, try %d",
panel_module_get_internal_name (external->module),
external->id, external->n_restarts);
external->unique_id, external->n_restarts);
}
/* handle the response */
@ -381,11 +382,14 @@ panel_plugin_external_plug_added (GtkSocket *socket)
if (G_LIKELY (external->dbus_queue))
{
/* reverse the order fo the queue, since we prepended all the time */
external->dbus_queue = g_slist_reverse (external->dbus_queue);
/* flush the queue */
for (li = external->dbus_queue; li != NULL; li = li->next)
{
data = li->data;
panel_dbus_service_set_plugin_property (external->id, data->property, &data->value);
panel_dbus_service_set_plugin_property (external->unique_id, data->property, &data->value);
g_value_unset (&data->value);
g_slice_free (QueuedData, data);
}
@ -432,13 +436,13 @@ panel_plugin_external_get_name (XfcePanelPluginProvider *provider)
static const gchar *
panel_plugin_external_get_id (XfcePanelPluginProvider *provider)
static gint
panel_plugin_external_get_unique_id (XfcePanelPluginProvider *provider)
{
panel_return_val_if_fail (PANEL_IS_PLUGIN_EXTERNAL (provider), NULL);
panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), NULL);
panel_return_val_if_fail (PANEL_IS_PLUGIN_EXTERNAL (provider), -1);
panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), -1);
return PANEL_PLUGIN_EXTERNAL (provider)->id;
return PANEL_PLUGIN_EXTERNAL (provider)->unique_id;
}
@ -452,12 +456,12 @@ panel_plugin_external_set_property (PanelPluginExternal *external,
panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external));
panel_return_if_fail (value && G_TYPE_CHECK_VALUE (value));
panel_return_if_fail (property != NULL && *property != '\0');
panel_return_if_fail (IS_STRING (property));
if (G_LIKELY (external->plug_embedded))
{
/* directly send the new property */
panel_dbus_service_set_plugin_property (external->id, property, value);
panel_dbus_service_set_plugin_property (external->unique_id, property, value);
}
else
{
@ -467,8 +471,8 @@ panel_plugin_external_set_property (PanelPluginExternal *external,
g_value_init (&data->value, G_VALUE_TYPE (value));
g_value_copy (value, &data->value);
/* add to the queue */
external->dbus_queue = g_slist_append (external->dbus_queue, data);
/* add to the queue (still in reversed order here) */
external->dbus_queue = g_slist_prepend (external->dbus_queue, data);
}
}
@ -585,20 +589,20 @@ panel_plugin_external_set_sensitive (PanelPluginExternal *external)
XfcePanelPluginProvider *
panel_plugin_external_new (PanelModule *module,
const gchar *name,
const gchar *id,
gint unique_id,
gchar **arguments)
{
PanelPluginExternal *external;
panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
panel_return_val_if_fail (name != NULL, NULL);
panel_return_val_if_fail (id != NULL, NULL);
panel_return_val_if_fail (unique_id != -1, NULL);
/* create new object */
external = g_object_new (PANEL_TYPE_PLUGIN_EXTERNAL, NULL);
/* set name, id and module */
external->id = g_strdup (id);
external->unique_id = unique_id;
external->module = g_object_ref (G_OBJECT (module));
external->arguments = g_strdupv (arguments);

2
panel/panel-plugin-external.h

@ -41,7 +41,7 @@ GType panel_plugin_external_get_type (void) G_GNU
XfcePanelPluginProvider *panel_plugin_external_new (PanelModule *module,
const gchar *name,
const gchar *id,
gint unique_id,
gchar **arguments);
void panel_plugin_external_set_background_alpha (PanelPluginExternal *external,

57
panel/panel-private.c

@ -19,60 +19,3 @@
#include <panel/panel-private.h>
#include <libxfce4panel/libxfce4panel.h>
#if !GTK_CHECK_VERSION (2,12,0)
void
_widget_set_tooltip_text (GtkWidget *widget,
const gchar *text)
{
static GtkTooltips tooltips = NULL;
panel_return_if_fail (GTK_IS_WIDGET (widget));
/* allocate shared tooltip */
if (G_UNLIKELY (tooltips == NULL))
tooltips = gtk_tooltips_new ();
/* set tip */
gtk_tooltips_set_tip (tooltips, widget, text);
}
void
_window_set_opacity (GtkWindow *window,
gdouble opacity)
{
guint32 cardinal;
panel_return_if_fail (GTK_IS_WINDOW (window));
/* prevent warnings */
gdk_error_trap_push ();
if (opacity >= 1.00 || opacity < 0.00)
{
/* remove property */
gdk_property_delete (GTK_WIDGET (window)->window,
gdk_atom_intern_static_string ("_NET_WM_WINDOW_OPACITY"));
}
else
{
/* opacity value for the window manager */
cardinal = opacity * 0xffffffff;
/* set window property */
gdk_property_change (GTK_WIDGET (window)->window,
gdk_atom_intern_static_string ("_NET_WM_WINDOW_OPACITY"),
gdk_atom_intern_static_string ("CARDINAL"), 32,
GDK_PROP_MODE_REPLACE,
(guchar *) &cardinal, 1L);
}
/* unlock warnings */
gdk_error_trap_pop ();
}
#endif

13
panel/panel-private.h

@ -29,19 +29,6 @@ G_BEGIN_DECLS
#define PANEL_UNSET_FLAG(flags,flag) G_STMT_START{ ((flags) &= ~(flag)); }G_STMT_END
#define PANEL_HAS_FLAG(flags,flag) (((flags) & (flag)) != 0)
/* handling deprecated functions in gtk */
#if GTK_CHECK_VERSION (2,12,0)
#define _widget_set_tooltip_text(widget,text) gtk_widget_set_tooltip_text (widget, text)
#define _window_set_opacity(window,opacity) gtk_window_set_opacity (window, opacity)
#else
void _widget_set_tooltip_text (GtkWidget *widget,
const gchar *text);
void _window_set_opacity (GtkWindow *window,
gdouble opacity);
#endif
G_END_DECLS
#endif /* !__PANEL_PRIVATE_H__ */

10
panel/panel-window.c

@ -523,10 +523,10 @@ panel_window_set_property (GObject *object,
/* set the autohide window opacity if created */
if (window->autohide_window)
_window_set_opacity (GTK_WINDOW (window->autohide_window), window->leave_opacity);
gtk_window_set_opacity (GTK_WINDOW (window->autohide_window), window->leave_opacity);
/* update the panel window opacity */
_window_set_opacity (GTK_WINDOW (window), window->leave_opacity);
gtk_window_set_opacity (GTK_WINDOW (window), window->leave_opacity);
break;
case PROP_BACKGROUND_ALPHA:
@ -998,7 +998,7 @@ panel_window_autohide_window (PanelWindow *window)
gtk_window_move (GTK_WINDOW (popup), OFFSCREEN, OFFSCREEN);
/* set window opacity */
_window_set_opacity (GTK_WINDOW (popup), window->leave_opacity);
gtk_window_set_opacity (GTK_WINDOW (popup), window->leave_opacity);
/* show the window */
gtk_widget_show (popup);
@ -1020,7 +1020,7 @@ panel_window_enter_notify_event (GtkWidget *widget,
/* set the opacity (when they differ) */
if (window->leave_opacity != window->enter_opacity)
_window_set_opacity (GTK_WINDOW (window), window->enter_opacity);
gtk_window_set_opacity (GTK_WINDOW (window), window->enter_opacity);
/* stop a running autohide timeout */
if (window->autohide_timer != 0)
@ -1047,7 +1047,7 @@ panel_window_leave_notify_event (GtkWidget *widget,
/* set the opacity (when they differ) */
if (window->leave_opacity != window->enter_opacity)
_window_set_opacity (GTK_WINDOW (window), window->leave_opacity);
gtk_window_set_opacity (GTK_WINDOW (window), window->leave_opacity);
/* stop a running autohide timeout */
if (window->autohide_timer != 0)

6
plugins/tasklist/plugin.c

@ -164,10 +164,9 @@ tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
GtkBuilder *builder;
GObject *dialog;
GObject *object;
GError *error = NULL;
builder = gtk_builder_new ();
if (gtk_builder_add_from_string (builder, tasklist_dialog_glade, tasklist_dialog_glade_length, &error))
if (gtk_builder_add_from_string (builder, tasklist_dialog_glade, tasklist_dialog_glade_length, NULL))
{
dialog = gtk_builder_get_object (builder, "dialog");
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, builder);
@ -202,9 +201,6 @@ tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
{
/* release the builder */
g_object_unref (G_OBJECT (builder));
g_message ("%s", error->message);
g_error_free (error);
}
}

63
wrapper/main.c

@ -51,19 +51,18 @@
gchar *opt_name = NULL;
static gchar *opt_display_name = NULL;
static gchar *opt_id = NULL;
static gint opt_unique_id = -1;
static gchar *opt_filename = NULL;
static gint opt_socket_id = 0;
static gchar **opt_arguments = NULL;
static GQuark plug_quark = 0;
static GOptionEntry option_entries[] =
{
{ "name", 'n', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_name, NULL, NULL },
{ "display-name", 'd', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_display_name, NULL, NULL },
{ "id", 'i', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_id, NULL, NULL },
{ "unique-id", 'i', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_INT, &opt_unique_id, NULL, NULL },
{ "filename", 'f', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_filename, NULL, NULL },
{ "socket-id", 's', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_INT, &opt_socket_id, NULL, NULL },
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &opt_arguments, NULL, NULL },
@ -74,7 +73,7 @@ static GOptionEntry option_entries[] =
static void
dbus_gproxy_provider_property_changed (DBusGProxy *dbus_gproxy,
const gchar *plugin_id,
gint plugin_id,
const gchar *property,
const GValue *value,
XfcePanelPluginProvider *provider)
@ -83,14 +82,15 @@ dbus_gproxy_provider_property_changed (DBusGProxy *dbus_gproxy,
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
panel_return_if_fail (value && G_TYPE_CHECK_VALUE (value));
panel_return_if_fail (opt_unique_id == xfce_panel_plugin_provider_get_unique_id (provider));
/* check if the signal is for this panel */
if (!plugin_id || strcmp (plugin_id, xfce_panel_plugin_provider_get_id (provider)) != 0)
if (plugin_id != opt_unique_id)
return;
/* handle the property */
if (G_UNLIKELY (property == NULL || *property == '\0'))
g_message ("External plugin '%s' received null property", plugin_id);
if (G_UNLIKELY (!IS_STRING (property)))
g_message ("External plugin '%s-%d' received null property.", opt_name, opt_unique_id);
else if (strcmp (property, "Size") == 0)
xfce_panel_plugin_provider_set_size (provider, g_value_get_int (value));
else if (strcmp (property, "Orientation") == 0)
@ -113,7 +113,7 @@ dbus_gproxy_provider_property_changed (DBusGProxy *dbus_gproxy,
else if (strcmp (property, "ActivePanel") == 0)
wrapper_plug_set_selected (plug, g_value_get_boolean (value));
else
g_message ("External plugin '%s' received unknown property '%s'", plugin_id, property);
g_message ("External plugin '%s-%d' received unknown property '%s'.", opt_name, opt_unique_id, property);
}
}
@ -124,16 +124,13 @@ dbus_gproxy_provider_signal (XfcePanelPluginProvider *provider,
XfcePanelPluginProviderSignal signal,
DBusGProxy *dbus_gproxy)
{
GValue value = { 0, };
GError *error = NULL;
const gchar *id;
guint active_panel = 0;
gboolean result = FALSE;
GValue value = { 0, };
GError *error = NULL;
guint active_panel = 0;
gboolean result = FALSE;
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
/* get the plugin id */
id = xfce_panel_plugin_provider_get_id (provider);
panel_return_if_fail (opt_unique_id == xfce_panel_plugin_provider_get_unique_id (provider));
/* handle the signal */
switch (signal)
@ -149,7 +146,8 @@ dbus_gproxy_provider_signal (XfcePanelPluginProvider *provider,
g_value_set_uint (&value, signal);
/* invoke the method */
result = wrapper_dbus_client_set_property (dbus_gproxy, id, "ProviderSignal", &value, &error);
result = wrapper_dbus_client_set_property (dbus_gproxy, opt_unique_id,
"ProviderSignal", &value, &error);
/* unset */
g_value_unset (&value);
@ -158,7 +156,8 @@ dbus_gproxy_provider_signal (XfcePanelPluginProvider *provider,
case ADD_NEW_ITEMS:
case PANEL_PREFERENCES:
/* try to get the panel number of this plugin */
if (wrapper_dbus_client_get_property (dbus_gproxy, id, "PanelNumber", &value, NULL))
if (wrapper_dbus_client_get_property (dbus_gproxy, opt_unique_id,
"PanelNumber", &value, NULL))
{
/* set the panel number */
active_panel = g_value_get_uint (&value);
@ -173,7 +172,7 @@ dbus_gproxy_provider_signal (XfcePanelPluginProvider *provider,
break;
default:
g_critical ("Plugin '%s' received an unknown provider signal %d.", id, signal);
g_critical ("Plugin '%s-%d' received an unknown provider signal '%d'.", opt_name, opt_unique_id, signal);
return;
}
@ -205,8 +204,7 @@ dbus_gproxy_dbus_filter (DBusConnection *connection,
DBUS_TYPE_INVALID))
{
/* check if the panel service lost the owner, if so, leave the mainloop */
if (strcmp (service, "org.xfce.Panel") == 0
&& (new_owner == NULL || *new_owner == '\0'))
if (strcmp (service, "org.xfce.Panel") == 0 && !IS_STRING (new_owner))
gtk_main_quit ();
}
}
@ -256,7 +254,7 @@ main (gint argc, gchar **argv)
}
/* check if the module exists */
if (opt_filename == NULL || *opt_filename == '\0'
if (!IS_STRING (opt_filename)
|| g_file_test (opt_filename, G_FILE_TEST_EXISTS) == FALSE)
{
/* print error */
@ -268,9 +266,9 @@ main (gint argc, gchar **argv)
/* check if all the other arguments are defined */
if (opt_socket_id == 0
|| opt_name == NULL || *opt_name == '\0'
|| opt_id == NULL || *opt_id == '\0'
|| opt_display_name == NULL || *opt_display_name == '\0')
|| !IS_STRING (opt_name)
|| opt_unique_id == -1
|| !IS_STRING (opt_display_name))
{
/* print error */
g_critical ("One of the required arguments is missing.");
@ -280,7 +278,7 @@ main (gint argc, gchar **argv)
}
/* change the process name to something that makes sence */
g_snprintf (process_name, sizeof (process_name), "panel-%s", opt_name);
g_snprintf (process_name, sizeof (process_name), "panel-%s-%d", opt_name, opt_unique_id);
prctl (PR_SET_NAME, (gulong) process_name, 0, 0, 0);
/* try to connect to dbus */
@ -325,9 +323,9 @@ main (gint argc, gchar **argv)
}
/* setup signal for property changes */
dbus_g_object_register_marshaller (wrapper_marshal_VOID__STRING_STRING_BOXED, G_TYPE_NONE,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
dbus_g_proxy_add_signal (dbus_gproxy, "PropertyChanged", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
dbus_g_object_register_marshaller (wrapper_marshal_VOID__INT_STRING_BOXED, G_TYPE_NONE,
G_TYPE_INT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
dbus_g_proxy_add_signal (dbus_gproxy, "PropertyChanged", G_TYPE_INT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
/* load the module and link the function */
module = g_module_open (opt_filename, G_MODULE_BIND_LOCAL);
@ -338,7 +336,7 @@ main (gint argc, gchar **argv)
&& !g_module_symbol (module, "__xpp_construct", (gpointer) &construct_func))