diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/email-custom-header/email-custom-header.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 127cbdc815..dad324aa02 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -279,7 +279,6 @@ epech_load_from_gconf (GConfClient *client,const gchar *path,CustomHeaderOptions CustomSubHeader temp_header_value_details = {NULL}; GSList *header_list,*q; gchar *buffer; - gchar *str_colon; gint index,pos; priv = mch->priv; @@ -293,13 +292,11 @@ epech_load_from_gconf (GConfClient *client,const gchar *path,CustomHeaderOptions temp_header_details.sub_header_type_value = g_array_new (TRUE, TRUE, sizeof (CustomSubHeader)); buffer = q->data; parse_header_list = g_strsplit_set (buffer, "=;,", -1); - str_colon = g_strconcat (parse_header_list[0], ":", NULL); temp_header_details.header_type_value = g_string_new(""); if (temp_header_details.header_type_value) { - g_string_assign(temp_header_details.header_type_value, str_colon); + g_string_assign(temp_header_details.header_type_value, parse_header_list[0]); } - g_free (str_colon); for (index = 0; parse_header_list[index+1] ; ++index) { temp_header_value_details.sub_header_string_value = g_string_new(""); @@ -615,9 +612,12 @@ commit_changes (ConfigData *cd) while (valid) { gchar *keyword = NULL, *value = NULL; - gtk_tree_model_get (model, &iter, HEADER_KEY_COLUMN, &keyword, -1); - /* Check if the keyword is not empty */ - gtk_tree_model_get (model, &iter, HEADER_VALUE_COLUMN, &value, -1); + + gtk_tree_model_get (model, &iter, + HEADER_KEY_COLUMN, &keyword, + HEADER_VALUE_COLUMN, &value, + -1); + /* Check if the keyword is not empty */ if ((keyword) && (g_utf8_strlen(g_strstrip(keyword), -1) > 0)) { if ((value) && (g_utf8_strlen(g_strstrip(value), -1) > 0)) { @@ -625,7 +625,10 @@ commit_changes (ConfigData *cd) } header_config_list = g_slist_append (header_config_list, g_strdup(keyword)); } + g_free (keyword); + g_free (value); + valid = gtk_tree_model_iter_next (model, &iter); } @@ -742,7 +745,6 @@ header_add_clicked (GtkButton *button, ConfigData *cd) { GtkTreeModel *model; GtkTreeIter iter; - gchar *new_header = NULL; GtkTreeViewColumn *focus_col; GtkTreePath *path; @@ -752,12 +754,11 @@ header_add_clicked (GtkButton *button, ConfigData *cd) /* Disconnect from signal so that we can create an empty row */ g_signal_handlers_disconnect_matched(G_OBJECT(model), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, header_isempty, cd); - new_header = g_strdup (""); gtk_list_store_append (GTK_LIST_STORE (model), &iter); gtk_list_store_set (GTK_LIST_STORE (model), &iter, - HEADER_KEY_COLUMN, new_header, -1); + HEADER_KEY_COLUMN, "", -1); gtk_list_store_set (GTK_LIST_STORE (model), &iter, - HEADER_VALUE_COLUMN, new_header, -1); + HEADER_VALUE_COLUMN, "", -1); focus_col = gtk_tree_view_get_column (GTK_TREE_VIEW (cd->treeview), HEADER_KEY_COLUMN); path = gtk_tree_model_get_path (model, &iter); @@ -877,7 +878,6 @@ e_plugin_lib_get_configure_widget (EPlugin *epl) GtkTreeModel *model; gint index; gchar *buffer; - gchar *str_colon = NULL, *str1_colon = NULL; GtkTreeViewColumn *col; gint col_pos; @@ -949,17 +949,15 @@ e_plugin_lib_get_configure_widget (EPlugin *epl) buffer = list->data; gtk_list_store_append (cd->store, &iter); + parse_header_list = g_strsplit_set (buffer, "=,", -1); - str_colon = g_strconcat (parse_header_list[0], "", NULL); - gtk_list_store_set (cd->store, &iter, HEADER_KEY_COLUMN, str_colon, -1); + + gtk_list_store_set (cd->store, &iter, HEADER_KEY_COLUMN, parse_header_list[0], -1); for (index = 0; parse_header_list[index+1] ; ++index) { - str1_colon = g_strconcat (parse_header_list[index+1], "", NULL); - gtk_list_store_set (cd->store, &iter, HEADER_VALUE_COLUMN, str1_colon, -1); + gtk_list_store_set (cd->store, &iter, HEADER_VALUE_COLUMN, parse_header_list[index+1], -1); } } - g_free (str_colon); - g_free (str1_colon); if (header_list) { g_slist_foreach (header_list, (GFunc) g_free, NULL); |