From 143695d07f3f23a82b5cb8f7f60ae777e91a3b6c Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 17 Jul 2009 12:08:18 +0200 Subject: Bug #583374 - Use CalDAV as Google's calendar backend --- plugins/google-account-setup/google-source.c | 166 +++++++++++++++++---------- 1 file changed, 103 insertions(+), 63 deletions(-) (limited to 'plugins') diff --git a/plugins/google-account-setup/google-source.c b/plugins/google-account-setup/google-source.c index e0655ce6aa..c3cfde8ff2 100644 --- a/plugins/google-account-setup/google-source.c +++ b/plugins/google-account-setup/google-source.c @@ -52,6 +52,7 @@ #define CALENDAR_LOCATION "://www.google.com/calendar/feeds/" #define CALENDAR_DEFAULT_PATH "/private/full" #define URL_GET_SUBSCRIBED_CALENDARS "://www.google.com/calendar/feeds/default/allcalendars/full" +#define CALENDAR_CALDAV_URI "caldav://%s@www.google.com/calendar/dav/%s/events" #define d(x) @@ -97,6 +98,22 @@ e_plugin_lib_enable (EPluginLib *ep, gint enable) /********************************************************************************************************************/ +static gchar * +decode_at_back (const gchar *user) +{ + gchar *res, *at; + + g_return_val_if_fail (user != NULL, NULL); + + res = g_strdup (user); + while (at = strstr (res, "%40"), at != NULL) { + *at = '@'; + memmove (at + 1, at + 3, strlen (at + 3) + 1); + } + + return res; +} + static gboolean is_email (const gchar *address) { @@ -118,7 +135,9 @@ sanitize_user_mail (const gchar *user) if (!user) return NULL; - if (!is_email (user)) { + if (strstr (user, "%40") != NULL) { + return g_strdup (user); + } else if (!is_email (user)) { return g_strconcat (user, "%40gmail.com", NULL); } else { gchar *tmp = g_malloc0 (sizeof (gchar) * (1 + strlen (user) + 2)); @@ -190,12 +209,47 @@ is_default_uri (const gchar *given_uri, const gchar *username) return res; } +static void +update_source_uris (ESource *source, const gchar *uri) +{ + gchar *abs_uri, *tmp, *user_sanitized, *slash; + const gchar *user, *feeds; + + g_return_if_fail (source != NULL); + g_return_if_fail (uri != NULL); + + /* this also changes an absolute uri */ + e_source_set_relative_uri (source, uri); + + user = e_source_get_property (source, "username"); + g_return_if_fail (user != NULL); + + feeds = strstr (uri, "/feeds/"); + g_return_if_fail (feeds != NULL); + feeds += 7; + + user_sanitized = sanitize_user_mail (user); + /* no "%40" in the URL path for caldav, really */ + tmp = decode_at_back (feeds); + + slash = strchr (tmp, '/'); + if (slash) + *slash = '\0'; + + abs_uri = g_strdup_printf (CALENDAR_CALDAV_URI, user_sanitized, tmp); + e_source_set_absolute_uri (source, abs_uri); + + g_free (abs_uri); + g_free (tmp); + g_free (user_sanitized); +} + static void init_combo_values (GtkComboBox *combo, const gchar *deftitle, const gchar *defuri); static void user_changed (GtkEntry *editable, ESource *source) { - gchar *uri; + gchar *uri, *eml; const gchar *user, *ssl; /* two reasons why set readonly to FALSE: @@ -203,18 +257,38 @@ user_changed (GtkEntry *editable, ESource *source) b) we are going to set default uri, which should be always writeable */ e_source_set_readonly (source, FALSE); - ssl = e_source_get_property (source, "ssl"); user = gtk_entry_get_text (GTK_ENTRY (editable)); + + if (user && *user) { + /* store the non-encoded email in the "username" property */ + if (strstr (user, "@") == NULL && strstr (user, "%40") == NULL) + eml = g_strconcat (user, "@gmail.com", NULL); + else + eml = decode_at_back (user); + } else { + eml = NULL; + } + + /* set username first, as it's used in update_source_uris */ + e_source_set_property (source, "username", eml); + + ssl = e_source_get_property (source, "ssl"); uri = construct_default_uri (user, !ssl || g_str_equal (ssl, "1")); - e_source_set_relative_uri (source, uri); + update_source_uris (source, uri); g_free (uri); - e_source_set_property (source, "username", user); - e_source_set_property (source, "protocol", "google"); - e_source_set_property (source, "auth-domain", "google"); + /* "setup-username" is used to this plugin only, to keep what user wrote, + not what uses the backend */ + e_source_set_property (source, "setup-username", user); e_source_set_property (source, "auth", (user && *user) ? "1" : NULL); e_source_set_property (source, "googlename", NULL); + /* delete obsolete properties */ + e_source_set_property (source, "protocol", NULL); + e_source_set_property (source, "auth-domain", NULL); + + g_free (eml); + /* we changed user, thus reset the chosen calendar combo too, because other user means other calendars subscribed */ init_combo_values (GTK_COMBO_BOX (g_object_get_data (G_OBJECT (editable), "CalendarCombo")), _("Default"), NULL); @@ -361,11 +435,13 @@ cal_combo_changed (GtkComboBox *combo, ESource *source) /* first set readonly to FALSE, otherwise if TRUE, then e_source_set_readonly does nothing */ e_source_set_readonly (source, FALSE); - e_source_set_relative_uri (source, uri); + update_source_uris (source, uri); e_source_set_readonly (source, readonly); e_source_set_property (source, "googlename", title); - e_source_set_property (source, "protocol", "google"); - e_source_set_property (source, "auth-domain", "google"); + + /* delete obsolete properties */ + e_source_set_property (source, "protocol", NULL); + e_source_set_property (source, "auth-domain", NULL); g_free (title); g_free (uri); @@ -393,7 +469,7 @@ retrieve_list_clicked (GtkButton *button, GtkComboBox *combo) ESource *source; GDataGoogleService *service; GDataFeed *feed; - gchar *password, *tmp; + gchar *user, *password, *tmp; const gchar *username, *ssl; gchar *get_subscribed_url; GError *error = NULL; @@ -410,17 +486,20 @@ retrieve_list_clicked (GtkButton *button, GtkComboBox *combo) username = e_source_get_property (source, "username"); g_return_if_fail (username != NULL && *username != '\0'); - tmp = g_strdup_printf (_("Enter password for user %s to access list of subscribed calendars."), username); + user = decode_at_back (username); + tmp = g_strdup_printf (_("Enter password for user %s to access list of subscribed calendars."), user); password = e_passwords_ask_password (_("Enter password"), "Calendar", "", tmp, E_PASSWORDS_REMEMBER_NEVER | E_PASSWORDS_REPROMPT | E_PASSWORDS_SECRET | E_PASSWORDS_DISABLE_REMEMBER, NULL, parent); g_free (tmp); - if (!password) + if (!password) { + g_free (user); return; + } service = gdata_google_service_new ("cl", "evolution-client-0.0.1"); - gdata_service_set_credentials (GDATA_SERVICE (service), username, password); + gdata_service_set_credentials (GDATA_SERVICE (service), user, password); /* privacy... maybe... */ memset (password, 0, strlen (password)); g_free (password); @@ -478,7 +557,7 @@ retrieve_list_clicked (GtkButton *button, GtkComboBox *combo) if (color) gdk_color_parse (color, &gdkcolor); - if (default_idx == -1 && is_default_uri (uri, username)) { + if (default_idx == -1 && is_default_uri (uri, user)) { /* have the default uri always NULL and first in the combo */ uri = NULL; gtk_list_store_insert (store, &iter, 0); @@ -524,6 +603,7 @@ retrieve_list_clicked (GtkButton *button, GtkComboBox *combo) } g_object_unref (service); + g_free (user); } static void @@ -538,20 +618,6 @@ retrieve_list_sensitize (GtkEntry *username_entry, gtk_widget_set_sensitive (button, sensitive); } -static void -ssl_toggled (GtkToggleButton *check, ESource *source) -{ - g_return_if_fail (check != NULL); - g_return_if_fail (source != NULL); - - if (gtk_toggle_button_get_active (check)) - e_source_set_property (source, "ssl", "1"); - else - e_source_set_property (source, "ssl", "0"); - - user_changed (GTK_ENTRY (g_object_get_data (G_OBJECT (check), "username")), source); -} - GtkWidget * plugin_google (EPlugin *epl, EConfigHookItemFactoryData *data) @@ -561,7 +627,6 @@ plugin_google (EPlugin *epl, ESourceGroup *group; EUri *euri; GtkWidget *parent; - GtkWidget *cssl; GtkWidget *widget; GtkWidget *luser; GtkWidget *user; @@ -569,8 +634,6 @@ plugin_google (EPlugin *epl, GtkWidget *combo; gchar *uri; const gchar *username; - const gchar *ssl_prop; - gboolean ssl_enabled; gint row; GtkCellRenderer *renderer; GtkListStore *store; @@ -595,37 +658,17 @@ plugin_google (EPlugin *epl, e_uri_free (euri); - username = e_source_get_property (source, "username"); - - ssl_prop = e_source_get_property (source, "ssl"); - if (!ssl_prop || g_str_equal (ssl_prop, "1")) { - ssl_enabled = TRUE; - } else { - ssl_enabled = FALSE; - } + username = e_source_get_property (source, "setup-username"); + if (!username) + username = e_source_get_property (source, "username"); - if (!ssl_prop) { - e_source_set_property (source, "ssl", "1"); - } else if (ssl_enabled) { - const gchar *rel_uri = e_source_peek_relative_uri (source); - - if (rel_uri && g_str_has_prefix (rel_uri, "http://")) { - ssl_enabled = FALSE; - e_source_set_property (source, "ssl", "0"); - } - } + /* google's CalDAV requires SSL, thus forcing it here, and no setup for it */ + e_source_set_property (source, "ssl", "1"); /* Build up the UI */ parent = data->parent; row = GTK_TABLE (parent)->nrows; - cssl = gtk_check_button_new_with_mnemonic (_("Use _SSL")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cssl), ssl_enabled); - gtk_widget_show (cssl); - gtk_table_attach (GTK_TABLE (parent), - cssl, 1, 2, - row + 3, row + 4, - GTK_FILL, 0, 0, 0); luser = gtk_label_new_with_mnemonic (_("User_name:")); gtk_widget_show (luser); gtk_misc_set_alignment (GTK_MISC (luser), 0.0, 0.5); @@ -679,9 +722,6 @@ plugin_google (EPlugin *epl, gtk_table_attach (GTK_TABLE (parent), hbox, 1, 2, row + 2, row + 3, GTK_EXPAND | GTK_FILL, 0, 0, 0); - g_object_set_data (G_OBJECT (cssl), "username", user); - g_signal_connect (cssl, "toggled", G_CALLBACK (ssl_toggled), source); - g_signal_connect (G_OBJECT (user), "changed", G_CALLBACK (user_changed), @@ -690,7 +730,7 @@ plugin_google (EPlugin *epl, label = gtk_label_new_with_mnemonic (_("Cal_endar:")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_widget_show (label); - gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row + 4, row + 5, GTK_FILL | GTK_EXPAND, 0, 0, 0); + gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row + 3, row + 4, GTK_FILL | GTK_EXPAND, 0, 0, 0); store = gtk_list_store_new ( NUM_COLUMNS, @@ -727,10 +767,10 @@ plugin_google (EPlugin *epl, g_signal_connect (user, "changed", G_CALLBACK (retrieve_list_sensitize), label); g_object_set_data (G_OBJECT (label), "ESource", source); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - gtk_widget_set_sensitive (label, FALSE); + gtk_widget_set_sensitive (label, username && *username); gtk_widget_show_all (hbox); - gtk_table_attach (GTK_TABLE (parent), hbox, 1, 2, row + 4, row + 5, GTK_FILL | GTK_EXPAND, 0, 0, 0); + gtk_table_attach (GTK_TABLE (parent), hbox, 1, 2, row + 3, row + 4, GTK_FILL | GTK_EXPAND, 0, 0, 0); return widget; } -- cgit v1.2.3 From 303ced5b758696c33477494c74e97d37d13aa12e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 17 Jul 2009 15:50:23 +0200 Subject: Bug #588856 - Migration code for Google by CalDAV calendar --- plugins/google-account-setup/Makefile.am | 6 +- plugins/google-account-setup/google-source.c | 66 ++++++++++++++++++---- .../org-gnome-evolution-google.eplug.xml | 4 ++ 3 files changed, 62 insertions(+), 14 deletions(-) (limited to 'plugins') diff --git a/plugins/google-account-setup/Makefile.am b/plugins/google-account-setup/Makefile.am index ed452c0bc7..67a7c2c152 100644 --- a/plugins/google-account-setup/Makefile.am +++ b/plugins/google-account-setup/Makefile.am @@ -1,6 +1,7 @@ AM_CPPFLAGS = \ -I . \ -I$(top_srcdir) \ + -I$(top_builddir)/shell \ -DCALDAV_GLADEDIR=\""$(gladedir)"\" \ $(EVOLUTION_CALENDAR_CFLAGS) \ $(EVOLUTION_ADDRESSBOOK_CFLAGS) @@ -15,8 +16,9 @@ liborg_gnome_evolution_google_la_SOURCES = \ google-contacts-source.h \ google-contacts-source.c -liborg_gnome_evolution_google_la_LIBADD = \ - $(EVOLUTION_CALENDAR_LIBS) \ +liborg_gnome_evolution_google_la_LIBADD = \ + $(top_builddir)/calendar/gui/libevolution-calendar.la \ + $(EVOLUTION_CALENDAR_LIBS) \ $(EPLUGIN_LIBS) liborg_gnome_evolution_google_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) diff --git a/plugins/google-account-setup/google-source.c b/plugins/google-account-setup/google-source.c index c3cfde8ff2..2a8b6c46e5 100644 --- a/plugins/google-account-setup/google-source.c +++ b/plugins/google-account-setup/google-source.c @@ -36,6 +36,8 @@ #include #include +#include +#include #include #include @@ -49,6 +51,7 @@ #include "google-contacts-source.h" +#define GOOGLE_BASE_URI "google://" #define CALENDAR_LOCATION "://www.google.com/calendar/feeds/" #define CALENDAR_DEFAULT_PATH "/private/full" #define URL_GET_SUBSCRIBED_CALENDARS "://www.google.com/calendar/feeds/default/allcalendars/full" @@ -58,11 +61,9 @@ /*****************************************************************************/ /* prototypes */ -gint e_plugin_lib_enable (EPluginLib *ep, - gint enable); - -GtkWidget * plugin_google (EPlugin *epl, - EConfigHookItemFactoryData *data); +gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +GtkWidget *plugin_google (EPlugin *epl, EConfigHookItemFactoryData *data); +void e_calendar_google_migrate (EPlugin *epl, ECalEventTargetComponent *data); /*****************************************************************************/ /* plugin intialization */ @@ -77,7 +78,7 @@ ensure_google_source_group (void) return; } - e_source_list_ensure_group (slist, _("Google"), "google://", FALSE); + e_source_list_ensure_group (slist, _("Google"), GOOGLE_BASE_URI, FALSE); g_object_unref (slist); } @@ -247,18 +248,19 @@ update_source_uris (ESource *source, const gchar *uri) static void init_combo_values (GtkComboBox *combo, const gchar *deftitle, const gchar *defuri); static void -user_changed (GtkEntry *editable, ESource *source) +update_user_in_source (ESource *source, const gchar *new_user) { - gchar *uri, *eml; - const gchar *user, *ssl; + gchar *uri, *eml, *user; + const gchar *ssl; + + /* to ensure it will not be freed before the work with it is done */ + user = g_strdup (new_user); /* two reasons why set readonly to FALSE: a) the e_source_set_relative_uri does nothing for readonly sources b) we are going to set default uri, which should be always writeable */ e_source_set_readonly (source, FALSE); - user = gtk_entry_get_text (GTK_ENTRY (editable)); - if (user && *user) { /* store the non-encoded email in the "username" property */ if (strstr (user, "@") == NULL && strstr (user, "%40") == NULL) @@ -288,6 +290,13 @@ user_changed (GtkEntry *editable, ESource *source) e_source_set_property (source, "auth-domain", NULL); g_free (eml); + g_free (user); +} + +static void +user_changed (GtkEntry *editable, ESource *source) +{ + update_user_in_source (source, gtk_entry_get_text (GTK_ENTRY (editable))); /* we changed user, thus reset the chosen calendar combo too, because other user means other calendars subscribed */ @@ -644,7 +653,7 @@ plugin_google (EPlugin *epl, group = e_source_peek_group (source); widget = NULL; - if (g_ascii_strncasecmp ("google://", e_source_group_peek_base_uri (group), 9) != 0) { + if (g_ascii_strncasecmp (GOOGLE_BASE_URI, e_source_group_peek_base_uri (group), strlen (GOOGLE_BASE_URI)) != 0) { return NULL; } @@ -774,3 +783,36 @@ plugin_google (EPlugin *epl, return widget; } + +void +e_calendar_google_migrate (EPlugin *epl, ECalEventTargetComponent *data) +{ + CalendarComponent *component; + ESourceList *source_list; + ESourceGroup *google = NULL; + gboolean changed = FALSE; + + component = data->component; + source_list = calendar_component_peek_source_list (component); + + google = e_source_list_peek_group_by_base_uri (source_list, GOOGLE_BASE_URI); + if (google) { + GSList *s; + + for (s = e_source_group_peek_sources (google); s; s = s->next) { + ESource *source = E_SOURCE (s->data); + + if (!source) + continue; + + /* new source through CalDAV uses absolute uri, thus it should be migrated if not set */ + if (!e_source_peek_absolute_uri (source)) { + update_user_in_source (source, e_source_get_property (source, "username")); + changed = TRUE; + } + } + } + + if (changed) + e_source_list_sync (source_list, NULL); +} diff --git a/plugins/google-account-setup/org-gnome-evolution-google.eplug.xml b/plugins/google-account-setup/org-gnome-evolution-google.eplug.xml index 42b84d58fa..afccbd3fb7 100644 --- a/plugins/google-account-setup/org-gnome-evolution-google.eplug.xml +++ b/plugins/google-account-setup/org-gnome-evolution-google.eplug.xml @@ -11,6 +11,10 @@ + + + + -- cgit v1.2.3 From dcf2c0e754d6e251733cea74c2427738122620af Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 18 Jul 2009 14:05:05 -0400 Subject: More whitespace cleanup. --- plugins/attachment-reminder/attachment-reminder.c | 4 +-- plugins/default-mailer/default-mailer.c | 6 ++-- plugins/email-custom-header/email-custom-header.c | 8 ++--- .../exchange-operations/exchange-config-listener.c | 12 +++---- .../exchange-operations/exchange-delegates-user.c | 2 +- .../exchange-mail-send-options.c | 4 +-- .../exchange-operations/exchange-send-options.c | 14 ++++---- .../groupwise-account-setup/camel-gw-listener.c | 2 +- plugins/groupwise-features/install-shared.c | 8 ++--- plugins/groupwise-features/junk-mail-settings.c | 2 +- plugins/groupwise-features/junk-settings.c | 22 ++++++------ plugins/groupwise-features/proxy.c | 6 ++-- plugins/groupwise-features/send-options.c | 2 +- plugins/groupwise-features/share-folder-common.c | 10 +++--- plugins/groupwise-features/share-folder.c | 40 +++++++++++----------- plugins/hula-account-setup/camel-hula-listener.c | 2 +- plugins/imap-features/imap-headers.c | 2 +- plugins/itip-formatter/itip-formatter.c | 2 +- plugins/pst-import/pst-importer.c | 8 ++--- plugins/publish-calendar/publish-calendar.c | 6 ++-- plugins/sa-junk-plugin/em-junk-filter.c | 14 ++++---- plugins/tnef-attachments/tnef-plugin.c | 18 +++++----- 22 files changed, 97 insertions(+), 97 deletions(-) (limited to 'plugins') diff --git a/plugins/attachment-reminder/attachment-reminder.c b/plugins/attachment-reminder/attachment-reminder.c index 0ff48d3f69..87acc1662d 100644 --- a/plugins/attachment-reminder/attachment-reminder.c +++ b/plugins/attachment-reminder/attachment-reminder.c @@ -200,8 +200,8 @@ strip_text_msg (gchar *msg) gchar *temp; /* Note : HTML Signatures won't work. Depends on Bug #522784 */ - while (lines [i] && g_strcmp0 (lines[i], SIGNATURE)){ - if (!g_str_has_prefix (g_strstrip(lines[i]), ">")){ + while (lines [i] && g_strcmp0 (lines[i], SIGNATURE)) { + if (!g_str_has_prefix (g_strstrip(lines[i]), ">")) { temp = stripped_msg; stripped_msg = g_strconcat (" ", stripped_msg, lines[i], NULL); diff --git a/plugins/default-mailer/default-mailer.c b/plugins/default-mailer/default-mailer.c index 8d383639ff..a651441e57 100644 --- a/plugins/default-mailer/default-mailer.c +++ b/plugins/default-mailer/default-mailer.c @@ -78,19 +78,19 @@ org_gnome_default_mailer_check_default (EPlugin *ep, ESEventTargetUpgrade *targe /* See whether the check default mailer key has already been set */ is_key = gconf_client_get(client, GCONF_KEY_CHECKDEFAULT, NULL); - if(!is_key) + if (!is_key) gconf_client_set_bool(client, GCONF_KEY_CHECKDEFAULT, TRUE, NULL); else gconf_value_free (is_key); /* Check whether we're supposed to check whether or not we are the default mailer */ - if(gconf_client_get_bool(client, GCONF_KEY_CHECKDEFAULT, NULL)) { + if (gconf_client_get_bool(client, GCONF_KEY_CHECKDEFAULT, NULL)) { mailer = gconf_client_get_string(client, GCONF_KEY_MAILTO_COMMAND, NULL); /* Check whether we are the default mailer */ if (!evolution_is_default_mailer (mailer)) { /* Ask whether we should be the default mailer */ - if(em_utils_prompt_user(NULL, GCONF_KEY_CHECKDEFAULT, "org.gnome.default.mailer:check-default", NULL)) { + if (em_utils_prompt_user(NULL, GCONF_KEY_CHECKDEFAULT, "org.gnome.default.mailer:check-default", NULL)) { gconf_client_set_bool(client, GCONF_KEY_MAILTO_ENABLED, TRUE, NULL); gconf_client_set_string(client, GCONF_KEY_MAILTO_COMMAND, EVOLUTION_MAILTO_COMMAND, NULL); } diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 5a76df3f08..4617edb83e 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -485,7 +485,7 @@ epech_append_to_custom_header (CustomHeaderOptionsDialog *dialog, gint state, gp for (sub_type_index = 0; sub_type_index < temp_header_ptr->number_of_subtype_header; sub_type_index++) { temp_header_value_ptr = &g_array_index(temp_header_ptr->sub_header_type_value, CustomSubHeader,sub_type_index); - if (sub_type_index == g_array_index(priv->header_index_type, gint, index_subtype)){ + if (sub_type_index == g_array_index(priv->header_index_type, gint, index_subtype)) { e_msg_composer_modify_header (composer, (temp_header_ptr->header_type_value)->str, (temp_header_value_ptr->sub_header_string_value)->str); } @@ -526,7 +526,7 @@ epech_custom_header_options_commit (EMsgComposer *comp, gpointer user_data) static gint epech_check_existing_composer_window(gconstpointer compowindow, gconstpointer other_compowindow) { - if ((compowindow) && (other_compowindow)){ + if ((compowindow) && (other_compowindow)) { if (((EmailCustomHeaderWindow *)compowindow)->epech_window == (GdkWindow *)other_compowindow) { return 0; } @@ -620,8 +620,8 @@ commit_changes (ConfigData *cd) /* 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)){ + 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)); diff --git a/plugins/exchange-operations/exchange-config-listener.c b/plugins/exchange-operations/exchange-config-listener.c index a45d9bc309..2c16d2f9ab 100644 --- a/plugins/exchange-operations/exchange-config-listener.c +++ b/plugins/exchange-operations/exchange-config-listener.c @@ -326,7 +326,7 @@ add_account_esources (ExchangeAccount *account, source, -1); g_object_unref (source); } - else if (folder->type == EXCHANGE_CALENDAR_FOLDER){ + else if (folder->type == EXCHANGE_CALENDAR_FOLDER) { relative_uri = g_strdup (folder->uri + strlen (EXCHANGE_URI_PREFIX)); source = e_source_new (folder->name, relative_uri); @@ -354,7 +354,7 @@ add_account_esources (ExchangeAccount *account, g_free (relative_uri); } - else if (folder->type == EXCHANGE_TASKS_FOLDER){ + else if (folder->type == EXCHANGE_TASKS_FOLDER) { relative_uri = g_strdup (folder->uri + strlen (EXCHANGE_URI_PREFIX)); source = e_source_new (folder->name, relative_uri); @@ -542,7 +542,7 @@ remove_account_esource (ExchangeAccount *account, strcmp (e_source_group_peek_base_uri (group), EXCHANGE_URI_PREFIX) == 0) { sources = e_source_group_peek_sources (group); - for(; sources != NULL; sources = g_slist_next (sources)) { + for (; sources != NULL; sources = g_slist_next (sources)) { source = E_SOURCE (sources->data); source_uid = e_source_peek_uid (source); @@ -946,7 +946,7 @@ requires_relogin (gchar *current_url, gchar *new_url) break; } } - else if (current_param_val || new_param_val){ + else if (current_param_val || new_param_val) { /* check for added or deleted parameter */ relogin = TRUE; break; @@ -1257,7 +1257,7 @@ exchange_add_autocompletion_folders (GConfClient *gc_client, ExchangeAccount *ac strcmp (e_source_group_peek_base_uri (group), EXCHANGE_URI_PREFIX) == 0) { GSList *sources = e_source_group_peek_sources (group); - for(; sources != NULL; sources = g_slist_next (sources)) { + for (; sources != NULL; sources = g_slist_next (sources)) { ESource *source = E_SOURCE (sources->data); const gchar *absolute_uri; @@ -1374,7 +1374,7 @@ remove_selected_non_offline_esources (ExchangeAccount *account, const gchar *gco strcmp (e_source_group_peek_base_uri (group), EXCHANGE_URI_PREFIX) == 0) { sources = e_source_group_peek_sources (group); - for(; sources != NULL; sources = g_slist_next (sources)) { + for (; sources != NULL; sources = g_slist_next (sources)) { source = E_SOURCE (sources->data); source_uid = e_source_peek_uid (source); diff --git a/plugins/exchange-operations/exchange-delegates-user.c b/plugins/exchange-operations/exchange-delegates-user.c index bc8cb1e357..191ed25fc8 100644 --- a/plugins/exchange-operations/exchange-delegates-user.c +++ b/plugins/exchange-operations/exchange-delegates-user.c @@ -409,7 +409,7 @@ exchange_delegates_user_edit (ExchangeAccount *account, } eaccount = exchange_account_fetch (account); - if(eaccount) { + if (eaccount) { camel_medium_set_header (CAMEL_MEDIUM (delegate_mail), "X-Evolution-Account", eaccount->uid); camel_medium_set_header (CAMEL_MEDIUM (delegate_mail), diff --git a/plugins/exchange-operations/exchange-mail-send-options.c b/plugins/exchange-operations/exchange-mail-send-options.c index 4cc582f25f..04065e4036 100644 --- a/plugins/exchange-operations/exchange-mail-send-options.c +++ b/plugins/exchange-operations/exchange-mail-send-options.c @@ -91,7 +91,7 @@ append_to_header (ExchangeSendOptionsDialog *dialog, gint state, gpointer data) addr = camel_header_address_decode (dialog->options->delegate_address, NULL); sender_addr = camel_header_address_decode (sender_id, NULL); - if(dialog->options->send_as_del_enabled && + if (dialog->options->send_as_del_enabled && dialog->options->delegate_address && g_ascii_strcasecmp(addr->v.addr, sender_addr->v.addr)) { @@ -102,7 +102,7 @@ append_to_header (ExchangeSendOptionsDialog *dialog, gint state, gpointer data) * So for cases where there is no name we append the address * (only email) within angular braces. */ - if(!g_ascii_strcasecmp (addr->name, "")) { + if (!g_ascii_strcasecmp (addr->name, "")) { recipient_id = g_strdup_printf ("<%s>", dialog->options->delegate_address); e_msg_composer_add_header (composer, "From", recipient_id); diff --git a/plugins/exchange-operations/exchange-send-options.c b/plugins/exchange-operations/exchange-send-options.c index cc707ab65e..4c6e705b9d 100644 --- a/plugins/exchange-operations/exchange-send-options.c +++ b/plugins/exchange-operations/exchange-send-options.c @@ -105,7 +105,7 @@ exchange_send_options_get_widgets_data (ExchangeSendOptionsDialog *sod) /* This block helps us fetch the address of the delegator(s). If no delegator is selected or more than one delegatee has been selected then an info dialog is popped up to help the user. */ - if(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->delegate_enabled))) { + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->delegate_enabled))) { name_selector_entry = e_name_selector_peek_section_entry (priv->proxy_name_selector, "Add User"); destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (name_selector_entry)); @@ -132,7 +132,7 @@ exchange_send_options_get_widgets_data (ExchangeSendOptionsDialog *sod) options->delegate_email = email; } - if(count == 0) { + if (count == 0) { e_error_run ((GtkWindow *) priv->main, "org-gnome-exchange-operations:no-delegate-selected", NULL, NULL); gtk_widget_grab_focus ((GtkWidget *) name_selector_entry); @@ -142,7 +142,7 @@ exchange_send_options_get_widgets_data (ExchangeSendOptionsDialog *sod) return -1; } - if(count > 1) { + if (count > 1) { e_error_run ((GtkWindow *)priv->main, "org-gnome-exchange-operations:more-delegates-selected", NULL, NULL); gtk_widget_grab_focus ((GtkWidget *) name_selector_entry); @@ -222,7 +222,7 @@ exchange_send_options_fill_widgets_with_data (ExchangeSendOptionsDialog *sod) name_selector_entry = e_name_selector_peek_section_entry (priv->proxy_name_selector, "Add User"); - if(options->send_as_del_enabled) { + if (options->send_as_del_enabled) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->delegate_enabled), TRUE); gtk_widget_set_sensitive ((GtkWidget *)name_selector_entry, TRUE); gtk_widget_set_sensitive ((GtkWidget *)priv->button_user, TRUE); @@ -287,7 +287,7 @@ static void exchange_send_options_cb (GtkDialog *dialog, gint state, gpointer fu switch (state) { case GTK_RESPONSE_OK: - if(exchange_send_options_get_widgets_data (sod) < 0) + if (exchange_send_options_get_widgets_data (sod) < 0) return; case GTK_RESPONSE_CANCEL: gtk_widget_hide (priv->main); @@ -321,7 +321,7 @@ delegate_option_toggled (GtkCheckButton *button, gpointer func_data) name_selector_entry = e_name_selector_peek_section_entry (priv->proxy_name_selector, "Add User"); - if(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->delegate_enabled))) { + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->delegate_enabled))) { gtk_widget_set_sensitive ((GtkWidget *) name_selector_entry, TRUE); gtk_widget_set_sensitive ((GtkWidget *) priv->button_user, TRUE); } @@ -411,7 +411,7 @@ exchange_sendoptions_dialog_run (ExchangeSendOptionsDialog *sod, GtkWidget *pare exchange_send_options_fill_widgets_with_data (sod); - if(options->delegate_address) { + if (options->delegate_address) { e_name_selector_model_peek_section (name_selector_model, "Add User", NULL, &destination_store); des = e_destination_new (); e_destination_set_email (des, options->delegate_email); diff --git a/plugins/groupwise-account-setup/camel-gw-listener.c b/plugins/groupwise-account-setup/camel-gw-listener.c index 957b9da1c8..72b810feea 100644 --- a/plugins/groupwise-account-setup/camel-gw-listener.c +++ b/plugins/groupwise-account-setup/camel-gw-listener.c @@ -286,7 +286,7 @@ remove_esource (const gchar *conf_key, const gchar *group_name, gchar * source_n strcmp (e_source_group_peek_base_uri (group), GROUPWISE_URI_PREFIX ) == 0) { GSList *sources = e_source_group_peek_sources (group); - for(; sources != NULL; sources = g_slist_next (sources)) { + for (; sources != NULL; sources = g_slist_next (sources)) { ESource *source = E_SOURCE (sources->data); const gchar *source_relative_uri; diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c index ef664b48ef..6dcbfe8d22 100644 --- a/plugins/groupwise-features/install-shared.c +++ b/plugins/groupwise-features/install-shared.c @@ -75,7 +75,7 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) CamelProvider *provider; EGwConnection *cnc; - if (response == GTK_RESPONSE_CANCEL){ + if (response == GTK_RESPONSE_CANCEL) { gtk_widget_destroy (GTK_WIDGET (emfs)); } else { model = accept_data->model; @@ -83,7 +83,7 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) uri = em_folder_selector_get_selected_uri (emfs); path = em_folder_selector_get_selected_path (emfs); names = g_strsplit (path, "/", -1); - if(names == NULL){ + if (names == NULL) { folder_name = (gchar *)path; parent_name = NULL; } else { @@ -103,10 +103,10 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) } cnc = get_cnc (store); - if(E_IS_GW_CONNECTION (cnc)) { + if (E_IS_GW_CONNECTION (cnc)) { container_id = get_container_id (cnc, parent_name); - if(e_gw_connection_accept_shared_folder (cnc, folder_name, container_id, (gchar *)item_id, NULL) == E_GW_CONNECTION_STATUS_OK) { + if (e_gw_connection_accept_shared_folder (cnc, folder_name, container_id, (gchar *)item_id, NULL) == E_GW_CONNECTION_STATUS_OK) { folder = camel_store_get_folder (store, "Mailbox", 0, NULL); /*changes = camel_folder_change_info_new (); diff --git a/plugins/groupwise-features/junk-mail-settings.c b/plugins/groupwise-features/junk-mail-settings.c index 68cbaf6f9d..bfaeee585d 100644 --- a/plugins/groupwise-features/junk-mail-settings.c +++ b/plugins/groupwise-features/junk-mail-settings.c @@ -100,7 +100,7 @@ junk_mail_settings (EPopup *ep, EPopupItem *item, gpointer data) gtk_box_pack_start ((GtkBox *) box, w, FALSE, FALSE, 6); /*We might have to add more options for settings i.e. more pages*/ - while (page_count > 0 ){ + while (page_count > 0 ) { notebook = gtk_notebook_new (); gtk_notebook_append_page ((GtkNotebook *)notebook, box, NULL); gtk_box_pack_start ((GtkBox *) ((GtkDialog *) dialog)->vbox, notebook, TRUE, TRUE, 0); diff --git a/plugins/groupwise-features/junk-settings.c b/plugins/groupwise-features/junk-settings.c index 5c8c76928e..f7c32ee969 100644 --- a/plugins/groupwise-features/junk-settings.c +++ b/plugins/groupwise-features/junk-settings.c @@ -115,7 +115,7 @@ junk_settings_init (JunkSettings *js) static void free_entry_node(EGwJunkEntry *entry) { - if(entry){ + if (entry) { g_free(entry->match); entry->match = NULL; } @@ -128,7 +128,7 @@ free_node(JunkEntry *nentry) { EGwJunkEntry *junk_entry = nentry->entry; - if(junk_entry){ + if (junk_entry) { g_free(junk_entry->match); junk_entry->match = NULL; } @@ -144,13 +144,13 @@ find_node(GList *list, gchar *match) GList *tmp; gint i; - if(list){ + if (list) { tmp = g_list_first(list); - for(i=0; tmp; i++) + for (i=0; tmp; i++) { one_entry = tmp->data; ent = one_entry->entry; - if(!g_ascii_strcasecmp(ent->match, match)){ + if (!g_ascii_strcasecmp(ent->match, match)) { return one_entry; /*if found, it returns that user*/ } @@ -164,7 +164,7 @@ find_node(GList *list, gchar *match) static void free_all (JunkSettings *js) { - if (js->junk_list){ + if (js->junk_list) { g_list_foreach (js->junk_list,(GFunc) free_node, NULL); g_list_free (js->junk_list); js->junk_list = NULL; @@ -240,7 +240,7 @@ commit_changes (JunkSettings *js) } if (E_IS_GW_CONNECTION (js->cnc)) { - if(js->flag_for_ok == 2 && js->enabled){ /* just turn off the bits*/ + if (js->flag_for_ok == 2 && js->enabled){ /* just turn off the bits*/ use_junk = use_pab = use_block = persistence = 0; if (e_gw_connection_modify_junk_settings (js->cnc, use_junk, use_pab, use_block, persistence) == E_GW_CONNECTION_STATUS_OK) { ; @@ -272,12 +272,12 @@ commit_changes (JunkSettings *js) } } - if(new_list){ + if (new_list) { g_list_foreach (new_list, (GFunc) free_entry_node, NULL); g_list_free (new_list); } new_list = NULL; - if(remove_list){ + if (remove_list) { g_list_foreach (remove_list,(GFunc) free_entry_node, NULL); g_list_free (remove_list); } @@ -314,7 +314,7 @@ add_clicked(GtkButton *button, JunkSettings *js) return; else { /*check whether already exists*/ - if (js->junk_list && email){ + if (js->junk_list && email) { new_entry = find_node (js->junk_list, (gchar *)email); if (new_entry) return; @@ -361,7 +361,7 @@ user_selected(GtkTreeSelection *selection, JunkSettings *js) GtkTreeModel *model; gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); - if (gtk_tree_selection_get_selected (selection, &model, &(js->iter))){ + if (gtk_tree_selection_get_selected (selection, &model, &(js->iter))) { gtk_widget_set_sensitive (GTK_WIDGET (js->remove), TRUE); } diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c index 637a13cb2d..91016a6126 100644 --- a/plugins/groupwise-features/proxy.c +++ b/plugins/groupwise-features/proxy.c @@ -146,7 +146,7 @@ proxy_dialog_finalize (GObject *object) g_return_if_fail (IS_PROXY_DIALOG (prd)); priv = prd->priv; - if(priv->proxy_name_selector) + if (priv->proxy_name_selector) g_object_unref (priv->proxy_name_selector); if (priv) { @@ -614,7 +614,7 @@ proxy_update_tree_view (EAccount *account) for (;list_iter; list_iter = g_list_next(list_iter)) { aclInstance = (proxyHandler *) list_iter->data; - if(! (aclInstance->flags & E_GW_PROXY_DELETED )) { + if (! (aclInstance->flags & E_GW_PROXY_DELETED )) { gtk_tree_store_append (priv->store, &iter, NULL); gtk_tree_store_set (priv->store, &iter, 0, broken_image, 1, g_strconcat(aclInstance->proxy_name,"\n",aclInstance->proxy_email, NULL), -1); } @@ -682,7 +682,7 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data) g_signal_connect (editProxy, "clicked", G_CALLBACK(proxy_edit_account), account); priv->proxy_list = NULL; - } else if (account->enabled){ + } else if (account->enabled) { GtkWidget *label; priv->tab_dialog = gtk_vbox_new (TRUE, 10); /*To Translators: In this case, Proxy does not mean something like 'HTTP Proxy', but a GroupWise feature by which one person can send/read mails/appointments using another person's identity without knowing his password, for example if that other person is on vacation*/ diff --git a/plugins/groupwise-features/send-options.c b/plugins/groupwise-features/send-options.c index 16c639b38e..db82ba9ca8 100644 --- a/plugins/groupwise-features/send-options.c +++ b/plugins/groupwise-features/send-options.c @@ -203,7 +203,7 @@ org_gnome_send_options (EPlugin *epl, EConfigHookItemFactoryData *data) target_account = (EMConfigTargetAccount *)data->config->target; account = target_account->account; - if(!g_strrstr (account->source->url, "groupwise://")) + if (!g_strrstr (account->source->url, "groupwise://")) return NULL; vbox = gtk_vbox_new (FALSE, 0); diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c index debb1acaa5..c9e8ffb572 100644 --- a/plugins/groupwise-features/share-folder-common.c +++ b/plugins/groupwise-features/share-folder-common.c @@ -79,7 +79,7 @@ refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store) uri = camel_url_to_string (((CamelService *) store)->url, CAMEL_URL_HIDE_ALL); account = mail_config_get_account_by_source_url (uri); - if (!account){ + if (!account) { return; } @@ -164,7 +164,7 @@ create_folder_done (struct _EMCreateFolder *m) if (m->done) { ccnc = get_cnc (store); - if(E_IS_GW_CONNECTION (ccnc)) { + if (E_IS_GW_CONNECTION (ccnc)) { (ssi->sf)->cnc = ccnc; (ssi->sf)->container_id = g_strdup (get_container_id ((ssi->sf)->cnc, m->full_name)); @@ -198,7 +198,7 @@ new_folder_created_cb (struct _EMCreateFolder *m, gpointer user_data) { struct ShareInfo *ssi = (struct ShareInfo *) user_data; EMFolderSelector *emfs = ssi->emfs; - if (m->fi){ + if (m->fi) { refresh_folder_tree (ssi->model, m->store); gtk_widget_destroy ((GtkWidget *) emfs); gtk_widget_destroy ((GtkWidget *) ssi->d); @@ -470,7 +470,7 @@ get_cnc (CamelStore *store) user = g_strdup (url->user); property_value = camel_url_get_param (url, "soap_port"); use_ssl = g_strdup (camel_url_get_param (url, "use_ssl")); - if(property_value == NULL) + if (property_value == NULL) port = g_strdup ("7191"); else if (strlen(property_value) == 0) port = g_strdup ("7191"); @@ -505,7 +505,7 @@ get_container_id(EGwConnection *cnc, const gchar *fname) gint i = 0, parts = 0; names = g_strsplit (fname, "/", -1); - if(names){ + if (names) { while (names [parts]) parts++; fname = names[i]; diff --git a/plugins/groupwise-features/share-folder.c b/plugins/groupwise-features/share-folder.c index 29ff8acc8a..67c58f05fd 100644 --- a/plugins/groupwise-features/share-folder.c +++ b/plugins/groupwise-features/share-folder.c @@ -129,7 +129,7 @@ share_folder_init (ShareFolder *sf) static void free_user_node(EShUsers *user) { - if(user){ + if (user) { g_free(user->email); user->email = NULL; } @@ -140,7 +140,7 @@ static void free_node(SharedUser *usr) { EShUsers *user = usr->user_node; - if(user){ + if (user) { g_free(user->email); user->email = NULL; } @@ -155,13 +155,13 @@ find_node(GList *list, gchar *email) GList *tmp; gint i; - if(list){ + if (list) { tmp = g_list_first(list); - for(i=0; tmp; i++) + for (i=0; tmp; i++) { user = tmp->data; usr = user->user_node; - if(!g_ascii_strcasecmp(usr->email, email)){ + if (!g_ascii_strcasecmp(usr->email, email)) { return user; /*if found, it returns that user*/ } tmp= g_list_next(tmp); @@ -173,7 +173,7 @@ find_node(GList *list, gchar *email) static void free_all (ShareFolder *sf) { - if (sf->users_list){ + if (sf->users_list) { g_list_foreach (sf->users_list,(GFunc) free_node, NULL); g_list_free (sf->users_list); sf->users_list = NULL; @@ -193,12 +193,12 @@ display_container (EGwContainer *container , ShareFolder *sf) EShUsers *user = NULL; sf->gcontainer = container; - if(!(byme = e_gw_container_get_is_shared_by_me(container))) + if (!(byme = e_gw_container_get_is_shared_by_me(container))) tome = e_gw_container_get_is_shared_to_me(container); - if(byme || tome) { + if (byme || tome) { e_gw_container_get_user_list (sf->gcontainer, &user_list); sf->users = g_list_length (user_list); - if(sf->users != 0) { + if (sf->users != 0) { sf->is_shared = TRUE; gtk_toggle_button_set_active((GtkToggleButton *) sf->shared, TRUE); shared_clicked(sf->shared , sf); @@ -273,13 +273,13 @@ get_container_list (ShareFolder *sf) id_shared = g_strdup(e_gw_container_get_id (container->data)); /* this has to be done since id changes after the folder is shared*/ - if( g_str_has_suffix (id_shared, "35")){ + if ( g_str_has_suffix (id_shared, "35")) { tail = g_strsplit(id_shared, "@", 2); id_unshared = g_strconcat(tail[0], "@", "13", NULL); g_strfreev(tail); } - if((id_shared && !g_ascii_strcasecmp(id_shared, sf->container_id)) ||(id_unshared && !g_ascii_strcasecmp(id_unshared, sf->container_id))) { + if ((id_shared && !g_ascii_strcasecmp(id_shared, sf->container_id)) ||(id_unshared && !g_ascii_strcasecmp(id_unshared, sf->container_id))) { display_container (E_GW_CONTAINER (container->data), sf); g_free (id_shared); @@ -348,7 +348,7 @@ add_clicked(GtkButton *button, ShareFolder *sf) } /*check whether already exists*/ - if (sf->users_list && email){ + if (sf->users_list && email) { new_user = find_node (sf->users_list, (gchar *)email); if (new_user) return; @@ -419,20 +419,20 @@ share_folder (ShareFolder *sf) } if (E_IS_GW_CONNECTION (sf->cnc)) { - if(sf->flag_for_ok == 2){ /* you have to remove all the users*/ + if (sf->flag_for_ok == 2){ /* you have to remove all the users*/ GList *list = NULL; - if(new_list){ + if (new_list) { g_list_foreach (new_list, (GFunc) free_user_node, NULL); g_list_free (new_list); } - if(update_list){ + if (update_list) { g_list_foreach (update_list, (GFunc) free_user_node, NULL); g_list_free (update_list); } new_list = NULL; - if(remove_list){ + if (remove_list) { g_list_foreach (remove_list,(GFunc) free_user_node, NULL); g_list_free (remove_list); } @@ -579,7 +579,7 @@ add_right_clicked (GtkCellRenderer *renderer, gchar *arg1, ShareFolder *sf ) GtkTreePath *path = NULL; path = gtk_tree_path_new_from_string (arg1); - if (!gtk_tree_model_get_iter ((GtkTreeModel *) sf->model, &(sf->iter), path)){ + if (!gtk_tree_model_get_iter ((GtkTreeModel *) sf->model, &(sf->iter), path)) { gtk_tree_path_free (path); return; } @@ -589,7 +589,7 @@ add_right_clicked (GtkCellRenderer *renderer, gchar *arg1, ShareFolder *sf ) gtk_tree_path_free (path); return; } - if(! usr->flag) /* if user was already existing one change the flag to update*/ + if (! usr->flag) /* if user was already existing one change the flag to update*/ usr->flag = usr->flag | 0x2; user = usr->user_node; if (!right) { @@ -622,7 +622,7 @@ edit_right_clicked(GtkCellRenderer *renderer, gchar *arg1, ShareFolder *sf ) gtk_tree_path_free (path); return; } - if(! usr->flag) /* if user was already existing one change the flag to update*/ + if (! usr->flag) /* if user was already existing one change the flag to update*/ usr->flag = usr->flag | 0x2; user = usr->user_node; @@ -656,7 +656,7 @@ delete_right_clicked(GtkCellRenderer *renderer, gchar *arg1, ShareFolder *sf ) gtk_tree_path_free (path); return; } - if(! usr->flag) /* if user was already existing one change the flag to update*/ + if (! usr->flag) /* if user was already existing one change the flag to update*/ usr->flag = usr->flag | 0x2; user = usr->user_node; if (!right) { diff --git a/plugins/hula-account-setup/camel-hula-listener.c b/plugins/hula-account-setup/camel-hula-listener.c index 5bed477a49..23e0dbe5d6 100644 --- a/plugins/hula-account-setup/camel-hula-listener.c +++ b/plugins/hula-account-setup/camel-hula-listener.c @@ -257,7 +257,7 @@ remove_esource (const gchar *conf_key, const gchar *group_name, gchar * source_n strcmp (e_source_group_peek_base_uri (group), HULA_CALDAV_URI_PREFIX ) == 0) { GSList *sources = e_source_group_peek_sources (group); - for(; sources != NULL; sources = g_slist_next (sources)) { + for (; sources != NULL; sources = g_slist_next (sources)) { ESource *source = E_SOURCE (sources->data); const gchar *source_relative_uri; diff --git a/plugins/imap-features/imap-headers.c b/plugins/imap-features/imap-headers.c index ea969b2b3a..8ce7f3ec60 100644 --- a/plugins/imap-features/imap-headers.c +++ b/plugins/imap-features/imap-headers.c @@ -266,7 +266,7 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data) target_account = (EMConfigTargetAccount *)data->config->target; account = target_account->account; - if(!g_str_has_prefix (account->source->url, "imap://") && !(use_imap && g_str_has_prefix (account->source->url, "groupwise://"))) + if (!g_str_has_prefix (account->source->url, "imap://") && !(use_imap && g_str_has_prefix (account->source->url, "groupwise://"))) return NULL; gladefile = g_build_filename (EVOLUTION_GLADEDIR, "imap-headers.glade", NULL); diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index c824760409..204d150950 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -1057,7 +1057,7 @@ update_item (struct _itip_puri *pitip, ItipViewResponse response) } if ((response != ITIP_VIEW_RESPONSE_CANCEL) - && (response != ITIP_VIEW_RESPONSE_DECLINE)){ + && (response != ITIP_VIEW_RESPONSE_DECLINE)) { GSList *attachments = NULL, *new_attachments = NULL, *l; CamelMimeMessage *msg = pitip->msg; diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index 39973ba60f..3ad3ade1ae 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -514,7 +514,7 @@ pst_import_folders (PstImporter *m, pst_desc_ll *topitem) d_ptr = d_ptr->next; } else { while (d_ptr != topitem && d_ptr->next == NULL) { - if(m->folder_uri) { + if (m->folder_uri) { g_free(m->folder_uri); } @@ -915,13 +915,13 @@ pst_process_email (PstImporter *m, pst_item *item) info = camel_message_info_new (NULL); /* Read message flags (see comments in libpst.c */ - if(item->email->flag && 0x01) + if (item->email->flag && 0x01) camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, ~0); - if(item->email->importance == 2) + if (item->email->importance == 2) camel_message_info_set_flags (info, CAMEL_MESSAGE_FLAGGED, ~0); - if(item->email->flag && 0x08) + if (item->email->flag && 0x08) camel_message_info_set_flags (info, CAMEL_MESSAGE_DRAFT, ~0); camel_folder_append_message (m->folder, msg, info, NULL, &m->ex); diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c index 84a41f23ad..27ab11ce3c 100644 --- a/plugins/publish-calendar/publish-calendar.c +++ b/plugins/publish-calendar/publish-calendar.c @@ -495,7 +495,7 @@ url_list_enable_toggled (GtkCellRendererToggle *renderer, url->enabled = !url->enabled; - if(url->enabled) + if (url->enabled) gtk_widget_set_sensitive (ui->url_enable, FALSE); else gtk_widget_set_sensitive (ui->url_enable, TRUE); @@ -518,7 +518,7 @@ selection_changed (GtkTreeSelection *selection, PublishUIData *ui) gtk_widget_set_sensitive (ui->url_edit, TRUE); gtk_widget_set_sensitive (ui->url_remove, TRUE); - if(url->enabled) + if (url->enabled) gtk_widget_set_sensitive (ui->url_enable, FALSE); else gtk_widget_set_sensitive (ui->url_enable, TRUE); @@ -662,7 +662,7 @@ url_enable_clicked (GtkButton *button, PublishUIData *ui) gtk_tree_model_get (model, &iter, URL_LIST_URL_COLUMN, &url, -1); url->enabled = !url->enabled; - if(url->enabled) + if (url->enabled) gtk_widget_set_sensitive (ui->url_enable, FALSE); else gtk_widget_set_sensitive (ui->url_enable, TRUE); diff --git a/plugins/sa-junk-plugin/em-junk-filter.c b/plugins/sa-junk-plugin/em-junk-filter.c index 66f5a92f74..74010f2555 100644 --- a/plugins/sa-junk-plugin/em-junk-filter.c +++ b/plugins/sa-junk-plugin/em-junk-filter.c @@ -648,18 +648,18 @@ get_spamassassin_version () NULL }; - if (!em_junk_sa_checked_spamassassin_version){ + if (!em_junk_sa_checked_spamassassin_version) { out = g_byte_array_new (); - if (pipe_to_sa_full (NULL, NULL, argv, -1, 1, out, NULL) != 0){ - if(out) + if (pipe_to_sa_full (NULL, NULL, argv, -1, 1, out, NULL) != 0) { + if (out) g_byte_array_free (out, TRUE); return em_junk_sa_spamassassin_version; } - if(out->len > 0){ - for(i = 0; i < out->len; i++){ - if(g_ascii_isdigit (out->data[i])){ + if (out->len > 0) { + for (i = 0; i < out->len; i++) { + if (g_ascii_isdigit (out->data[i])) { em_junk_sa_spamassassin_version = (out->data[i] - '0'); em_junk_sa_checked_spamassassin_version = TRUE; break; @@ -667,7 +667,7 @@ get_spamassassin_version () } } - if(out) + if (out) g_byte_array_free (out, TRUE); } diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c index 597570ed17..c03dd39d68 100644 --- a/plugins/tnef-attachments/tnef-plugin.c +++ b/plugins/tnef-attachments/tnef-plugin.c @@ -263,7 +263,7 @@ void processTnef(TNEFStruct *tnef) { } else { sprintf(ifilename, "%s/%s.rtf", filepath, tnef->subject.data); } - for(i=0; iMAPI), + if ((filedata = MAPIFindProperty(&(p->MAPI), PROP_TAG(PT_OBJECT, PR_ATTACH_DATA_OBJ))) == MAPI_UNDEFINED) { - if((filedata = MAPIFindProperty(&(p->MAPI), + if ((filedata = MAPIFindProperty(&(p->MAPI), PROP_TAG(PT_BINARY, PR_ATTACH_DATA_OBJ))) == MAPI_UNDEFINED) { /* Nope, standard TNEF stuff. */ @@ -366,7 +366,7 @@ void processTnef(TNEFStruct *tnef) { } else { sprintf(ifilename, "%s/%s", filepath, filename->data); } - for(i=0; idata); } } - for(i=0; isize;index++) { + for (index=0;indexsize;index++) { fprintf(fptr,"%02X", (guchar)filename->data[index]); } fprintf(fptr,"\n"); @@ -1027,7 +1027,7 @@ void saveVCalendar(TNEFStruct *tnef) { } /* Summary */ filename = NULL; - if((filename=MAPIFindProperty(&(tnef->MapiProperties), + if ((filename=MAPIFindProperty(&(tnef->MapiProperties), PROP_TAG(PT_STRING8, PR_CONVERSATION_TOPIC))) != MAPI_UNDEFINED) { fprintf(fptr, "SUMMARY:"); @@ -1156,7 +1156,7 @@ void saveVTask(TNEFStruct *tnef) { } else { sprintf(ifilename, "%s/%s.vcf", filepath, vl->data); } - for(i=0; idata; index < vl->size; index++, byte++) { + for (index = 0, byte=vl->data; index < vl->size; index++, byte++) { if (*byte == '}') { brace_ct--; key = 0; -- cgit v1.2.3 From 606f6c15dbfbd7821a5aa92a81d64b318842fe7a Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Thu, 23 Jul 2009 18:34:02 +0530 Subject: Bug #339361 (bnc) - soap threading not working. --- plugins/groupwise-features/mail-send-options.c | 20 ++++++++++++++++++++ .../org-gnome-groupwise-features.eplug.xml | 11 ++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/groupwise-features/mail-send-options.c b/plugins/groupwise-features/mail-send-options.c index 4faaf9bbc6..701205f04c 100644 --- a/plugins/groupwise-features/mail-send-options.c +++ b/plugins/groupwise-features/mail-send-options.c @@ -44,6 +44,7 @@ static ESendOptionsDialog * dialog = NULL; void org_gnome_composer_send_options (EPlugin *ep, EMEventTargetComposer *t); +void org_gnome_composer_message_reply (EPlugin *ep, EMEventTargetMessage *t); static time_t add_day_to_time (time_t time, gint days) @@ -171,3 +172,22 @@ org_gnome_composer_send_options (EPlugin *ep, EMEventTargetComposer *t) G_CALLBACK (send_options_commit), dialog); } +void +org_gnome_composer_message_reply (EPlugin *ep, EMEventTargetMessage *t) +{ + EMsgComposer *comp = (struct _EMsgComposer *)t->composer ; + EComposerHeaderTable *table; + EAccount *account = NULL; + char *temp = NULL; + + table = e_msg_composer_get_header_table (comp); + account = e_composer_header_table_get_account (table); + if (!account) + return; + + temp = strstr (account->transport->url, "groupwise") ; + if (!temp) { + return; + } + e_msg_composer_add_header (comp, "X-GW-ORIG-ITEM-ID", t->uid); +} diff --git a/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml b/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml index 8bb6651acf..ea4f06a6e7 100644 --- a/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml +++ b/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml @@ -72,7 +72,16 @@ enable="sendoption" /> - + + + + + -- cgit v1.2.3 From f69c15d69d634a3fb857cc062f91e31055a95863 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Thu, 23 Jul 2009 19:17:45 +0530 Subject: Bug #583972 - Resend meeting dialog isn't coming properly. --- plugins/groupwise-features/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins') diff --git a/plugins/groupwise-features/Makefile.am b/plugins/groupwise-features/Makefile.am index 1af407dcd7..b26fa1693d 100644 --- a/plugins/groupwise-features/Makefile.am +++ b/plugins/groupwise-features/Makefile.am @@ -65,6 +65,7 @@ error_DATA = \ org-gnome-shared-folder.error \ org-gnome-proxy.error \ org-gnome-proxy-login.error \ + org-gnome-process-meeting.error \ org-gnome-mail-retract.error errordir = $(privdatadir)/errors @@ -76,6 +77,7 @@ EXTRA_DIST = \ org-gnome-compose-send-options.xml \ org-gnome-groupwise-features.eplug.xml \ org-gnome-shared-folder.error.xml \ + org-gnome-process-meeting.error.xml \ org-gnome-proxy.error.xml \ org-gnome-proxy-login.error.xml \ org-gnome-mail-retract.error.xml -- cgit v1.2.3 From 30ac043b6ef2ad85de31c8dfbd87ac5a63d58dd8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 26 Jul 2009 08:18:59 -0400 Subject: Coding style and whitespace cleanups. --- plugins/groupwise-features/mail-send-options.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/groupwise-features/mail-send-options.c b/plugins/groupwise-features/mail-send-options.c index 701205f04c..8244088f8a 100644 --- a/plugins/groupwise-features/mail-send-options.c +++ b/plugins/groupwise-features/mail-send-options.c @@ -175,17 +175,17 @@ org_gnome_composer_send_options (EPlugin *ep, EMEventTargetComposer *t) void org_gnome_composer_message_reply (EPlugin *ep, EMEventTargetMessage *t) { - EMsgComposer *comp = (struct _EMsgComposer *)t->composer ; + EMsgComposer *comp = (struct _EMsgComposer *)t->composer; EComposerHeaderTable *table; EAccount *account = NULL; - char *temp = NULL; - + gchar *temp = NULL; + table = e_msg_composer_get_header_table (comp); account = e_composer_header_table_get_account (table); if (!account) return; - - temp = strstr (account->transport->url, "groupwise") ; + + temp = strstr (account->transport->url, "groupwise"); if (!temp) { return; } -- cgit v1.2.3 From fd66fd1800b1f32f1de9f0b19749a11e7f8377b6 Mon Sep 17 00:00:00 2001 From: Bharath Acharya Date: Mon, 27 Jul 2009 10:37:43 +0530 Subject: BUG #578945 - Adapt to changes in libpst 0.6.41 The PST Importer is now compatible with libpst 0.6.41 --- plugins/pst-import/pst-importer.c | 330 ++++++++++++++++++-------------------- 1 file changed, 154 insertions(+), 176 deletions(-) (limited to 'plugins') diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index 3ad3ade1ae..a8099bd0b1 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -66,7 +66,6 @@ #include #include -#include #include #include @@ -75,8 +74,8 @@ typedef struct _PstImporter PstImporter; gint pst_init (pst_file *pst, gchar *filename); gchar *get_pst_rootname (pst_file *pst, gchar *filename); static void pst_error_msg (const gchar *fmt, ...); -static void pst_import_folders (PstImporter *m, pst_desc_ll *topitem); -static void pst_process_item (PstImporter *m, pst_desc_ll *d_ptr); +static void pst_import_folders (PstImporter *m, pst_desc_tree *topitem); +static void pst_process_item (PstImporter *m, pst_desc_tree *d_ptr); static void pst_process_folder (PstImporter *m, pst_item *item); static void pst_process_email (PstImporter *m, pst_item *item); static void pst_process_contact (PstImporter *m, pst_item *item); @@ -447,7 +446,7 @@ pst_import_file (PstImporter *m) gint ret; gchar *filename; pst_item *item = NULL; - pst_desc_ll *d_ptr; + pst_desc_tree *d_ptr; filename = g_filename_from_uri (((EImportTargetURI *)m->target)->uri_src, NULL, NULL); m->parent_uri = g_strdup (((EImportTargetURI *)m->target)->uri_dest); /* Destination folder, was set in our widget */ @@ -470,7 +469,7 @@ pst_import_file (PstImporter *m) camel_operation_progress_count (NULL, 1); - if ((item = pst_parse_item (&m->pst, m->pst.d_head)) == NULL) { + if ((item = pst_parse_item (&m->pst, m->pst.d_head, NULL)) == NULL) { pst_error_msg ("Could not get root record"); return; } @@ -494,9 +493,9 @@ pst_import_file (PstImporter *m) } static void -pst_import_folders (PstImporter *m, pst_desc_ll *topitem) +pst_import_folders (PstImporter *m, pst_desc_tree *topitem) { - pst_desc_ll *d_ptr; + pst_desc_tree *d_ptr; gchar *seperator; d_ptr = topitem->child; @@ -538,14 +537,14 @@ pst_import_folders (PstImporter *m, pst_desc_ll *topitem) } static void -pst_process_item (PstImporter *m, pst_desc_ll *d_ptr) +pst_process_item (PstImporter *m, pst_desc_tree *d_ptr) { pst_item *item = NULL; if (d_ptr->desc == NULL) return; - item = pst_parse_item (&m->pst, d_ptr); + item = pst_parse_item (&m->pst, d_ptr, NULL); if (item == NULL) return; @@ -558,7 +557,7 @@ pst_process_item (PstImporter *m, pst_desc_ll *d_ptr) if (item->folder != NULL) { pst_process_folder (m, item); - camel_operation_start (NULL, _("Importing `%s'"), item->file_as); + camel_operation_start (NULL, _("Importing `%s'"), item->file_as.str); } else { if (m->folder_count && (m->current_item < m->folder_count)) { camel_operation_progress (NULL, (m->current_item * 100) / m->folder_count); @@ -659,10 +658,10 @@ pst_process_folder (PstImporter *m, pst_item *item) g_free (m->folder_name); g_free (m->folder_uri); - if (item->file_as != NULL) { - m->folder_name = foldername_to_utf8 (item->file_as); + if (item->file_as.str != NULL) { + m->folder_name = foldername_to_utf8 (item->file_as.str); } else { - g_critical ("Folder: No name! item->file_as=%s", item->file_as); + g_critical ("Folder: No name! item->file_as=%s", item->file_as.str); m->folder_name = g_strdup ("unknown_name"); } @@ -674,7 +673,7 @@ pst_process_folder (PstImporter *m, pst_item *item) m->folder = NULL; } - m->folder_count = item->folder->email_count; + m->folder_count = item->folder->item_count; m->current_item = 0; } @@ -735,29 +734,28 @@ attachment_to_part (PstImporter *m, pst_item_attach *attach) part = camel_mime_part_new (); - if (attach->filename2 || attach->filename1) { - camel_mime_part_set_filename (part, (attach->filename2 ? attach->filename2 : attach->filename1)); + if (attach->filename2.str || attach->filename1.str) { + camel_mime_part_set_filename (part, (attach->filename2.str ? attach->filename2.str : attach->filename1.str)); camel_mime_part_set_disposition (part, "attachment"); camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_BASE64); } else { camel_mime_part_set_disposition (part, "inline"); } - if (attach->mimetype != NULL) { - mimetype = attach->mimetype; + if (attach->mimetype.str != NULL) { + mimetype = attach->mimetype.str; } else { mimetype = "application/octet-stream"; } - if (attach->data != NULL) { - camel_mime_part_set_content (part, attach->data, strlen (attach->data), mimetype); + if (attach->data.data != NULL) { + camel_mime_part_set_content (part, attach->data.data, attach->data.size, mimetype); } else { - gchar *buf = NULL; - gsize size; - size = pst_attach_to_mem (&m->pst, attach, &buf); + pst_binary attach_rc; + attach_rc = pst_attach_to_mem (&m->pst, attach); - camel_mime_part_set_content (part, (gchar *) buf, size, mimetype); - free(buf); + camel_mime_part_set_content (part, (gchar *) attach_rc.data, attach_rc.size, mimetype); + free(attach_rc.data); } return part; @@ -771,6 +769,7 @@ pst_process_email (PstImporter *m, pst_item *item) CamelMultipart *mp; CamelMimePart *part; CamelMessageInfo *info; + pst_item_attach *attach; if (m->folder == NULL) { pst_create_folder (m); @@ -780,12 +779,12 @@ pst_process_email (PstImporter *m, pst_item *item) msg = camel_mime_message_new (); - if (item->email->subject != NULL) { + if (item->subject.str != NULL) { gchar *subj; - subj = string_to_utf8 (item->email->subject->subj); + subj = string_to_utf8 (item->subject.str); if (subj == NULL) { - g_warning ("Could not convert email subject to utf8: %s", item->email->subject->subj); + g_warning ("Could not convert email subject to utf8: %s", item->subject.str); camel_mime_message_set_subject (msg, "(lost subject)"); } else { camel_mime_message_set_subject (msg, subj); @@ -795,12 +794,12 @@ pst_process_email (PstImporter *m, pst_item *item) addr = camel_internet_address_new (); - if (item->email->outlook_sender_name != NULL && item->email->outlook_sender != NULL) { - camel_internet_address_add (addr, item->email->outlook_sender_name, item->email->outlook_sender); - } else if (item->email->outlook_sender_name != NULL) { - camel_address_decode (CAMEL_ADDRESS (addr), item->email->outlook_sender_name); - } else if (item->email->outlook_sender != NULL) { - camel_address_decode (CAMEL_ADDRESS (addr), item->email->outlook_sender); + if (item->email->outlook_sender_name.str != NULL && item->email->outlook_sender.str != NULL) { + camel_internet_address_add (addr, item->email->outlook_sender_name.str, item->email->outlook_sender.str); + } else if (item->email->outlook_sender_name.str != NULL) { + camel_address_decode (CAMEL_ADDRESS (addr), item->email->outlook_sender_name.str); + } else if (item->email->outlook_sender.str != NULL) { + camel_address_decode (CAMEL_ADDRESS (addr), item->email->outlook_sender.str); } else { /* Evo prints a warning if no from is set, so supply an empty address */ camel_internet_address_add (addr, "", ""); @@ -810,38 +809,38 @@ pst_process_email (PstImporter *m, pst_item *item) camel_object_unref (addr); if (item->email->sent_date != NULL) { - camel_mime_message_set_date (msg, fileTimeToUnixTime (item->email->sent_date, 0), 0); + camel_mime_message_set_date (msg, pst_fileTimeToUnixTime (item->email->sent_date), 0); } - if (item->email->messageid != NULL) { - camel_mime_message_set_message_id (msg, item->email->messageid); + if (item->email->messageid.str != NULL) { + camel_mime_message_set_message_id (msg, item->email->messageid.str); } - if (item->email->header != NULL) { + if (item->email->header.str != NULL) { /* Use mime parser to read headers */ CamelStream *stream; /*g_debug (" Email headers length=%zd", strlen (item->email->header));*/ /*g_message (" Email headers... %s...", item->email->header);*/ - stream = camel_stream_mem_new_with_buffer (item->email->header, strlen (item->email->header)); + stream = camel_stream_mem_new_with_buffer (item->email->header.str, strlen (item->email->header.str)); if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)msg, stream) == -1) g_warning ("Error reading headers, skipped"); } else { - if (item->email->sentto_address != NULL) { + if (item->email->sentto_address.str != NULL) { addr = camel_internet_address_new (); - if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->sentto_address) > 0); + if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->sentto_address.str) > 0); camel_mime_message_set_recipients (msg, "To", addr); camel_object_unref (addr); } - if (item->email->cc_address != NULL) { + if (item->email->cc_address.str != NULL) { addr = camel_internet_address_new (); - if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->cc_address) > 0); + if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->cc_address.str) > 0); camel_mime_message_set_recipients (msg, "CC", addr); camel_object_unref (addr); @@ -854,11 +853,11 @@ pst_process_email (PstImporter *m, pst_item *item) camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (mp), "multipart/mixed"); - } else if (item->email->htmlbody && item->email->body) { + } else if (item->email->htmlbody.str && item->body.str) { camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (mp), "multipart/alternate"); - } else if (item->email->htmlbody) { + } else if (item->email->htmlbody.str) { camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (mp), "text/html"); @@ -866,62 +865,56 @@ pst_process_email (PstImporter *m, pst_item *item) camel_multipart_set_boundary (mp, NULL); - if (item->email->body != NULL) { + if (item->body.str != NULL) { /* Read internet headers */ /*g_debug (" Email body length=%zd", strlen (item->email->body)); g_message (" Email body %100s...", item->email->body);*/ part = camel_mime_part_new (); - camel_mime_part_set_content (part, item->email->body, strlen (item->email->body), "text/plain"); + camel_mime_part_set_content (part, item->body.str, strlen (item->body.str), "text/plain"); camel_multipart_add_part (mp, part); camel_object_unref (part); } - if (item->email->htmlbody != NULL) { + if (item->email->htmlbody.str != NULL) { /*g_debug (" HTML body length=%zd", strlen (item->email->htmlbody));*/ part = camel_mime_part_new (); - camel_mime_part_set_content (part, item->email->htmlbody, strlen (item->email->htmlbody), "text/html"); + camel_mime_part_set_content (part, item->email->htmlbody.str, strlen (item->email->htmlbody.str), "text/html"); camel_multipart_add_part (mp, part); camel_object_unref (part); } - item->current_attach = item->attach; - - while (item->current_attach != NULL) { - pst_item_attach *attach; - - attach = item->current_attach; - part = attachment_to_part(m, attach); - - camel_multipart_add_part (mp, part); - camel_object_unref (part); - - item->current_attach = item->current_attach->next; + for (attach = item->attach; attach; attach = attach->next) { + if (attach->data.data || attach->i_id) { + part = attachment_to_part(m, attach); + camel_multipart_add_part (mp, part); + camel_object_unref (part); + } } /*camel_mime_message_dump (msg, TRUE);*/ - if (item->email->htmlbody || item->attach) { + if (item->email->htmlbody.str || item->attach) { camel_medium_set_content_object (CAMEL_MEDIUM (msg), CAMEL_DATA_WRAPPER (mp)); - } else if (item->email->body) { - camel_mime_part_set_content (CAMEL_MIME_PART (msg), item->email->body, strlen (item->email->body), "text/plain"); + } else if (item->body.str) { + camel_mime_part_set_content (CAMEL_MIME_PART (msg), item->body.str, strlen (item->body.str), "text/plain"); } else { g_warning ("Email without body. Subject:%s", - (item->email->subject->subj ? item->email->subject->subj : "(empty)")); + (item->subject.str ? item->subject.str : "(empty)")); camel_mime_part_set_content (CAMEL_MIME_PART (msg), "\n", 1, "text/plain"); } info = camel_message_info_new (NULL); /* Read message flags (see comments in libpst.c */ - if (item->email->flag && 0x01) + if(item->flags && 0x01) camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, ~0); if (item->email->importance == 2) camel_message_info_set_flags (info, CAMEL_MESSAGE_FLAGGED, ~0); - if (item->email->flag && 0x08) + if(item->flags && 0x08) camel_message_info_set_flags (info, CAMEL_MESSAGE_DRAFT, ~0); camel_folder_append_message (m->folder, msg, info, NULL, &m->ex); @@ -1001,7 +994,7 @@ contact_set_date (EContact *contact, EContactField id, FILETIME *date) EContactDate *bday; bday = e_contact_date_new (); - t1 = fileTimeToUnixTime (date, 0); + t1 = pst_fileTimeToUnixTime (date); gmtime_r (&t1, &tm); bday->year = tm.tm_year + 1900; @@ -1024,84 +1017,84 @@ pst_process_contact (PstImporter *m, pst_item *item) ec = e_contact_new (); /* pst's fullname field only contains first, middle, surname */ - if (c->display_name_prefix || c->suffix) { + if (c->display_name_prefix.str || c->suffix.str) { GString *name = g_string_sized_new (128); - if (c->display_name_prefix) { - g_string_assign (name, c->display_name_prefix); + if (c->display_name_prefix.str) { + g_string_assign (name, c->display_name_prefix.str); } - if (c->first_name) { - g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->first_name); + if (c->first_name.str) { + g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->first_name.str); } - if (c->middle_name) { - g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->middle_name); + if (c->middle_name.str) { + g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->middle_name.str); } - if (c->surname) { - g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->surname); + if (c->surname.str) { + g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->surname.str); } - if (c->suffix) { - g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->suffix); + if (c->surname.str) { + g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->surname.str); } contact_set_string (ec, E_CONTACT_FULL_NAME, name->str); g_string_free (name, TRUE); } else { - contact_set_string (ec, E_CONTACT_FULL_NAME, c->fullname); + contact_set_string (ec, E_CONTACT_FULL_NAME, c->fullname.str); } /* unknown_field (ec, notes, "initials", c->initials); */ - contact_set_string (ec, E_CONTACT_NICKNAME, c->nickname); + contact_set_string (ec, E_CONTACT_NICKNAME, c->nickname.str); - contact_set_string (ec, E_CONTACT_ORG, c->company_name); - contact_set_string (ec, E_CONTACT_ORG_UNIT, c->department); - contact_set_string (ec, E_CONTACT_TITLE, c->job_title); + contact_set_string (ec, E_CONTACT_ORG, c->company_name.str); + contact_set_string (ec, E_CONTACT_ORG_UNIT, c->department.str); + contact_set_string (ec, E_CONTACT_TITLE, c->job_title.str); contact_set_address (ec,E_CONTACT_ADDRESS_WORK, - c->business_address, c->business_city, c->business_country, - c->business_po_box, c->business_postal_code, c->business_state, c->business_street); + c->business_address.str, c->business_city.str, c->business_country.str, + c->business_po_box.str, c->business_postal_code.str, c->business_state.str, c->business_street.str); contact_set_address (ec,E_CONTACT_ADDRESS_HOME, - c->home_address, c->home_city, c->home_country, - c->home_po_box, c->home_postal_code, c->home_state, c->home_street); + c->home_address.str, c->home_city.str, c->home_country.str, + c->home_po_box.str, c->home_postal_code.str, c->home_state.str, c->home_street.str); contact_set_address (ec,E_CONTACT_ADDRESS_OTHER, - c->other_address, c->other_city, c->other_country, - c->other_po_box, c->other_postal_code, c->other_state, c->other_street); - - contact_set_string (ec, E_CONTACT_PHONE_ASSISTANT, c->assistant_phone); - contact_set_string (ec, E_CONTACT_PHONE_BUSINESS_FAX, c->business_fax); - contact_set_string (ec, E_CONTACT_PHONE_BUSINESS, c->business_phone); - contact_set_string (ec, E_CONTACT_PHONE_BUSINESS_2, c->business_phone2); - contact_set_string (ec, E_CONTACT_PHONE_CALLBACK, c->callback_phone); - contact_set_string (ec, E_CONTACT_PHONE_CAR, c->car_phone); - contact_set_string (ec, E_CONTACT_PHONE_COMPANY, c->company_main_phone); - contact_set_string (ec, E_CONTACT_PHONE_HOME_FAX, c->home_fax); - contact_set_string (ec, E_CONTACT_PHONE_HOME, c->home_phone); - contact_set_string (ec, E_CONTACT_PHONE_HOME_2, c->home_phone2); - contact_set_string (ec, E_CONTACT_PHONE_ISDN, c->isdn_phone); - contact_set_string (ec, E_CONTACT_PHONE_MOBILE, c->mobile_phone); - contact_set_string (ec, E_CONTACT_PHONE_OTHER_FAX, c->primary_fax); /* ? */ - contact_set_string (ec, E_CONTACT_PHONE_PAGER, c->pager_phone); - contact_set_string (ec, E_CONTACT_PHONE_PRIMARY, c->primary_phone); - contact_set_string (ec, E_CONTACT_PHONE_RADIO, c->radio_phone); - contact_set_string (ec, E_CONTACT_PHONE_TTYTDD, c->ttytdd_phone); - contact_set_string (ec, E_CONTACT_PHONE_TELEX, c->telex); - unknown_field (ec, notes, "account_name", c->account_name); + c->other_address.str, c->other_city.str, c->other_country.str, + c->other_po_box.str, c->other_postal_code.str, c->other_state.str, c->other_street.str); + + contact_set_string (ec, E_CONTACT_PHONE_ASSISTANT, c->assistant_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_BUSINESS_FAX, c->business_fax.str); + contact_set_string (ec, E_CONTACT_PHONE_BUSINESS, c->business_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_BUSINESS_2, c->business_phone2.str); + contact_set_string (ec, E_CONTACT_PHONE_CALLBACK, c->callback_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_CAR, c->car_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_COMPANY, c->company_main_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_HOME_FAX, c->home_fax.str); + contact_set_string (ec, E_CONTACT_PHONE_HOME, c->home_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_HOME_2, c->home_phone2.str); + contact_set_string (ec, E_CONTACT_PHONE_ISDN, c->isdn_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_MOBILE, c->mobile_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_OTHER_FAX, c->primary_fax.str); /* ? */ + contact_set_string (ec, E_CONTACT_PHONE_PAGER, c->pager_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_PRIMARY, c->primary_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_RADIO, c->radio_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_TTYTDD, c->ttytdd_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_TELEX, c->telex.str); + unknown_field (ec, notes, "account_name", c->account_name.str); contact_set_date (ec, E_CONTACT_ANNIVERSARY, c->wedding_anniversary); - contact_set_string (ec, E_CONTACT_ASSISTANT, c->assistant_name); - unknown_field (ec, notes, "billing_information", c->billing_information); + contact_set_string (ec, E_CONTACT_ASSISTANT, c->assistant_name.str); + unknown_field (ec, notes, "billing_information", c->billing_information.str); contact_set_date (ec, E_CONTACT_BIRTH_DATE, c->birthday); /* contact_set_string (ec, E_CONTACT_CATEGORIES, c->??); */ - contact_set_string (ec, E_CONTACT_EMAIL_1 , c->address1); - contact_set_string (ec, E_CONTACT_EMAIL_2 , c->address2); - contact_set_string (ec, E_CONTACT_EMAIL_3 , c->address3); + contact_set_string (ec, E_CONTACT_EMAIL_1 , c->address1.str); + contact_set_string (ec, E_CONTACT_EMAIL_2 , c->address2.str); + contact_set_string (ec, E_CONTACT_EMAIL_3 , c->address3.str); /*unknown_field (ec, notes, "address1_desc" , c->address1_desc); unknown_field (ec, notes, "address1_transport" , c->address1_transport); @@ -1113,43 +1106,42 @@ pst_process_contact (PstImporter *m, pst_item *item) /*unknown_field (ec, notes, "def_postal_address", c->def_postal_address);*/ /* unknown_field (ec, ??, c->gender); */ - unknown_field (ec, notes, "access_method", c->access_method); - unknown_field (ec, notes, "gov_id", c->gov_id); - unknown_field (ec, notes, "customer_id", c->customer_id); - unknown_field (ec, notes, "hobbies", c->hobbies); - unknown_field (ec, notes, "followup", c->followup); - - contact_set_string (ec, E_CONTACT_FREEBUSY_URL , c->free_busy_address); - - unknown_field (ec, notes, "keyword", c->keyword); - unknown_field (ec, notes, "language", c->language); - unknown_field (ec, notes, "location", c->location); - contact_set_string (ec, E_CONTACT_OFFICE, c->office_loc); - unknown_field (ec, notes, "computer_name", c->computer_name); - unknown_field (ec, notes, "ftp_site", c->ftp_site); - - contact_set_string (ec, E_CONTACT_MANAGER , c->manager_name); - unknown_field (ec, notes, "mileage", c->mileage); - unknown_field (ec, notes, "org_id", c->org_id); - contact_set_string (ec, E_CONTACT_ROLE, c->profession); - - contact_set_string (ec, E_CONTACT_SPOUSE , c->spouse_name); - - if (c->personal_homepage) { - contact_set_string (ec, E_CONTACT_HOMEPAGE_URL , c->personal_homepage); - if (c->business_homepage) { - unknown_field (ec, notes, "business_homepage", c->business_homepage); + unknown_field (ec, notes, "gov_id", c->gov_id.str); + unknown_field (ec, notes, "customer_id", c->customer_id.str); + unknown_field (ec, notes, "hobbies", c->hobbies.str); + unknown_field (ec, notes, "followup", c->followup.str); + + contact_set_string (ec, E_CONTACT_FREEBUSY_URL , c->free_busy_address.str); + + unknown_field (ec, notes, "keyword", c->keyword.str); + unknown_field (ec, notes, "language", c->language.str); + unknown_field (ec, notes, "location", c->location.str); + contact_set_string (ec, E_CONTACT_OFFICE, c->office_loc.str); + unknown_field (ec, notes, "computer_name", c->computer_name.str); + unknown_field (ec, notes, "ftp_site", c->ftp_site.str); + + contact_set_string (ec, E_CONTACT_MANAGER , c->manager_name.str); + unknown_field (ec, notes, "mileage", c->mileage.str); + unknown_field (ec, notes, "org_id", c->org_id.str); + contact_set_string (ec, E_CONTACT_ROLE, c->profession.str); + + contact_set_string (ec, E_CONTACT_SPOUSE , c->spouse_name.str); + + if (c->personal_homepage.str) { + contact_set_string (ec, E_CONTACT_HOMEPAGE_URL , c->personal_homepage.str); + if (c->business_homepage.str) { + unknown_field (ec, notes, "business_homepage", c->business_homepage.str); } - } else if (c->business_homepage) { - contact_set_string (ec, E_CONTACT_HOMEPAGE_URL , c->business_homepage); + } else if (c->business_homepage.str) { + contact_set_string (ec, E_CONTACT_HOMEPAGE_URL , c->business_homepage.str); } - if (item->comment) { - g_string_append_printf (notes, "%s\n", item->comment); + if (item->comment.str) { + g_string_append_printf (notes, "%s\n", item->comment.str); } - if (item->email && item->email->body) { - g_string_append_printf (notes, "%s\n", item->email->body); + if (item->email && item->body.str) { + g_string_append_printf (notes, "%s\n", item->body.str); } contact_set_string (ec, E_CONTACT_NOTE, notes->str); @@ -1172,26 +1164,13 @@ get_ical_date (FILETIME *date, gboolean is_date) if (date && (date->dwLowDateTime || date->dwHighDateTime) ) { time_t t; - t = fileTimeToUnixTime (date, 0); + t = pst_fileTimeToUnixTime (date); return icaltime_from_timet_with_zone (t, is_date, NULL); } else { return icaltime_null_date (); } } -gchar *rfc2445_datetime_format (FILETIME *ft) { - static gchar * buffer = NULL; - struct tm *stm = NULL; - - if (buffer == NULL) { - buffer = malloc (30); // should be enough - } - - stm = fileTimeToStructTM (ft); - strftime (buffer, 30, "%Y%m%dT%H%M%SZ", stm); - return buffer; -} - static void set_cal_attachments (ECal *cal, ECalComponent *ec, PstImporter *m, pst_item_attach *attach) { @@ -1313,19 +1292,19 @@ fill_calcomponent (PstImporter *m, pst_item *item, ECalComponent *ec, const gcha } if (e) { - if (e->subject || e->proc_subject) { - if (e->subject) { - text.value = e->subject->subj; - } else if (e->proc_subject) { - text.value = e->proc_subject; + if (item->subject.str || e->processed_subject.str) { + if (item->subject.str) { + text.value = item->subject.str; + } else if (e->processed_subject.str) { + text.value = e->processed_subject.str; } text.altrep = NULL; /* email->proc_subject? */ e_cal_component_set_summary (ec, &text); } - if (e->body) { + if (item->body.str) { GSList l; - text.value = e->body; + text.value = item->body.str; text.altrep = NULL; l.data = &text; l.next = NULL; @@ -1335,8 +1314,8 @@ fill_calcomponent (PstImporter *m, pst_item *item, ECalComponent *ec, const gcha g_warning ("%s without subject / body!", type); } - if (a->location) { - e_cal_component_set_location (ec, a->location); + if (a->location.str) { + e_cal_component_set_location (ec, a->location.str); } if (a->start) { @@ -1403,7 +1382,7 @@ fill_calcomponent (PstImporter *m, pst_item *item, ECalComponent *ec, const gcha } if (a->alarm) { - if (a->alarm_filename) { + if (a->alarm_filename.str) { e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_AUDIO); } else { e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_DISPLAY); @@ -1415,7 +1394,7 @@ fill_calcomponent (PstImporter *m, pst_item *item, ECalComponent *ec, const gcha } - if (a->recurrence != PST_APP_RECUR_NONE) { + if (a->recurrence_description.str != PST_APP_RECUR_NONE) { struct icalrecurrencetype r; GSList recur_list; @@ -1704,7 +1683,6 @@ pst_init (pst_file *pst, gchar *filename) DEBUG_REGISTER_CLOSE (); #endif - DEBUG_ENT ("main"); if (pst_open (pst, filename) < 0) { pst_error_msg ("Error opening PST file %s", filename); return -1; @@ -1735,7 +1713,7 @@ get_pst_rootname (pst_file *pst, gchar *filename) pst_item *item = NULL; gchar *rootname = NULL; - if ((item = pst_parse_item (pst, pst->d_head)) == NULL) { + if ((item = pst_parse_item (pst, pst->d_head, NULL)) == NULL) { pst_error_msg ("Could not get root record"); return NULL; } @@ -1747,14 +1725,14 @@ get_pst_rootname (pst_file *pst, gchar *filename) } /* default the file_as to the same as the main filename if it doesn't exist */ - if (item->file_as == NULL) { + if (item->file_as.str == NULL) { if (filename == NULL) { pst_freeItem (item); return NULL; } rootname = g_path_get_basename (filename); } else { - rootname = g_strdup (item->file_as); + rootname = g_strdup (item->file_as.str); } pst_freeItem (item); -- cgit v1.2.3 From 919a9bde9c9af0ef4a2119909c6de9e4042de3e0 Mon Sep 17 00:00:00 2001 From: Bharath Acharya Date: Mon, 27 Jul 2009 10:45:49 +0530 Subject: BUG #480095 (BNC) - Alpha Search In Proxy Dialog Crashes Evolution. * proxy-login.c (proxy_login_tree_view_changed_cb): Use the unique stamp to catch only the valid iterators. Bug description: If you right mouse click on your Groupwise email account, you can select "Proxy Login" and a dialog appears with all of your previously used accounts in a list. If you click focus into the list and then type in a keyboard letter it crashes. This should position you at the first match of that letter, or at least not crash :) --- plugins/groupwise-features/proxy-login.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c index 00d851f449..b8fe49506b 100644 --- a/plugins/groupwise-features/proxy-login.c +++ b/plugins/groupwise-features/proxy-login.c @@ -400,7 +400,9 @@ proxy_login_tree_view_changed_cb(GtkDialog *dialog) account_select = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree)); gtk_tree_selection_get_selected (account_select, &model, &iter); - gtk_tree_model_get (model, &iter, ACCOUNT_NAME, &account_mailid, -1); + if ((priv->store)->stamp != (&iter)->stamp) + return; + gtk_tree_model_get (model, &iter, ACCOUNT_NAME, &account_mailid, -1); account_mailid = g_strrstr (account_mailid, "\n") + 1; account_name_tbox = glade_xml_get_widget (priv->xml, "account_name"); gtk_entry_set_text((GtkEntry*) account_name_tbox,account_mailid); -- cgit v1.2.3 From ff186e22dd664953566250c9295a147a4e1d4d5d Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 27 Jul 2009 13:02:47 +0200 Subject: Bug #572176 - Allow Local iCal Files To Be Selected As Cal Source --- plugins/calendar-file/calendar-file.c | 268 ++++++++++++++++++++- .../org-gnome-calendar-file.eplug.xml | 4 +- 2 files changed, 264 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/calendar-file/calendar-file.c b/plugins/calendar-file/calendar-file.c index 9d21d62688..fa6aaa7470 100644 --- a/plugins/calendar-file/calendar-file.c +++ b/plugins/calendar-file/calendar-file.c @@ -27,15 +27,160 @@ #include #include -GtkWidget *e_calendar_file_dummy (EPlugin *epl, EConfigHookItemFactoryData *data); +static void +location_changed (GtkFileChooserButton *widget, ESource *source) +{ + char *filename; + + g_return_if_fail (widget != NULL); + g_return_if_fail (source != NULL); + + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); + e_source_set_property (source, "custom-file", (filename && *filename) ? filename : NULL); + g_free (filename); +} + +static void +set_refresh_time (ESource *source, GtkWidget *spin, GtkWidget *combobox) +{ + gint time; + gint item_num = 0; + const gchar *refresh_str = e_source_get_property (source, "refresh"); + time = refresh_str ? atoi (refresh_str) : 30; + + if (time && !(time % 10080)) { + /* weeks */ + item_num = 3; + time /= 10080; + } else if (time && !(time % 1440)) { + /* days */ + item_num = 2; + time /= 1440; + } else if (time && !(time % 60)) { + /* hours */ + item_num = 1; + time /= 60; + } + gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), item_num); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time); +} + +static gchar * +get_refresh_minutes (GtkWidget *spin, GtkWidget *combobox) +{ + gint setting = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin)); + switch (gtk_combo_box_get_active (GTK_COMBO_BOX (combobox))) { + case 0: + /* minutes */ + break; + case 1: + /* hours */ + setting *= 60; + break; + case 2: + /* days */ + setting *= 1440; + break; + case 3: + /* weeks - is this *really* necessary? */ + setting *= 10080; + break; + default: + g_warning ("Time unit out of range"); + break; + } + + return g_strdup_printf ("%d", setting); +} + +static void +spin_changed (GtkSpinButton *spin, ESource *source) +{ + gchar *refresh_str; + GtkWidget *combobox; + + combobox = g_object_get_data (G_OBJECT (spin), "combobox"); + + refresh_str = get_refresh_minutes ((GtkWidget *) spin, combobox); + e_source_set_property (source, "refresh", refresh_str); + g_free (refresh_str); +} + +static void +combobox_changed (GtkComboBox *combobox, ESource *source) +{ + gchar *refresh_str; + GtkWidget *spin; + + spin = g_object_get_data (G_OBJECT (combobox), "spin"); + + refresh_str = get_refresh_minutes (spin, (GtkWidget *) combobox); + e_source_set_property (source, "refresh", refresh_str); + g_free (refresh_str); +} + +static void +maincheck_toggled (GtkToggleButton *check, ESource *source) +{ + GtkWidget *w; + gboolean enabled = gtk_toggle_button_get_active (check); + + w = g_object_get_data (G_OBJECT (check), "child"); + gtk_widget_set_sensitive (w, enabled); + + if (enabled) { + char *file; + + w = g_object_get_data (G_OBJECT (check), "file-chooser"); + file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w)); + e_source_set_property (source, "custom-file", (file && *file) ? file : NULL); + g_free (file); + } else { + e_source_set_property (source, "custom-file", NULL); + } +} + +static void +refresh_type_changed (GtkComboBox *refresh_type, ESource *source) +{ + GtkWidget *spin, *combobox; + gint active = gtk_combo_box_get_active (refresh_type); + char buff[2] = {0}; + + spin = g_object_get_data (G_OBJECT (refresh_type), "spin"); + combobox = g_object_get_data (G_OBJECT (refresh_type), "combobox"); + + if (active < 0 || active > 2) + active = 0; + + if (active == 2) { + gtk_widget_show (spin); + gtk_widget_show (combobox); + } else { + gtk_widget_hide (spin); + gtk_widget_hide (combobox); + } + + buff [0] = '0' + active; + e_source_set_property (source, "refresh-type", buff); +} + +static void +force_readonly_toggled (GtkToggleButton *check, ESource *source) +{ + e_source_set_property (source, "custom-file-readonly", gtk_toggle_button_get_active (check) ? "1" : NULL); +} + +GtkWidget *e_calendar_file_customs (EPlugin *epl, EConfigHookItemFactoryData *data); GtkWidget * -e_calendar_file_dummy (EPlugin *epl, EConfigHookItemFactoryData *data) +e_calendar_file_customs (EPlugin *epl, EConfigHookItemFactoryData *data) { ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; ESource *source = t->source; gchar *uri_text; - const gchar *relative_uri; + const gchar *relative_uri, *value; + GtkWidget *w1, *w2, *w3, *box1, *box2, *mainbox, *maincheck; uri_text = e_source_get_uri (source); if (strncmp (uri_text, "file", 4)) { @@ -45,13 +190,124 @@ e_calendar_file_dummy (EPlugin *epl, EConfigHookItemFactoryData *data) } relative_uri = e_source_peek_relative_uri (source); - g_free (uri_text); - if (relative_uri && *relative_uri) { + if (relative_uri && g_str_equal (relative_uri, "system")) { + g_free (uri_text); return NULL; } e_source_set_relative_uri (source, e_source_peek_uid (source)); - return NULL; + mainbox = gtk_vbox_new (FALSE, 2); + gtk_table_attach (GTK_TABLE (data->parent), mainbox, 1, 2, GTK_TABLE (data->parent)->nrows, GTK_TABLE (data->parent)->nrows + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); + + maincheck = gtk_check_button_new_with_mnemonic (_("_Customize options")); + g_signal_connect (G_OBJECT (maincheck), "toggled", G_CALLBACK (maincheck_toggled), source); + gtk_box_pack_start ((GtkBox *)mainbox, maincheck, TRUE, TRUE, 2); + + box1 = gtk_hbox_new (FALSE, 2); + gtk_box_pack_start ((GtkBox *)mainbox, box1, TRUE, TRUE, 2); + + g_object_set_data ((GObject*)maincheck, "child", box1); + + /* left-most space, the first one */ + w1 = gtk_label_new (""); + gtk_box_pack_start ((GtkBox *)box1, w1, FALSE, TRUE, 8); + + box2 = gtk_vbox_new (FALSE, 2); + gtk_box_pack_start ((GtkBox *)box1, box2, TRUE, TRUE, 2); + + box1 = box2; + box2 = gtk_hbox_new (FALSE, 2); + gtk_box_pack_start ((GtkBox *)box1, box2, TRUE, TRUE, 2); + + w1 = gtk_label_new_with_mnemonic (_("File _name:")); + gtk_misc_set_alignment (GTK_MISC (w1), 0.0, 0.5); + gtk_box_pack_start ((GtkBox *)box2, w1, FALSE, TRUE, 2); + + w2 = gtk_file_chooser_button_new (_("Choose calendar file"), GTK_FILE_CHOOSER_ACTION_OPEN); + gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (w2), TRUE); + gtk_label_set_mnemonic_widget (GTK_LABEL (w1), w2); + g_signal_connect (G_OBJECT (w2), "file-set", G_CALLBACK (location_changed), source); + gtk_box_pack_start ((GtkBox *)box2, w2, TRUE, TRUE, 2); + + g_object_set_data (G_OBJECT (maincheck), "file-chooser", w2); + + value = e_source_get_property (source, "custom-file"); + if (value && *value) { + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (w2), value); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (maincheck), TRUE); + } else { + char *uri = NULL; + + switch (t->source_type) { + case E_CAL_SOURCE_TYPE_EVENT: + uri = g_strconcat (uri_text, "/", "calendar.ics", NULL); + break; + case E_CAL_SOURCE_TYPE_TODO: + uri = g_strconcat (uri_text, "/", "tasks.ics", NULL); + break; + case E_CAL_SOURCE_TYPE_JOURNAL: + uri = g_strconcat (uri_text, "/", "journal.ics", NULL); + break; + case E_CAL_SOURCE_TYPE_LAST: + break; + } + + if (uri && *uri) + gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (w2), uri); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (maincheck), FALSE); + g_free (uri); + } + maincheck_toggled (GTK_TOGGLE_BUTTON (maincheck), source); + + box2 = gtk_hbox_new (FALSE, 2); + gtk_box_pack_start ((GtkBox *)box1, box2, FALSE, TRUE, 2); + + w1 = gtk_label_new_with_mnemonic (_("Re_fresh:")); + gtk_misc_set_alignment (GTK_MISC (w1), 0.0, 0.5); + gtk_box_pack_start ((GtkBox *)box2, w1, FALSE, TRUE, 2); + + w2 = gtk_combo_box_new_text (); + gtk_combo_box_append_text ((GtkComboBox *)w2, _("On open")); + gtk_combo_box_append_text ((GtkComboBox *)w2, _("On file change")); + gtk_combo_box_append_text ((GtkComboBox *)w2, _("Periodically")); + gtk_label_set_mnemonic_widget (GTK_LABEL (w1), w2); + gtk_box_pack_start ((GtkBox *)box2, w2, FALSE, TRUE, 2); + + value = e_source_get_property (source, "refresh-type"); + gtk_combo_box_set_active ((GtkComboBox *)w2, (value && *value && !value[1] && value [0] >= '0' && value [0] <= '2') ? value [0] - '0' : 0); + + w1 = w2; + w2 = gtk_spin_button_new_with_range (1, 100, 1); + gtk_box_pack_start (GTK_BOX (box2), w2, FALSE, TRUE, 0); + + w3 = gtk_combo_box_new_text (); + gtk_combo_box_append_text (GTK_COMBO_BOX (w3), _("minutes")); + gtk_combo_box_append_text (GTK_COMBO_BOX (w3), _("hours")); + gtk_combo_box_append_text (GTK_COMBO_BOX (w3), _("days")); + gtk_combo_box_append_text (GTK_COMBO_BOX (w3), _("weeks")); + set_refresh_time (source, w2, w3); + gtk_box_pack_start (GTK_BOX (box2), w3, FALSE, TRUE, 0); + + g_object_set_data (G_OBJECT (w1), "spin", w2); + g_object_set_data (G_OBJECT (w1), "combobox", w3); + g_object_set_data (G_OBJECT (w2), "combobox", w3); + + g_signal_connect (G_OBJECT (w1), "changed", G_CALLBACK (refresh_type_changed), source); + g_signal_connect (G_OBJECT (w2), "value-changed", G_CALLBACK (spin_changed), source); + g_signal_connect (G_OBJECT (w3), "changed", G_CALLBACK (combobox_changed), source); + + w2 = gtk_check_button_new_with_mnemonic (_("Force read _only")); + g_signal_connect (G_OBJECT (w2), "toggled", G_CALLBACK (force_readonly_toggled), source); + gtk_box_pack_start ((GtkBox *)box1, w2, TRUE, TRUE, 2); + + gtk_widget_show_all (mainbox); + + /* w1 is a refresh-type combobox, and it hides widgets, + thus should be called after show_all call */ + refresh_type_changed (GTK_COMBO_BOX (w1), source); + g_free (uri_text); + + return mainbox; } diff --git a/plugins/calendar-file/org-gnome-calendar-file.eplug.xml b/plugins/calendar-file/org-gnome-calendar-file.eplug.xml index 9b146101f2..a9c6379636 100644 --- a/plugins/calendar-file/org-gnome-calendar-file.eplug.xml +++ b/plugins/calendar-file/org-gnome-calendar-file.eplug.xml @@ -14,8 +14,8 @@ id="org.gnome.evolution.calendar.calendarProperties"> + path="00.general/00.source/99.file_customs" + factory="e_calendar_file_customs"/> -- cgit v1.2.3 From da1117397e3b2ad70431f9100b4b1abef0498e78 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 27 Jul 2009 08:46:13 -0400 Subject: Update NEWS + coding style cleanups. --- plugins/calendar-file/calendar-file.c | 8 ++++---- plugins/pst-import/pst-importer.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/calendar-file/calendar-file.c b/plugins/calendar-file/calendar-file.c index fa6aaa7470..66a491edcd 100644 --- a/plugins/calendar-file/calendar-file.c +++ b/plugins/calendar-file/calendar-file.c @@ -30,7 +30,7 @@ static void location_changed (GtkFileChooserButton *widget, ESource *source) { - char *filename; + gchar *filename; g_return_if_fail (widget != NULL); g_return_if_fail (source != NULL); @@ -129,7 +129,7 @@ maincheck_toggled (GtkToggleButton *check, ESource *source) gtk_widget_set_sensitive (w, enabled); if (enabled) { - char *file; + gchar *file; w = g_object_get_data (G_OBJECT (check), "file-chooser"); file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w)); @@ -145,7 +145,7 @@ refresh_type_changed (GtkComboBox *refresh_type, ESource *source) { GtkWidget *spin, *combobox; gint active = gtk_combo_box_get_active (refresh_type); - char buff[2] = {0}; + gchar buff[2] = {0}; spin = g_object_get_data (G_OBJECT (refresh_type), "spin"); combobox = g_object_get_data (G_OBJECT (refresh_type), "combobox"); @@ -238,7 +238,7 @@ e_calendar_file_customs (EPlugin *epl, EConfigHookItemFactoryData *data) gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (w2), value); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (maincheck), TRUE); } else { - char *uri = NULL; + gchar *uri = NULL; switch (t->source_type) { case E_CAL_SOURCE_TYPE_EVENT: diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index a8099bd0b1..ddc7e7662f 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -908,13 +908,13 @@ pst_process_email (PstImporter *m, pst_item *item) info = camel_message_info_new (NULL); /* Read message flags (see comments in libpst.c */ - if(item->flags && 0x01) + if (item->flags && 0x01) camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, ~0); if (item->email->importance == 2) camel_message_info_set_flags (info, CAMEL_MESSAGE_FLAGGED, ~0); - if(item->flags && 0x08) + if (item->flags && 0x08) camel_message_info_set_flags (info, CAMEL_MESSAGE_DRAFT, ~0); camel_folder_append_message (m->folder, msg, info, NULL, &m->ex); @@ -1056,15 +1056,15 @@ pst_process_contact (PstImporter *m, pst_item *item) contact_set_string (ec, E_CONTACT_TITLE, c->job_title.str); contact_set_address (ec,E_CONTACT_ADDRESS_WORK, - c->business_address.str, c->business_city.str, c->business_country.str, + c->business_address.str, c->business_city.str, c->business_country.str, c->business_po_box.str, c->business_postal_code.str, c->business_state.str, c->business_street.str); contact_set_address (ec,E_CONTACT_ADDRESS_HOME, - c->home_address.str, c->home_city.str, c->home_country.str, + c->home_address.str, c->home_city.str, c->home_country.str, c->home_po_box.str, c->home_postal_code.str, c->home_state.str, c->home_street.str); contact_set_address (ec,E_CONTACT_ADDRESS_OTHER, - c->other_address.str, c->other_city.str, c->other_country.str, + c->other_address.str, c->other_city.str, c->other_country.str, c->other_po_box.str, c->other_postal_code.str, c->other_state.str, c->other_street.str); contact_set_string (ec, E_CONTACT_PHONE_ASSISTANT, c->assistant_phone.str); -- cgit v1.2.3