Browse Source

Move provider signal to the interface + some other fixes.

- Update TODO
 - Add provider_signal in the iface and use it in
   panel-plugin-external.c.
 - Direct call for provider_signal instead of
   g_signal_emit_by_name().
tags/xfce4-panel-4.10.0
Nick Schermer 11 years ago
parent
commit
f30ff1b3db
7 changed files with 82 additions and 56 deletions
  1. +4
    -1
      TODO
  2. +14
    -1
      libxfce4panel/xfce-panel-plugin-provider.c
  3. +25
    -18
      libxfce4panel/xfce-panel-plugin-provider.h
  4. +8
    -7
      libxfce4panel/xfce-panel-plugin.c
  5. +1
    -1
      panel/panel-dbus-service.c
  6. +26
    -24
      panel/panel-plugin-external.c
  7. +4
    -4
      wrapper/main.c

+ 4
- 1
TODO View File

@@ -27,4 +27,7 @@ Plugins
- Possible support for a 'desktop file only' launcher, on plugin
changes we edit the origional launcher (copy in
~/.local/share/applications/).
- Transparent tray icons.
- Transparent tray icons (Fixed in Gtk+?).
- Option to 'disable' tray icons instead of hiding them.
- Use libnotify for systray notifications, currently the code is disabled.

+ 14
- 1
libxfce4panel/xfce-panel-plugin-provider.c View File

@@ -71,7 +71,8 @@ xfce_panel_plugin_provider_class_init (gpointer klass)
g_signal_new (I_("provider-signal"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
G_STRUCT_OFFSET (XfcePanelPluginProviderIface, provider_signal),
NULL, NULL,
g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
}
@@ -138,3 +139,15 @@ xfce_panel_plugin_provider_save (XfcePanelPluginProvider *provider)

(*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->save) (provider);
}



void
xfce_panel_plugin_provider_send_signal (XfcePanelPluginProvider *provider,
XfcePanelPluginProviderSignal signal)
{
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
/* emit the signal */
g_signal_emit (G_OBJECT (provider), provider_signals[PROVIDER_SIGNAL], 0, signal);
}

+ 25
- 18
libxfce4panel/xfce-panel-plugin-provider.h View File

@@ -53,17 +53,21 @@ struct _XfcePanelPluginProviderIface
{
/*< private >*/
GTypeInterface __parent__;
/*< signals >*/
void (*provider_signal) (XfcePanelPluginProvider *provider,
XfcePanelPluginProviderSignal signal);

/*< public >*/
const gchar *(*get_name) (XfcePanelPluginProvider *provider);
const gchar *(*get_id) (XfcePanelPluginProvider *provider);
void (*set_size) (XfcePanelPluginProvider *provider,
gint size);
void (*set_orientation) (XfcePanelPluginProvider *provider,
GtkOrientation orientation);
void (*set_screen_position) (XfcePanelPluginProvider *provider,
XfceScreenPosition screen_position);
void (*save) (XfcePanelPluginProvider *provider);
const gchar *(*get_name) (XfcePanelPluginProvider *provider);
const gchar *(*get_id) (XfcePanelPluginProvider *provider);
void (*set_size) (XfcePanelPluginProvider *provider,
gint size);
void (*set_orientation) (XfcePanelPluginProvider *provider,
GtkOrientation orientation);
void (*set_screen_position) (XfcePanelPluginProvider *provider,
XfceScreenPosition screen_position);
void (*save) (XfcePanelPluginProvider *provider);
};

enum _XfcePanelPluginProviderSignal
@@ -82,20 +86,23 @@ enum _XfcePanelPluginProviderSignal

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_name (XfcePanelPluginProvider *provider);

const gchar *xfce_panel_plugin_provider_get_id (XfcePanelPluginProvider *provider);
const gchar *xfce_panel_plugin_provider_get_id (XfcePanelPluginProvider *provider);

void xfce_panel_plugin_provider_set_size (XfcePanelPluginProvider *provider,
gint size);
void xfce_panel_plugin_provider_set_size (XfcePanelPluginProvider *provider,
gint size);

void xfce_panel_plugin_provider_set_orientation (XfcePanelPluginProvider *provider,
GtkOrientation orientation);
void xfce_panel_plugin_provider_set_orientation (XfcePanelPluginProvider *provider,
GtkOrientation orientation);

void xfce_panel_plugin_provider_set_screen_position (XfcePanelPluginProvider *provider,
XfceScreenPosition screen_position);
void xfce_panel_plugin_provider_set_screen_position (XfcePanelPluginProvider *provider,
XfceScreenPosition screen_position);

void xfce_panel_plugin_provider_save (XfcePanelPluginProvider *provider);
void xfce_panel_plugin_provider_save (XfcePanelPluginProvider *provider);

void xfce_panel_plugin_provider_send_signal (XfcePanelPluginProvider *provider,
XfcePanelPluginProviderSignal signal);

G_END_DECLS



+ 8
- 7
libxfce4panel/xfce-panel-plugin.c View File

@@ -555,7 +555,7 @@ xfce_panel_plugin_menu_move (XfcePanelPlugin *plugin)
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (plugin));

/* move the plugin */
g_signal_emit_by_name (G_OBJECT (plugin), "provider-signal", MOVE_PLUGIN);
xfce_panel_plugin_provider_send_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin), MOVE_PLUGIN);
}


@@ -602,7 +602,7 @@ xfce_panel_plugin_menu_remove (XfcePanelPlugin *plugin)
}

/* ask the panel or wrapper to remove the plugin */
g_signal_emit_by_name (G_OBJECT (plugin), "provider-signal", REMOVE_PLUGIN);
xfce_panel_plugin_provider_send_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin), REMOVE_PLUGIN);
}

/* destroy */
@@ -618,7 +618,7 @@ xfce_panel_plugin_menu_add_items (XfcePanelPlugin *plugin)
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (plugin));

/* open items dialog */
g_signal_emit_by_name (G_OBJECT (plugin), "provider-signal", ADD_NEW_ITEMS);
xfce_panel_plugin_provider_send_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin), ADD_NEW_ITEMS);
}


@@ -630,7 +630,7 @@ xfce_panel_plugin_menu_panel_preferences (XfcePanelPlugin *plugin)
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (plugin));

/* open preferences dialog */
g_signal_emit_by_name (G_OBJECT (plugin), "provider-signal", PANEL_PREFERENCES);
xfce_panel_plugin_provider_send_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin), PANEL_PREFERENCES);
}


@@ -763,7 +763,7 @@ xfce_panel_plugin_unregister_menu (GtkMenu *menu,

/* emit signal to unlock the panel */
if (G_LIKELY (plugin->priv->registered_menus == 0))
g_signal_emit_by_name (G_OBJECT (plugin), "provider-signal", UNLOCK_PANEL);
xfce_panel_plugin_provider_send_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin), UNLOCK_PANEL);
}
}

@@ -994,7 +994,8 @@ xfce_panel_plugin_set_expand (XfcePanelPlugin *plugin,
plugin->priv->expand = expand;

/* emit signal (in provider) */
g_signal_emit_by_name (G_OBJECT (plugin), "provider-signal", expand ? EXPAND_PLUGIN : COLLAPSE_PLUGIN);
xfce_panel_plugin_provider_send_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin),
expand ? EXPAND_PLUGIN : COLLAPSE_PLUGIN);
}
}

@@ -1192,7 +1193,7 @@ xfce_panel_plugin_register_menu (XfcePanelPlugin *plugin,

/* tell panel it needs to lock */
if (G_LIKELY (plugin->priv->registered_menus == 1))
g_signal_emit_by_name (G_OBJECT (plugin), "provider-signal", LOCK_PANEL);
xfce_panel_plugin_provider_send_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin), LOCK_PANEL);
}




+ 1
- 1
panel/panel-dbus-service.c View File

@@ -335,7 +335,7 @@ panel_dbus_service_set_property (PanelDBusService *service,

/* emit the signal for the local plugin provider */
if (G_LIKELY (provider))
g_signal_emit_by_name (G_OBJECT (provider), "provider-signal", g_value_get_uint (value));
xfce_panel_plugin_provider_send_signal (XFCE_PANEL_PLUGIN_PROVIDER (provider), g_value_get_uint (value));

/* release the factory */
g_object_unref (G_OBJECT (factory));


+ 26
- 24
panel/panel-plugin-external.c View File

@@ -55,6 +55,8 @@ static void panel_plugin_external_realize (GtkWidget
static void panel_plugin_external_unrealize (GtkWidget *widget);
static gboolean panel_plugin_external_plug_removed (GtkSocket *socket);
static void panel_plugin_external_plug_added (GtkSocket *socket);
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 void panel_plugin_external_set_size (XfcePanelPluginProvider *provider,
@@ -65,8 +67,6 @@ static void panel_plugin_external_set_screen_position (XfcePanelPluginPr
XfceScreenPosition screen_position);
static void panel_plugin_external_save (XfcePanelPluginProvider *provider);
static void panel_plugin_external_set_sensitive (PanelPluginExternal *external);
static void panel_plugin_external_provider_signal (PanelPluginExternal *external,
XfcePanelPluginProviderSignal signal);
static void panel_plugin_external_set_property (PanelPluginExternal *external,
const gchar *property,
const GValue *value);
@@ -149,9 +149,6 @@ panel_plugin_external_init (PanelPluginExternal *external)

/* 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);

/* connect signal to monitor the remove plugin signal */
g_signal_connect (G_OBJECT (external), "provider-signal", G_CALLBACK (panel_plugin_external_provider_signal), NULL);
}


@@ -159,6 +156,7 @@ panel_plugin_external_init (PanelPluginExternal *external)
static void
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->set_size = panel_plugin_external_set_size;
@@ -415,6 +413,29 @@ panel_plugin_external_plug_added (GtkSocket *socket)



static void
panel_plugin_external_provider_signal (XfcePanelPluginProvider *provider,
XfcePanelPluginProviderSignal signal)
{
PanelPluginExternal *external = PANEL_PLUGIN_EXTERNAL (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 == 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));
}
}




static const gchar *
panel_plugin_external_get_name (XfcePanelPluginProvider *provider)
{
@@ -576,25 +597,6 @@ panel_plugin_external_set_sensitive (PanelPluginExternal *external)



static void
panel_plugin_external_provider_signal (PanelPluginExternal *external,
XfcePanelPluginProviderSignal signal)
{
panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external));

/* only handle the remove signal, everything else is handles in the panel-application */
if (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));
}
}



XfcePanelPluginProvider *
panel_plugin_external_new (PanelModule *module,
const gchar *name,


+ 4
- 4
wrapper/main.c View File

@@ -74,10 +74,10 @@ static GOptionEntry option_entries[] =

static void
dbus_gproxy_provider_property_changed (DBusGProxy *dbus_gproxy,
const gchar *plugin_id,
const gchar *property,
const GValue *value,
XfcePanelPluginProvider *provider)
const gchar *plugin_id,
const gchar *property,
const GValue *value,
XfcePanelPluginProvider *provider)
{
WrapperPlug *plug;



Loading…
Cancel
Save