From b437b5ed8fed646b97a7726e13ddcdcb2bc793ac Mon Sep 17 00:00:00 2001 From: Ashish Shrivastava Date: Sun, 20 Jul 2008 16:03:43 +0000 Subject: Committing on behalf of Ashish Shrivastava 2008-06-25 Ashish Shrivastava * email-custom-header.glade: Marked strings for translation. remove "window1" string from translation. 2008-06-24 Ashish Shrivastava * email-custom-header.c: (e_plugin_lib_get_configure_widget), (org_gnome_email_custom_header_config_option): Added Support for configuring gconf values. * email-custom-header.glade: Configure email-custom-header plugin within the plugin-manager. * org-gnome-email-custom-header.eplug.xml: Add hook class for Configure tab. * Makefile.am: Add new file.(email-custom-header.glade). svn path=/trunk/; revision=35774 --- plugins/email-custom-header/email-custom-header.c | 414 +++++++++++++++++++++- 1 file changed, 412 insertions(+), 2 deletions(-) (limited to 'plugins/email-custom-header/email-custom-header.c') diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index ef2ac976a7..5579e9c420 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -37,6 +37,23 @@ #define d(x) x +#define GCONF_KEY_CUSTOM_HEADER "/apps/evolution/eplugin/email_custom_header/customHeader" + +typedef struct { + GladeXML *xml; + GConfClient *gconf; + GtkWidget *treeview; + GtkWidget *header_add; + GtkWidget *header_edit; + GtkWidget *header_remove; + GtkListStore *store; +} ConfigData; + +enum { + HEADER_KEY_COLUMN, + HEADER_VALUE_COLUMN, + HEADER_N_COLUMNS, +}; struct _EmailCustomHeaderOptionsDialogPrivate { /* Glade XML data */ @@ -60,9 +77,17 @@ static void epech_dialog_init (GObject *object); static void epech_dialog_dispose (GObject *object); static void epech_setup_widgets (CustomHeaderOptionsDialog *mch); static gint epech_check_existing_composer_window(gconstpointer a, gconstpointer b); - +static void commit_changes (ConfigData *cd); +int e_plugin_lib_enable (EPluginLib *ep, int enable); +GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl); gboolean e_plugin_ui_init(GtkUIManager *manager, EMsgComposer *composer); +int +e_plugin_lib_enable (EPluginLib *ep, int enable) +{ + return 0; +} + static void epech_get_widgets_data (CustomHeaderOptionsDialog *mch) { @@ -242,7 +267,7 @@ epech_get_header_list (CustomHeaderOptionsDialog *mch) client = gconf_client_get_default (); g_return_if_fail (GCONF_IS_CLIENT (client)); - gconf_client_add_dir (client, "/apps/evolution/eplugin/email_custom_header" , GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + gconf_client_add_dir (client, GCONF_KEY_CUSTOM_HEADER, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); epech_load_from_gconf (client, "/apps/evolution/eplugin/email_custom_header/customHeader", mch); return; @@ -554,3 +579,388 @@ e_plugin_ui_init (GtkUIManager *manager, return TRUE; } +static void +commit_changes (ConfigData *cd) +{ + GtkTreeModel *model = NULL; + GSList *header_config_list = NULL; + GtkTreeIter iter; + gboolean valid; + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (cd->treeview)); + valid = gtk_tree_model_get_iter_first (model, &iter); + + 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); + /* 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)){ + keyword = g_strconcat (keyword, "=", value, NULL); + } + header_config_list = g_slist_append (header_config_list, g_strdup(keyword)); + } + g_free (keyword); + valid = gtk_tree_model_iter_next (model, &iter); + } + + gconf_client_set_list (cd->gconf, GCONF_KEY_CUSTOM_HEADER, GCONF_VALUE_STRING, header_config_list, NULL); + + g_slist_foreach (header_config_list, (GFunc) g_free, NULL); + g_slist_free (header_config_list); +} + +static void +header_isempty (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, ConfigData *cd) +{ + GtkTreeSelection *selection; + char *keyword = NULL; + char *value = NULL; + gboolean valid; + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (cd->treeview)); + /* move to the previous node */ + valid = gtk_tree_path_prev (path); + + gtk_tree_model_get (model, iter, HEADER_KEY_COLUMN, &keyword, -1); + + if ((keyword) && !(g_utf8_strlen (g_strstrip (keyword), -1) > 0)) + gtk_list_store_remove (cd->store, iter); + + /* Check if we have a valid row to select. If not, then select + * the previous row */ + if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (model), iter)) { + gtk_tree_selection_select_iter (selection, iter); + } else { + if (path && valid) { + gtk_tree_model_get_iter (model, iter, path); + gtk_tree_selection_select_iter (selection, iter); + } + } + + gtk_widget_grab_focus (cd->treeview); + g_free (keyword); + g_free (value); +} + +static gboolean +header_foreach_check_isempty (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, ConfigData *cd) +{ + gboolean valid; + + valid = gtk_tree_model_get_iter_first (model, iter); + while (valid && gtk_list_store_iter_is_valid (cd->store, iter)) { + char *keyword = NULL; + gtk_tree_model_get (model, iter, HEADER_KEY_COLUMN, &keyword, -1); + /* Check if the keyword is not empty and then emit the row-changed + signal (if we delete the row, then the iter gets corrupted) */ + if ((keyword) && !(g_utf8_strlen (g_strstrip (keyword), -1) > 0)) + gtk_tree_model_row_changed (model, path, iter); + + char *value = NULL; + gtk_tree_model_get (model, iter, HEADER_VALUE_COLUMN, &value, -1); + /* Check if the keyword is not empty and then emit the row-changed + signal (if we delete the row, then the iter gets corrupted) */ + if ((value) && !(g_utf8_strlen (g_strstrip (value), -1) > 0)) + gtk_tree_model_row_changed (model, path, iter); + + g_free (keyword); + g_free (value); + + valid = gtk_tree_model_iter_next (model, iter); + } + + return FALSE; +} + +static void +cell_edited_callback (GtkCellRendererText *cell, + gchar *path_string, + gchar *new_text, + ConfigData *cd) +{ + GtkTreeModel *model; + GtkTreeIter iter; + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (cd->treeview)); + + gtk_tree_model_get_iter_from_string (model, &iter, path_string); + + gtk_list_store_set (GTK_LIST_STORE (model), &iter, + HEADER_KEY_COLUMN, new_text, -1); + + commit_changes (cd); +} + +static void +cell_value_edited_callback (GtkCellRendererText *cell, + gchar *path_string, + gchar *new_text, + ConfigData *cd) +{ + GtkTreeModel *model; + GtkTreeIter iter; + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (cd->treeview)); + + gtk_tree_model_get_iter_from_string (model, &iter, path_string); + + gtk_list_store_set (GTK_LIST_STORE (model), &iter, + HEADER_VALUE_COLUMN, new_text, -1); + + commit_changes (cd); +} + +static void +header_add_clicked (GtkButton *button, ConfigData *cd) +{ + GtkTreeModel *model; + GtkTreeIter iter; + gchar *new_header = NULL; + GtkTreeViewColumn *focus_col; + GtkTreePath *path; + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (cd->treeview)); + gtk_tree_model_foreach (model, (GtkTreeModelForeachFunc) header_foreach_check_isempty, 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); + gtk_list_store_set (GTK_LIST_STORE (model), &iter, + HEADER_VALUE_COLUMN, new_header, -1); + + focus_col = gtk_tree_view_get_column (GTK_TREE_VIEW (cd->treeview), HEADER_KEY_COLUMN); + path = gtk_tree_model_get_path (model, &iter); + + if (path) { + gtk_tree_view_set_cursor (GTK_TREE_VIEW (cd->treeview), path, focus_col, TRUE); + gtk_tree_view_row_activated(GTK_TREE_VIEW(cd->treeview), path, focus_col); + gtk_tree_path_free (path); + } + + /* We have done our job, connect back to the signal */ + g_signal_connect(G_OBJECT(model), "row-changed", G_CALLBACK(header_isempty), cd); +} + +static void +header_remove_clicked (GtkButton *button, ConfigData *cd) +{ + GtkTreeSelection *selection; + GtkTreeModel *model; + GtkTreeIter iter; + GtkTreePath *path; + gboolean valid; + gint len; + + valid = FALSE; + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (cd->treeview)); + if (!gtk_tree_selection_get_selected (selection, &model, &iter)) + return; + + /* Get the path and move to the previous node :) */ + path = gtk_tree_model_get_path (model, &iter); + if (path) + valid = gtk_tree_path_prev(path); + + gtk_list_store_remove (GTK_LIST_STORE (model), &iter); + + len = gtk_tree_model_iter_n_children (model, NULL); + if (len > 0) { + if (gtk_list_store_iter_is_valid (GTK_LIST_STORE(model), &iter)) { + gtk_tree_selection_select_iter (selection, &iter); + } else { + if (path && valid) { + gtk_tree_model_get_iter(model, &iter, path); + gtk_tree_selection_select_iter (selection, &iter); + } + } + } else { + gtk_widget_set_sensitive (cd->header_edit, FALSE); + gtk_widget_set_sensitive (cd->header_remove, FALSE); + } + + gtk_widget_grab_focus(cd->treeview); + gtk_tree_path_free (path); + + commit_changes (cd); +} + +static void +header_edit_clicked (GtkButton *button, ConfigData *cd) +{ + GtkTreeSelection *selection; + GtkTreeModel *model; + GtkTreePath *path; + GtkTreeIter iter; + GtkTreeViewColumn *focus_col; + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (cd->treeview)); + if (!gtk_tree_selection_get_selected (selection, &model, &iter)) + return; + + focus_col = gtk_tree_view_get_column (GTK_TREE_VIEW (cd->treeview), HEADER_KEY_COLUMN); + path = gtk_tree_model_get_path (model, &iter); + + if (path) { + gtk_tree_view_set_cursor (GTK_TREE_VIEW (cd->treeview), path, focus_col, TRUE); + gtk_tree_path_free (path); + } +} + +static void +selection_changed (GtkTreeSelection *selection, ConfigData *cd) +{ + GtkTreeModel *model; + GtkTreeIter iter; + + if (gtk_tree_selection_get_selected (selection, &model, &iter)) { + gtk_widget_set_sensitive (cd->header_edit, TRUE); + gtk_widget_set_sensitive (cd->header_remove, TRUE); + } else { + gtk_widget_set_sensitive (cd->header_edit, FALSE); + gtk_widget_set_sensitive (cd->header_remove, FALSE); + } +} + +static void +destroy_cd_data (gpointer data) +{ + ConfigData *cd = (ConfigData *) data; + + if (!cd) + return; + + g_object_unref (cd->xml); + g_object_unref (cd->gconf); + g_free (cd); +} + +GtkWidget * +e_plugin_lib_get_configure_widget (EPlugin *epl) +{ + GtkCellRenderer *renderer; + GtkTreeSelection *selection; + GtkTreeIter iter; + GtkWidget *hbox; + GSList *list; + GSList *header_list = NULL; + GtkTreeModel *model; + gint index; + gchar *buffer; + char *str_colon = NULL, *str1_colon = NULL; + GtkTreeViewColumn *col; + int col_pos; + + GConfClient *client = gconf_client_get_default(); + + ConfigData *cd = g_new0 (ConfigData, 1); + + char *gladefile; + + gladefile = g_build_filename (EVOLUTION_GLADEDIR, + "email-custom-header.glade", + NULL); + cd->xml = glade_xml_new (gladefile, "ech_configuration_box", NULL); + g_free (gladefile); + + cd->gconf = gconf_client_get_default (); + + cd->treeview = glade_xml_get_widget (cd->xml, "header_treeview"); + + cd->store = gtk_list_store_new (HEADER_N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING); + + gtk_tree_view_set_model (GTK_TREE_VIEW (cd->treeview), GTK_TREE_MODEL (cd->store)); + + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (cd->treeview), -1, _("Key"), + renderer, "text", HEADER_KEY_COLUMN, NULL); + col = gtk_tree_view_get_column (GTK_TREE_VIEW (cd->treeview), col_pos -1); + gtk_tree_view_column_set_resizable (col, TRUE); + gtk_tree_view_column_set_reorderable(col, TRUE); + g_object_set (col, "min-width", 50, NULL); + + g_object_set (G_OBJECT (renderer), "editable", TRUE, NULL); + g_signal_connect(renderer, "edited", (GCallback) cell_edited_callback, cd); + + renderer = gtk_cell_renderer_text_new (); + col_pos = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (cd->treeview), -1, _("Values"), + renderer, "text", HEADER_VALUE_COLUMN, NULL); + col = gtk_tree_view_get_column (GTK_TREE_VIEW (cd->treeview), col_pos -1); + gtk_tree_view_column_set_resizable (col, TRUE); + gtk_tree_view_column_set_reorderable(col, TRUE); + g_object_set (G_OBJECT (renderer), "editable", TRUE, NULL); + + g_signal_connect(renderer, "edited", (GCallback) cell_value_edited_callback, cd); + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (cd->treeview)); + gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); + g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (selection_changed), cd); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (cd->treeview), TRUE); + + cd->header_add = glade_xml_get_widget (cd->xml, "header_add"); + g_signal_connect (G_OBJECT (cd->header_add), "clicked", G_CALLBACK (header_add_clicked), cd); + + cd->header_remove = glade_xml_get_widget (cd->xml, "header_remove"); + g_signal_connect (G_OBJECT (cd->header_remove), "clicked", G_CALLBACK (header_remove_clicked), cd); + gtk_widget_set_sensitive (cd->header_remove, FALSE); + + cd->header_edit = glade_xml_get_widget (cd->xml, "header_edit"); + g_signal_connect (G_OBJECT (cd->header_edit), "clicked", G_CALLBACK (header_edit_clicked), cd); + gtk_widget_set_sensitive (cd->header_edit, FALSE); + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (cd->treeview)); + g_signal_connect(G_OBJECT(model), "row-changed", G_CALLBACK(header_isempty), cd); + + /* Populate tree view with values from gconf */ + header_list = gconf_client_get_list (client,GCONF_KEY_CUSTOM_HEADER,GCONF_VALUE_STRING, NULL); + + for (list = header_list; list; list = g_slist_next (list)) { + gtk_list_store_append (cd->store, &iter); + gchar **parse_header_list; + buffer = list->data; + 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); + + 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); + } + } + g_free (str_colon); + g_free (str1_colon); + + if (header_list) { + g_slist_foreach (header_list, (GFunc) g_free, NULL); + g_slist_free (header_list); + } + + /* Add the list here */ + + hbox = gtk_vbox_new (FALSE, 0); + + gtk_box_pack_start (GTK_BOX (hbox), glade_xml_get_widget (cd->xml, "ech_configuration_box"), TRUE, TRUE, 0); + + /* to let free data properly on destroy of configuration widget */ + g_object_set_data_full (G_OBJECT (hbox), "mycd-data", cd, destroy_cd_data); + + return hbox; +} + +/* Configuration in Mail Prefs Page goes here */ + +GtkWidget * +org_gnome_email_custom_header_config_option (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data) +{ + /* This function and the hook needs to be removed, + once the configure code is thoroughly tested */ + + return NULL; + +} -- cgit v1.2.3 From 5e4b6fcb89797b533b9a741c491ec592d2a06721 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 22 Jul 2008 08:43:06 +0000 Subject: ** Fix for bug #544022 2008-07-22 Milan Crha ** Fix for bug #544022 * configure.in: Do not redefine DBUS_VERSION define supplied by dbus itself, rather rename our define to FOUND_DBUS_VERSION. * mail/e-searching-tokenizer.c: (dump_trie): Define function only when required. (Compiler warning cleanup.) * shell/e-shell-window-commands.c: (char *authors[]): Break the escape sequence properly (compiler warning cleanup). * plugins/email-custom-header/email-custom-header.c: Compiler warning cleanup. * plugins/mail-notification/Makefile.am: * plugins/mail-notification/mail-notification.c: (send_dbus_message): Do not redefine DBUS_VERSION define, it's supplied by dbus itself. svn path=/trunk/; revision=35819 --- plugins/email-custom-header/email-custom-header.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins/email-custom-header/email-custom-header.c') diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 5579e9c420..6918a9b43c 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -33,6 +33,7 @@ #include "mail/em-event.h" #include "composer/e-msg-composer.h" #include "libedataserver/e-account.h" +#include "e-util/e-config.h" #include "email-custom-header.h" @@ -81,6 +82,7 @@ static void commit_changes (ConfigData *cd); int e_plugin_lib_enable (EPluginLib *ep, int enable); GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl); gboolean e_plugin_ui_init(GtkUIManager *manager, EMsgComposer *composer); +GtkWidget *org_gnome_email_custom_header_config_option (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); int e_plugin_lib_enable (EPluginLib *ep, int enable) -- cgit v1.2.3 From 09cfe5d5690a75e8f79c94b052980dd191965054 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 14 Aug 2008 19:21:10 +0000 Subject: New convenience function for launching help from Evolution. Displays an 2008-08-14 Matthew Barnes * e-util/e-util.c (e_display_help): New convenience function for launching help from Evolution. Displays an error dialog over the given parent window if an error occurs. * addressbook/gui/contact-editor/e-contact-editor.c: * calendar/gui/dialogs/comp-editor.c: * plugins/email-custom-header/gui/contact-editor/e-contact-editor.c: * plugins/exchange-operations/exchange-send-options.c: * widgets/misc/e-multi-config-dialog.c: * widgets/misc/e-send-options.c: Use e_display_help() for displaying help. svn path=/trunk/; revision=35991 --- plugins/email-custom-header/email-custom-header.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'plugins/email-custom-header/email-custom-header.c') diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 6918a9b43c..ab882cc197 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "mail/em-menu.h" #include "mail/em-utils.h" @@ -34,6 +33,7 @@ #include "composer/e-msg-composer.h" #include "libedataserver/e-account.h" #include "e-util/e-config.h" +#include "e-util/e-util.h" #include "email-custom-header.h" @@ -197,7 +197,6 @@ epech_header_options_cb (GtkDialog *dialog, gint state, gpointer func_data) { EmailCustomHeaderOptionsDialogPrivate *priv; CustomHeaderOptionsDialog *mch; - GError *error = NULL; mch = func_data; priv = mch->priv; @@ -211,12 +210,9 @@ epech_header_options_cb (GtkDialog *dialog, gint state, gpointer func_data) g_object_unref (priv->xml); break; case GTK_RESPONSE_HELP: - gnome_help_display ( - "evolution.xml", priv->help_section, &error); - if (error) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_display_help ( + GTK_WINDOW (priv->main), + priv->help_section); break; } -- cgit v1.2.3 From a8cff3a02a1aecdea2e4fecfa37dca809a176ec2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 1 Sep 2008 14:57:02 +0000 Subject: Fix compiler warnings in some of the test programs. 2008-09-01 Matthew Barnes * configure.in: Fix compiler warnings in some of the test programs. * mail/em-composer-utils.c (edit_message): * plugins/email-custom-header/email-custom-header.c: * plugins/templates/templates.c: Don't mix declarations and code. svn path=/trunk/; revision=36242 --- plugins/email-custom-header/email-custom-header.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins/email-custom-header/email-custom-header.c') diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index ab882cc197..847c56d315 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -651,13 +651,13 @@ header_foreach_check_isempty (GtkTreeModel *model, GtkTreePath *path, GtkTreeIte valid = gtk_tree_model_get_iter_first (model, iter); while (valid && gtk_list_store_iter_is_valid (cd->store, iter)) { char *keyword = NULL; + char *value = NULL; gtk_tree_model_get (model, iter, HEADER_KEY_COLUMN, &keyword, -1); /* Check if the keyword is not empty and then emit the row-changed signal (if we delete the row, then the iter gets corrupted) */ if ((keyword) && !(g_utf8_strlen (g_strstrip (keyword), -1) > 0)) gtk_tree_model_row_changed (model, path, iter); - char *value = NULL; gtk_tree_model_get (model, iter, HEADER_VALUE_COLUMN, &value, -1); /* Check if the keyword is not empty and then emit the row-changed signal (if we delete the row, then the iter gets corrupted) */ @@ -919,9 +919,10 @@ e_plugin_lib_get_configure_widget (EPlugin *epl) header_list = gconf_client_get_list (client,GCONF_KEY_CUSTOM_HEADER,GCONF_VALUE_STRING, NULL); for (list = header_list; list; list = g_slist_next (list)) { - gtk_list_store_append (cd->store, &iter); gchar **parse_header_list; + 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); -- cgit v1.2.3 From b7fc5caefe4aded8d0ffd7088ecbbf1f370b995e Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Fri, 12 Sep 2008 16:19:36 +0000 Subject: License Changes from GPL to LGPL svn path=/trunk/; revision=36313 --- plugins/email-custom-header/email-custom-header.c | 28 ++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'plugins/email-custom-header/email-custom-header.c') diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 847c56d315..b3feb99de2 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -1,21 +1,23 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Ashish Shrivastava - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * +/* * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Ashish Shrivastava + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, MA 02110-1301. */ #ifdef HAVE_CONFIG_H -- cgit v1.2.3 From 538f13dd6e28f1463e3c30f1cef8783f5b9ec835 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Fri, 9 Jan 2009 15:26:20 +0000 Subject: Reviewed by Matthew Barnes 2009-01-09 Takao Fujiwara Reviewed by Matthew Barnes ** Fix for bug #567129 * apps_evolution_email_custom_header.schemas.in: Add tag in C locale to localize the value. * email-custom-header.c (epech_setup_widgets): Add gettext. svn path=/trunk/; revision=37022 --- plugins/email-custom-header/email-custom-header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/email-custom-header/email-custom-header.c') diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index b3feb99de2..5942d28c20 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -367,7 +367,7 @@ epech_setup_widgets (CustomHeaderOptionsDialog *mch) (temp_header_value_ptr->sub_header_string_value)->str); } - gtk_combo_box_append_text (GTK_COMBO_BOX (sub_combo_box_ptr->header_value_combo_box),"None"); + gtk_combo_box_append_text (GTK_COMBO_BOX (sub_combo_box_ptr->header_value_combo_box), _("None")); gtk_widget_show (sub_combo_box_ptr->header_value_combo_box); } } -- cgit v1.2.3 From 51dba6bd0c19773ba8b631efbf51c07d548fc75c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 1 Feb 2009 01:18:42 +0000 Subject: ** Disable debug macros (#define d(x) x) throughout. (#569638) 2009-01-31 Matthew Barnes ** Disable debug macros (#define d(x) x) throughout. (#569638) svn path=/trunk/; revision=37202 --- plugins/email-custom-header/email-custom-header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/email-custom-header/email-custom-header.c') diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 5942d28c20..0305dd2c25 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -39,7 +39,7 @@ #include "email-custom-header.h" -#define d(x) x +#define d(x) #define GCONF_KEY_CUSTOM_HEADER "/apps/evolution/eplugin/email_custom_header/customHeader" typedef struct { -- cgit v1.2.3 From 92cf0195de07748cd4fbf0d5d67005a4754a03e1 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Tue, 3 Feb 2009 01:33:00 +0000 Subject: Reviewed by Srinivasa Ragavan 2009-02-02 Takao Fujiwara Reviewed by Srinivasa Ragavan ** Fix for bug #567568 * apps_evolution_email_custom_header.schemas.in: Remove translatable tag. * email-custom-header.c (epech_setup_widgets): Added gettext for the default custom header. svn path=/trunk/; revision=37211 --- plugins/email-custom-header/email-custom-header.c | 29 +++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'plugins/email-custom-header/email-custom-header.c') diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 0305dd2c25..69bae1143f 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -329,6 +329,20 @@ epech_setup_widgets (CustomHeaderOptionsDialog *mch) HeaderValueComboBox *sub_combo_box_ptr; gint sub_index,row_combo,column_combo; gint header_section_id,sub_type_index,row,column,label_row; + gint i; + gchar *str; + static gchar *security_field = N_("Security:"); + static struct _security_values { + char *value, *str; + } security_values[] = { + { "Personal", N_("Personal") } , + { "Unclassified", N_("Unclassified") }, + { "Protected", N_("Protected") }, + { "InConfidence", N_("Confidential") }, + { "Secret", N_("Secret") }, + { "Topsecret", N_("Top secret") }, + { NULL, NULL } + }; priv = mch->priv; priv->combo_box_header_value = g_array_new (TRUE, FALSE, sizeof (HeaderValueComboBox)); @@ -339,7 +353,11 @@ epech_setup_widgets (CustomHeaderOptionsDialog *mch) // To create an empty label widget. Text will be added dynamically. priv->header_type_name_label = gtk_label_new (""); temp_header_ptr = &g_array_index(priv->email_custom_header_details, EmailCustomHeaderDetails,header_section_id); - gtk_label_set_markup (GTK_LABEL (priv->header_type_name_label),(temp_header_ptr->header_type_value)->str); + str = (temp_header_ptr->header_type_value)->str; + if (strcmp (str, security_field) == 0) { + str = _(security_field); + } + gtk_label_set_markup (GTK_LABEL (priv->header_type_name_label), str); gtk_table_attach (GTK_TABLE (priv->header_table), priv->header_type_name_label, 0, 1, row, column, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), @@ -363,8 +381,15 @@ epech_setup_widgets (CustomHeaderOptionsDialog *mch) for (sub_type_index = 0; sub_type_index < temp->number_of_subtype_header; sub_type_index++) { temp_header_value_ptr = &g_array_index(temp->sub_header_type_value, CustomSubHeader,sub_type_index); + str = (temp_header_value_ptr->sub_header_string_value)->str; + for (i = 0; security_values[i].value != NULL; i++) { + if (strcmp (str, security_values[i].value) == 0) { + str = _(security_values[i].str); + break; + } + } gtk_combo_box_append_text (GTK_COMBO_BOX (sub_combo_box_ptr->header_value_combo_box), - (temp_header_value_ptr->sub_header_string_value)->str); + str); } gtk_combo_box_append_text (GTK_COMBO_BOX (sub_combo_box_ptr->header_value_combo_box), _("None")); -- cgit v1.2.3 From 9c28e70fb0e7dc3eea887938651ef66cceb68e05 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 14 Feb 2009 04:25:11 +0000 Subject: ** Fixes part of bug #564229 2009-02-13 Matthew Barnes ** Fixes part of bug #564229 * e-util/e-plugin-ui.c (plugin_ui_hook_class_init): Initialize the EPluginUI registry during class initialization, so that it's sure to be there when we need it. * plugins/email-custom-header/email-custom-header.c: (e_plugin_lib_get_configure_widget): Do not use uninitialized variable. svn path=/trunk/; revision=37265 --- plugins/email-custom-header/email-custom-header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/email-custom-header/email-custom-header.c') diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 69bae1143f..233804cd13 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -903,7 +903,7 @@ e_plugin_lib_get_configure_widget (EPlugin *epl) gtk_tree_view_set_model (GTK_TREE_VIEW (cd->treeview), GTK_TREE_MODEL (cd->store)); renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (cd->treeview), -1, _("Key"), + col_pos = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (cd->treeview), -1, _("Key"), renderer, "text", HEADER_KEY_COLUMN, NULL); col = gtk_tree_view_get_column (GTK_TREE_VIEW (cd->treeview), col_pos -1); gtk_tree_view_column_set_resizable (col, TRUE); -- cgit v1.2.3 From e11f37f2fcaba74949b30a7b2181916da2a9c9a1 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 25 Feb 2009 11:23:33 +0000 Subject: ** Fix for bug #572399 2009-02-25 Milan Crha ** Fix for bug #572399 * email-custom-header.c: (header_foreach_check_isempty): Do not read from invalid iterator after call of row changed. svn path=/trunk/; revision=37331 --- plugins/email-custom-header/email-custom-header.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'plugins/email-custom-header/email-custom-header.c') diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 233804cd13..994af730b6 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -684,12 +684,13 @@ header_foreach_check_isempty (GtkTreeModel *model, GtkTreePath *path, GtkTreeIte signal (if we delete the row, then the iter gets corrupted) */ if ((keyword) && !(g_utf8_strlen (g_strstrip (keyword), -1) > 0)) gtk_tree_model_row_changed (model, path, iter); - - gtk_tree_model_get (model, iter, HEADER_VALUE_COLUMN, &value, -1); - /* Check if the keyword is not empty and then emit the row-changed - signal (if we delete the row, then the iter gets corrupted) */ - if ((value) && !(g_utf8_strlen (g_strstrip (value), -1) > 0)) - gtk_tree_model_row_changed (model, path, iter); + else { + gtk_tree_model_get (model, iter, HEADER_VALUE_COLUMN, &value, -1); + /* Check if the keyword is not empty and then emit the row-changed + signal (if we delete the row, then the iter gets corrupted) */ + if ((value) && !(g_utf8_strlen (g_strstrip (value), -1) > 0)) + gtk_tree_model_row_changed (model, path, iter); + } g_free (keyword); g_free (value); -- cgit v1.2.3