[evolution-mapi/foldersize: 1/2] EPlugin : Add settings page in account editor.



commit 588067c1470a3324481504a1ce08cc87da2d807a
Author: Johnny Jacob <jjohnny novell com>
Date:   Thu Jul 9 09:39:18 2009 +0530

    EPlugin : Add settings page in account editor.

 src/account-setup-eplugin/ChangeLog                |    5 +
 src/account-setup-eplugin/Makefile.am              |    1 +
 .../exchange-mapi-account-settings.c               |  104 ++++++++++++++++++++
 .../exchange-mapi-account-setup.c                  |    1 -
 .../org-gnome-exchange-mapi.eplug.xml              |   23 ++++-
 5 files changed, 132 insertions(+), 2 deletions(-)
---
diff --git a/src/account-setup-eplugin/ChangeLog b/src/account-setup-eplugin/ChangeLog
index e7bf14d..7a6a609 100644
--- a/src/account-setup-eplugin/ChangeLog
+++ b/src/account-setup-eplugin/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-09  Johnny Jacob  <jjohnny novell com>
+
+	* exchange-mapi-account-settings.c (org_gnome_exchange_mapi_settings): Added. Factory
+	for creating a settings page in account editor.
+
 2009-03-19  Milan Crha  <mcrha redhat com>
 
 	** Fix for bug #574784
diff --git a/src/account-setup-eplugin/Makefile.am b/src/account-setup-eplugin/Makefile.am
index 77040b1..084a336 100644
--- a/src/account-setup-eplugin/Makefile.am
+++ b/src/account-setup-eplugin/Makefile.am
@@ -17,6 +17,7 @@ plugin_LTLIBRARIES = liborg-gnome-exchange-mapi.la
 liborg_gnome_exchange_mapi_la_SOURCES = 		\
 	exchange-mapi-account-setup.c			\
 	exchange-mapi-account-setup.h			\
+	exchange-mapi-account-settings.c		\
 	exchange-mapi-account-listener.c		\
 	exchange-mapi-account-listener.h
 
diff --git a/src/account-setup-eplugin/exchange-mapi-account-settings.c b/src/account-setup-eplugin/exchange-mapi-account-settings.c
new file mode 100644
index 0000000..bf18b3a
--- /dev/null
+++ b/src/account-setup-eplugin/exchange-mapi-account-settings.c
@@ -0,0 +1,104 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>  
+ *
+ *
+ * Authors:
+ *		Johnny Jacob  <jjohnny novell com>
+ *
+ * Copyright (C) 1999-2009 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include <camel/camel-provider.h>
+#include <camel/camel-url.h>
+#include <camel/camel-service.h>
+#include <camel/camel-folder.h>
+#include <libedataserver/e-xml-hash-utils.h>
+#include <libedataserverui/e-passwords.h>
+#include <libedataserver/e-account.h>
+#include <e-util/e-dialog-utils.h>
+
+#include "mail/em-config.h"
+
+static void
+folder_size_clicked (GtkButton *button, gpointer data)
+{
+}
+
+/* only used in editor */
+GtkWidget *
+org_gnome_exchange_mapi_settings (EPlugin *epl, EConfigHookItemFactoryData *data)
+{
+	EMConfigTargetAccount *target_account;
+	CamelURL *url;
+	const gchar *source_url;
+	GtkVBox *settings;
+
+	/* Miscelleneous setting */
+	GtkFrame *frm_misc;
+	GtkVBox *vbox_misc;
+	GtkTable *tbl_misc;
+	GtkLabel *lbl_fsize;
+	GtkButton *btn_fsize;
+
+	target_account = (EMConfigTargetAccount *)data->config->target;
+
+	source_url = e_account_get_string (target_account->account,  E_ACCOUNT_SOURCE_URL);
+
+	url = camel_url_new(source_url, NULL);
+	if (url == NULL || strcmp(url->protocol, "mapi") != 0) {
+		if (url)
+			camel_url_free(url);
+		return NULL;
+	}
+
+	settings = (GtkVBox*) g_object_new (GTK_TYPE_VBOX, "homogeneous", FALSE, "spacing", 6, NULL);
+	gtk_container_set_border_width (GTK_CONTAINER (settings), 12);
+
+	/* Miscelleneous settings */
+	frm_misc = (GtkFrame*) g_object_new (GTK_TYPE_FRAME, "label", _("Miscelleneous"), NULL);
+	gtk_box_pack_start (GTK_BOX (settings), GTK_WIDGET (frm_misc), FALSE, FALSE, 0);
+
+	vbox_misc = (GtkVBox*) g_object_new (GTK_TYPE_VBOX, "homogeneous", FALSE, "spacing", 6, NULL);
+	gtk_container_set_border_width (GTK_CONTAINER (vbox_misc), 6);
+	gtk_container_add (GTK_CONTAINER (frm_misc), GTK_WIDGET (vbox_misc));
+
+	tbl_misc = (GtkTable*) g_object_new (GTK_TYPE_TABLE, "n-rows", 1, "n-columns", 1, 
+					     "homogeneous", FALSE, "row-spacing", 6,
+					     "column-spacing", 6, NULL);
+
+	/* Folder Size */
+	lbl_fsize = (GtkLabel*) g_object_new (GTK_TYPE_LABEL, "label", _("View the size of all Exchange folders"), NULL);
+	gtk_misc_set_alignment (GTK_MISC (lbl_fsize), 0, 0.5);
+	btn_fsize = (GtkButton*) g_object_new (GTK_TYPE_BUTTON, "label", _("Folders Size"), NULL);
+	g_signal_connect (btn_fsize, "clicked", G_CALLBACK (folder_size_clicked), NULL);
+	gtk_table_attach_defaults (tbl_misc, GTK_WIDGET (lbl_fsize), 0, 1, 0, 1);
+	gtk_table_attach (tbl_misc, GTK_WIDGET (btn_fsize), 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+	gtk_box_pack_start (GTK_BOX (vbox_misc), GTK_WIDGET (tbl_misc), FALSE, FALSE, 0);
+
+	gtk_widget_show_all (GTK_WIDGET (settings));
+
+	/*Insert the page*/
+	gtk_notebook_insert_page (GTK_NOTEBOOK (data->parent), GTK_WIDGET (settings), gtk_label_new(_("Exchange Settings")), 4);
+
+	return GTK_WIDGET (settings);
+}
diff --git a/src/account-setup-eplugin/exchange-mapi-account-setup.c b/src/account-setup-eplugin/exchange-mapi-account-setup.c
index 19349f3..393464c 100644
--- a/src/account-setup-eplugin/exchange-mapi-account-setup.c
+++ b/src/account-setup-eplugin/exchange-mapi-account-setup.c
@@ -594,4 +594,3 @@ exchange_mapi_cal_commit (EPlugin *epl, EConfigTarget *target)
 	// Update the folder list in the plugin and ExchangeMAPIFolder
 	return;
 }
-
diff --git a/src/account-setup-eplugin/org-gnome-exchange-mapi.eplug.xml b/src/account-setup-eplugin/org-gnome-exchange-mapi.eplug.xml
index 802f5c0..cc5c0d2 100644
--- a/src/account-setup-eplugin/org-gnome-exchange-mapi.eplug.xml
+++ b/src/account-setup-eplugin/org-gnome-exchange-mapi.eplug.xml
@@ -41,6 +41,28 @@
 					factory="org_gnome_exchange_mapi_account_setup"/>
 			</group>
 		</hook>
+		<hook class="org.gnome.evolution.mail.config:1.0">
+      		      <group 
+			 target="account" 
+			 id="org.gnome.evolution.mail.config.accountEditor"
+			 check="org_gnome_exchange_mapi_check_options">
+			<item type="page" 
+	      		      path="40.settings"
+	      		      _label="Exchange Settings"
+	      		      factory="org_gnome_exchange_mapi_settings"/>
+      		      </group>
+		</hook>
+
+		<hook class="org.gnome.evolution.mail.config:1.0">
+		          <group id="org.gnome.evolution.mail.folderConfig" 
+			         target="folder"
+			         check= "exchange_show_folder_size_check">
+			    <item type="page" 
+				  path="10.size" 
+				  _label="Size" 
+				  factory="org_gnome_exchange_mapi_show_folder_size"/>
+			  </group>
+		</hook>
 		<hook class="org.gnome.evolution.addressbook.config:1.0">
 			<group 
 				target="source" 
@@ -65,6 +87,5 @@
 					factory="exchange_mapi_create"/>
 			</group>
 		</hook>
-
 	</e-plugin>
 </e-plugin-list>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]