[Goodies-commits] r6559 - in xfce4-clipman-plugin/branches/xfce-4-6: . panel-plugin

Mike Massonnet mmassonnet at xfce.org
Sun Jan 25 23:32:18 CET 2009


Author: mmassonnet
Date: 2009-01-25 22:32:18 +0000 (Sun, 25 Jan 2009)
New Revision: 6559

Modified:
   xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog
   xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/actions.c
Log:
Forget to add support for GLib < 2.16 to save the actions.

Modified: xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog
===================================================================
--- xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog	2009-01-25 22:13:10 UTC (rev 6558)
+++ xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog	2009-01-25 22:32:18 UTC (rev 6559)
@@ -1,4 +1,11 @@
 2009-01-25	Mike Massonnet
+Forget to add support for GLib < 2.16 to save the actions.
+
+	- panel-plugin/actions.c:
+		I somehow was too hasty to commit, and forgot about support
+		for GLib < 2.16 to save the actions to the XML file.
+
+2009-01-25	Mike Massonnet
 Fix g_debug().
 
 	- Looks like I left some g_debug() calls in the code.

Modified: xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/actions.c
===================================================================
--- xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/actions.c	2009-01-25 22:13:10 UTC (rev 6558)
+++ xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/actions.c	2009-01-25 22:32:18 UTC (rev 6559)
@@ -60,9 +60,12 @@
                                                              gpointer b);
 static void           __clipman_actions_entry_free          (ClipmanActionsEntry *entry);
 #if !GLIB_CHECK_VERSION (2,16,0)
-static void           __g_hash_table_foreach_entry          (gpointer key,
+static void           __foreach_command_create_mi           (gpointer key,
                                                              gpointer value,
                                                              gpointer user_data);
+static void           __foreach_command_write_xml           (gpointer key,
+                                                             gpointer value,
+                                                             gpointer user_data);
 #endif
 
 /*
@@ -332,9 +335,9 @@
 
 #if !GLIB_CHECK_VERSION (2,16,0)
 static void
-__g_hash_table_foreach_entry (gpointer key,
-                              gpointer value,
-                              gpointer user_data)
+__foreach_command_create_mi (gpointer key,
+                             gpointer value,
+                             gpointer user_data)
 {
   gchar *command_name = key;
   gchar *command = value;
@@ -348,6 +351,29 @@
   gtk_container_add (GTK_CONTAINER (menu), mi);
   g_signal_connect (mi, "activate", G_CALLBACK (cb_entry_activated), NULL);
 }
+
+static void
+__foreach_command_write_xml (gpointer key,
+                             gpointer value,
+                             gpointer user_data)
+{
+  gchar *command_name = key;
+  gchar *command = value;
+  GString *output = user_data;
+  gchar *tmp;
+
+  g_string_append (output, "\t\t\t<command>\n");
+
+  tmp = g_markup_escape_text (command_name, -1);
+  g_string_append_printf (output, "\t\t\t\t<name>%s</name>\n", tmp);
+  g_free (tmp);
+
+  tmp = g_markup_escape_text (command, -1);
+  g_string_append_printf (output, "\t\t\t\t<exec>%s</exec>\n", tmp);
+  g_free (tmp);
+
+  g_string_append (output, "\t\t\t</command>\n");
+}
 #endif
 
 /*
@@ -552,7 +578,7 @@
         }
 #else
       g_object_set_data (G_OBJECT (actions->priv->menu), "regex", entry->regex);
-      g_hash_table_foreach (entry->commands, (GHFunc)__g_hash_table_foreach_entry, actions->priv->menu);
+      g_hash_table_foreach (entry->commands, (GHFunc)__foreach_command_create_mi, actions->priv->menu);
 #endif
 
       mi = gtk_separator_menu_item_new ();
@@ -667,6 +693,8 @@
 
           g_string_append (output, "\t\t\t</command>\n");
         }
+#else
+      g_hash_table_foreach (entry->commands, (GHFunc)__foreach_command_write_xml, output);
 #endif
 
       g_string_append (output, "\t\t</commands>\n");




More information about the Goodies-commits mailing list