[evolution-patches] Exchange fix for #311323
- From: Sarfraaz Ahmed <asarfraaz novell com>
- To: Patches List <evolution-patches lists ximian com>
- Subject: [evolution-patches] Exchange fix for #311323
- Date: Sat, 23 Jul 2005 16:52:54 +0530
Hi,
This patch fixes #311323. The ChangeLog explains the changes.
Thanks
-- Sarfraaz
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/ChangeLog,v
retrieving revision 1.28
diff -u -p -u -p -r1.28 ChangeLog
--- ChangeLog 22 Jul 2005 10:25:22 -0000 1.28
+++ ChangeLog 23 Jul 2005 11:12:39 -0000
@@ -1,3 +1,18 @@
+2005-07-23 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-20 Shakti Sen <shprasad novell com>
* Makefile.am: Included files org-gnome-exchange-ab-subscription.xml,
Index: exchange-account-setup.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-account-setup.c,v
retrieving revision 1.14
diff -u -p -u -p -r1.14 exchange-account-setup.c
--- exchange-account-setup.c 19 Jul 2005 08:51:05 -0000 1.14
+++ exchange-account-setup.c 23 Jul 2005 11:12:39 -0000
@@ -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,6 +49,7 @@
#include "mail/em-config.h"
#include "exchange-delegates.h"
#include "exchange-change-password.h"
+#include "exchange-folder-size-display.h"
#define ERROR_DOMAIN "org-gnome-exchange-operations"
@@ -56,6 +58,7 @@ GtkWidget *org_gnome_exchange_owa_url(EP
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 */
@@ -896,4 +899,45 @@ org_gnome_exchange_auth_section (EPlugin
g_list_free (authtypes);
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;
+ 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 ();
+ GtkListStore *model;
+ 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;
}
Index: exchange-calendar.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-calendar.c,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 exchange-calendar.c
--- exchange-calendar.c 22 Jul 2005 07:48:16 -0000 1.4
+++ exchange-calendar.c 23 Jul 2005 11:12:40 -0000
@@ -36,6 +36,7 @@
#include "e-util/e-error.h"
#include "exchange-operations.h"
+#include "exchange-folder-size-display.h"
enum {
CALENDARNAME_COL,
@@ -132,7 +133,7 @@ e_exchange_calendar_pcalendar_on_change
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;
@@ -140,11 +141,14 @@ e_exchange_calendar_pcalendar (EPlugin *
GtkTreeViewColumn *tvc_calendar;
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 +188,28 @@ e_exchange_calendar_pcalendar (EPlugin *
/* 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);
+ GtkListStore *model;
+ 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 *
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 *
}
g_ptr_array_free (callist, TRUE);
+ g_free (folder_size);
return tv_pcalendar;
}
Index: exchange-contacts.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-contacts.c,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 exchange-contacts.c
--- exchange-contacts.c 22 Jul 2005 07:48:16 -0000 1.3
+++ exchange-contacts.c 23 Jul 2005 11:12:40 -0000
@@ -38,6 +38,7 @@
#include "e-util/e-error.h"
#include "exchange-operations.h"
+#include "exchange-folder-size-display.h"
enum {
CONTACTSNAME_COL,
@@ -119,7 +120,7 @@ e_exchange_contacts_pcontacts_on_change
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;
@@ -128,6 +129,7 @@ e_exchange_contacts_pcontacts (EPlugin *
ExchangeAccount *account;
int i;
+ char *folder_size, *abook_name;
EABConfigTargetSource *t = (EABConfigTargetSource *) data->target;
ESource *source = t->source;
@@ -144,7 +146,9 @@ e_exchange_contacts_pcontacts (EPlugin *
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 +160,29 @@ e_exchange_contacts_pcontacts (EPlugin *
account = exchange_operations_get_exchange_account ();
account_name = account->account_name;
+ abook_name = e_source_peek_name (source);
+ GtkListStore *model;
+ 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 *
}
g_ptr_array_free (conlist, TRUE);
+ g_free (folder_size);
return vb_pcontacts;
}
Index: exchange-folder-size-display.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-folder-size-display.c,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 exchange-folder-size-display.c
--- exchange-folder-size-display.c 19 Jul 2005 08:51:05 -0000 1.4
+++ exchange-folder-size-display.c 23 Jul 2005 11:12:40 -0000
@@ -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,
Index: exchange-folder-size-display.h
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-folder-size-display.h,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 exchange-folder-size-display.h
--- exchange-folder-size-display.h 7 Jul 2005 11:35:32 -0000 1.1
+++ exchange-folder-size-display.h 23 Jul 2005 11:12:40 -0000
@@ -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
}
Index: org-gnome-exchange-operations.eplug.in
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/org-gnome-exchange-operations.eplug.in,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 org-gnome-exchange-operations.eplug.in
--- org-gnome-exchange-operations.eplug.in 22 Jul 2005 10:25:22 -0000 1.6
+++ org-gnome-exchange-operations.eplug.in 23 Jul 2005 11:12:40 -0000
@@ -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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]