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

Mike Massonnet mmassonnet at xfce.org
Fri Jan 30 08:49:36 CET 2009


Author: mmassonnet
Date: 2009-01-30 07:49:36 +0000 (Fri, 30 Jan 2009)
New Revision: 6601

Modified:
   xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog
   xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/panel-plugin.c
Log:
Add support for GLib < 2.16 for the commands treeview.

Modified: xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog
===================================================================
--- xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog	2009-01-30 07:32:48 UTC (rev 6600)
+++ xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog	2009-01-30 07:49:36 UTC (rev 6601)
@@ -1,4 +1,11 @@
 2009-01-30	Mike Massonnet
+Add support for GLib < 2.16 for the commands treeview.
+
+	- panel-plugin/panel-plugin.c:
+		New function __foreach_command_fill_commands for versions of
+		GLib prior to 2.16.
+
+2009-01-30	Mike Massonnet
 Fix a crasher.
 
 	- panel-plugin/history.c(clipman_history_clear):

Modified: xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/panel-plugin.c
===================================================================
--- xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/panel-plugin.c	2009-01-30 07:32:48 UTC (rev 6600)
+++ xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/panel-plugin.c	2009-01-30 07:49:36 UTC (rev 6601)
@@ -114,6 +114,11 @@
                                                          MyPlugin *plugin);
 static void             entry_dialog_cleanup            (GtkDialog *dialog,
                                                          MyPlugin *plugin);
+#if !GLIB_CHECK_VERSION(2,16,0)
+static void           __foreach_command_fill_commands   (gpointer key,
+                                                         gpointer value,
+                                                         gpointer user_data);
+#endif
 static void             cb_commands_selection_changed   (GtkTreeSelection *selection,
                                                          MyPlugin *plugin);
 static void             cb_add_command                  (GtkButton *button,
@@ -682,6 +687,8 @@
       gtk_list_store_set (GTK_LIST_STORE (commands_model), &iter, 0, title, 1, key, 2, value, -1);
       g_free (title);
     }
+#else
+  g_hash_table_foreach (entry->commands, (GHFunc)__foreach_command_fill_commands, commands_model);
 #endif
 
   res = gtk_dialog_run (GTK_DIALOG (dialog));
@@ -751,7 +758,24 @@
   gtk_list_store_clear (GTK_LIST_STORE (model));
 }
 
+#if !GLIB_CHECK_VERSION(2,16,0)
 static void
+__foreach_command_fill_commands (gpointer key,
+                                 gpointer value,
+                                 gpointer user_data)
+{
+  GtkTreeModel *model = user_data;
+  GtkTreeIter iter;
+  gchar *title;
+
+  title = g_strdup_printf ("<b>%s</b>\n<small>%s</small>", (gchar *)key, (gchar *)value);
+  gtk_list_store_append (GTK_LIST_STORE (_model), &iter);
+  gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, title, 1, key, 2, value, -1);
+  g_free (title);
+}
+#endif
+
+static void
 cb_commands_selection_changed (GtkTreeSelection *selection,
                                MyPlugin *plugin)
 {




More information about the Goodies-commits mailing list