From fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 27 May 2009 11:13:25 -0400 Subject: Prefer GLib basic types over C types. --- mail/em-vfolder-rule.c | 88 +++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'mail/em-vfolder-rule.c') diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c index 03f46afff8..d3090a672d 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-rule.c @@ -43,10 +43,10 @@ #define d(x) -static int validate(FilterRule *); -static int vfolder_eq(FilterRule *fr, FilterRule *cm); +static gint validate(FilterRule *); +static gint vfolder_eq(FilterRule *fr, FilterRule *cm); static xmlNodePtr xml_encode(FilterRule *); -static int xml_decode(FilterRule *, xmlNodePtr, RuleContext *f); +static gint xml_decode(FilterRule *, xmlNodePtr, RuleContext *f); static void rule_copy(FilterRule *dest, FilterRule *src); /*static void build_code(FilterRule *, GString *out);*/ static GtkWidget *get_widget(FilterRule *fr, RuleContext *f); @@ -56,7 +56,7 @@ static void em_vfolder_rule_init(EMVFolderRule *vr); static void em_vfolder_rule_finalise(GObject *obj); /* DO NOT internationalise these strings */ -static const char *with_names[] = { +static const gchar *with_names[] = { "specific", "local_remote_active", "remote_active", @@ -141,7 +141,7 @@ em_vfolder_rule_new(void) } void -em_vfolder_rule_add_source(EMVFolderRule *vr, const char *uri) +em_vfolder_rule_add_source(EMVFolderRule *vr, const gchar *uri) { g_return_if_fail (EM_IS_VFOLDER_RULE(vr)); g_return_if_fail (uri); @@ -151,8 +151,8 @@ em_vfolder_rule_add_source(EMVFolderRule *vr, const char *uri) filter_rule_emit_changed((FilterRule *)vr); } -const char * -em_vfolder_rule_find_source(EMVFolderRule *vr, const char *uri) +const gchar * +em_vfolder_rule_find_source(EMVFolderRule *vr, const gchar *uri) { GList *l; @@ -171,13 +171,13 @@ em_vfolder_rule_find_source(EMVFolderRule *vr, const char *uri) } void -em_vfolder_rule_remove_source(EMVFolderRule *vr, const char *uri) +em_vfolder_rule_remove_source(EMVFolderRule *vr, const gchar *uri) { - char *found; + gchar *found; g_return_if_fail (EM_IS_VFOLDER_RULE(vr)); - found =(char *)em_vfolder_rule_find_source(vr, uri); + found =(gchar *)em_vfolder_rule_find_source(vr, uri); if (found) { vr->sources = g_list_remove(vr->sources, found); g_free(found); @@ -185,15 +185,15 @@ em_vfolder_rule_remove_source(EMVFolderRule *vr, const char *uri) } } -const char * -em_vfolder_rule_next_source(EMVFolderRule *vr, const char *last) +const gchar * +em_vfolder_rule_next_source(EMVFolderRule *vr, const gchar *last) { GList *node; if (last == NULL) { node = vr->sources; } else { - node = g_list_find(vr->sources, (char *)last); + node = g_list_find(vr->sources, (gchar *)last); if (node == NULL) node = vr->sources; else @@ -201,7 +201,7 @@ em_vfolder_rule_next_source(EMVFolderRule *vr, const char *last) } if (node) - return (const char *)node->data; + return (const gchar *)node->data; return NULL; } @@ -231,10 +231,10 @@ validate(FilterRule *fr) static int list_eq(GList *al, GList *bl) { - int truth = TRUE; + gint truth = TRUE; while (truth && al && bl) { - char *a = al->data, *b = bl->data; + gchar *a = al->data, *b = bl->data; truth = strcmp(a, b)== 0; al = al->next; @@ -262,13 +262,13 @@ xml_encode(FilterRule *fr) g_return_val_if_fail (node != NULL, NULL); g_return_val_if_fail (vr->with < sizeof(with_names)/sizeof(with_names[0]), NULL); - set = xmlNewNode(NULL, (const unsigned char *)"sources"); + set = xmlNewNode(NULL, (const guchar *)"sources"); xmlAddChild(node, set); - xmlSetProp(set, (const unsigned char *)"with", (unsigned char *)with_names[vr->with]); + xmlSetProp(set, (const guchar *)"with", (guchar *)with_names[vr->with]); l = vr->sources; while (l) { - work = xmlNewNode(NULL, (const unsigned char *)"folder"); - xmlSetProp(work, (const unsigned char *)"uri", (unsigned char *)l->data); + work = xmlNewNode(NULL, (const guchar *)"folder"); + xmlSetProp(work, (const guchar *)"uri", (guchar *)l->data); xmlAddChild(set, work); l = l->next; } @@ -277,9 +277,9 @@ xml_encode(FilterRule *fr) } static void -set_with(EMVFolderRule *vr, const char *name) +set_with(EMVFolderRule *vr, const gchar *name) { - int i; + gint i; for(i=0;ixml_decode(fr, node, f); if (result != 0) @@ -312,16 +312,16 @@ xml_decode(FilterRule *fr, xmlNodePtr node, struct _RuleContext *f) set = node->children; while (set) { - if (!strcmp((char *)set->name, "sources")) { - tmp = (char *)xmlGetProp(set, (const unsigned char *)"with"); + if (!strcmp((gchar *)set->name, "sources")) { + tmp = (gchar *)xmlGetProp(set, (const guchar *)"with"); if (tmp) { set_with(vr, tmp); xmlFree(tmp); } work = set->children; while (work) { - if (!strcmp((char *)work->name, "folder")) { - tmp = (char *)xmlGetProp(work, (const unsigned char *)"uri"); + if (!strcmp((gchar *)work->name, "folder")) { + tmp = (gchar *)xmlGetProp(work, (const guchar *)"uri"); if (tmp) { vr->sources = g_list_append(vr->sources, g_strdup(tmp)); xmlFree(tmp); @@ -352,7 +352,7 @@ rule_copy(FilterRule *dest, FilterRule *src) node = vsrc->sources; while (node) { - char *uri = node->data; + gchar *uri = node->data; vdest->sources = g_list_append(vdest->sources, g_strdup(uri)); node = node->next; @@ -372,7 +372,7 @@ enum { struct _source_data { RuleContext *rc; EMVFolderRule *vr; - const char *current; + const gchar *current; GtkListStore *model; GtkTreeView *list; GtkWidget *source_selector; @@ -439,11 +439,11 @@ select_source_with_changed(GtkWidget *widget, struct _source_data *data) } /* attempt to make a 'nice' folder name out of the raw uri */ -static char *format_source(const char *euri) +static gchar *format_source(const gchar *euri) { CamelURL *url; GString *out; - char *res, *uri; + gchar *res, *uri; /* This should really probably base it on the account name? */ uri = em_uri_to_camel(euri); @@ -476,10 +476,10 @@ static char *format_source(const char *euri) static void vfr_folder_response(GtkWidget *dialog, gint button, struct _source_data *data) { - const char *uri = em_folder_selector_get_selected_uri((EMFolderSelector *)dialog); + const gchar *uri = em_folder_selector_get_selected_uri((EMFolderSelector *)dialog); if (button == GTK_RESPONSE_OK && uri != NULL) { - char *urinice, *euri; + gchar *urinice, *euri; GtkTreeSelection *selection; GtkTreeIter iter; @@ -521,11 +521,11 @@ static void source_remove(GtkWidget *widget, struct _source_data *data) { GtkTreeSelection *selection; - const char *source; + const gchar *source; GtkTreePath *path; GtkTreeIter iter; - int index = 0; - int n; + gint index = 0; + gint n; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->list)); @@ -568,11 +568,11 @@ source_remove(GtkWidget *widget, struct _source_data *data) } -GtkWidget *em_vfolder_editor_sourcelist_new(char *widget_name, char *string1, char *string2, - int int1, int int2); +GtkWidget *em_vfolder_editor_sourcelist_new(gchar *widget_name, gchar *string1, gchar *string2, + gint int1, gint int2); GtkWidget * -em_vfolder_editor_sourcelist_new(char *widget_name, char *string1, char *string2, int int1, int int2) +em_vfolder_editor_sourcelist_new(gchar *widget_name, gchar *string1, gchar *string2, gint int1, gint int2) { GtkWidget *table, *scrolled; GtkTreeSelection *selection; @@ -616,11 +616,11 @@ get_widget(FilterRule *fr, RuleContext *rc) GtkWidget *widget, *frame, *list; struct _source_data *data; GtkRadioButton *rb; - const char *source; + const gchar *source; GtkTreeIter iter; GladeXML *gui; - int i; - char *gladefile; + gint i; + gchar *gladefile; widget = FILTER_RULE_CLASS(parent_class)->get_widget(fr, rc); @@ -649,7 +649,7 @@ get_widget(FilterRule *fr, RuleContext *rc) source = NULL; while ((source = em_vfolder_rule_next_source(vr, source))) { - char *nice = format_source(source); + gchar *nice = format_source(source); gtk_list_store_append(data->model, &iter); gtk_list_store_set(data->model, &iter, 0, nice, 1, source, -1); -- cgit v1.2.3