[Xfce4-commits] <xfce4-clipman-plugin:master> [actions] Save pattern parallel to the GRegex

Mike Massonnet noreply at xfce.org
Sun Dec 13 14:54:01 CET 2009


Updating branch refs/heads/master
         to 150645167a746f4806d38619cd73bd1983610f4d (commit)
       from f002b9fc8383257fbea2939fdae056ac3e1f792c (commit)

commit 150645167a746f4806d38619cd73bd1983610f4d
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Sun Dec 13 14:46:46 2009 +0100

    [actions] Save pattern parallel to the GRegex
    
    As the pattern is modified locally (last commit) it is needed to keep
    the pattern in a separate data memory. The ClipmanActionEntry has a new
    member "pattern". The code has been updated to use entry->pattern
    instead of g_regex_get_pattern.

 panel-plugin/actions.c                |    3 ++-
 panel-plugin/actions.h                |    1 +
 panel-plugin/xfce4-clipman-settings.c |    4 ++--
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/actions.c b/panel-plugin/actions.c
index 239635a..09c9d19 100644
--- a/panel-plugin/actions.c
+++ b/panel-plugin/actions.c
@@ -534,6 +534,7 @@ clipman_actions_add (ClipmanActions *actions,
 
       entry = g_slice_new0 (ClipmanActionsEntry);
       entry->action_name = g_strdup (action_name);
+      entry->pattern = g_strdup (regex);
       entry->regex = _regex;
       entry->group = 0;
       entry->commands = g_hash_table_new_full ((GHashFunc)g_str_hash, (GEqualFunc)g_str_equal,
@@ -857,7 +858,7 @@ clipman_actions_save (ClipmanActions *actions)
       g_string_append_printf (output, "\t\t<name>%s</name>\n", tmp);
       g_free (tmp);
 
-      tmp = g_markup_escape_text (g_regex_get_pattern (entry->regex), -1);
+      tmp = g_markup_escape_text (entry->pattern, -1);
       g_string_append_printf (output, "\t\t<regex>%s</regex>\n", tmp);
       g_free (tmp);
 
diff --git a/panel-plugin/actions.h b/panel-plugin/actions.h
index 7255782..9f99cb8 100644
--- a/panel-plugin/actions.h
+++ b/panel-plugin/actions.h
@@ -29,6 +29,7 @@ typedef struct _ClipmanActionsEntry ClipmanActionsEntry;
 struct _ClipmanActionsEntry
 {
   gchar                *action_name;
+  gchar                *pattern;
   GRegex               *regex;
   gint                  group;
   GHashTable           *commands;
diff --git a/panel-plugin/xfce4-clipman-settings.c b/panel-plugin/xfce4-clipman-settings.c
index 8080bea..6c2d848 100644
--- a/panel-plugin/xfce4-clipman-settings.c
+++ b/panel-plugin/xfce4-clipman-settings.c
@@ -265,7 +265,7 @@ refresh_actions_treeview (GtkTreeView *treeview)
       entry = entries->data;
 
       title = g_markup_printf_escaped ("<b>%s</b>\n<small>%s</small>",
-                                       entry->action_name, g_regex_get_pattern (entry->regex));
+                                       entry->action_name, entry->pattern);
       gtk_list_store_append (GTK_LIST_STORE (model), &iter);
       gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, entry, 1, title, -1);
       g_free (title);
@@ -402,7 +402,7 @@ cb_actions_row_activated (GtkTreeView *treeview,
 #endif
 
   gtk_entry_set_text (GTK_ENTRY (glade_xml_get_widget (gxml, "action-name")), entry->action_name);
-  gtk_entry_set_text (GTK_ENTRY (glade_xml_get_widget (gxml, "regex")), g_regex_get_pattern (entry->regex));
+  gtk_entry_set_text (GTK_ENTRY (glade_xml_get_widget (gxml, "regex")), entry->pattern);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (glade_xml_get_widget (gxml, "manual")), entry->group);
 
   res = gtk_dialog_run (GTK_DIALOG (action_dialog));



More information about the Xfce4-commits mailing list