[evolution-mapi/foldersize] EPlugin : Added a right click entry for folder size.
- From: Johnny Jacob <jjohnny src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution-mapi/foldersize] EPlugin : Added a right click entry for folder size.
- Date: Tue, 14 Jul 2009 11:06:17 +0000 (UTC)
commit 30a9b43f628c570b8a3a6247b75f45775c690020
Author: Johnny Jacob <jjohnny novell com>
Date: Tue Jul 14 15:43:08 2009 +0530
EPlugin : Added a right click entry for folder size.
src/account-setup-eplugin/ChangeLog | 5 ++
.../exchange-mapi-account-settings.c | 48 ++++++++++++++++++--
.../org-gnome-exchange-mapi.eplug.xml | 7 +++
3 files changed, 56 insertions(+), 4 deletions(-)
---
diff --git a/src/account-setup-eplugin/ChangeLog b/src/account-setup-eplugin/ChangeLog
index 8e76842..d0e3f34 100644
--- a/src/account-setup-eplugin/ChangeLog
+++ b/src/account-setup-eplugin/ChangeLog
@@ -1,5 +1,10 @@
2009-07-14 Johnny Jacob <jjohnny novell com>
+ * exchange-mapi-account-settings.c (org_gnome_folder_size_display_popup): Added.
+ Shows a 'Folder Size' pop on a right click on the folder tree.
+
+2009-07-14 Johnny Jacob <jjohnny novell com>
+
* exchange-mapi-account-settings.c (mapi_settings_run_folder_size_dialog): Added.
(org_gnome_exchange_mapi_settings): Add 'Folder size' in the account editor dialog.
diff --git a/src/account-setup-eplugin/exchange-mapi-account-settings.c b/src/account-setup-eplugin/exchange-mapi-account-settings.c
index 24ccae1..ab0da98 100644
--- a/src/account-setup-eplugin/exchange-mapi-account-settings.c
+++ b/src/account-setup-eplugin/exchange-mapi-account-settings.c
@@ -41,9 +41,13 @@
#include <exchange-mapi-connection.h>
#include <exchange-mapi-utils.h>
+#include <mail/mail-config.h>
+#include <mail/em-popup.h>
#include "mail/em-config.h"
#include "exchange-mapi-account-listener.h"
+#define FOLDERSIZE_MENU_ITEM 0
+
enum {
COL_FOLDERSIZE_NAME = 0,
COL_FOLDERSIZE_SIZE,
@@ -51,7 +55,7 @@ enum {
};
static void
-mapi_settings_run_folder_size_dialog ()
+mapi_settings_run_folder_size_dialog (GtkWidget *parent)
{
GtkDialog *dialog;
GtkBox *content_area;
@@ -64,8 +68,11 @@ mapi_settings_run_folder_size_dialog ()
/* TODO :This should be in a thread. If the folder list is not cached, we would be blocking UI. */
GSList *folder_list = exchange_mapi_account_listener_peek_folder_list ();
- dialog = (GtkDialog *)gtk_dialog_new_with_buttons (_("Folder Size"), NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT, NULL);
+ dialog = (GtkDialog *)gtk_dialog_new_with_buttons (_("Folder Size"), NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT,
+ NULL);
+
content_area = gtk_dialog_get_content_area (dialog);
/*Tree View */
@@ -108,7 +115,7 @@ mapi_settings_run_folder_size_dialog ()
static void
folder_size_clicked (GtkButton *button, gpointer data)
{
- mapi_settings_run_folder_size_dialog ();
+ mapi_settings_run_folder_size_dialog (button);
}
/* only used in editor */
@@ -172,3 +179,36 @@ org_gnome_exchange_mapi_settings (EPlugin *epl, EConfigHookItemFactoryData *data
return GTK_WIDGET (settings);
}
+
+
+static void
+popup_free (EPopup *ep, GSList *items, gpointer data)
+{
+ g_slist_free (items);
+}
+
+static EPopupItem popup_items[] = {
+ { E_POPUP_ITEM, (gchar *) "50.emc.04", (gchar *) N_("_Folder size"),
+ mapi_settings_run_folder_size_dialog, NULL, NULL,
+ 0, EM_POPUP_FOLDER_STORE }
+};
+
+void
+org_gnome_folder_size_display_popup (EPlugin *ep, EMPopupTargetFolder *t)
+{
+ EAccount *account;
+ GSList *menus = NULL;
+
+ account = mail_config_get_account_by_source_url (t->uri);
+
+ if (account == NULL)
+ return;
+
+ /* Show only for MAPI accounts */
+ if (g_strrstr (t->uri,"mapi://")) {
+ popup_items[FOLDERSIZE_MENU_ITEM].label = _(popup_items [FOLDERSIZE_MENU_ITEM].label);
+ menus = g_slist_prepend (menus, &popup_items [FOLDERSIZE_MENU_ITEM]);
+ }
+
+ e_popup_add_items (t->target.popup, menus, NULL, popup_free, account);
+}
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 cc5c0d2..60bec55 100644
--- a/src/account-setup-eplugin/org-gnome-exchange-mapi.eplug.xml
+++ b/src/account-setup-eplugin/org-gnome-exchange-mapi.eplug.xml
@@ -87,5 +87,12 @@
factory="exchange_mapi_create"/>
</group>
</hook>
+
+ <hook class="org.gnome.evolution.mail.popup:1.0">
+ <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder"
+ factory="org_gnome_folder_size_display_popup">
+ </menu>
+ </hook>
+
</e-plugin>
</e-plugin-list>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]