aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/exchange-operations/exchange-operations.c
diff options
context:
space:
mode:
authorSarfraaz Ahmed <asarfraaz@novell.com>2005-06-13 20:39:20 +0800
committerAhmed Sarfraaz <sarfraaz@src.gnome.org>2005-06-13 20:39:20 +0800
commitd12d5fd082bd480bd9b635dbdae72d439730273a (patch)
tree83aab9a5eb38958a1828d20a1a09cfb8c980d4a1 /plugins/exchange-operations/exchange-operations.c
parent571d426db5c37683f03e2c95d3feea7e3d2905ec (diff)
downloadgsoc2013-evolution-d12d5fd082bd480bd9b635dbdae72d439730273a.tar.gz
gsoc2013-evolution-d12d5fd082bd480bd9b635dbdae72d439730273a.tar.zst
gsoc2013-evolution-d12d5fd082bd480bd9b635dbdae72d439730273a.zip
Added a new plugin directory for renaming exchange-account-setup as
2005-06-12 Sarfraaz Ahmed <asarfraaz@novell.com> * plugins/exchange-operations : Added a new plugin directory for renaming exchange-account-setup as exchange-operations. svn path=/trunk/; revision=29498
Diffstat (limited to 'plugins/exchange-operations/exchange-operations.c')
-rw-r--r--plugins/exchange-operations/exchange-operations.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/plugins/exchange-operations/exchange-operations.c b/plugins/exchange-operations/exchange-operations.c
new file mode 100644
index 0000000000..fcee3902d5
--- /dev/null
+++ b/plugins/exchange-operations/exchange-operations.c
@@ -0,0 +1,94 @@
+#include <string.h>
+
+#include "exchange-operations.h"
+
+ExchangeConfigListener *exchange_global_config_listener=NULL;
+
+static void
+free_exchange_listener (void)
+{
+ g_object_unref (exchange_global_config_listener);
+}
+
+int
+e_plugin_lib_enable (EPluginLib *eplib, int enable)
+{
+ if (!exchange_global_config_listener) {
+ exchange_global_config_listener = exchange_config_listener_new ();
+ g_atexit (free_exchange_listener);
+ }
+ g_print ("*** DEBUG: Exchange config listener is initialized ***\n");
+ return 0;
+}
+
+gboolean
+exchange_operations_tokenize_string (char **string, char *token, char delimit)
+{
+ int i=0;
+ char *str=*string;
+ while (*str!=delimit && *str!='\0') {
+ token[i++]=*str++;
+ }
+ while (*str==delimit)
+ str++;
+ token[i]='\0';
+ *string = str;
+ if (i==0)
+ return FALSE;
+ return TRUE;
+}
+
+gboolean
+exchange_operations_cta_add_node_to_tree (GtkTreeStore *store, GtkTreeIter *parent, const char *nuri, const char *ruri)
+{
+ GtkTreeIter iter;
+ char *luri=(char *)nuri;
+ char nodename[80];
+ gchar *readname;
+ gboolean status, found;
+
+ g_print ("TOKENIZER: String passed to tokenizer %s\n", luri);
+ exchange_operations_tokenize_string (&luri, nodename, '/');
+ g_print ("TOKENIZER: Token - %s Residue - %s\n", nodename, luri);
+ if (!nodename[0]) {
+ return TRUE;
+ }
+ if (!strcmp (nodename, "personal") && !parent) {
+ strcpy (nodename, "Personal Folders");
+ }
+
+ found = FALSE;
+ status = gtk_tree_model_iter_children (GTK_TREE_MODEL (store), &iter, parent);
+ while (status) {
+ g_print ("Reading name...\n");
+ gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &readname, -1);
+ g_print ("Name read - %s\n", readname);
+ if (!strcmp (nodename, readname)) {
+ g_print ("Found. Inserting as child.\n");
+ found = TRUE;
+ exchange_operations_cta_add_node_to_tree (store, &iter, luri, ruri);
+ break;
+ }
+ g_free (readname);
+ status = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter);
+ }
+ if (!found) {
+ g_print ("Not found. Inserting node %s\n", nodename);
+ gtk_tree_store_append (store, &iter, parent);
+ gtk_tree_store_set (store, &iter, 0, nodename, 1, ruri, -1);
+ exchange_operations_cta_add_node_to_tree (store, &iter, luri, ruri);
+ }
+ return TRUE;
+}
+
+ExchangeAccount *
+exchange_operations_get_exchange_account (void) {
+ ExchangeAccount *account;
+ GSList *acclist;
+
+ acclist = exchange_config_listener_get_accounts (exchange_global_config_listener);
+ account = acclist->data; /* FIXME: Need to be changed for handling multiple accounts */
+
+ return account;
+}
+