aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSarfraaz Ahmed <asarfraaz@novell.com>2005-07-25 15:13:47 +0800
committerAhmed Sarfraaz <sarfraaz@src.gnome.org>2005-07-25 15:13:47 +0800
commitfacdb640ee5024dfd5e68ed1956279356b9b0222 (patch)
tree8e40a537ccae43a13ec440a90397a59423fe857a /plugins
parent361a4ff8955acfa250dc4a804b1ee5a8628d6260 (diff)
downloadgsoc2013-evolution-facdb640ee5024dfd5e68ed1956279356b9b0222.tar
gsoc2013-evolution-facdb640ee5024dfd5e68ed1956279356b9b0222.tar.gz
gsoc2013-evolution-facdb640ee5024dfd5e68ed1956279356b9b0222.tar.bz2
gsoc2013-evolution-facdb640ee5024dfd5e68ed1956279356b9b0222.tar.lz
gsoc2013-evolution-facdb640ee5024dfd5e68ed1956279356b9b0222.tar.xz
gsoc2013-evolution-facdb640ee5024dfd5e68ed1956279356b9b0222.tar.zst
gsoc2013-evolution-facdb640ee5024dfd5e68ed1956279356b9b0222.zip
Takes care of displaying the folder size for mail folders. Now also adds
2005-07-25 Sarfraaz Ahmed <asarfraaz@novell.com> * exchange-account-setup.c (org_gnome_exchange_show_folder_size_factory): Takes care of displaying the folder size for mail folders. * exchange-calendar.c (e_exchange_calendar_pcalendar): Now also adds the calendar size in the properties page * exchange-contacts.c (e_exchange_contacts_pcontacts): Now also adds the addressbook size in the properties page. * exchange-folder-size-display.c (exchange_folder_size_get_val) : Fetch the folder size of a particular exchange folder. * exchange-folder-size-display.h : Similar * org-gnome-exchange-operations.eplug.in : Added the hook for the mail properties page. svn path=/trunk/; revision=29878
Diffstat (limited to 'plugins')
-rw-r--r--plugins/exchange-operations/ChangeLog15
-rw-r--r--plugins/exchange-operations/exchange-account-setup.c44
-rw-r--r--plugins/exchange-operations/exchange-calendar.c27
-rw-r--r--plugins/exchange-operations/exchange-contacts.c27
-rw-r--r--plugins/exchange-operations/exchange-folder-size-display.c40
-rw-r--r--plugins/exchange-operations/exchange-folder-size-display.h1
-rw-r--r--plugins/exchange-operations/org-gnome-exchange-operations.eplug.in28
7 files changed, 172 insertions, 10 deletions
diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog
index e60003c915..2a7161a6ed 100644
--- a/plugins/exchange-operations/ChangeLog
+++ b/plugins/exchange-operations/ChangeLog
@@ -1,3 +1,18 @@
+2005-07-25 Sarfraaz Ahmed <asarfraaz@novell.com>
+
+ * exchange-account-setup.c
+ (org_gnome_exchange_show_folder_size_factory): Takes care of displaying
+ the folder size for mail folders.
+ * exchange-calendar.c (e_exchange_calendar_pcalendar): Now also adds
+ the calendar size in the properties page
+ * exchange-contacts.c (e_exchange_contacts_pcontacts): Now also adds
+ the addressbook size in the properties page.
+ * exchange-folder-size-display.c (exchange_folder_size_get_val) : Fetch
+ the folder size of a particular exchange folder.
+ * exchange-folder-size-display.h : Similar
+ * org-gnome-exchange-operations.eplug.in : Added the hook for the mail
+ properties page.
+
2005-07-25 Arunprakash <arunp@novell.com>
* exchange-delegates.c (get_folder_security) (add_button_clicked_cb)
diff --git a/plugins/exchange-operations/exchange-account-setup.c b/plugins/exchange-operations/exchange-account-setup.c
index 1f14225386..17f3ba343f 100644
--- a/plugins/exchange-operations/exchange-account-setup.c
+++ b/plugins/exchange-operations/exchange-account-setup.c
@@ -36,6 +36,7 @@
#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 <e-util/e-dialog-utils.h>
#include <e2k-validate.h>
@@ -48,12 +49,14 @@
#include "mail/em-config.h"
#include "exchange-delegates.h"
#include "exchange-change-password.h"
+#include "exchange-folder-size-display.h"
GtkWidget* org_gnome_exchange_settings(EPlugin *epl, EConfigHookItemFactoryData *data);
GtkWidget *org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data);
gboolean org_gnome_exchange_check_options(EPlugin *epl, EConfigHookPageCheckData *data);
GtkWidget *org_gnome_exchange_auth_section (EPlugin *epl, EConfigHookItemFactoryData *data);
void org_gnome_exchange_commit (EPlugin *epl, EConfigHookItemFactoryData *data);
+GtkWidget* org_gnome_exchange_show_folder_size_factory (EPlugin *epl, EConfigHookItemFactoryData *data);
CamelServiceAuthType camel_exchange_ntlm_authtype = {
/* i18n: "Secure Password Authentication" is an Outlookism */
@@ -895,3 +898,44 @@ org_gnome_exchange_auth_section (EPlugin *epl, EConfigHookItemFactoryData *data)
return vbox;
}
+
+GtkWidget *
+org_gnome_exchange_show_folder_size_factory (EPlugin *epl, EConfigHookItemFactoryData *data)
+{
+ EMConfigTargetFolder *target= (EMConfigTargetFolder *)data->config->target;
+ CamelFolder *cml_folder = target->folder;
+ ExchangeAccount *account;
+ GtkWidget *lbl_size, *lbl_size_val;
+ GtkListStore *model;
+ GtkVBox *vbx;
+ GtkHBox *hbx_size;
+ char *folder_name, *folder_size;
+
+ folder_name = camel_folder_get_name (cml_folder);
+ if (!folder_name)
+ folder_name = g_strdup ("name");
+ account = exchange_operations_get_exchange_account ();
+ model = exchange_account_folder_size_get_model (account);
+ if (model)
+ folder_size = g_strdup_printf ("%s KB", exchange_folder_size_get_val (model, folder_name));
+ else
+ folder_size = g_strdup ("0 KB");
+
+ hbx_size = gtk_hbox_new (FALSE, 0);
+ vbx = (GtkVBox *)gtk_notebook_get_nth_page (data->parent, 0);
+
+ lbl_size = gtk_label_new_with_mnemonic (_("Size:"));
+ lbl_size_val = gtk_label_new_with_mnemonic (_(folder_size));
+ gtk_widget_show (lbl_size);
+ gtk_widget_show (lbl_size_val);
+ gtk_misc_set_alignment (GTK_MISC (lbl_size), 0.0, 0.5);
+ gtk_misc_set_alignment (GTK_MISC (lbl_size_val), 0.0, 0.5);
+ gtk_box_pack_start (hbx_size, lbl_size, FALSE, TRUE, 12);
+ gtk_box_pack_start (hbx_size, lbl_size_val, FALSE, TRUE, 10);
+ gtk_widget_show_all (hbx_size);
+
+ gtk_box_pack_start (GTK_BOX (vbx), hbx_size, FALSE, FALSE, 0);
+ g_free (folder_size);
+
+ return hbx_size;
+}
diff --git a/plugins/exchange-operations/exchange-calendar.c b/plugins/exchange-operations/exchange-calendar.c
index fb7603cf34..8c9efa8af2 100644
--- a/plugins/exchange-operations/exchange-calendar.c
+++ b/plugins/exchange-operations/exchange-calendar.c
@@ -36,6 +36,7 @@
#include "e-util/e-error.h"
#include "exchange-operations.h"
+#include "exchange-folder-size-display.h"
enum {
CALENDARNAME_COL,
@@ -132,19 +133,23 @@ e_exchange_calendar_pcalendar_on_change (GtkTreeView *treeview, ESource *source)
GtkWidget *
e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data)
{
- static GtkWidget *lbl_pcalendar, *scrw_pcalendar, *tv_pcalendar;
+ static GtkWidget *lbl_pcalendar, *scrw_pcalendar, *tv_pcalendar, *lbl_size, *lbl_size_val;
static GtkWidget *hidden = NULL;
GtkWidget *parent;
GtkTreeStore *ts_pcalendar;
GtkCellRenderer *cr_calendar;
GtkTreeViewColumn *tvc_calendar;
+ GtkListStore *model;
GPtrArray *callist;
ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target;
+ ESource *source = t->source;
EUri *uri;
ExchangeAccount *account;
gchar *ruri;
gchar *account_name;
gchar *uri_text;
+ gchar *cal_name;
+ char *folder_size;
int row, i;
if (!hidden)
@@ -184,12 +189,27 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data)
/* REVIEW: Should this handle be freed? - Attn: surf */
account = exchange_operations_get_exchange_account ();
account_name = account->account_name;
+ cal_name = e_source_peek_name (source);
+ model = exchange_account_folder_size_get_model (account);
+ if (model)
+ folder_size = g_strdup_printf ("%s KB", exchange_folder_size_get_val (model, cal_name));
+ else
+ folder_size = g_strdup ("0 KB");
/* FIXME: Take care of i18n */
+ lbl_size = gtk_label_new_with_mnemonic (_("Size:"));
+ lbl_size_val = gtk_label_new_with_mnemonic (_(folder_size));
+ gtk_widget_show (lbl_size);
+ gtk_widget_show (lbl_size_val);
+ gtk_misc_set_alignment (GTK_MISC (lbl_size), 0.0, 0.5);
+ gtk_misc_set_alignment (GTK_MISC (lbl_size_val), 0.0, 0.5);
+ gtk_table_attach (GTK_TABLE (parent), lbl_size, 0, 2, row, row+1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (parent), lbl_size_val, 1, 3, row, row+1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
+
lbl_pcalendar = gtk_label_new_with_mnemonic (_("_Location:"));
gtk_widget_show (lbl_pcalendar);
gtk_misc_set_alignment (GTK_MISC (lbl_pcalendar), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (parent), lbl_pcalendar, 0, 2, row, row+1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (parent), lbl_pcalendar, 0, 2, row+1, row+2, GTK_FILL|GTK_EXPAND, 0, 0, 0);
ts_pcalendar = gtk_tree_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
@@ -215,7 +235,7 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data)
gtk_label_set_mnemonic_widget (GTK_LABEL (lbl_pcalendar), tv_pcalendar);
g_signal_connect (G_OBJECT (tv_pcalendar), "cursor-changed", G_CALLBACK (e_exchange_calendar_pcalendar_on_change), t->source);
- gtk_table_attach (GTK_TABLE (parent), scrw_pcalendar, 0, 2, row+1, row+2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (parent), scrw_pcalendar, 0, 2, row+2, row+3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
gtk_widget_show_all (scrw_pcalendar);
if (calendar_src_exists) {
@@ -243,6 +263,7 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data)
}
g_ptr_array_free (callist, TRUE);
+ g_free (folder_size);
return tv_pcalendar;
}
diff --git a/plugins/exchange-operations/exchange-contacts.c b/plugins/exchange-operations/exchange-contacts.c
index 0dc53bf30f..3f2d5d3de2 100644
--- a/plugins/exchange-operations/exchange-contacts.c
+++ b/plugins/exchange-operations/exchange-contacts.c
@@ -38,6 +38,7 @@
#include "e-util/e-error.h"
#include "exchange-operations.h"
+#include "exchange-folder-size-display.h"
enum {
CONTACTSNAME_COL,
@@ -119,15 +120,17 @@ e_exchange_contacts_pcontacts_on_change (GtkTreeView *treeview, ESource *source)
GtkWidget *
e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data)
{
- static GtkWidget *lbl_pcontacts, *scrw_pcontacts, *tv_pcontacts, *vb_pcontacts;
+ static GtkWidget *lbl_pcontacts, *scrw_pcontacts, *tv_pcontacts, *vb_pcontacts, *lbl_size, *lbl_size_val, *hbx_size;
GtkTreeStore *ts_pcontacts;
GtkCellRenderer *cr_contacts;
GtkTreeViewColumn *tvc_contacts;
+ GtkListStore *model;
GPtrArray *conlist;
gchar *ruri, *account_name, *uri_text;
ExchangeAccount *account;
int i;
+ char *folder_size, *abook_name;
EABConfigTargetSource *t = (EABConfigTargetSource *) data->target;
ESource *source = t->source;
@@ -144,7 +147,9 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data)
g_free (uri_text);
- if (strcmp (e_source_peek_relative_uri (source), e_source_peek_uid (source))) {
+ if (e_source_peek_relative_uri (source) &&
+ e_source_peek_uid (source) &&
+ (strcmp (e_source_peek_relative_uri (source), e_source_peek_uid (source)))) {
contacts_src_exists = TRUE;
g_free (contacts_old_src_uri);
contacts_old_src_uri = g_strdup (e_source_peek_relative_uri (source));
@@ -156,11 +161,28 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data)
account = exchange_operations_get_exchange_account ();
account_name = account->account_name;
+ abook_name = e_source_peek_name (source);
+ model = exchange_account_folder_size_get_model (account);
+ if (model)
+ folder_size = g_strdup_printf ("%s KB", exchange_folder_size_get_val (model, abook_name));
+ else
+ folder_size = g_strdup_printf ("0 KB");
vb_pcontacts = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (data->parent), vb_pcontacts);
/* FIXME: Take care of i18n */
+ lbl_size = gtk_label_new_with_mnemonic (_("Size:"));
+ lbl_size_val = gtk_label_new_with_mnemonic (_(folder_size));
+ hbx_size = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (hbx_size, lbl_size, FALSE, TRUE, 0);
+ gtk_box_pack_start (hbx_size, lbl_size_val, FALSE, TRUE, 10);
+ gtk_widget_show (lbl_size);
+ gtk_widget_show (lbl_size_val);
+ gtk_misc_set_alignment (GTK_MISC (lbl_size), 0.0, 0.5);
+ gtk_misc_set_alignment (GTK_MISC (lbl_size_val), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (vb_pcontacts), hbx_size, FALSE, FALSE, 0);
+
lbl_pcontacts = gtk_label_new_with_mnemonic (_("_Location:"));
gtk_widget_show (lbl_pcontacts);
gtk_misc_set_alignment (GTK_MISC (lbl_pcontacts), 0.0, 0.5);
@@ -223,6 +245,7 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data)
}
g_ptr_array_free (conlist, TRUE);
+ g_free (folder_size);
return vb_pcontacts;
}
diff --git a/plugins/exchange-operations/exchange-folder-size-display.c b/plugins/exchange-operations/exchange-folder-size-display.c
index ebfa22cacc..b35af71075 100644
--- a/plugins/exchange-operations/exchange-folder-size-display.c
+++ b/plugins/exchange-operations/exchange-folder-size-display.c
@@ -40,6 +40,46 @@ enum {
NUM_COLUMNS
};
+static void
+free_entries (gpointer name, gpointer value, gpointer data)
+{
+ g_free (name);
+ g_free (value);
+}
+
+static gboolean
+get_folder_size_func (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer user_data)
+{
+ GHashTable *info = (GHashTable *) user_data;
+ gdouble folder_size;
+ char *folder_name;
+
+ gtk_tree_model_get(model, iter, COLUMN_SIZE, &folder_size, COLUMN_NAME, &folder_name, -1);
+
+ g_hash_table_insert (info, g_strdup (folder_name), g_strdup_printf ("%.2f", folder_size));
+ return FALSE;
+}
+
+char *
+exchange_folder_size_get_val (GtkListStore *model, const char *folder_name)
+{
+ GHashTable *finfo = g_hash_table_new (g_str_hash, g_str_equal);
+ char *col_name, *folder_size, *fsize;
+
+ gtk_tree_model_foreach (model, get_folder_size_func, finfo);
+
+ if ((fsize = g_hash_table_lookup (finfo, folder_name)) != NULL)
+ folder_size = g_strdup (fsize);
+ else
+ folder_size = g_strdup ("0");
+
+ g_hash_table_foreach (finfo, free_entries, NULL);
+
+ return folder_size;
+}
static void
format_size_func (GtkTreeViewColumn *col,
diff --git a/plugins/exchange-operations/exchange-folder-size-display.h b/plugins/exchange-operations/exchange-folder-size-display.h
index 2f09094062..2f109277c6 100644
--- a/plugins/exchange-operations/exchange-folder-size-display.h
+++ b/plugins/exchange-operations/exchange-folder-size-display.h
@@ -13,6 +13,7 @@ extern "C" {
#endif /* __cplusplus */
void exchange_folder_size_display (GtkListStore *model, GtkWidget *parent);
+char * exchange_folder_size_get_val (GtkListStore *model, const char *folder_name);
#ifdef __cplusplus
}
diff --git a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.in b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.in
index e459e0be2c..79bdc254bd 100644
--- a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.in
+++ b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.in
@@ -146,22 +146,40 @@
</menu>
</hook>
<hook class="org.gnome.evolution.calendar.popup:1.0">
- <menu id="org.gnome.evolution.calendar.source.popup" target="source" factory="org_gnome_exchange_check_subscribed">
+ <menu id="org.gnome.evolution.calendar.source.popup"
+ target="source"
+ factory="org_gnome_exchange_check_subscribed">
</menu>
</hook>
<hook class="org.gnome.evolution.calendar.popup:1.0">
- <menu id="org.gnome.evolution.tasks.source.popup" target="source" factory="org_gnome_exchange_check_subscribed">
+ <menu id="org.gnome.evolution.tasks.source.popup"
+ target="source"
+ factory="org_gnome_exchange_check_subscribed">
</menu>
</hook>
<hook class="org.gnome.evolution.addressbook.popup:1.0">
- <menu id="org.gnome.evolution.addressbook.source.popup" target="source" factory="org_gnome_exchange_check_address_book_subscribed">
+ <menu id="org.gnome.evolution.addressbook.source.popup"
+ target="source"
+ factory="org_gnome_exchange_check_address_book_subscribed">
</menu>
</hook>
<hook class="org.gnome.evolution.mail.popup:1.0">
- <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder" factory = "org_gnome_exchange_check_inbox_subscribed">
+ <menu id="org.gnome.evolution.mail.foldertree.popup"
+ target="folder"
+ factory = "org_gnome_exchange_check_inbox_subscribed">
</menu>
</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_show_folder_size_factory"/>
+ </group>
+ </hook>
</e-plugin>
</e-plugin-list>