[Xfce4-commits] <xfce4-panel:devel> Add support to the launcher for creating a new launcher from the plugin arguments.

Nick Schermer nick at xfce.org
Tue Aug 11 20:28:10 CEST 2009


Updating branch refs/heads/devel
         to 1eee4c6c8306cb772ca0fbc5be67440f7423a24e (commit)
       from c45a844319cb49c46c6fd17f5f3cf157aa4666ae (commit)

commit 1eee4c6c8306cb772ca0fbc5be67440f7423a24e
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Feb 22 16:49:14 2009 +0100

    Add support to the launcher for creating a new launcher from the plugin arguments.

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

diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index f1de1e1..5a2ff3a 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -155,8 +155,11 @@ launcher_plugin_property_changed (XfconfChannel  *channel,
 static void
 launcher_plugin_construct (XfcePanelPlugin *panel_plugin)
 {
-  LauncherPlugin *plugin = XFCE_LAUNCHER_PLUGIN (panel_plugin);
-  GtkWidget      *widget;
+  LauncherPlugin      *plugin = XFCE_LAUNCHER_PLUGIN (panel_plugin);
+  GtkWidget           *widget;
+  const gchar * const *filenames;
+  guint                i;
+  XfceMenuItem        *item;
 
   /* open the xfconf channel */
   plugin->channel = xfce_panel_plugin_xfconf_channel_new (panel_plugin);
@@ -213,6 +216,22 @@ launcher_plugin_construct (XfcePanelPlugin *panel_plugin)
   /* load the items */
   launcher_plugin_items_load (plugin);
 
+  if (G_UNLIKELY (plugin->items == NULL))
+    {
+      /* get the plugin arguments list */
+      filenames = xfce_panel_plugin_get_arguments (panel_plugin);
+      if (G_LIKELY (filenames != NULL))
+        {
+          for (i = 0; filenames[i] != NULL; i++)
+            {
+              /* create a new item from the file */
+              item = xfce_menu_item_new (filenames[i]);
+              if (G_LIKELY (item != NULL))
+                plugin->items = g_slist_append (plugin->items, item);
+            }
+        }
+    }
+
   /* update the icon */
   launcher_plugin_button_set_icon (plugin);
 }



More information about the Xfce4-commits mailing list