aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2009-01-24 05:41:01 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2009-01-24 05:41:01 +0800
commitbd9f473a896496b95b9896d30940f2ab27493432 (patch)
tree7c314e4776bcfbff0c483ee7995818519fbc43bb /plugins
parent3c7a575407bef757d434808904a4c4dc1ba60cb3 (diff)
downloadgsoc2013-evolution-bd9f473a896496b95b9896d30940f2ab27493432.tar.gz
gsoc2013-evolution-bd9f473a896496b95b9896d30940f2ab27493432.tar.zst
gsoc2013-evolution-bd9f473a896496b95b9896d30940f2ab27493432.zip
Redesign EPluginUI to accommodate merging and unmerging shell views.
Get the "mark-all-read" and "plugin-manager" plugins working. svn path=/branches/kill-bonobo/; revision=37125
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mark-all-read/Makefile.am2
-rw-r--r--plugins/mark-all-read/mark-all-read.c72
-rw-r--r--plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml31
-rw-r--r--plugins/plugin-manager/Makefile.am7
-rw-r--r--plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml23
-rw-r--r--plugins/plugin-manager/org-gnome-plugin-manager.xml15
-rw-r--r--plugins/plugin-manager/plugin-manager.c83
7 files changed, 135 insertions, 98 deletions
diff --git a/plugins/mark-all-read/Makefile.am b/plugins/mark-all-read/Makefile.am
index 756e945d00..c13125c7a5 100644
--- a/plugins/mark-all-read/Makefile.am
+++ b/plugins/mark-all-read/Makefile.am
@@ -12,7 +12,7 @@ liborg_gnome_mark_all_read_la_SOURCES = mark-all-read.c
liborg_gnome_mark_all_read_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_mark_all_read_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/mail/libevolution-mail.la \
+ $(top_builddir)/mail/libevolution-module-mail.la \
$(EVOLUTION_MAIL_LIBS)
EXTRA_DIST = org-gnome-mark-all-read.eplug.xml
diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index c9ea67ca61..c98b33edd1 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -28,20 +28,27 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <e-util/e-config.h>
-#include <mail/em-popup.h>
+#include <e-util/e-plugin-ui.h>
+#include <mail/e-mail-shell-sidebar.h>
+#include <mail/em-folder-tree.h>
#include <mail/mail-ops.h>
#include <mail/mail-mt.h>
#include <camel/camel-vee-folder.h>
#include "e-util/e-error.h"
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-window.h>
+#include <shell/e-shell-window-actions.h>
+
#define PRIMARY_TEXT \
N_("Also mark messages in subfolders?")
#define SECONDARY_TEXT \
N_("Do you want to mark messages as read in the current folder " \
"only, or in the current folder as well as all subfolders?")
-void org_gnome_mark_all_read (EPlugin *ep, EMPopupTargetFolder *target);
+gboolean e_plugin_ui_init (GtkUIManager *manager,
+ EShellView *shell_view);
+
static void mar_got_folder (char *uri, CamelFolder *folder, void *data);
static void mar_all_sub_folders (CamelStore *store, CamelFolderInfo *fi, CamelException *ex);
@@ -190,16 +197,6 @@ prompt_user (void)
return response;
}
-void
-org_gnome_mark_all_read (EPlugin *ep, EMPopupTargetFolder *t)
-{
- if (t->uri == NULL) {
- return;
- }
-
- mail_get_folder(t->uri, 0, mar_got_folder, NULL, mail_msg_unordered_push);
-}
-
static void
mark_all_as_read (CamelFolder *folder)
{
@@ -270,3 +267,52 @@ mar_all_sub_folders (CamelStore *store, CamelFolderInfo *fi, CamelException *ex)
fi = fi->next;
}
}
+
+static void
+action_mail_mark_read_recursive_cb (GtkAction *action,
+ EShellView *shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EShellSidebar *shell_sidebar;
+ EMFolderTree *folder_tree;
+ const gchar *folder_uri;
+
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ g_return_if_fail (E_IS_MAIL_SHELL_SIDEBAR (shell_sidebar));
+
+ mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+ g_return_if_fail (folder_uri != NULL);
+
+ mail_get_folder (
+ folder_uri, 0, mar_got_folder, NULL, mail_msg_unordered_push);
+}
+
+static GtkActionEntry entries[] = {
+
+ { "mail-mark-read-recursive",
+ "mail-mark-read",
+ N_("Mark Me_ssages as Read"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_mark_read_recursive_cb) }
+};
+
+gboolean
+e_plugin_ui_init (GtkUIManager *manager,
+ EShellView *shell_view)
+{
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ action_group = E_SHELL_WINDOW_ACTION_GROUP_SHELL (shell_window);
+
+ /* Add actions to the "shell" action group. */
+ gtk_action_group_add_actions (
+ action_group, entries,
+ G_N_ELEMENTS (entries), shell_view);
+
+ return TRUE;
+}
diff --git a/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml b/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml
index a4542572a5..76c0864fa1 100644
--- a/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml
+++ b/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml
@@ -1,18 +1,21 @@
<?xml version="1.0"?>
<e-plugin-list>
- <e-plugin
- id="org.gnome.evolution.mail.folder.mark_all_read"
- type="shlib"
- domain="@GETTEXT_PACKAGE@"
- _name="Mark All Read"
- location="@PLUGINDIR@/liborg-gnome-mark-all-read@SOEXT@">
- <author name="Chenthill Palanisamy" email="pchenthill@novell.com"/>
- <_description>Used for marking all the messages under a folder as read</_description>
+ <e-plugin id="org.gnome.evolution.mail.folder.mark_all_read"
+ type="shlib"
+ domain="@GETTEXT_PACKAGE@"
+ _name="Mark All Read"
+ location="@PLUGINDIR@/liborg-gnome-mark-all-read@SOEXT@">
+ <author name="Chenthill Palanisamy" email="pchenthill@novell.com"/>
+ <_description>Used for marking all the messages under a folder as read</_description>
- <hook class="org.gnome.evolution.mail.popup:1.0">
- <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder">
- <item type="item" path="30.emc.01" icon="mail-mark-read" _label="Mark Me_ssages as Read" activate="org_gnome_mark_all_read" enable="folder" visible="folder"/>
- </menu>
- </hook>
- </e-plugin>
+ <hook class="org.gnome.evolution.ui:1.0">
+ <ui-manager id="org.gnome.evolution.mail">
+ <popup name="mail-folder-popup">
+ <placeholder name="mail-folder-popup-actions">
+ <menuitem action="mail-mark-read-recursive"/>
+ </placeholder>
+ </popup>
+ </ui-manager>
+ </hook>
+ </e-plugin>
</e-plugin-list>
diff --git a/plugins/plugin-manager/Makefile.am b/plugins/plugin-manager/Makefile.am
index f9d6642521..22e4ca7d51 100644
--- a/plugins/plugin-manager/Makefile.am
+++ b/plugins/plugin-manager/Makefile.am
@@ -4,7 +4,7 @@ INCLUDES = \
@EVO_PLUGIN_RULE@
-plugin_DATA = org-gnome-plugin-manager.eplug org-gnome-plugin-manager.xml
+plugin_DATA = org-gnome-plugin-manager.eplug
plugin_LTLIBRARIES = liborg-gnome-plugin-manager.la
liborg_gnome_plugin_manager_la_SOURCES = plugin-manager.c
@@ -13,9 +13,8 @@ liborg_gnome_plugin_manager_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
$(EVOLUTION_MAIL_LIBS)
-EXTRA_DIST = \
- org-gnome-plugin-manager.eplug.xml \
- org-gnome-plugin-manager.xml
+EXTRA_DIST = \
+ org-gnome-plugin-manager.eplug.xml
BUILT_SOURCES = org-gnome-plugin-manager.eplug
diff --git a/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml b/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml
index d8e4849f2f..c931b5c968 100644
--- a/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml
+++ b/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml
@@ -6,18 +6,19 @@
location="@PLUGINDIR@/liborg-gnome-plugin-manager@SOEXT@"
_name="Plugin Manager"
system_plugin="true">
- <_description>A plugin for managing which plugins are enabled or disabled.</_description>
<author name="Michael Zucchi" email="notzed@ximian.com"/>
- <hook class="org.gnome.evolution.shell.bonobomenu:1.0">
- <menu id="org.gnome.evolution.shell" target="shell">
- <!-- the path to the bonobo menu description -->
- <ui file="@PLUGINDIR@/org-gnome-plugin-manager.xml"/>
- <item
- type="item"
- verb="EPluginManagerManage"
- path="/commands/EPluginManagerManage"
- activate="org_gnome_plugin_manager_manage"/>
- </menu>
+ <_description>A plugin for managing which plugins are enabled or disabled.</_description>
+
+ <hook class="org.gnome.evolution.ui:1.0">
+ <ui-manager id="org.gnome.evolution.shell">
+ <menubar name="main-menu">
+ <menu action="edit-menu">
+ <placeholder name="administrative-actions">
+ <menuitem action="plugin-manager"/>
+ </placeholder>
+ </menu>
+ </menubar>
+ </ui-manager>
</hook>
</e-plugin>
</e-plugin-list>
diff --git a/plugins/plugin-manager/org-gnome-plugin-manager.xml b/plugins/plugin-manager/org-gnome-plugin-manager.xml
deleted file mode 100644
index 3f74a2dd4c..0000000000
--- a/plugins/plugin-manager/org-gnome-plugin-manager.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<Root>
- <commands>
- <cmd name="EPluginManagerManage" _label="_Plugins"
- _tip="Enable and disable plugins"/>
- </commands>
-
- <menu>
- <submenu name="Edit">
- <placeholder name="PluginManagerPlaceholder">
- <menuitem name="EPluginManagerManage" verb=""/>
- </placeholder>
- </submenu>
-
- </menu>
-</Root>
diff --git a/plugins/plugin-manager/plugin-manager.c b/plugins/plugin-manager/plugin-manager.c
index 19af3eeb7e..129ff0a74f 100644
--- a/plugins/plugin-manager/plugin-manager.c
+++ b/plugins/plugin-manager/plugin-manager.c
@@ -32,7 +32,8 @@
#include <stdio.h>
#include "e-util/e-plugin.h"
-#include "shell/es-menu.h"
+#include "shell/e-shell-window.h"
+#include "shell/e-shell-window-actions.h"
#define d(S) (S)
@@ -61,7 +62,6 @@ static struct {
typedef struct _Manager Manager;
struct _Manager {
- GtkDialog *dialog;
GtkTreeView *treeview;
GtkTreeModel *model;
@@ -75,13 +75,13 @@ struct _Manager {
};
/* for tracking if we're shown */
-static GtkDialog *dialog;
static GtkWidget *notebook;
static GtkWidget *configure_page;
static gint last_selected_page;
static gulong switch_page_handler_id;
-void org_gnome_plugin_manager_manage(void *ep, ESMenuTargetShell *t);
+gboolean e_plugin_ui_init (GtkUIManager *manager,
+ EShellWindow *shell_window);
static void
eppm_set_label (GtkLabel *l, const char *v)
@@ -221,19 +221,15 @@ eppm_free (void *data)
}
static void
-eppm_response (GtkDialog *w, int button, Manager *m)
-{
- gtk_widget_destroy (GTK_WIDGET (w));
- dialog = NULL;
-}
-
-void
-org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
+action_plugin_manager_cb (GtkAction *action,
+ EShellWindow *shell_window)
{
Manager *m;
int i;
+ GtkWidget *dialog;
GtkWidget *hbox, *w;
GtkWidget *overview_page;
+ GtkWidget *content_area;
GtkListStore *store;
GtkTreeSelection *selection;
GtkCellRenderer *renderer;
@@ -241,26 +237,23 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
char *string;
GtkWidget *subvbox;
- if (dialog) {
- gtk_window_present (GTK_WINDOW (dialog));
- return;
- }
-
m = g_malloc0 (sizeof (*m));
/* Setup the ui */
- m->dialog = GTK_DIALOG (gtk_dialog_new_with_buttons (_("Plugin Manager"),
- GTK_WINDOW (gtk_widget_get_toplevel (t->target.widget)),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
- NULL));
+ dialog = gtk_dialog_new_with_buttons (
+ _("Plugin Manager"),
+ GTK_WINDOW (shell_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
- gtk_window_set_default_size (GTK_WINDOW (m->dialog), 640, 400);
- g_object_set (G_OBJECT (m->dialog), "has_separator", FALSE, NULL);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 640, 400);
+ g_object_set (dialog, "has_separator", FALSE, NULL);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
- gtk_box_pack_start (GTK_BOX (m->dialog->vbox), hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
string = g_strdup_printf ("<i>%s</i>", _("Note: Some changes will not take effect until restart"));
@@ -272,7 +265,7 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
gtk_widget_show (w);
g_free (string);
- gtk_box_pack_start (GTK_BOX (m->dialog->vbox), w, FALSE, TRUE, 6);
+ gtk_box_pack_start (GTK_BOX (content_area), w, FALSE, TRUE, 6);
notebook = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE);
@@ -423,24 +416,34 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (m->treeview)), _("Plugin"));
- g_object_set_data_full (G_OBJECT (m->dialog), "plugin-manager", m, eppm_free);
- g_signal_connect (m->dialog, "response", G_CALLBACK (eppm_response), m);
-
- dialog = m->dialog;
+ gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_show (GTK_WIDGET (m->dialog));
+ gtk_widget_destroy (dialog);
+ eppm_free (m);
}
-int e_plugin_lib_enable (EPluginLib *ep, int enable);
+static GtkActionEntry entries[] = {
-int
-e_plugin_lib_enable (EPluginLib *ep, int enable)
+ { "plugin-manager",
+ NULL,
+ N_("_Plugins"),
+ NULL,
+ N_("Enable and disable plugins"),
+ G_CALLBACK (action_plugin_manager_cb) }
+};
+
+gboolean
+e_plugin_ui_init (GtkUIManager *manager,
+ EShellWindow *shell_window)
{
- if (enable) {
- } else {
- /* This plugin can't be disabled ... */
- return -1;
- }
+ GtkActionGroup *action_group;
+
+ action_group = E_SHELL_WINDOW_ACTION_GROUP_SHELL (shell_window);
+
+ /* Add actions to the "shell" action group. */
+ gtk_action_group_add_actions (
+ action_group, entries,
+ G_N_ELEMENTS (entries), shell_window);
- return 0;
+ return TRUE;
}