[Xfce4-commits] <xfce4-panel:devel> Implement popup event for launchers.

Nick Schermer noreply at xfce.org
Sat Nov 28 21:02:08 CET 2009


Updating branch refs/heads/devel
         to 47808ab61034a96c26cd8a30cf063714d6457e37 (commit)
       from d2011b8929ec539170a88041afe787b2ac6d2979 (commit)

commit 47808ab61034a96c26cd8a30cf063714d6457e37
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Nov 28 20:33:46 2009 +0100

    Implement popup event for launchers.
    
    You can popup a launcher by using
    xfce4-panel --plugin-event=launcher:popup:bool:false.

 plugins/launcher/launcher.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index eb8d5e8..9eba83e 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -57,6 +57,7 @@ static void launcher_plugin_style_set (GtkWidget *widget, GtkStyle *previous_sty
 static void launcher_plugin_construct (XfcePanelPlugin *panel_plugin);
 static void launcher_plugin_free_data (XfcePanelPlugin *panel_plugin);
 static void launcher_plugin_removed (XfcePanelPlugin *panel_plugin);
+static gboolean launcher_plugin_remote_event (XfcePanelPlugin *panel_plugin, const gchar *name, const GValue *value);
 static void launcher_plugin_save (XfcePanelPlugin *panel_plugin);
 static void launcher_plugin_orientation_changed (XfcePanelPlugin *panel_plugin, GtkOrientation orientation);
 static gboolean launcher_plugin_size_changed (XfcePanelPlugin *panel_plugin, gint size);
@@ -197,6 +198,7 @@ launcher_plugin_class_init (LauncherPluginClass *klass)
   plugin_class->configure_plugin = launcher_plugin_configure_plugin;
   plugin_class->screen_position_changed = launcher_plugin_screen_position_changed;
   plugin_class->removed = launcher_plugin_removed;
+  plugin_class->remote_event = launcher_plugin_remote_event;
 
   g_object_class_install_property (gobject_class,
                                    PROP_ITEMS,
@@ -1020,6 +1022,27 @@ launcher_plugin_removed (XfcePanelPlugin *panel_plugin)
 
 
 
+static gboolean
+launcher_plugin_remote_event (XfcePanelPlugin *panel_plugin,
+                              const gchar     *name,
+                              const GValue    *value)
+{
+  LauncherPlugin *plugin = XFCE_LAUNCHER_PLUGIN (panel_plugin);
+
+  if (exo_str_is_equal (name, "popup")
+      && LIST_HAS_TWO_OR_MORE_ENTRIES (plugin->items)
+      && (plugin->menu == NULL || !GTK_WIDGET_VISIBLE (plugin->menu)))
+    {
+      launcher_plugin_menu_popup (plugin);
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+
+
 static void
 launcher_plugin_save (XfcePanelPlugin *panel_plugin)
 {



More information about the Xfce4-commits mailing list