2004-11-15 [colin] 0.9.12cvs146.12
authorColin Leroy <colin@colino.net>
Mon, 15 Nov 2004 10:28:16 +0000 (10:28 +0000)
committerColin Leroy <colin@colino.net>
Mon, 15 Nov 2004 10:28:16 +0000 (10:28 +0000)
* src/compose.c
* src/prefs_filtering.c
* src/prefs_filtering_action.c
* src/prefs_toolbar.c
Fix some const-correctness

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/compose.c
src/prefs_filtering.c
src/prefs_filtering_action.c
src/prefs_toolbar.c

index f113f6d6a100548ad80a799fe0db3731495af756..4d63fbb52caab13841949a8e621c3232e7fa7c07 100644 (file)
@@ -1,3 +1,11 @@
+2004-11-15 [colin]     0.9.12cvs146.12
+
+       * src/compose.c
+       * src/prefs_filtering.c
+       * src/prefs_filtering_action.c
+       * src/prefs_toolbar.c
+               Fix some const-correctness
+
 2004-11-15 [colin]     0.9.12cvs146.11
 
        * src/summaryview.c
index bd065cd2858d2c3d3475c0a3ef8a9fa0966c1a82..5f629635027671ff4e92938b9009b525f23a0d87 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.96.2.34 -r 1.96.2.35 src/textview.c; ) > 0.9.12cvs146.9.patchset
 ( cvs diff -u -r 1.65.2.18 -r 1.65.2.19 src/codeconv.c; ) > 0.9.12cvs146.10.patchset
 ( cvs diff -u -r 1.395.2.40 -r 1.395.2.41 src/summaryview.c; cvs diff -u -r 1.3.2.11 -r 1.3.2.12 src/prefs_themes.c; cvs diff -u -r 1.94.2.33 -r 1.94.2.34 src/messageview.c; ) > 0.9.12cvs146.11.patchset
+( cvs diff -u -r 1.382.2.64 -r 1.382.2.65 src/compose.c; cvs diff -u -r 1.59.2.9 -r 1.59.2.10 src/prefs_filtering.c; cvs diff -u -r 1.1.4.8 -r 1.1.4.9 src/prefs_filtering_action.c; cvs diff -u -r 1.30.2.6 -r 1.30.2.7 src/prefs_toolbar.c; ) > 0.9.12cvs146.12.patchset
index 15b28ecaf5f945d07e407e39468f560b84a42959..07c9ef9e23680eb4b7563e420a0a39612e2f5f97 100644 (file)
@@ -13,7 +13,7 @@ INTERFACE_AGE=0
 BINARY_AGE=0
 EXTRA_VERSION=146
 EXTRA_RELEASE=
-EXTRA_GTK2_VERSION=.11
+EXTRA_GTK2_VERSION=.12
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
index 9eadf1b5211a1b7087c427ab223daa38c99dd1bc..46452d9519b921db18745618689411272871825c 100644 (file)
@@ -4112,7 +4112,7 @@ static gchar *compose_get_header(Compose *compose)
        compose_add_headerfield_from_headerlist(compose, header, "Bcc", ", ");
 
        /* Subject */
-       str = (gpointer)gtk_entry_get_text(GTK_ENTRY(compose->subject_entry));
+       str = gtk_editable_get_chars(GTK_EDITABLE(compose->subject_entry), 0, -1);
        if (*str != '\0' && !IS_IN_CUSTOM_HEADER("Subject")) {
                gchar *tmpstr;
 
@@ -4129,6 +4129,7 @@ static gchar *compose_get_header(Compose *compose)
                }
                g_free(tmpstr);
        }
+       g_free(str);
 
        /* Message-ID */
        if (compose->account->gen_msgid) {
index 9bf8e01dc01c8a3a2a4e513b160899d946bb82cb..993346fdaeb2e38e1d5ad0072e4bdff653c8bb0f 100644 (file)
@@ -708,13 +708,15 @@ static void prefs_filtering_condition_define(void)
        gchar * cond_str;
        MatcherList * matchers = NULL;
 
-       cond_str = (gpointer)gtk_entry_get_text(GTK_ENTRY(filtering.cond_entry));
+       cond_str = gtk_editable_get_chars(GTK_EDITABLE(filtering.cond_entry), 0, -1);
 
        if (*cond_str != '\0') {
                matchers = matcher_parser_get_cond(cond_str);
                if (matchers == NULL)
                        alertpanel_error(_("Condition string is not valid."));
        }
+       
+       g_free(cond_str);
 
        prefs_matcher_open(matchers, prefs_filtering_condition_define_done);
 
@@ -742,13 +744,15 @@ static void prefs_filtering_action_define(void)
        gchar * action_str;
        GSList * action_list = NULL;
 
-       action_str = (gpointer)gtk_entry_get_text(GTK_ENTRY(filtering.action_entry));
+       action_str = gtk_editable_get_chars(GTK_EDITABLE(filtering.action_entry), 0, -1);
 
        if (*action_str != '\0') {
                action_list = matcher_parser_get_action_list(action_str);
                if (action_list == NULL)
                        alertpanel_error(_("Action string is not valid."));
        }
+       
+       g_free(action_str);
 
        prefs_filtering_action_open(action_list,
             prefs_filtering_action_define_done);
@@ -768,39 +772,43 @@ static void prefs_filtering_action_define(void)
 static FilteringProp * prefs_filtering_dialog_to_filtering(gboolean alert)
 {
        MatcherList * cond;
-       gchar * cond_str;
-       gchar * action_str;
-       FilteringProp * prop;
+       gchar * cond_str = NULL;
+       gchar * action_str = NULL;
+       FilteringProp * prop = NULL;
        GSList * action_list;
 
-       cond_str = (gpointer)gtk_entry_get_text(GTK_ENTRY(filtering.cond_entry));
+       cond_str = gtk_editable_get_chars(GTK_EDITABLE(filtering.cond_entry), 0, -1);
        if (*cond_str == '\0') {
                if(alert == TRUE) alertpanel_error(_("Condition string is empty."));
-               return NULL;
+               goto fail;
        }
-
-       action_str = (gpointer)gtk_entry_get_text(GTK_ENTRY(filtering.action_entry));
+       
+       action_str = gtk_editable_get_chars(GTK_EDITABLE(filtering.action_entry), 0, -1);
        if (*action_str == '\0') {
                if(alert == TRUE) alertpanel_error(_("Action string is empty."));
-               return NULL;
+               goto fail;
        }
 
-       cond = (gpointer)matcher_parser_get_cond(cond_str);
+       cond = matcher_parser_get_cond(cond_str);
 
        if (cond == NULL) {
                if(alert == TRUE) alertpanel_error(_("Condition string is not valid."));
-               return NULL;
+               goto fail;
        }
         
-        action_list = (gpointer)matcher_parser_get_action_list(action_str);
+        action_list = matcher_parser_get_action_list(action_str);
+       
 
        if (action_list == NULL) {
                if(alert == TRUE) alertpanel_error(_("Action string is not valid."));
-               return NULL;
+               goto fail;
        }
 
        prop = filteringprop_new(cond, action_list);
 
+fail:
+       g_free(cond_str);
+       g_free(action_str);
        return prop;
 }
 
index 2557114f28521a930dd07b56d16f3ae3186ccafa..5fdfb930b76f7b28eb101d5613aa89b3e052d0ac 100644 (file)
@@ -737,10 +737,10 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
        gint action_type;
        gint list_id;
        gint account_id;
-       gchar * destination;
+       gchar * destination = NULL;
        gint labelcolor = 0;
         FilteringAction * action;
-        gchar * score_str;
+        gchar * score_str = NULL;
         gint score;
         
        action_id = get_sel_from_list(GTK_LIST(filtering_action.action_type_list));
@@ -754,24 +754,24 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
        case ACTION_MOVE:
        case ACTION_COPY:
        case ACTION_EXECUTE:
-               destination = (gpointer)gtk_entry_get_text(
-                               GTK_ENTRY(filtering_action.dest_entry));
+               destination = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.dest_entry), 0, -1);
                if (*destination == '\0') {
                        if (alert)
                                 alertpanel_error(action_id == ACTION_EXECUTE 
                                                 ? _("Command line not set")
                                                 : _("Destination is not set."));
+                       g_free(destination);
                        return NULL;
                }
                break;
        case ACTION_FORWARD:
        case ACTION_FORWARD_AS_ATTACHMENT:
        case ACTION_REDIRECT:
-               destination = (gpointer)gtk_entry_get_text(
-                               GTK_ENTRY(filtering_action.dest_entry));
+               destination = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.dest_entry), 0, -1);
                if (*destination == '\0') {
                        if (alert)
                                 alertpanel_error(_("Recipient is not set."));
+                       g_free(destination);
                        return NULL;
                }
                break;
@@ -782,10 +782,11 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
                break;
         case ACTION_CHANGE_SCORE:
         case ACTION_SET_SCORE:
-               score_str = (gpointer)gtk_entry_get_text(GTK_ENTRY(filtering_action.dest_entry));
+               score_str = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.dest_entry), 0, -1);
                if (*score_str == '\0') {
                        if (alert)
                                 alertpanel_error(_("Score is not set"));
+                       g_free(score_str);
                        return NULL;
                }
                 score = strtol(score_str, NULL, 10);
@@ -805,8 +806,10 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
        
        action = filteringaction_new(action_type, account_id,
             destination, labelcolor, score);
-
-        return action;
+       
+       g_free(destination);
+       g_free(score_str);
+       return action;
 }
 
 /*!
index 896913579886fcbd57b120d398145b4c9d6673ff..5c9fbb60c002cf394c5fde135ca71e909d5549b3 100644 (file)
@@ -339,7 +339,7 @@ static void prefs_toolbar_default(GtkButton *button, ToolbarPage *prefs_toolbar)
        prefs_toolbar_set_displayed(prefs_toolbar);
 }
 
-static void get_action_name(gchar *entry, gchar **menu)
+static void get_action_name(const gchar *entry, gchar **menu)
 {
        gchar *act, *act_p;
 
@@ -398,7 +398,7 @@ static void prefs_toolbar_register(GtkButton *button, ToolbarPage *prefs_toolbar
 
                if (g_utf8_collate(item[3], syl_act) == 0) {
 
-                       gchar *entry = (gpointer)gtk_entry_get_text(GTK_ENTRY(prefs_toolbar->combo_syl_entry));
+                       const gchar *entry = gtk_entry_get_text(GTK_ENTRY(prefs_toolbar->combo_syl_entry));
                        get_action_name(entry, &item[2]);
                }
                else {
@@ -468,8 +468,7 @@ static void prefs_toolbar_substitute(GtkButton *button, ToolbarPage *prefs_toolb
                                  &xpm, &xpmmask);
 
                if (g_utf8_collate(item[3], syl_act) == 0) {
-
-                       gchar *entry = (gpointer)gtk_entry_get_text(GTK_ENTRY(prefs_toolbar->combo_syl_entry));
+                       const gchar *entry = gtk_entry_get_text(GTK_ENTRY(prefs_toolbar->combo_syl_entry));
                        get_action_name(entry, &item[2]);
                } else {
                        item[2] = g_strdup(gtk_entry_get_text(GTK_ENTRY(prefs_toolbar->entry_icon_text)));