aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShakti Sen <shprasad@novell.com>2005-07-14 15:00:51 +0800
committerShakti Prasad Sen <shaktis@src.gnome.org>2005-07-14 15:00:51 +0800
commita714a01aeb70692229f0994d1530b6c9dadd1f29 (patch)
treec658ec060514a0bbc0b47f540290176ce499b3d3
parentbfa2e64242c672435866d4226c944770f3d10446 (diff)
downloadgsoc2013-evolution-a714a01aeb70692229f0994d1530b6c9dadd1f29.tar
gsoc2013-evolution-a714a01aeb70692229f0994d1530b6c9dadd1f29.tar.gz
gsoc2013-evolution-a714a01aeb70692229f0994d1530b6c9dadd1f29.tar.bz2
gsoc2013-evolution-a714a01aeb70692229f0994d1530b6c9dadd1f29.tar.lz
gsoc2013-evolution-a714a01aeb70692229f0994d1530b6c9dadd1f29.tar.xz
gsoc2013-evolution-a714a01aeb70692229f0994d1530b6c9dadd1f29.tar.zst
gsoc2013-evolution-a714a01aeb70692229f0994d1530b6c9dadd1f29.zip
Checked for if the exchange account exist/configured. Replaced all the
2005-07-13 Shakti Sen <shprasad@novell.com> * exchange-operations.c: Checked for if the exchange account exist/configured. * exchange-folder-permission.c: Replaced all the occurences of function exchange_config_listener_get_accounts() with exchange_operations_get_exchange_account() and returns if it doesn't exist. Also took care to avoid some compile time warnings. * exchange-folder.c: Same. Also took care to avoid some compile time warnings. * exchange-folder-subscription.c: Included exchange-folder-subscription.h file to avoid compilation warning. Fixes bug #310233. svn path=/trunk/; revision=29768
-rw-r--r--plugins/exchange-operations/ChangeLog15
-rw-r--r--plugins/exchange-operations/exchange-folder-permission.c28
-rw-r--r--plugins/exchange-operations/exchange-folder-subscription.c2
-rw-r--r--plugins/exchange-operations/exchange-folder-subscription.h3
-rw-r--r--plugins/exchange-operations/exchange-folder.c120
-rw-r--r--plugins/exchange-operations/exchange-operations.c5
6 files changed, 93 insertions, 80 deletions
diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog
index b5acaf1896..cdc95c184d 100644
--- a/plugins/exchange-operations/ChangeLog
+++ b/plugins/exchange-operations/ChangeLog
@@ -1,3 +1,18 @@
+2005-07-13 Shakti Sen <shprasad@novell.com>
+
+ * exchange-operations.c: Checked for if the exchange account
+ exist/configured.
+ * exchange-folder-permission.c: Replaced all the occurences of function
+ exchange_config_listener_get_accounts() with
+ exchange_operations_get_exchange_account() and returns if it doesn't
+ exist. Also took care to avoid some compile time warnings.
+ * exchange-folder.c: Same. Also took care to avoid some compile time
+ warnings.
+ * exchange-folder-subscription.c: Included
+ exchange-folder-subscription.h file to avoid compilation warning.
+
+ Fixes bug #310233.
+
2005-07-13 Praveen Kumar <kpraveen@novell.com>
* org-gnome-exchange-operations.eplug.in : Modified the eplug file to
diff --git a/plugins/exchange-operations/exchange-folder-permission.c b/plugins/exchange-operations/exchange-folder-permission.c
index 61a47785a3..885eb11493 100644
--- a/plugins/exchange-operations/exchange-folder-permission.c
+++ b/plugins/exchange-operations/exchange-folder-permission.c
@@ -34,6 +34,7 @@
#include "exchange-operations.h"
#include <mail/em-popup.h>
#include <mail/em-menu.h>
+#include "exchange-permissions-dialog.h"
static void org_folder_permissions_cb (EPopup *ep, EPopupItem *p, void *data);
void org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t);
@@ -57,14 +58,13 @@ org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t)
GSList *menus = NULL;
int i = 0;
static int first =1;
- GSList *accounts, *acc;
ExchangeAccount *account = NULL;
EFolder *folder = NULL;
- accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
- for (acc = accounts; acc; acc = acc->next) {
- account = acc->data;
- }
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
folder = exchange_account_get_folder (account, t->uri);
@@ -94,14 +94,13 @@ org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t)
static void
org_folder_permissions_cb (EPopup *ep, EPopupItem *p, void *data)
{
- GSList *accounts, *acc;
ExchangeAccount *account = NULL;
EFolder *folder = NULL;
- accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
- for (acc = accounts; acc; acc = acc->next) {
- account = acc->data;
- }
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
folder = exchange_account_get_folder (account, selected_exchange_folder_uri);
if (folder)
@@ -112,17 +111,16 @@ org_folder_permissions_cb (EPopup *ep, EPopupItem *p, void *data)
void
org_gnome_exchange_menu_folder_permissions (EPlugin *ep, EMMenuTargetSelect *target)
{
- GSList *accounts, *acc;
ExchangeAccount *account = NULL;
EFolder *folder = NULL;
if (target == NULL)
return;
- accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
- for (acc = accounts; acc; acc = acc->next) {
- account = acc->data;
- }
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
folder = exchange_account_get_folder (account, target->uri);
if (folder)
diff --git a/plugins/exchange-operations/exchange-folder-subscription.c b/plugins/exchange-operations/exchange-folder-subscription.c
index c54e292ccc..1c61df0fa2 100644
--- a/plugins/exchange-operations/exchange-folder-subscription.c
+++ b/plugins/exchange-operations/exchange-folder-subscription.c
@@ -35,6 +35,7 @@
#include <libedataserver/e-xml-hash-utils.h>
#include <libedataserverui/e-name-selector.h>
#include "exchange-config-listener.h"
+#include "exchange-folder-subscription.h"
static void
@@ -167,7 +168,6 @@ create_folder_subscription_dialog (gchar *mail_account, gchar **user_email_addre
EDestinationStore *destination_store;
GList *destinations;
EDestination *destination;
- gchar *temp;
glade_xml = glade_xml_new (CONNECTOR_GLADEDIR "/e-foreign-folder-dialog.glade",
diff --git a/plugins/exchange-operations/exchange-folder-subscription.h b/plugins/exchange-operations/exchange-folder-subscription.h
index f8722ba49b..af53799c65 100644
--- a/plugins/exchange-operations/exchange-folder-subscription.h
+++ b/plugins/exchange-operations/exchange-folder-subscription.h
@@ -1,4 +1,7 @@
#ifndef __EXCHANGE_FOLDER_SUBSCRIPTION_H__
#define __EXCHANGE_FOLDER_SUBSCRIPTION_H__
+gboolean
+create_folder_subscription_dialog (gchar *mail_account, gchar **user_email_address_ret, gchar **folder_name_ret);
+
#endif
diff --git a/plugins/exchange-operations/exchange-folder.c b/plugins/exchange-operations/exchange-folder.c
index 70f264e0a0..c22c1e90dd 100644
--- a/plugins/exchange-operations/exchange-folder.c
+++ b/plugins/exchange-operations/exchange-folder.c
@@ -27,21 +27,23 @@
#include <gtk/gtk.h>
#include <gtk/gtkdialog.h>
#include <gconf/gconf-client.h>
+#include <e-folder-exchange.h>
#include <exchange-hierarchy.h>
#include <calendar/gui/e-cal-popup.h>
#include <mail/em-popup.h>
#include <mail/em-menu.h>
+#include <libedataserverui/e-source-selector.h>
#include "exchange-operations.h"
#include "addressbook/gui/widgets/eab-popup.h"
-
+#include "exchange-folder-subscription.h"
void org_gnome_exchange_folder_subscription (EPlugin *ep, EMMenuTargetSelect *target);
void org_gnome_exchange_check_subscribed (EPlugin *ep, ECalPopupTargetSource *target);
-void org_gnome_exchange_folder_unsubscribe (EPlugin *ep, EPopupItem *p, void *data);
+void org_gnome_exchange_folder_unsubscribe (EPopup *ep, EPopupItem *p, void *data);
void org_gnome_exchange_check_address_book_subscribed (EPlugin *ep, EABPopupTargetSource *target);
-void org_gnome_exchange_folder_ab_unsubscribe (EPlugin *ep, EPopupItem *p, void *data);
+void org_gnome_exchange_folder_ab_unsubscribe (EPopup *ep, EPopupItem *p, void *data);
void org_gnome_exchange_check_inbox_subscribed (EPlugin *ep, EMPopupTargetFolder *target);
-void org_gnome_exchange_folder_inbox_unsubscribe (EPlugin *ep, EPopupItem *p, void *data);
+void org_gnome_exchange_folder_inbox_unsubscribe (EPopup *ep, EPopupItem *p, void *data);
void popup_free (EPopup *ep, GSList *items, void *data);
void popup_inbox_free (EPopup *ep, GSList *items, void *data);
void popup_ab_free (EPopup *ep, GSList *items, void *data);
@@ -60,7 +62,7 @@ popup_inbox_free (EPopup *ep, GSList *items, void *data)
}
void
-org_gnome_exchange_folder_inbox_unsubscribe (EPlugin *ep, EPopupItem *p, void *data)
+org_gnome_exchange_folder_inbox_unsubscribe (EPopup *ep, EPopupItem *p, void *data)
{
// To be done:
}
@@ -70,15 +72,14 @@ org_gnome_exchange_check_inbox_subscribed (EPlugin *ep, EMPopupTargetFolder *tar
{
GSList *menus = NULL;
int i = 0;
- GSList *accounts, *acc;
ExchangeAccount *account = NULL;
gchar *path = NULL;
gchar *sub_folder = NULL;
- accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
- for (acc = accounts; acc; acc = acc->next) {
- account = acc->data;
- }
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
path = g_strdup_printf (target->uri + strlen ("exchange://") + strlen (account->account_filename));
sub_folder = strchr (path, '@');
@@ -122,15 +123,14 @@ org_gnome_exchange_check_address_book_subscribed (EPlugin *ep, EABPopupTargetSou
gchar *uri = NULL;
gchar *path = NULL;
char *sub_folder = NULL;
- GSList *accounts, *acc;
ExchangeAccount *account = NULL;
- accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
- for (acc = accounts; acc; acc = acc->next) {
- account = acc->data;
- }
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
- source = e_source_selector_peek_primary_selection (target->selector);
+ source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
uri = e_source_get_uri (source);
path = g_strdup_printf (uri + strlen ("exchange://") + strlen (account->account_filename));
sub_folder = strchr (path, '@');
@@ -155,16 +155,15 @@ org_gnome_exchange_check_subscribed (EPlugin *ep, ECalPopupTargetSource *target)
gchar *ruri = NULL;
gchar *path = NULL;
char *sub_folder = NULL;
- GSList *accounts, *acc;
ExchangeAccount *account = NULL;
- accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
- for (acc = accounts; acc; acc = acc->next) {
- account = acc->data;
- }
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
- source = e_source_selector_peek_primary_selection (target->selector);
- ruri = e_source_peek_relative_uri (source);
+ source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
+ ruri = (gchar *) e_source_peek_relative_uri (source);
path = g_strdup_printf (ruri + strlen (account->account_filename));
sub_folder = strchr (path, '@');
@@ -183,7 +182,6 @@ unsubscribe_dialog_ab_response (GtkDialog *dialog, int response, gpointer data)
{
if (response == GTK_RESPONSE_OK) {
- GSList *accounts, *acc;
ExchangeAccount *account = NULL;
gchar *path = NULL;
gchar *uri = NULL;
@@ -195,11 +193,12 @@ unsubscribe_dialog_ab_response (GtkDialog *dialog, int response, gpointer data)
client = gconf_client_get_default ();
- accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
- for (acc = accounts; acc; acc = acc->next) {
- account = acc->data;
- }
- source = e_source_selector_peek_primary_selection (target->selector);
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
+
+ source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
uri = e_source_get_uri (source);
path = g_strdup_printf (uri + strlen ("exchange://") + strlen (account->account_filename));
source_uid = e_source_peek_uid (source);
@@ -222,7 +221,6 @@ unsubscribe_dialog_response (GtkDialog *dialog, int response, gpointer data)
{
if (response == GTK_RESPONSE_OK) {
- GSList *accounts, *acc;
GSList *ids, *node_to_be_deleted;
ExchangeAccount *account = NULL;
gchar *path = NULL;
@@ -235,12 +233,13 @@ unsubscribe_dialog_response (GtkDialog *dialog, int response, gpointer data)
client = gconf_client_get_default ();
- accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
- for (acc = accounts; acc; acc = acc->next) {
- account = acc->data;
- }
- source = e_source_selector_peek_primary_selection (target->selector);
- ruri = e_source_peek_relative_uri (source);
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
+
+ source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
+ ruri = (gchar *) e_source_peek_relative_uri (source);
source_uid = e_source_peek_uid (source);
path = g_strdup_printf (ruri + strlen (account->account_filename));
@@ -277,24 +276,23 @@ unsubscribe_dialog_response (GtkDialog *dialog, int response, gpointer data)
}
void
-org_gnome_exchange_folder_ab_unsubscribe (EPlugin *ep, EPopupItem *p, void *data)
+org_gnome_exchange_folder_ab_unsubscribe (EPopup *ep, EPopupItem *p, void *data)
{
GtkWidget *dialog = NULL;
EABPopupTargetSource *target = data;
ESource *source = NULL;
- GSList *accounts, *acc;
ExchangeAccount *account = NULL;
gchar *title = NULL;
gchar *displayed_folder_name = NULL;
gint response;
- accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
- for (acc = accounts; acc; acc = acc->next) {
- account = acc->data;
- }
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
- source = e_source_selector_peek_primary_selection (target->selector);
- displayed_folder_name = e_source_peek_name (source);
+ source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
+ displayed_folder_name = (gchar *) e_source_peek_name (source);
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION,
@@ -318,27 +316,26 @@ org_gnome_exchange_folder_ab_unsubscribe (EPlugin *ep, EPopupItem *p, void *data
g_free (displayed_folder_name);
gtk_widget_show (dialog);
- unsubscribe_dialog_ab_response (dialog, response, data);
+ unsubscribe_dialog_ab_response (GTK_DIALOG (dialog), response, data);
}
void
-org_gnome_exchange_folder_unsubscribe (EPlugin *ep, EPopupItem *p, void *data)
+org_gnome_exchange_folder_unsubscribe (EPopup *ep, EPopupItem *p, void *data)
{
GtkWidget *dialog = NULL;
ECalPopupTargetSource *target = data;
ESource *source = NULL;
- GSList *accounts, *acc;
ExchangeAccount *account = NULL;
gchar *title = NULL;
gchar *displayed_folder_name = NULL;
gint response;
- accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
- for (acc = accounts; acc; acc = acc->next) {
- account = acc->data;
- }
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
- source = e_source_selector_peek_primary_selection (target->selector);
- displayed_folder_name = e_source_peek_name (source);
+ source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
+ displayed_folder_name = (gchar *) e_source_peek_name (source);
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION,
@@ -362,14 +359,13 @@ org_gnome_exchange_folder_unsubscribe (EPlugin *ep, EPopupItem *p, void *data)
g_free (displayed_folder_name);
gtk_widget_show (dialog);
- unsubscribe_dialog_response (dialog, response, data);
+ unsubscribe_dialog_response (GTK_DIALOG (dialog), response, data);
}
void
org_gnome_exchange_folder_subscription (EPlugin *ep, EMMenuTargetSelect *target)
{
- GSList *accounts, *acc;
ExchangeAccount *account = NULL;
EFolder *folder = NULL;
ExchangeHierarchy *hier;
@@ -377,12 +373,12 @@ org_gnome_exchange_folder_subscription (EPlugin *ep, EMMenuTargetSelect *target)
gchar *folder_display_name = NULL;
gchar *folder_type = NULL;
gchar *physical_uri = NULL;
- gchar *user_email_address = NULL, *storage_name, *folder_name = NULL;
+ gchar *user_email_address = NULL, *folder_name = NULL;
- accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
- for (acc = accounts; acc; acc = acc->next) {
- account = acc->data;
- }
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
create_folder_subscription_dialog (account->account_name, &user_email_address, &folder_name);
@@ -395,8 +391,8 @@ org_gnome_exchange_folder_subscription (EPlugin *ep, EMMenuTargetSelect *target)
hier = e_folder_exchange_get_hierarchy (folder);
folder_display_name = g_strdup_printf ("%s's %s", hier->owner_name, folder_name);
- folder_type = e_folder_get_type_string (folder);
- physical_uri = e_folder_get_physical_uri (folder);
+ folder_type = (gchar *) e_folder_get_type_string (folder);
+ physical_uri = (gchar *) e_folder_get_physical_uri (folder);
if (!(strcmp (folder_type, "calendar")) ||
!(strcmp (folder_type, "calendar/public"))) {
add_folder_esource (account, EXCHANGE_CALENDAR_FOLDER, folder_display_name, physical_uri);
diff --git a/plugins/exchange-operations/exchange-operations.c b/plugins/exchange-operations/exchange-operations.c
index bd7f959ef5..24756008c9 100644
--- a/plugins/exchange-operations/exchange-operations.c
+++ b/plugins/exchange-operations/exchange-operations.c
@@ -176,12 +176,13 @@ exchange_operations_cta_select_node_from_tree (GtkTreeStore *store, GtkTreeIter
ExchangeAccount *
exchange_operations_get_exchange_account (void)
{
- ExchangeAccount *account;
+ ExchangeAccount *account = NULL;
GSList *acclist;
acclist = exchange_config_listener_get_accounts (exchange_global_config_listener);
/* FIXME: Need to be changed for handling multiple accounts */
- account = acclist->data;
+ if (acclist)
+ account = acclist->data;
return account;
}