diff options
author | Dan Vrátil <dvratil@redhat.com> | 2012-06-06 21:29:38 +0800 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2012-06-06 21:29:38 +0800 |
commit | 931191474643164e96b5778c790e42cca517e729 (patch) | |
tree | aec00f3303dbcd95a8a3f18ee324ac80594ff9b5 /modules/itip-formatter/plugin | |
parent | 5b8340563c271fb684a88c6e5bb6dd3bfb629058 (diff) | |
download | gsoc2013-evolution-931191474643164e96b5778c790e42cca517e729.tar gsoc2013-evolution-931191474643164e96b5778c790e42cca517e729.tar.gz gsoc2013-evolution-931191474643164e96b5778c790e42cca517e729.tar.bz2 gsoc2013-evolution-931191474643164e96b5778c790e42cca517e729.tar.lz gsoc2013-evolution-931191474643164e96b5778c790e42cca517e729.tar.xz gsoc2013-evolution-931191474643164e96b5778c790e42cca517e729.tar.zst gsoc2013-evolution-931191474643164e96b5778c790e42cca517e729.zip |
Mail formatter rewrite - convert some plugins to modules
audio-inline, itip-formatter, prefer-plain, tnef-attachments
and vcard-inline plugins were converted to modules so that they
can fit into concept of the new formatter.
Every module still installs .eplug file, because there is no
suitable API at the moment to register plugins to the plugins dialog
and to extend the Preferences dialog.
Diffstat (limited to 'modules/itip-formatter/plugin')
-rw-r--r-- | modules/itip-formatter/plugin/Makefile.am | 36 | ||||
-rw-r--r-- | modules/itip-formatter/plugin/config-ui.c | 159 | ||||
-rw-r--r-- | modules/itip-formatter/plugin/org-gnome-itip-formatter.eplug.xml | 15 |
3 files changed, 210 insertions, 0 deletions
diff --git a/modules/itip-formatter/plugin/Makefile.am b/modules/itip-formatter/plugin/Makefile.am new file mode 100644 index 0000000000..b84059c2b4 --- /dev/null +++ b/modules/itip-formatter/plugin/Makefile.am @@ -0,0 +1,36 @@ +@EVO_PLUGIN_RULE@ + +plugin_DATA = org-gnome-itip-formatter.eplug +plugin_LTLIBRARIES = liborg-gnome-itip-formatter.la + +liborg_gnome_itip_formatter_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ + -I$(top_srcdir)/modules/itip-formatter \ + -DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \ + $(EVOLUTION_DATA_SERVER_CFLAGS) \ + $(GNOME_PLATFORM_CFLAGS) + +liborg_gnome_itip_formatter_la_SOURCES = \ + config-ui.c + +liborg_gnome_itip_formatter_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) + +liborg_gnome_itip_formatter_la_LIBADD = \ + $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/calendar/gui/libevolution-calendar.la \ + $(top_builddir)/mail/libevolution-mail.la \ + $(top_builddir)/shell/libeshell.la \ + $(top_builddir)/em-format/libemformat.la \ + $(top_builddir)/widgets/misc/libemiscwidgets.la \ + $(top_builddir)/modules/itip-formatter/module-itip-formatter.la \ + $(EVOLUTION_DATA_SERVER_LIBS) \ + $(GNOME_PLATFORM_LIBS) + +BUILT_SOURCES = $(plugin_DATA) + +CLEANFILES = $(BUILT_SOURCES) + +EXTRA_DIST = \ + org-gnome-itip-formatter.eplug.xml diff --git a/modules/itip-formatter/plugin/config-ui.c b/modules/itip-formatter/plugin/config-ui.c new file mode 100644 index 0000000000..9ba6f05b0e --- /dev/null +++ b/modules/itip-formatter/plugin/config-ui.c @@ -0,0 +1,159 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gtk/gtk.h> +#include <glib/gi18n.h> + +#include <mail/em-config.h> + +#include <shell/e-shell.h> +#include <libedataserver/libedataserver.h> +#include <libecal/libecal.h> +#include <modules/itip-formatter/e-conflict-search-selector.h> +#include <modules/itip-formatter/e-source-conflict-search.h> + +#define CONF_KEY_DELETE "delete-processed" + +GtkWidget *itip_formatter_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); + +gint +e_plugin_lib_enable (EPlugin *ep, + gint enable) +{ + return 0; +} + +static void +delete_toggled_cb (GtkWidget *widget) +{ + GSettings *settings; + gboolean active; + + settings = g_settings_new ("org.gnome.evolution.plugin.itip"); + active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); + g_settings_set_boolean (settings, CONF_KEY_DELETE, active); + g_object_unref (settings); +} + +GtkWidget * +itip_formatter_page_factory (EPlugin *ep, + EConfigHookItemFactoryData *hook_data) +{ + EShell *shell; + ESourceRegistry *registry; + GtkWidget *page; + GtkWidget *tab_label; + GtkWidget *frame; + GtkWidget *frame_label; + GtkWidget *padding_label; + GtkWidget *hbox; + GtkWidget *inner_vbox; + GtkWidget *check; + GtkWidget *label; + GtkWidget *ess; + GtkWidget *scrolledwin; + gchar *str; + GSettings *settings; + + shell = e_shell_get_default (); + registry = e_shell_get_registry (shell); + + /* Create a new notebook page */ + page = gtk_vbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (page), 12); + tab_label = gtk_label_new (_("Meeting Invitations")); + gtk_notebook_append_page (GTK_NOTEBOOK (hook_data->parent), page, tab_label); + + /* Frame */ + frame = gtk_vbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0); + + /* "General" */ + frame_label = gtk_label_new (""); + str = g_strdup_printf ("<span weight=\"bold\">%s</span>", _("General")); + gtk_label_set_markup (GTK_LABEL (frame_label), str); + g_free (str); + gtk_misc_set_alignment (GTK_MISC (frame_label), 0.0, 0.5); + gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0); + + /* Indent/padding */ + hbox = gtk_hbox_new (FALSE, 12); + gtk_box_pack_start (GTK_BOX (frame), hbox, FALSE, TRUE, 0); + padding_label = gtk_label_new (""); + gtk_box_pack_start (GTK_BOX (hbox), padding_label, FALSE, FALSE, 0); + inner_vbox = gtk_vbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (hbox), inner_vbox, FALSE, FALSE, 0); + + /* Delete message after acting */ + settings = g_settings_new ("org.gnome.evolution.plugin.itip"); + + check = gtk_check_button_new_with_mnemonic (_("_Delete message after acting")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), g_settings_get_boolean (settings, CONF_KEY_DELETE)); + g_signal_connect ( + check, "toggled", + G_CALLBACK (delete_toggled_cb), NULL); + gtk_box_pack_start (GTK_BOX (inner_vbox), check, FALSE, FALSE, 0); + + g_object_unref (settings); + + /* "Conflict searching" */ + frame = gtk_vbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 24); + + frame_label = gtk_label_new (""); + str = g_strdup_printf ("<span weight=\"bold\">%s</span>", _("Conflict Search")); + gtk_label_set_markup (GTK_LABEL (frame_label), str); + g_free (str); + gtk_misc_set_alignment (GTK_MISC (frame_label), 0.0, 0.5); + gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0); + + /* Indent/padding */ + hbox = gtk_hbox_new (FALSE, 12); + gtk_box_pack_start (GTK_BOX (frame), hbox, TRUE, TRUE, 0); + padding_label = gtk_label_new (""); + gtk_box_pack_start (GTK_BOX (hbox), padding_label, FALSE, FALSE, 0); + inner_vbox = gtk_vbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (hbox), inner_vbox, TRUE, TRUE, 0); + + /* Source selector */ + label = gtk_label_new (_("Select the calendars to search for meeting conflicts")); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); + gtk_box_pack_start (GTK_BOX (inner_vbox), label, FALSE, FALSE, 0); + + scrolledwin = gtk_scrolled_window_new (NULL, NULL); + + gtk_scrolled_window_set_policy ( + GTK_SCROLLED_WINDOW (scrolledwin), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type ( + GTK_SCROLLED_WINDOW (scrolledwin), + GTK_SHADOW_IN); + gtk_box_pack_start (GTK_BOX (inner_vbox), scrolledwin, TRUE, TRUE, 0); + + ess = e_conflict_search_selector_new (registry); + atk_object_set_name (gtk_widget_get_accessible (ess), _("Conflict Search")); + gtk_container_add (GTK_CONTAINER (scrolledwin), ess); + + gtk_widget_show_all (page); + + return page; +} diff --git a/modules/itip-formatter/plugin/org-gnome-itip-formatter.eplug.xml b/modules/itip-formatter/plugin/org-gnome-itip-formatter.eplug.xml new file mode 100644 index 0000000000..b60b0e129f --- /dev/null +++ b/modules/itip-formatter/plugin/org-gnome-itip-formatter.eplug.xml @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<e-plugin-list> + <e-plugin id="org.gnome.evolution.itip_formatter" + type="shlib" _name="Itip Formatter" + location="@PLUGINDIR@/liborg-gnome-itip-formatter@SOEXT@"> + <_description>Display "text/calendar" MIME parts in mail messages.</_description> + <author name="JP Rosevear" email="jpr@novell.com"/> + + <hook class="org.gnome.evolution.calendar.config:1.0"> + <group id="org.gnome.evolution.calendar.prefs" target="prefs"> + <item type="page" path="90.itip" label="itip" factory="itip_formatter_page_factory"/> + </group> + </hook> + </e-plugin> +</e-plugin-list>
\ No newline at end of file |