Re: [evolution-patches] Plugin for Adding Disable account popup menu



Hey,

It seems like i had totally forgotten about this patch doh :-O.
Anyway attaching a patch which fixes the concerns and also adds a
conditional which
Changes the menu item "Disable" to "Proxy Logout" if the account is a
proxy.

Cheers,
Shreyas
On Tue, 2005-05-24 at 09:35 +0530, Not Zed wrote:
> You need to add the xml file to the po/POTFILES.in file, otherwise its
> strings wont be extracted for translation.
> 
> Other than than, another style niggle - always put a blank line after
> the decelaration section in a new block.
> 
> i.e.
> 
> {
> 	int foo = 0;		/* declaration section */
> 	Object boo;
> <- insert blank line here always
> 	if (foo) {		/* code section */
> 		boo.do();
> 	}
> }
> 
> Various style hints are in the HACKING file.
> 
> 
> On Mon, 2005-05-23 at 07:11 -0600, S Shreyas wrote:
> > hey,
> > 
> > Attaching a patch( plugin ) which adds Disable Account pop up menu to a
> > store at right click.
> > 
> > Cheers,
> > Shreyas
> > _______________________________________________
> > evolution-patches mailing list
> > evolution-patches lists ximian com
> > http://lists.ximian.com/mailman/listinfo/evolution-patches
> 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ChangeLog,v
retrieving revision 1.1494
diff -u -p -r1.1494 ChangeLog
--- ChangeLog	27 Jun 2005 00:36:06 -0000	1.1494
+++ ChangeLog	9 Jul 2005 06:29:00 -0000
@@ -1,3 +1,8 @@
+2005-07-09  Shreyas Srinivasan <sshreyas novell com>
+
+	* plugins/mail-account-disable/*: Plugin to add Account Disable at
+	right click.
+	
 2005-06-27  Tor Lillqvist  <tml novell com>
 
 	* configure.in: Drop local mail file lock method tests and the
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.824
diff -u -p -r1.824 configure.in
--- configure.in	27 Jun 2005 00:36:06 -0000	1.824
+++ configure.in	9 Jul 2005 06:30:23 -0000
@@ -1410,7 +1410,7 @@ AC_SUBST_FILE(EVO_PLUGIN_RULE)
 AC_ARG_ENABLE(plugins, [  --enable-plugins=[no/base/all/experimental/list]      Enable plugins.],enable_plugins="$enableval",enable_plugins=all)
 
 dnl Add any new plugins here
-plugins_base="calendar-file calendar-http calendar-weather itip-formatter plugin-manager default-source addressbook-file startup-wizard print-message mark-all-read groupwise-features $EXCHANGE_PLUGIN $MONO_PLUGIN" 
+plugins_base="calendar-file calendar-http calendar-weather itip-formatter plugin-manager default-source addressbook-file startup-wizard print-message mark-all-read groupwise-features mail-account-disable $EXCHANGE_PLUGIN $MONO_PLUGIN" 
 
 plugins_standard="bbdb subject-thread save-calendar select-one-source copy-tool mail-to-task mark-calendar-offline audio-inline mailing-list-actions new-mail-notify default-mailer" 
 
@@ -1691,6 +1691,7 @@ plugins/default-mailer/Makefile
 plugins/addressbook-file/Makefile
 plugins/startup-wizard/Makefile
 plugins/print-message/Makefile
+plugins/mail-account-disable/Makefile
 smime/Makefile
 smime/lib/Makefile
 smime/gui/Makefile
Index: po/POTFILES.in
===================================================================
RCS file: /cvs/gnome/evolution/po/POTFILES.in,v
retrieving revision 1.268
diff -u -p -r1.268 POTFILES.in
--- po/POTFILES.in	28 Jun 2005 06:04:41 -0000	1.268
+++ po/POTFILES.in	9 Jul 2005 06:31:34 -0000
@@ -321,6 +321,7 @@ plugins/startup-wizard/org-gnome-evoluti
 plugins/startup-wizard/startup-wizard.c
 plugins/subject-thread/org-gnome-subject-thread.eplug.xml
 plugins/subject-thread/subject-thread.c
+plugins/mail-account-disable/mail-account-disable.c
 shell/GNOME_Evolution_Shell.server.in.in
 shell/GNOME_Evolution_Test.server.in.in
 shell/apps_evolution_shell.schemas.in.in
--- /dev/null	2005-03-20 01:06:14.000000000 +0530
+++ plugins/mail-account-disable/Makefile.am	2005-07-08 11:30:39.000000000 +0530
@@ -0,0 +1,15 @@
+INCLUDES =						\
+	-I$(top_srcdir)					\
+	$(EVOLUTION_MAIL_CFLAGS)			\
+	$(EVOLUTION_MAIL_CFLAGS)			\
+	-DEVOLUTION_GLADEDIR=\""$(gladedir)"\"
+
+ EVO_PLUGIN_RULE@
+
+plugin_DATA = org-gnome-mail-account-disable.eplug
+plugin_LTLIBRARIES = libmail-account-disable.la
+
+libmail_account_disable_la_SOURCES = mail-account-disable.c
+libmail_account_disable_la_LDFLAGS = -module -avoid-version
+
+EXTRA_DIST = org-gnome-mail-account-disable.eplug.xml
--- /dev/null	2005-03-20 01:06:14.000000000 +0530
+++ plugins/mail-account-disable/org-gnome-mail-account-disable.eplug.xml	2005-07-08 11:28:09.000000000 +0530
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<e-plugin-list>
+  <e-plugin id="org.gnome.mail.account.disable" 
+   type="shlib" domain="evolution" _name="Disable Account"
+   location="@PLUGINDIR@/libmail-account-disable.so">
+    <_description>Allows disabling of accounts.</_description>
+    <author name="Shreyas Srinivasan" email="sshreyas novell com"/>
+    <hook class="org.gnome.evolution.mail.popup:1.0">
+      <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder"
+factory = "org_gnome_create_mail_account_disable">
+      </menu>
+    </hook>
+  </e-plugin>
+</e-plugin-list>
--- /dev/null	2005-03-20 01:06:14.000000000 +0530
+++ plugins/mail-account-disable/mail-account-disable.c	2005-07-08 11:49:00.000000000 +0530
@@ -0,0 +1,103 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ *  Authors: Shreyas Srinivasan <sshreyas novell com>
+ *
+ *  Copyright 2004 Novell, Inc. (www.novell.com)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <string.h>
+#include <mail/mail-component.h>
+#include <mail/em-folder-selector.h>
+#include <mail/em-popup.h>
+#include <mail/em-account-editor.h>
+#include <mail/mail-config.h>
+#include <e-util/e-account.h>
+#include <e-util/e-account-list.h>
+
+#define ACCOUNT_DISABLE 0
+#define PROXY_LOGOUT 1
+
+void mail_account_disable (EPopup *ep, EPopupItem *p, char *uri);
+void org_gnome_create_mail_account_disable (EPlugin *ep, EMPopupTargetFolder *t);
+
+static EPopupItem popup_items[] = {
+	{ E_POPUP_ITEM, "20.emc.04", N_("_Disable"), mail_account_disable, NULL, NULL, 0, EM_POPUP_FOLDER_STORE },
+	{ E_POPUP_ITEM, "20.emc.04", N_("Proxy _Logout"), mail_account_disable, NULL, NULL, 0, EM_POPUP_FOLDER_STORE }
+};
+
+static void 
+popup_free (EPopup *ep, GSList *items, void *data)
+{
+g_slist_free (items);
+}
+
+void
+mail_account_disable (EPopup *ep, EPopupItem *p, char *uri)
+{
+	EAccount *account;
+
+	account = mail_config_get_account_by_source_url (uri);
+
+	if (account) {
+		MailComponent *component = mail_component_peek ();
+		
+		if (mail_config_has_proxies(account))
+			mail_config_remove_account_proxies (account);
+		
+		account->enabled = !account->enabled;
+		e_account_list_change(mail_config_get_accounts(), account);
+		mail_component_remove_store_by_uri (component, account->source->url);		
+
+		if (account->parent_uid)
+			mail_config_remove_account (account);
+
+		mail_config_save_accounts();	
+	}	
+
+	return ;
+}
+
+void
+org_gnome_create_mail_account_disable (EPlugin *ep, EMPopupTargetFolder *t)
+{
+	EAccount *account;
+	GSList *menus = NULL;
+
+	account = mail_config_get_account_by_source_url (t->uri);
+
+	if (g_strrstr (t->uri,"groupwise://") && account->parent_uid) {
+		popup_items[PROXY_LOGOUT].label =  _(popup_items [PROXY_LOGOUT].label);
+		menus = g_slist_prepend (menus, &popup_items [PROXY_LOGOUT]);
+	}
+	else {
+		popup_items[ACCOUNT_DISABLE].label =  _(popup_items [ACCOUNT_DISABLE].label);
+		menus = g_slist_prepend (menus, &popup_items [ACCOUNT_DISABLE]);
+	}
+
+	e_popup_add_items (t->target.popup, menus, NULL, popup_free, t->uri);	
+
+	return;
+}
+


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