diff options
author | Milan Crha <mcrha@redhat.com> | 2009-01-08 19:20:24 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2009-01-08 19:20:24 +0800 |
commit | c6bd0b0932f3cfe78b8b76f71b57f51afab74db3 (patch) | |
tree | f6e23bb8af903618315ee1b2a1844391bfec33bf /mail/em-filter-folder-element.c | |
parent | 37362c7b255ab1b932db1c9e41da146dd43abfa7 (diff) | |
download | gsoc2013-evolution-c6bd0b0932f3cfe78b8b76f71b57f51afab74db3.tar.gz gsoc2013-evolution-c6bd0b0932f3cfe78b8b76f71b57f51afab74db3.tar.zst gsoc2013-evolution-c6bd0b0932f3cfe78b8b76f71b57f51afab74db3.zip |
** Fix for bug #565376
2009-01-08 Milan Crha <mcrha@redhat.com>
** Fix for bug #565376
* vfoldertypes.xml:
* searchtypes.xml: Merge some search types together.
* em-vfolder-context.c: (vfolder_new_element): More elements.
* em-filter-folder-element.h: (struct _EMFilterFolderElement):
* em-filter-folder-element.c: (xml_encode), (xml_decode),
(folder_selected), (get_widget), (format_sexp):
Support storing folder uri in a camel's way.
* em-format-html-display.c: (efhd_use_component):
Compiler warning fix.
svn path=/trunk/; revision=37015
Diffstat (limited to 'mail/em-filter-folder-element.c')
-rw-r--r-- | mail/em-filter-folder-element.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c index 3539881290..a95a4dd88d 100644 --- a/mail/em-filter-folder-element.c +++ b/mail/em-filter-folder-element.c @@ -180,7 +180,10 @@ xml_encode(FilterElement *fe) value = xmlNewNode(NULL, (unsigned const char *)"value"); xmlSetProp(value, (unsigned const char *)"name", (unsigned char *)fe->name); - xmlSetProp(value, (unsigned const char *)"type", (unsigned const char *)"folder"); + if (ff->store_camel_uri) + xmlSetProp(value, (unsigned const char *)"type", (unsigned const char *)"folder-curi"); + else + xmlSetProp(value, (unsigned const char *)"type", (unsigned const char *)"folder"); work = xmlNewChild(value, NULL, (unsigned const char *)"folder", NULL); xmlSetProp(work, (unsigned const char *)"uri", (unsigned const char *)ff->uri); @@ -193,12 +196,21 @@ xml_decode(FilterElement *fe, xmlNodePtr node) { EMFilterFolderElement *ff = (EMFilterFolderElement *)fe; xmlNodePtr n; + xmlChar *type; d(printf("Decoding folder from xml %p\n", fe)); xmlFree(fe->name); fe->name = (char *)xmlGetProp(node, (unsigned const char *)"name"); + type = xmlGetProp (node, (unsigned const char *)"type"); + if (type) { + ff->store_camel_uri = g_str_equal ((const char *)type, "folder-curi"); + xmlFree (type); + } else { + ff->store_camel_uri = FALSE; + } + n = node->children; while(n) { if (!strcmp((char *)n->name, "folder")) { @@ -223,7 +235,11 @@ folder_selected(EMFolderSelectionButton *button, EMFilterFolderElement *ff) uri = em_folder_selection_button_get_selection(button); g_free(ff->uri); - ff->uri = uri!=NULL?em_uri_from_camel(uri):NULL; + + if (ff->store_camel_uri) + ff->uri = g_strdup (uri); + else + ff->uri = uri != NULL ? em_uri_from_camel (uri) : NULL; gdk_window_raise(GTK_WIDGET(gtk_widget_get_ancestor(GTK_WIDGET(button), GTK_TYPE_WINDOW))->window); } @@ -235,10 +251,15 @@ get_widget(FilterElement *fe) GtkWidget *button; char *uri; - uri = em_uri_to_camel(ff->uri); + if (ff->store_camel_uri) + uri = ff->uri; + else + uri = em_uri_to_camel (ff->uri); button = em_folder_selection_button_new(_("Select Folder"), NULL); em_folder_selection_button_set_selection(EM_FOLDER_SELECTION_BUTTON(button), uri); - g_free(uri); + + if (!ff->store_camel_uri) + g_free(uri); gtk_widget_show(button); g_signal_connect(button, "selected", G_CALLBACK(folder_selected), ff); @@ -263,8 +284,9 @@ format_sexp(FilterElement *fe, GString *out) static void emff_copy_value(FilterElement *de, FilterElement *se) { - if (EM_IS_FILTER_FOLDER_ELEMENT(se)) + if (EM_IS_FILTER_FOLDER_ELEMENT(se)) { + ((EMFilterFolderElement *)de)->store_camel_uri = ((EMFilterFolderElement *)se)->store_camel_uri; em_filter_folder_element_set_value((EMFilterFolderElement *)de, ((EMFilterFolderElement *)se)->uri); - else + } else parent_class->copy_value(de, se); } |