2013-02-20 [colin] 3.9.0cvs84

* configure.ac
	* po/POTFILES.in
	* src/plugins/Makefile.am
	* src/plugins/dillo_viewer/.cvsignore
	* src/plugins/dillo_viewer/Makefile.am
	* src/plugins/dillo_viewer/README
	* src/plugins/dillo_viewer/dillo_prefs.c
	* src/plugins/dillo_viewer/dillo_prefs.h
	* src/plugins/dillo_viewer/dillo_viewer.c
	* src/plugins/trayicon/.cvsignore
	* src/plugins/trayicon/Makefile.am
	* src/plugins/trayicon/README
	* src/plugins/trayicon/trayicon.c
	* src/plugins/trayicon/trayicon_prefs.c
	* src/plugins/trayicon/trayicon_prefs.h
	* src/plugins/trayicon/libeggtrayicon/.cvsignore
		Drop trayicon and dillo_viewer
This commit is contained in:
Colin Leroy 2013-02-20 09:04:44 +00:00
parent efe0b015a0
commit fa12fb431e
18 changed files with 22 additions and 1682 deletions

View file

@ -1,3 +1,23 @@
2013-02-20 [colin] 3.9.0cvs84
* configure.ac
* po/POTFILES.in
* src/plugins/Makefile.am
* src/plugins/dillo_viewer/.cvsignore
* src/plugins/dillo_viewer/Makefile.am
* src/plugins/dillo_viewer/README
* src/plugins/dillo_viewer/dillo_prefs.c
* src/plugins/dillo_viewer/dillo_prefs.h
* src/plugins/dillo_viewer/dillo_viewer.c
* src/plugins/trayicon/.cvsignore
* src/plugins/trayicon/Makefile.am
* src/plugins/trayicon/README
* src/plugins/trayicon/trayicon.c
* src/plugins/trayicon/trayicon_prefs.c
* src/plugins/trayicon/trayicon_prefs.h
* src/plugins/trayicon/libeggtrayicon/.cvsignore
Drop trayicon and dillo_viewer
2013-02-20 [colin] 3.9.0cvs83
* configure.ac

View file

@ -4581,3 +4581,4 @@
( cvs diff -u -r 1.654.2.4657 -r 1.654.2.4658 configure.ac; ) > 3.9.0cvs81.patchset
( cvs diff -u -r 1.1.2.7 -r 1.1.2.8 src/plugins/bogofilter/Makefile.am; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/clamd/Makefile.am; cvs diff -u -r 1.3.2.4 -r 1.3.2.5 src/plugins/demo/Makefile.am; cvs diff -u -r 1.4.2.9 -r 1.4.2.10 src/plugins/dillo_viewer/Makefile.am; cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/fancy/Makefile.am; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/fetchinfo/Makefile.am; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/gdata/Makefile.am; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/mailmbox/Makefile.am; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/newmail/Makefile.am; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/notification/Makefile.am; cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/pdf_viewer/Makefile.am; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/perl/Makefile.am; cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/python/Makefile.am; cvs diff -u -r 1.5.2.10 -r 1.5.2.11 src/plugins/spamassassin/Makefile.am; cvs diff -u -r 1.4.2.14 -r 1.4.2.15 src/plugins/trayicon/Makefile.am; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/vcalendar/libical/libical/Makefile.am; ) > 3.9.0cvs82.patchset
( cvs diff -u -r 1.654.2.4659 -r 1.654.2.4660 configure.ac; cvs diff -u -r 1.8.2.14 -r 1.8.2.15 src/plugins/Makefile.am; diff -u /dev/null src/plugins/spam_report/.cvsignore; diff -u /dev/null src/plugins/spam_report/Makefile.am; cvs diff -u -r -1.1.2.1 -r -1.1.2.2 src/plugins/spam_report/placeholder.txt; diff -u /dev/null src/plugins/spam_report/spam_report.c; diff -u /dev/null src/plugins/spam_report/spam_report_prefs.c; diff -u /dev/null src/plugins/spam_report/spam_report_prefs.h; diff -u /dev/null src/plugins/tnef_parse/.cvsignore; diff -u /dev/null src/plugins/tnef_parse/Makefile.am; diff -u /dev/null src/plugins/tnef_parse/claws.def; diff -u /dev/null src/plugins/tnef_parse/mapi.h; diff -u /dev/null src/plugins/tnef_parse/mapidefs.h; diff -u /dev/null src/plugins/tnef_parse/mapitags.h; cvs diff -u -r -1.1.2.1 -r -1.1.2.2 src/plugins/tnef_parse/placeholder.txt; diff -u /dev/null src/plugins/tnef_parse/plugin.def; diff -u /dev/null src/plugins/tnef_parse/tnef-errors.h; diff -u /dev/null src/plugins/tnef_parse/tnef-types.h; diff -u /dev/null src/plugins/tnef_parse/tnef_dump.c; diff -u /dev/null src/plugins/tnef_parse/tnef_dump.h; diff -u /dev/null src/plugins/tnef_parse/tnef_parse.c; diff -u /dev/null src/plugins/tnef_parse/version.rc; diff -u /dev/null src/plugins/tnef_parse/ytnef.c; diff -u /dev/null src/plugins/tnef_parse/ytnef.h; ) > 3.9.0cvs83.patchset
( cvs diff -u -r 1.654.2.4660 -r 1.654.2.4661 configure.ac; cvs diff -u -r 1.53.2.46 -r 1.53.2.47 po/POTFILES.in; cvs diff -u -r 1.8.2.15 -r 1.8.2.16 src/plugins/Makefile.am; cvs diff -u -r -1.1 -r -1.2 src/plugins/dillo_viewer/.cvsignore; cvs diff -u -r -1.4.2.10 -r -1.4.2.11 src/plugins/dillo_viewer/Makefile.am; cvs diff -u -r -1.2.4.2 -r -1.2.4.3 src/plugins/dillo_viewer/README; cvs diff -u -r -1.5.2.30 -r -1.5.2.31 src/plugins/dillo_viewer/dillo_prefs.c; cvs diff -u -r -1.2.4.11 -r -1.2.4.12 src/plugins/dillo_viewer/dillo_prefs.h; cvs diff -u -r -1.12.2.32 -r -1.12.2.33 src/plugins/dillo_viewer/dillo_viewer.c; cvs diff -u -r -1.1 -r -1.2 src/plugins/trayicon/.cvsignore; cvs diff -u -r -1.4.2.15 -r -1.4.2.16 src/plugins/trayicon/Makefile.am; cvs diff -u -r -1.1.4.1 -r -1.1.4.2 src/plugins/trayicon/README; cvs diff -u -r -1.14.2.83 -r -1.14.2.84 src/plugins/trayicon/trayicon.c; cvs diff -u -r -1.1.2.12 -r -1.1.2.13 src/plugins/trayicon/trayicon_prefs.c; cvs diff -u -r -1.1.2.7 -r -1.1.2.8 src/plugins/trayicon/trayicon_prefs.h; cvs diff -u -r -1.1.4.2 -r -1.1.4.3 src/plugins/trayicon/libeggtrayicon/.cvsignore; ) > 3.9.0cvs84.patchset

View file

@ -12,7 +12,7 @@ MINOR_VERSION=9
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=83
EXTRA_VERSION=84
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
@ -975,19 +975,6 @@ else
fi
AM_CONDITIONAL(BUILD_DEMO_PLUGIN, test x"$ac_cv_enable_demo_plugin" = xyes)
dnl --- Dillo Viewer ---
AC_MSG_CHECKING([whether to build Dillo plugin])
AC_ARG_ENABLE(dillo-viewer-plugin,
[ --disable-dillo-viewer-plugin do not build Dillo plugin for html mail rendering],
[ac_cv_enable_dillo_viewer_plugin=$enableval], [ac_cv_enable_dillo_viewer_plugin=yes])
if test x"$ac_cv_enable_dillo_viewer_plugin" = xyes; then
AC_MSG_RESULT(yes)
PLUGINS="dillo-viewer $PLUGINS"
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(BUILD_DILLO_VIEWER_PLUGIN, test x"$ac_cv_enable_dillo_viewer_plugin" = xyes)
dnl --- Fancy ---
AC_MSG_CHECKING([whether to build Fancy plugin])
AC_ARG_ENABLE(fancy-plugin,
@ -1380,19 +1367,6 @@ else
fi
AM_CONDITIONAL(BUILD_TNEF_PARSE_PLUGIN, test x"$ac_cv_enable_tnef_parse_plugin" = xyes)
dnl --- Trayicon ---
AC_MSG_CHECKING([whether to build Trayicon plugin])
AC_ARG_ENABLE(trayicon-plugin,
[ --disable-trayicon-plugin do not build System Tray Icon plugin],
[ac_cv_enable_trayicon_plugin=$enableval], [ac_cv_enable_trayicon_plugin=yes])
if test x"$ac_cv_enable_trayicon_plugin" = xyes; then
AC_MSG_RESULT(yes)
PLUGINS="trayicon $PLUGINS"
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(BUILD_TRAYICON_PLUGIN, test x"$ac_cv_enable_trayicon_plugin" = xyes)
dnl --- vCalendar ---
AC_MSG_CHECKING([whether to build vCalendar plugin])
AC_ARG_ENABLE(vcalendar-plugin,
@ -1499,7 +1473,6 @@ src/plugins/bsfilter/Makefile
src/plugins/clamd/Makefile
src/plugins/clamd/libclamd/Makefile
src/plugins/demo/Makefile
src/plugins/dillo_viewer/Makefile
src/plugins/fancy/Makefile
src/plugins/fetchinfo/Makefile
src/plugins/gdata/Makefile
@ -1517,7 +1490,6 @@ src/plugins/smime/Makefile
src/plugins/spamassassin/Makefile
src/plugins/spam_report/Makefile
src/plugins/tnef_parse/Makefile
src/plugins/trayicon/Makefile
src/plugins/vcalendar/Makefile
src/plugins/vcalendar/libical/Makefile
src/plugins/vcalendar/libical/libical/icalversion.h

View file

@ -93,8 +93,6 @@ src/plugins/clamd/clamav_plugin.c
src/plugins/clamd/clamav_plugin_gtk.c
src/plugins/clamd/libclamd/clamd-plugin.c
src/plugins/demo/demo.c
src/plugins/dillo_viewer/dillo_prefs.c
src/plugins/dillo_viewer/dillo_viewer.c
src/plugins/fancy/fancy_viewer.c
src/plugins/fancy/fancy_prefs.c
src/plugins/fetchinfo/fetchinfo_plugin.c
@ -141,8 +139,6 @@ src/plugins/spam_report/spam_report.c
src/plugins/spamassassin/spamassassin.c
src/plugins/spamassassin/spamassassin_gtk.c
src/plugins/tnef_parse/tnef_parse.c
src/plugins/trayicon/trayicon.c
src/plugins/trayicon/trayicon_prefs.c
src/plugins/vcalendar/vcalendar.c
src/plugins/vcalendar/vcal_prefs.c
src/plugins/vcalendar/vcal_folder.c

View file

@ -34,10 +34,6 @@ if BUILD_DEMO_PLUGIN
demo_dir = demo
endif
if BUILD_DILLO_VIEWER_PLUGIN
dillo_viewer_dir = dillo_viewer
endif
if BUILD_FANCY_PLUGIN
fancy_dir = fancy
endif
@ -103,10 +99,6 @@ if BUILD_TNEF_PARSE_PLUGIN
tnef_parse_dir = tnef_parse
endif
if BUILD_TRAYICON_PLUGIN
trayicon_dir = trayicon
endif
if BUILD_VCALENDAR_PLUGIN
vcalendar_dir = vcalendar
endif
@ -121,7 +113,6 @@ SUBDIRS = \
$(bsfilter_dir) \
$(clamd_dir) \
$(demo_dir) \
$(dillo_viewer_dir) \
$(fancy_dir) \
$(fetchinfo_dir) \
$(gdata_dir) \
@ -139,5 +130,4 @@ SUBDIRS = \
$(spamassassin_dir) \
$(spam_report_dir) \
$(tnef_parse_dir) \
$(trayicon_dir) \
$(vcalendar_dir)

View file

@ -1,7 +0,0 @@
.deps
.libs
Makefile
Makefile.in
*.o
*.la
*.lo

View file

@ -1,31 +0,0 @@
plugindir = $(pkglibdir)/plugins
plugin_LTLIBRARIES = dillo_viewer.la
dillo_viewer_la_SOURCES = \
dillo_viewer.c \
dillo_prefs.c dillo_prefs.h
dillo_viewer_la_LDFLAGS = \
-avoid-version -module
if CYGWIN
cygwin_export_lib = -L$(top_builddir)/src -lclaws-mail
else
cygwin_export_lib =
endif
dillo_viewer_la_LIBADD = $(cygwin_export_lib) \
$(GTK_LIBS) \
$(MAEMO_LIBS)
INCLUDES = \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/common \
-I$(top_builddir)/src/common \
-I$(top_srcdir)/src/gtk
AM_CPPFLAGS = \
$(ENCHANT_CFLAGS) \
$(GLIB_CFLAGS) \
$(GTK_CFLAGS) \
$(MAEMO_CFLAGS)

View file

@ -1,48 +0,0 @@
Dillo Viewer: HTML mail viewing in Claws Mail
-------------------------------------------------
This plugin uses the Dillo (http://www.dillo.org) browser to
view text/html MIME parts inside Claws Mail.
When the plugin is loaded, if the MIME part to be viewed is of
text/html type, then the MIME part is saved in a temporary file and
Dillo is started with special options to embed it inside
Claws Mail' message view and to "safely" view the part. Dillo is
also run in the fullwindow mode, where the toolbar, menubar and the
statusbar are hidden so the message is viewed in a larger area. The
fullwindow mode is toggled on and off by double clicking on an empty
part of the page or by clicking on the icon in the lower right corner.
The "safe" viewing of text/html message parts is achieved by using the
-l (or --local) option of Dillo. This option prevents Dillo from
retrieving remote web resources, like images. Thus, no connection
to the Internet is done. If the user wants to view the message
without this restriction, s/he just reloads the page by clicking on
the "Reload" button in Dillo's toolbar.
WARNING: This plugin is provided as is. The author does not guarantee
safe viewing of text/html messages although he tried hard to achieve
this goal.
What Dillo version should be used?
----------------------------------
Dillo 0.7.0 was the first version that included the features needed by
Claws, but it had a small bug where remote resources could be
accessed even with the --local option (when a BASE element is present
in the message).
Since 2002-03-16, the CVS tree of Dillo fixed that bug.
Dillo 0.7.2 and newer do not have that bug, and are the recommended
versions to be used.
Acknowledgment:
---------------
The author of this plugin thanks the author of Dillo, Jorge Arellano
Cid, who accepted to integrate and improve the different patches
needed for this functionality.
--
Melvin Hadasht

View file

@ -1,305 +0,0 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2012 the Claws Mail Team
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
/*
* The structure of this file has been borrowed from the structure of
* the image_viewer plugin file. I also used it as an example of how to
* build the preferences for the dillo plugin.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#include "claws-features.h"
#endif
#include "defs.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "gtkutils.h"
#include "utils.h"
#include "prefs.h"
#include "prefs_gtk.h"
#include "prefswindow.h"
#include "combobox.h"
#include "addressbook.h"
#include "dillo_prefs.h"
#define PREFS_BLOCK_NAME "Dillo"
DilloBrowserPrefs dillo_prefs;
typedef struct _DilloBrowserPage DilloBrowserPage;
struct _DilloBrowserPage {
PrefsPage page;
GtkWidget *local;
GtkWidget *whitelist_ab;
GtkWidget *whitelist_ab_folder_combo;
GtkWidget *whitelist_ab_select_btn;
GtkWidget *full;
};
static PrefParam param[] = {
{"local_browse", "TRUE", &dillo_prefs.local, P_BOOL, NULL, NULL, NULL},
{"full_window", "TRUE", &dillo_prefs.full, P_BOOL, NULL, NULL, NULL},
{"whitelist_ab", "FALSE", &dillo_prefs.whitelist_ab, P_BOOL,
NULL, NULL, NULL},
{"whitelist_ab_folder", N_("Any"), &dillo_prefs.whitelist_ab_folder, P_STRING,
NULL, NULL, NULL},
{0,0,0,0,0,0,0}
};
static DilloBrowserPage prefs_page;
static void create_dillo_prefs_page (PrefsPage *page,
GtkWindow *window,
gpointer data);
static void destroy_dillo_prefs_page (PrefsPage *page);
static void save_dillo_prefs (PrefsPage *page);
#ifndef USE_NEW_ADDRBOOK
static void dillo_whitelist_ab_select_cb(GtkWidget *widget, gpointer data)
{
DilloBrowserPage *page = (DilloBrowserPage *) data;
const gchar *folderpath = NULL;
gchar *new_path = NULL;
folderpath = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((page->whitelist_ab_folder_combo)))));
new_path = addressbook_folder_selection(folderpath);
if (new_path) {
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((page->whitelist_ab_folder_combo)))), new_path);
g_free(new_path);
}
}
#endif
static void local_checkbox_toggled(GtkToggleButton *button,
gpointer user_data)
{
gboolean active = gtk_toggle_button_get_active(button);
DilloBrowserPage *prefs_page = (DilloBrowserPage *) user_data;
gtk_widget_set_sensitive(prefs_page->whitelist_ab, active);
gtk_widget_set_sensitive(prefs_page->whitelist_ab_folder_combo, active &&
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_page->whitelist_ab)));
#ifndef USE_NEW_ADDRBOOK
gtk_widget_set_sensitive(prefs_page->whitelist_ab_select_btn, active &&
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_page->whitelist_ab)));
#endif
}
static void whitelist_checkbox_toggled(GtkToggleButton *button,
gpointer user_data)
{
gboolean active = gtk_toggle_button_get_active(button);
DilloBrowserPage *prefs_page = (DilloBrowserPage *) user_data;
active &= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_page->local));
gtk_widget_set_sensitive(prefs_page->whitelist_ab_folder_combo, active);
gtk_widget_set_sensitive(prefs_page->whitelist_ab_select_btn, active);
}
void dillo_prefs_init(void)
{
static gchar *path[3];
gchar *rcpath;
path[0] = _("Plugins");
path[1] = _("Dillo Browser");
path[2] = NULL;
prefs_set_default(param);
rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
prefs_read_config(param, PREFS_BLOCK_NAME, rcpath, NULL);
g_free(rcpath);
prefs_page.page.path = path;
prefs_page.page.create_widget = create_dillo_prefs_page;
prefs_page.page.destroy_widget = destroy_dillo_prefs_page;
prefs_page.page.save_page = save_dillo_prefs;
prefs_page.page.weight = 35.0;
prefs_gtk_register_page((PrefsPage *) &prefs_page);
}
void dillo_prefs_done(void)
{
prefs_gtk_unregister_page((PrefsPage *) &prefs_page);
}
static void create_dillo_prefs_page(PrefsPage *page,
GtkWindow *window,
gpointer data)
{
DilloBrowserPage *prefs_page = (DilloBrowserPage *) page;
GtkWidget *vbox;
GtkWidget *local_checkbox;
GtkWidget *full_checkbox;
GtkWidget *label;
GtkWidget *whitelist_ab_checkbtn;
GtkWidget *whitelist_ab_folder_combo;
GtkWidget *whitelist_ab_select_btn;
GtkWidget *hbox_whitelist, *spacer;
vbox = gtk_vbox_new(FALSE, 3);
gtk_container_set_border_width(GTK_CONTAINER(vbox), VBOX_BORDER);
gtk_widget_show(vbox);
local_checkbox = gtk_check_button_new_with_label
(_("Load remote links in mails"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(local_checkbox),
!dillo_prefs.local);
gtk_box_pack_start(GTK_BOX(vbox), local_checkbox, FALSE, FALSE, 0);
gtk_widget_show(local_checkbox);
CLAWS_SET_TIP(local_checkbox,
_("Equivalent to Dillo's '--local' option"));
label = gtk_label_new(_("You can still load remote links "
"by reloading the page"));
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtkut_widget_set_small_font_size (label);
gtk_widget_show(label);
hbox_whitelist = gtk_hbox_new(FALSE, 8);
gtk_widget_show(hbox_whitelist);
gtk_box_pack_start (GTK_BOX (vbox), hbox_whitelist, FALSE, FALSE, 0);
spacer = gtk_hbox_new(FALSE, 0);
gtk_widget_set_size_request(spacer, 12, -1);
gtk_widget_show(spacer);
gtk_box_pack_start(GTK_BOX(hbox_whitelist), spacer, FALSE, FALSE, 0);
whitelist_ab_checkbtn = gtk_check_button_new_with_label(_("Only for senders found in address book/folder"));
gtk_widget_show(whitelist_ab_checkbtn);
gtk_box_pack_start(GTK_BOX(hbox_whitelist), whitelist_ab_checkbtn, FALSE, FALSE, 0);
whitelist_ab_folder_combo = combobox_text_new(TRUE, _("Any"), NULL);
gtk_widget_set_size_request(whitelist_ab_folder_combo, 100, -1);
gtk_box_pack_start (GTK_BOX (hbox_whitelist), whitelist_ab_folder_combo, TRUE, TRUE, 0);
whitelist_ab_select_btn = gtk_button_new_with_label(_("Select ..."));
gtk_widget_show (whitelist_ab_select_btn);
gtk_box_pack_start (GTK_BOX (hbox_whitelist), whitelist_ab_select_btn, FALSE, FALSE, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(whitelist_ab_checkbtn), dillo_prefs.whitelist_ab);
if (dillo_prefs.whitelist_ab_folder != NULL) {
/* translate "Any" (stored UNtranslated) */
if (strcasecmp(dillo_prefs.whitelist_ab_folder, "Any") == 0)
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
_("Any"));
else
/* backward compatibility (when translated "Any" was stored) */
if (g_utf8_collate(dillo_prefs.whitelist_ab_folder, _("Any")) == 0)
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
dillo_prefs.whitelist_ab_folder);
else
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
dillo_prefs.whitelist_ab_folder);
}
full_checkbox = gtk_check_button_new_with_label
(_("Full window mode (hide controls)"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(full_checkbox),
dillo_prefs.full);
gtk_box_pack_start(GTK_BOX(vbox), full_checkbox, FALSE, FALSE, 0);
gtk_widget_show(full_checkbox);
CLAWS_SET_TIP(full_checkbox,
_("Equivalent to Dillo's '--fullwindow' option"));
g_signal_connect(G_OBJECT(local_checkbox), "toggled",
G_CALLBACK(local_checkbox_toggled),
prefs_page);
g_signal_connect(G_OBJECT(whitelist_ab_checkbtn), "toggled",
G_CALLBACK(whitelist_checkbox_toggled),
prefs_page);
#ifndef USE_NEW_ADDRBOOK
g_signal_connect(G_OBJECT (whitelist_ab_select_btn), "clicked",
G_CALLBACK(dillo_whitelist_ab_select_cb), prefs_page);
#else
gtk_widget_set_sensitive(GTK_WIDGET(whitelist_ab_select_btn), FALSE);
#endif
gtk_widget_set_sensitive(whitelist_ab_checkbtn, !dillo_prefs.local);
gtk_widget_set_sensitive(whitelist_ab_folder_combo, !dillo_prefs.local && dillo_prefs.whitelist_ab);
gtk_widget_set_sensitive(whitelist_ab_select_btn, !dillo_prefs.local && dillo_prefs.whitelist_ab);
prefs_page->local = local_checkbox;
prefs_page->full = full_checkbox;
prefs_page->whitelist_ab = whitelist_ab_checkbtn;
prefs_page->whitelist_ab_folder_combo = whitelist_ab_folder_combo;
prefs_page->whitelist_ab_select_btn = whitelist_ab_select_btn;
prefs_page->page.widget = vbox;
}
static void destroy_dillo_prefs_page(PrefsPage *page)
{
/* Do nothing! */
}
static void save_dillo_prefs(PrefsPage *page)
{
DilloBrowserPage *prefs_page = (DilloBrowserPage *) page;
PrefFile *pref_file;
gchar *rc_file_path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
COMMON_RC, NULL);
dillo_prefs.local = !gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON(prefs_page->local));
dillo_prefs.full = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON(prefs_page->full));
dillo_prefs.whitelist_ab = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_page->whitelist_ab));
g_free(dillo_prefs.whitelist_ab_folder);
dillo_prefs.whitelist_ab_folder = gtk_editable_get_chars(
GTK_EDITABLE(gtk_bin_get_child(GTK_BIN((prefs_page->whitelist_ab_folder_combo)))), 0, -1);
/* store UNtranslated "Any" */
if (g_utf8_collate(dillo_prefs.whitelist_ab_folder, _("Any")) == 0) {
g_free(dillo_prefs.whitelist_ab_folder);
dillo_prefs.whitelist_ab_folder = g_strdup("Any");
}
pref_file = prefs_write_open(rc_file_path);
g_free(rc_file_path);
if (!(pref_file) ||
(prefs_set_block_label(pref_file, PREFS_BLOCK_NAME) < 0))
return;
if (prefs_write_param(param, pref_file->fp) < 0) {
g_warning("failed to write Dillo Plugin configuration\n");
prefs_file_close_revert(pref_file);
return;
}
if (fprintf(pref_file->fp, "\n") < 0) {
FILE_OP_ERROR(rc_file_path, "fprintf");
prefs_file_close_revert(pref_file);
} else
prefs_file_close(pref_file);
}

View file

@ -1,46 +0,0 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2012 the Claws Mail Team
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
/*
* The structure of this file has been borrowed from the structure of
* the image_viewer plugin file. I also used it as an example of how to
* build the preferences for the dillo plugin.
*/
#ifndef DILLOPREFS_H
#define DILLOPREFS_H
#include <glib.h>
typedef struct _DilloBrowserPrefs DilloBrowserPrefs;
struct _DilloBrowserPrefs
{
gboolean local; /**< local browsing */
gboolean whitelist_ab;
gchar *whitelist_ab_folder;
gboolean full; /**< use full window */
};
extern DilloBrowserPrefs dillo_prefs;
void dillo_prefs_init(void);
void dillo_prefs_done(void);
#endif

View file

@ -1,310 +0,0 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2012 the Claws Mail Team
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#include "claws-features.h"
#endif
#include <unistd.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#if GTK_CHECK_VERSION(3, 0, 0)
#include <gtk/gtkx.h>
#endif
#include <gdk/gdkx.h>
#include "common/claws.h"
#include "common/version.h"
#include "plugin.h"
#include "utils.h"
#include "mimeview.h"
#include "addr_compl.h"
#include "dillo_prefs.h"
#define PLUGIN_NAME (_("Dillo HTML Viewer"))
typedef struct _DilloViewer DilloViewer;
struct _DilloViewer
{
MimeViewer mimeviewer;
GtkWidget *widget;
GtkWidget *socket;
gchar *filename;
};
static MimeViewerFactory dillo_viewer_factory;
static GtkWidget *dillo_get_widget(MimeViewer *_viewer)
{
DilloViewer *viewer = (DilloViewer *) _viewer;
debug_print("dillo_get_widget\n");
return GTK_WIDGET(viewer->widget);
}
#if !GTK_CHECK_VERSION(3, 0, 0)
static gboolean socket_destroy_cb(GtkObject *object, gpointer data)
#else
static gboolean socket_destroy_cb(GtkObject *object, gpointer data)
#endif
{
DilloViewer *viewer = (DilloViewer *) data;
debug_print("Destroyed dillo socket %p\n", viewer->socket);
viewer->socket = NULL;
return FALSE;
}
static gboolean found_in_addressbook(const gchar *address)
{
gchar *addr = NULL;
gboolean found = FALSE;
gint num_addr = 0;
if (!address)
return FALSE;
addr = g_strdup(address);
extract_address(addr);
num_addr = complete_address(addr);
if (num_addr > 1) {
/* skip first item (this is the search string itself) */
int i = 1;
for (; i < num_addr && !found; i++) {
gchar *caddr = get_complete_address(i);
extract_address(caddr);
if (strcasecmp(caddr, addr) == 0)
found = TRUE;
g_free(caddr);
}
}
g_free(addr);
return found;
}
static gboolean load_images(DilloViewer *viewer)
{
MessageView *messageview = ((MimeViewer *)viewer)->mimeview
? ((MimeViewer *)viewer)->mimeview->messageview
: NULL;
MsgInfo *msginfo = NULL;
gchar *ab_folderpath = NULL;
if (messageview == NULL)
return FALSE;
msginfo = messageview->msginfo;
if (msginfo == NULL)
return FALSE;
/* don't load remote images, period. */
if (dillo_prefs.local)
return FALSE;
/* don't do whitelisting -> load images */
if (!dillo_prefs.whitelist_ab)
return TRUE;
if (*dillo_prefs.whitelist_ab_folder != '\0' &&
strcasecmp(dillo_prefs.whitelist_ab_folder, _("Any")) != 0)
ab_folderpath = dillo_prefs.whitelist_ab_folder;
start_address_completion(ab_folderpath);
/* do whitelisting -> check sender */
if (found_in_addressbook(msginfo->from)) {
end_address_completion();
return TRUE;
}
end_address_completion();
return FALSE;
}
static void dillo_show_mimepart(MimeViewer *_viewer,
const gchar *infile,
MimeInfo *partinfo)
{
DilloViewer *viewer = (DilloViewer *) _viewer;
debug_print("dillo_show_mimepart\n");
if (viewer->filename != NULL) {
claws_unlink(viewer->filename);
g_free(viewer->filename);
}
viewer->filename = procmime_get_tmp_file_name(partinfo);
if (!(procmime_get_part(viewer->filename, partinfo) < 0)) {
gchar *cmd;
if (viewer->socket)
gtk_widget_destroy(viewer->socket);
viewer->socket = gtk_socket_new();
debug_print("Adding dillo socket %p", viewer->socket);
gtk_container_add(GTK_CONTAINER(viewer->widget),
viewer->socket);
gtk_widget_realize(viewer->socket);
gtk_widget_show(viewer->socket);
g_signal_connect(G_OBJECT(viewer->socket), "destroy",
G_CALLBACK(socket_destroy_cb), viewer);
cmd = g_strdup_printf("dillo %s%s-x %d \"%s\"",
(!load_images(viewer) ? "-l " : ""),
(dillo_prefs.full ? "-f " : ""),
(gint) GDK_WINDOW_XWINDOW(viewer->socket->window),
viewer->filename);
execute_command_line(cmd, TRUE);
g_free(cmd);
}
}
static void dillo_clear_viewer(MimeViewer *_viewer)
{
DilloViewer *viewer = (DilloViewer *) _viewer;
debug_print("dillo_clear_viewer\n");
debug_print("Removing dillo socket %p\n", viewer->socket);
if (viewer->socket) {
gtk_widget_destroy(viewer->socket);
}
}
static void dillo_destroy_viewer(MimeViewer *_viewer)
{
DilloViewer *viewer = (DilloViewer *) _viewer;
debug_print("dillo_destroy_viewer\n");
if (viewer->socket) {
gtk_widget_destroy(viewer->socket);
}
g_object_unref(GTK_WIDGET(viewer->widget));
claws_unlink(viewer->filename);
g_free(viewer->filename);
g_free(viewer);
}
static MimeViewer *dillo_viewer_create(void)
{
DilloViewer *viewer;
debug_print("dillo_viewer_create\n");
viewer = g_new0(DilloViewer, 1);
viewer->mimeviewer.factory = &dillo_viewer_factory;
viewer->mimeviewer.get_widget = dillo_get_widget;
viewer->mimeviewer.show_mimepart = dillo_show_mimepart;
viewer->mimeviewer.clear_viewer = dillo_clear_viewer;
viewer->mimeviewer.destroy_viewer = dillo_destroy_viewer;
viewer->mimeviewer.get_selection = NULL;
viewer->widget = gtk_event_box_new();
gtk_widget_show(viewer->widget);
g_object_ref(viewer->widget);
viewer->filename = NULL;
return (MimeViewer *) viewer;
}
static gchar *content_types[] =
{"text/html", NULL};
static MimeViewerFactory dillo_viewer_factory =
{
content_types,
0,
dillo_viewer_create,
};
gint plugin_init(gchar **error)
{
gchar *dillo_path = NULL;
if (!check_plugin_version(MAKE_NUMERIC_VERSION(2,9,2,72),
VERSION_NUMERIC, PLUGIN_NAME, error))
return -1;
if ((dillo_path = g_find_program_in_path("dillo")) == NULL) {
*error = g_strdup(_("Can't find the dillo executable in PATH. Is it installed?"));
return -1;
}
g_free(dillo_path);
dillo_prefs_init();
mimeview_register_viewer_factory(&dillo_viewer_factory);
return 0;
}
gboolean plugin_done(void)
{
mimeview_unregister_viewer_factory(&dillo_viewer_factory);
dillo_prefs_done();
return TRUE;
}
const gchar *plugin_name(void)
{
return PLUGIN_NAME;
}
const gchar *plugin_desc(void)
{
return _("This plugin renders HTML mail using the Dillo "
"web browser.\n"
"\n"
"Options can be found in /Configuration/Preferences/Plugins/Dillo Browser");
}
const gchar *plugin_type(void)
{
return "GTK2";
}
const gchar *plugin_licence(void)
{
return "GPL3+";
}
const gchar *plugin_version(void)
{
return VERSION;
}
struct PluginFeature *plugin_provides(void)
{
static struct PluginFeature features[] =
{ {PLUGIN_MIMEVIEWER, "text/html"},
{PLUGIN_NOTHING, NULL}};
return features;
}

View file

@ -1,7 +0,0 @@
.deps
.libs
Makefile
Makefile.in
*.o
*.lo
*.la

View file

@ -1,38 +0,0 @@
plugindir = $(pkglibdir)/plugins
plugin_LTLIBRARIES = trayicon.la
if CYGWIN
cygwin_export_lib = -L$(top_builddir)/src -lclaws-mail
else
cygwin_export_lib =
endif
trayicon_la_SOURCES = \
trayicon.c \
trayicon_prefs.c \
trayicon_prefs.h
trayicon_la_LDFLAGS = \
-avoid-version -module -no-undefined
trayicon_la_LIBADD = \
$(cygwin_export_lib) \
$(GTK_LIBS) \
-L/usr/X11R6/lib -lX11 \
$(MAEMO_LIBS)
INCLUDES = \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/common \
-I$(top_builddir)/src/common \
-I$(top_srcdir)/src/gtk
AM_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(GTK_CFLAGS) \
$(ENCHANT_CFLAGS) \
$(MAEMO_CFLAGS)
EXTRA_DIST = \
README

View file

@ -1,33 +0,0 @@
Trayicon Plugin
---------------
This plugin puts a little icon into the system tray. The system tray
has to be compatible to the system tray protocol specification from
http://www.freedesktop.org/standards/. System trays know to work are
available for Gnome 2 (Notification Area Applet) and KDE 3.1.1.
The plugin uses a backport of the GTK eggtray widget from Gnome 2. Not
all features of GTK+ 2 are available in GTK+ 1.2 and so I'm not sure
if the plugin will properly work. It is a known problem that the icon
sometimes does not dock into the system tray and opens in a seperate
window. The reason for this is unknown. If you are sure that your system
tray is working correctly or if it worked before restarting claws-mail
fixes this in most cases.
The icon in the system tray will show you if you have new or unread
mail. If the mailbox is empty you have no unread mails, if a letter is
properly put into it you have unread mails, a letter that was just put
into it indicates new mail.
The icon also has a tooltip. If you keep the mouse 1 second over the
icon a tooltip showing the text "New: xxx, Unread: xxx, Total: xxx"
will appear, where xxx is the number of new, unread and total messages.
It is planned to add a popup menu that can be opened with the right mouse
button to execute some quick actions. Ideas for the menu are currently
to start a check for new mails and to open a compose window.
Another idea is to allow to hide the claws-mail main window completely by
clicking on the icon with the left mouse button. This currently breaks
the automatic mail check. If these problems have been solved the feature
will be available.

View file

@ -1,7 +0,0 @@
.deps
.libs
Makefile
Makefile.in
*.o
*.lo
*.la

View file

@ -1,594 +0,0 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 2003-2012 the Claws Mail Team
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#include "claws-features.h"
#endif
#include <stdio.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "common/claws.h"
#include "common/version.h"
#include "plugin.h"
#include "utils.h"
#include "hooks.h"
#include "folder.h"
#include "mainwindow.h"
#include "gtkutils.h"
#include "menu.h"
#include "toolbar.h"
#include "prefs_common.h"
#include "main.h"
#include "alertpanel.h"
#include "account.h"
#include "gtk/manage_window.h"
#ifndef USE_NEW_ADDRBOOK
#include "addressbook.h"
#else
#include "addressbook-dbus.h"
#endif
#include "trayicon_prefs.h"
#include "stock_pixmap.h"
#define PLUGIN_NAME (_("Trayicon"))
static guint item_hook_id;
static guint folder_hook_id;
static guint offline_hook_id;
static guint account_hook_id;
static guint close_hook_id;
static guint iconified_hook_id;
static guint theme_hook_id;
static GdkPixbuf *newmail_pixbuf[2] = {NULL, NULL};
static GdkPixbuf *unreadmail_pixbuf[2] = {NULL, NULL};
static GdkPixbuf *newmarkedmail_pixbuf[2] = {NULL, NULL};
static GdkPixbuf *unreadmarkedmail_pixbuf[2] = {NULL, NULL};
static GdkPixbuf *nomail_pixbuf[2] = {NULL, NULL};
static GtkStatusIcon *trayicon;
static GtkWidget *focused_widget = NULL;
static GtkWidget *traymenu_popup;
static gboolean updating_menu = FALSE;
typedef enum
{
TRAYICON_NEW,
TRAYICON_NEWMARKED,
TRAYICON_UNREAD,
TRAYICON_UNREADMARKED,
TRAYICON_NOTHING
} TrayIconType;
static void trayicon_get_all_cb (GtkAction *action, gpointer data);
static void trayicon_compose_cb (GtkAction *action, gpointer data);
static void trayicon_compose_acc_cb (GtkMenuItem *menuitem, gpointer data );
static void trayicon_addressbook_cb (GtkAction *action, gpointer data);
static void trayicon_exit_cb (GtkAction *action, gpointer data);
static void trayicon_toggle_offline_cb (GtkAction *action, gpointer data);
static GtkActionEntry trayicon_popup_menu_entries[] =
{
{"TrayiconPopup", NULL, "TrayiconPopup" },
{"TrayiconPopup/GetMail", NULL, N_("_Get Mail"), NULL, NULL, G_CALLBACK(trayicon_get_all_cb) },
{"TrayiconPopup/---", NULL, "---", NULL, NULL, G_CALLBACK(trayicon_compose_cb) },
{"TrayiconPopup/Email", NULL, N_("_Email"), NULL, NULL, G_CALLBACK(trayicon_compose_cb) },
{"TrayiconPopup/EmailAcc", NULL, N_("E_mail from account"), NULL, NULL, NULL },
{"TrayiconPopup/OpenAB", NULL, N_("Open A_ddressbook"), NULL, NULL, G_CALLBACK(trayicon_addressbook_cb) },
{"TrayiconPopup/Exit", NULL, N_("E_xit Claws Mail"), NULL, NULL, G_CALLBACK(trayicon_exit_cb) },
};
static GtkToggleActionEntry trayicon_popup_toggle_menu_entries[] =
{
{"TrayiconPopup/ToggleOffline", NULL, N_("_Work Offline"), NULL, NULL, G_CALLBACK(trayicon_toggle_offline_cb) },
};
static gboolean trayicon_set_accounts_hook(gpointer source, gpointer data)
{
GList *cur_ac;
GtkWidget *menu, *submenu;
GtkWidget *menuitem;
PrefsAccount *ac_prefs;
GList *account_list = account_get_list();
menu = gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/TrayiconPopup/EmailAcc");
gtk_widget_show(menu);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), NULL);
submenu = gtk_menu_new();
for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
ac_prefs = (PrefsAccount *)cur_ac->data;
menuitem = gtk_menu_item_new_with_label
(ac_prefs->account_name ? ac_prefs->account_name
: _("Untitled"));
gtk_widget_show(menuitem);
gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
g_signal_connect(G_OBJECT(menuitem), "activate",
G_CALLBACK(trayicon_compose_acc_cb),
ac_prefs);
}
gtk_widget_show(submenu);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
return FALSE;
}
static void set_trayicon_pixbuf(TrayIconType icontype)
{
GdkPixbuf *pixbuf = NULL;
static GdkPixbuf *last_pixbuf = NULL;
switch(icontype) {
case TRAYICON_NEW:
pixbuf = newmail_pixbuf[prefs_common.work_offline];
break;
case TRAYICON_NEWMARKED:
pixbuf = newmarkedmail_pixbuf[prefs_common.work_offline];
break;
case TRAYICON_UNREAD:
pixbuf = unreadmail_pixbuf[prefs_common.work_offline];
break;
case TRAYICON_UNREADMARKED:
pixbuf = unreadmarkedmail_pixbuf[prefs_common.work_offline];
break;
default:
pixbuf = nomail_pixbuf[prefs_common.work_offline];
break;
}
if (pixbuf == last_pixbuf) {
return;
}
gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(trayicon), pixbuf);
last_pixbuf = pixbuf;
}
static void update(FolderItem *removed_item)
{
guint new, unread, unreadmarked, marked, total;
guint replied, forwarded, locked, ignored, watched;
gchar *buf;
TrayIconType icontype = TRAYICON_NOTHING;
folder_count_total_msgs(&new, &unread, &unreadmarked, &marked, &total,
&replied, &forwarded, &locked, &ignored,
&watched);
if (removed_item) {
total -= removed_item->total_msgs;
new -= removed_item->new_msgs;
unread -= removed_item->unread_msgs;
}
buf = g_strdup_printf(_("New %d, Unread: %d, Total: %d"), new, unread, total);
#if !(GTK_CHECK_VERSION(2,16,0))
gtk_status_icon_set_tooltip(trayicon, buf);
#else
gtk_status_icon_set_tooltip_text(trayicon, buf);
#endif
g_free(buf);
if (new > 0 && unreadmarked > 0) {
icontype = TRAYICON_NEWMARKED;
} else if (new > 0) {
icontype = TRAYICON_NEW;
} else if (unreadmarked > 0) {
icontype = TRAYICON_UNREADMARKED;
} else if (unread > 0) {
icontype = TRAYICON_UNREAD;
}
set_trayicon_pixbuf(icontype);
}
static gboolean folder_item_update_hook(gpointer source, gpointer data)
{
update(NULL);
return FALSE;
}
static gboolean folder_update_hook(gpointer source, gpointer data)
{
FolderUpdateData *hookdata;
hookdata = source;
if (hookdata->update_flags & FOLDER_REMOVE_FOLDERITEM)
update(hookdata->item);
else
update(NULL);
return FALSE;
}
static gboolean offline_update_hook(gpointer source, gpointer data)
{
update(NULL);
return FALSE;
}
static gboolean trayicon_close_hook(gpointer source, gpointer data)
{
if (source) {
gboolean *close_allowed = (gboolean*)source;
if (trayicon_prefs.close_to_tray) {
MainWindow *mainwin = mainwindow_get_mainwindow();
*close_allowed = FALSE;
focused_widget = gtk_window_get_focus(GTK_WINDOW(mainwin->window));
if (gtk_widget_get_visible(GTK_WIDGET(mainwin->window)))
main_window_hide(mainwin);
}
}
return FALSE;
}
static gboolean trayicon_got_iconified_hook(gpointer source, gpointer data)
{
MainWindow *mainwin = mainwindow_get_mainwindow();
if (trayicon_prefs.hide_when_iconified
&& gtk_widget_get_visible(GTK_WIDGET(mainwin->window))
&& !gtk_window_get_skip_taskbar_hint(GTK_WINDOW(mainwin->window))) {
focused_widget = gtk_window_get_focus(GTK_WINDOW(mainwin->window));
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mainwin->window), TRUE);
}
return FALSE;
}
static void fix_folderview_scroll(MainWindow *mainwin)
{
static gboolean fix_done = FALSE;
if (fix_done)
return;
gtk_widget_queue_resize(mainwin->folderview->ctree);
fix_done = TRUE;
}
static gboolean click_cb(GtkWidget * widget,
GdkEventButton * event, gpointer user_data)
{
MainWindow *mainwin;
if (event == NULL) {
return TRUE;
}
mainwin = mainwindow_get_mainwindow();
switch (event->button) {
case 1:
if (gtk_widget_get_visible(GTK_WIDGET(mainwin->window))) {
if ((gdk_window_get_state(gtk_widget_get_window(
GTK_WIDGET(mainwin->window)))&GDK_WINDOW_STATE_ICONIFIED)
|| mainwindow_is_obscured()) {
gtk_window_deiconify(GTK_WINDOW(mainwin->window));
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mainwin->window), FALSE);
main_window_show(mainwin);
gtk_window_present(GTK_WINDOW(mainwin->window));
gtk_window_set_focus(GTK_WINDOW(mainwin->window), focused_widget);
} else {
focused_widget = gtk_window_get_focus(GTK_WINDOW(mainwin->window));
main_window_hide(mainwin);
}
} else {
gtk_window_deiconify(GTK_WINDOW(mainwin->window));
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mainwin->window), FALSE);
main_window_show(mainwin);
gtk_window_present(GTK_WINDOW(mainwin->window));
fix_folderview_scroll(mainwin);
gtk_window_set_focus(GTK_WINDOW(mainwin->window), focused_widget);
}
break;
case 3:
/* tell callbacks to skip any event */
updating_menu = TRUE;
/* initialize checkitem according to current offline state */
cm_toggle_menu_set_active("TrayiconPopup/ToggleOffline", prefs_common.work_offline);
cm_menu_set_sensitive("TrayiconPopup/GetMail", mainwin->lock_count == 0);
updating_menu = FALSE;
gtk_menu_popup( GTK_MENU(traymenu_popup), NULL, NULL, NULL, NULL,
event->button, event->time );
break;
default:
return TRUE;
}
return TRUE;
}
static void create_trayicon(void);
static gboolean trayicon_update_theme(gpointer source, gpointer data)
{
MainWindow *mainwin = mainwindow_get_mainwindow();
stock_pixbuf_gdk(GTK_WIDGET(mainwin->window), STOCK_PIXMAP_TRAY_NOMAIL, &nomail_pixbuf[0]);
stock_pixbuf_gdk(GTK_WIDGET(mainwin->window), STOCK_PIXMAP_TRAY_UNREADMAIL, &unreadmail_pixbuf[0]);
stock_pixbuf_gdk(GTK_WIDGET(mainwin->window), STOCK_PIXMAP_TRAY_NEWMAIL, &newmail_pixbuf[0]);
stock_pixbuf_gdk(GTK_WIDGET(mainwin->window), STOCK_PIXMAP_TRAY_UNREADMARKEDMAIL, &unreadmarkedmail_pixbuf[0]);
stock_pixbuf_gdk(GTK_WIDGET(mainwin->window), STOCK_PIXMAP_TRAY_NEWMARKEDMAIL, &newmarkedmail_pixbuf[0]);
stock_pixbuf_gdk(GTK_WIDGET(mainwin->window), STOCK_PIXMAP_TRAY_NOMAIL_OFFLINE, &nomail_pixbuf[1]);
stock_pixbuf_gdk(GTK_WIDGET(mainwin->window), STOCK_PIXMAP_TRAY_UNREADMAIL_OFFLINE, &unreadmail_pixbuf[1]);
stock_pixbuf_gdk(GTK_WIDGET(mainwin->window), STOCK_PIXMAP_TRAY_NEWMAIL_OFFLINE, &newmail_pixbuf[1]);
stock_pixbuf_gdk(GTK_WIDGET(mainwin->window), STOCK_PIXMAP_TRAY_UNREADMARKEDMAIL_OFFLINE, &unreadmarkedmail_pixbuf[1]);
stock_pixbuf_gdk(GTK_WIDGET(mainwin->window), STOCK_PIXMAP_TRAY_NEWMARKEDMAIL_OFFLINE, &newmarkedmail_pixbuf[1]);
update(NULL);
return FALSE;
}
static void create_trayicon()
{
GtkActionGroup *action_group;
trayicon = gtk_status_icon_new();
gtk_status_icon_set_title(GTK_STATUS_ICON(trayicon), _("Claws Mail"));
g_signal_connect(G_OBJECT(trayicon), "button-press-event",
G_CALLBACK(click_cb), NULL);
action_group = cm_menu_create_action_group("TrayiconPopup", trayicon_popup_menu_entries,
G_N_ELEMENTS(trayicon_popup_menu_entries), (gpointer)NULL);
gtk_action_group_add_toggle_actions(action_group, trayicon_popup_toggle_menu_entries,
G_N_ELEMENTS(trayicon_popup_toggle_menu_entries), (gpointer)NULL);
MENUITEM_ADDUI("/Menus", "TrayiconPopup", "TrayiconPopup", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI("/Menus/TrayiconPopup", "GetMail", "TrayiconPopup/GetMail", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI("/Menus/TrayiconPopup", "Separator1", "TrayiconPopup/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI("/Menus/TrayiconPopup", "Email", "TrayiconPopup/Email", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI("/Menus/TrayiconPopup", "EmailAcc", "TrayiconPopup/EmailAcc", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI("/Menus/TrayiconPopup", "Separator2", "TrayiconPopup/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI("/Menus/TrayiconPopup", "OpenAB", "TrayiconPopup/OpenAB", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI("/Menus/TrayiconPopup", "Separator3", "TrayiconPopup/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI("/Menus/TrayiconPopup", "ToggleOffline", "TrayiconPopup/ToggleOffline", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI("/Menus/TrayiconPopup", "Separator4", "TrayiconPopup/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI("/Menus/TrayiconPopup", "Exit", "TrayiconPopup/Exit", GTK_UI_MANAGER_MENUITEM)
traymenu_popup = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/TrayiconPopup")) );
trayicon_update_theme(NULL, NULL);
}
int plugin_init(gchar **error)
{
if (!check_plugin_version(MAKE_NUMERIC_VERSION(2,9,2,72),
VERSION_NUMERIC, PLUGIN_NAME, error))
return -1;
item_hook_id = hooks_register_hook (FOLDER_ITEM_UPDATE_HOOKLIST, folder_item_update_hook, NULL);
if (item_hook_id == -1) {
*error = g_strdup(_("Failed to register folder item update hook"));
goto err_out_item;
}
folder_hook_id = hooks_register_hook (FOLDER_UPDATE_HOOKLIST, folder_update_hook, NULL);
if (folder_hook_id == -1) {
*error = g_strdup(_("Failed to register folder update hook"));
goto err_out_folder;
}
offline_hook_id = hooks_register_hook (OFFLINE_SWITCH_HOOKLIST, offline_update_hook, NULL);
if (offline_hook_id == -1) {
*error = g_strdup(_("Failed to register offline switch hook"));
goto err_out_offline;
}
account_hook_id = hooks_register_hook (ACCOUNT_LIST_CHANGED_HOOKLIST, trayicon_set_accounts_hook, NULL);
if (account_hook_id == -1) {
*error = g_strdup(_("Failed to register account list changed hook"));
goto err_out_account;
}
close_hook_id = hooks_register_hook (MAIN_WINDOW_CLOSE, trayicon_close_hook, NULL);
if (close_hook_id == -1) {
*error = g_strdup(_("Failed to register close hook"));
goto err_out_close;
}
iconified_hook_id = hooks_register_hook (MAIN_WINDOW_GOT_ICONIFIED, trayicon_got_iconified_hook, NULL);
if (iconified_hook_id == -1) {
*error = g_strdup(_("Failed to register got iconified hook"));
goto err_out_iconified;
}
theme_hook_id = hooks_register_hook(THEME_CHANGED_HOOKLIST, trayicon_update_theme, NULL);
if (theme_hook_id == -1) {
*error = g_strdup(_("Failed to register theme change hook"));
goto err_out_theme;
}
create_trayicon();
trayicon_set_accounts_hook(NULL, NULL);
trayicon_prefs_init();
if (trayicon_prefs.hide_at_startup && claws_is_starting()) {
MainWindow *mainwin = mainwindow_get_mainwindow();
if (gtk_widget_get_visible(GTK_WIDGET(mainwin->window)))
main_window_hide(mainwin);
main_set_show_at_startup(FALSE);
}
return 0;
err_out_theme:
hooks_unregister_hook(MAIN_WINDOW_GOT_ICONIFIED, iconified_hook_id);
err_out_iconified:
hooks_unregister_hook(MAIN_WINDOW_CLOSE, close_hook_id);
err_out_close:
hooks_unregister_hook(ACCOUNT_LIST_CHANGED_HOOKLIST, account_hook_id);
err_out_account:
hooks_unregister_hook(OFFLINE_SWITCH_HOOKLIST, offline_hook_id);
err_out_offline:
hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, folder_hook_id);
err_out_folder:
hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, item_hook_id);
err_out_item:
return -1;
}
gboolean plugin_done(void)
{
trayicon_prefs_done();
hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, item_hook_id);
hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, folder_hook_id);
hooks_unregister_hook(OFFLINE_SWITCH_HOOKLIST, offline_hook_id);
hooks_unregister_hook(ACCOUNT_LIST_CHANGED_HOOKLIST, account_hook_id);
hooks_unregister_hook(MAIN_WINDOW_CLOSE, close_hook_id);
hooks_unregister_hook(MAIN_WINDOW_GOT_ICONIFIED, iconified_hook_id);
hooks_unregister_hook(THEME_CHANGED_HOOKLIST, theme_hook_id);
if (claws_is_exiting())
return TRUE;
gtk_status_icon_set_visible(trayicon, FALSE);
g_object_unref(G_OBJECT(trayicon));
trayicon = NULL;
while (gtk_events_pending()) {
gtk_main_iteration();
}
return TRUE;
}
const gchar *plugin_name(void)
{
return PLUGIN_NAME;
}
const gchar *plugin_desc(void)
{
return _("This plugin places a mailbox icon in the system tray that "
"indicates if you have new or unread mail.\n"
"\n"
"The mailbox is empty if you have no unread mail, otherwise "
"it contains a letter. A tooltip shows new, unread and total "
"number of messages.");
}
const gchar *plugin_type(void)
{
return "GTK2";
}
const gchar *plugin_licence(void)
{
return "GPL3+";
}
const gchar *plugin_version(void)
{
return VERSION;
}
/* popup menu callbacks */
static void trayicon_get_all_cb( GtkAction *action, gpointer data )
{
MainWindow *mainwin = mainwindow_get_mainwindow();
inc_all_account_mail_cb(mainwin, 0, NULL);
}
static void trayicon_compose_cb( GtkAction *action, gpointer data )
{
MainWindow *mainwin = mainwindow_get_mainwindow();
compose_mail_cb(mainwin, 0, NULL);
}
static void trayicon_compose_acc_cb( GtkMenuItem *menuitem, gpointer data )
{
compose_new((PrefsAccount *)data, NULL, NULL);
}
static void trayicon_addressbook_cb( GtkAction *action, gpointer data )
{
#ifndef USE_NEW_ADDRBOOK
addressbook_open(NULL);
#else
GError* error = NULL;
addressbook_dbus_open(FALSE, &error);
if (error) {
g_warning("%s", error->message);
g_error_free(error);
}
#endif
}
static void trayicon_toggle_offline_cb( GtkAction *action, gpointer data )
{
/* toggle offline mode if menu checkitem has been clicked */
if (!updating_menu) {
MainWindow *mainwin = mainwindow_get_mainwindow();
main_window_toggle_work_offline(mainwin, !prefs_common.work_offline, TRUE);
}
}
static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
{
if (prefs_common.clean_on_exit) {
if (!main_window_empty_trash(mainwin, prefs_common.ask_on_clean, TRUE))
return;
}
if (prefs_common.confirm_on_exit) {
if (alertpanel(_("Exit"), _("Exit Claws Mail?"),
GTK_STOCK_CANCEL, GTK_STOCK_OK,
NULL) != G_ALERTALTERNATE) {
return;
}
manage_window_focus_in(mainwin->window, NULL, NULL);
}
app_will_exit(NULL, mainwin);
}
static void trayicon_exit_cb( GtkAction *action, gpointer data )
{
MainWindow *mainwin = mainwindow_get_mainwindow();
if (mainwin->lock_count == 0) {
app_exit_cb(mainwin, 0, NULL);
}
}
struct PluginFeature *plugin_provides(void)
{
static struct PluginFeature features[] =
{ {PLUGIN_NOTIFIER, N_("Trayicon")},
{PLUGIN_NOTHING, NULL}};
return features;
}

View file

@ -1,175 +0,0 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 2007-2012 the Claws Mail Team
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#include "claws-features.h"
#endif
#include "defs.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "gtkutils.h"
#include "utils.h"
#include "prefs.h"
#include "prefs_gtk.h"
#include "prefswindow.h"
#include "trayicon_prefs.h"
TrayIconPrefs trayicon_prefs;
typedef struct _TrayIconPage TrayIconPage;
struct _TrayIconPage {
PrefsPage page;
GtkWidget *hide_at_startup;
GtkWidget *close_to_tray;
GtkWidget *hide_when_iconified;
};
static PrefParam param[] = {
{"hide_at_startup", "FALSE", &trayicon_prefs.hide_at_startup, P_BOOL, NULL, NULL, NULL},
{"close_to_tray", "FALSE", &trayicon_prefs.close_to_tray, P_BOOL, NULL, NULL, NULL},
{"hide_when_iconified", "FALSE", &trayicon_prefs.hide_when_iconified, P_BOOL, NULL, NULL, NULL},
{0,0,0,0,0,0,0}
};
static TrayIconPage prefs_page;
static void create_trayicon_prefs_page (PrefsPage *page,
GtkWindow *window,
gpointer data);
static void destroy_trayicon_prefs_page (PrefsPage *page);
static void save_trayicon_prefs (PrefsPage *page);
void trayicon_prefs_init(void)
{
static gchar *path[3];
gchar *rcpath;
path[0] = _("Plugins");
path[1] = _("Trayicon");
path[2] = NULL;
prefs_set_default(param);
rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
prefs_read_config(param, "TrayIcon", rcpath, NULL);
g_free(rcpath);
prefs_page.page.path = path;
prefs_page.page.create_widget = create_trayicon_prefs_page;
prefs_page.page.destroy_widget = destroy_trayicon_prefs_page;
prefs_page.page.save_page = save_trayicon_prefs;
prefs_gtk_register_page((PrefsPage *) &prefs_page);
}
void trayicon_prefs_done(void)
{
prefs_gtk_unregister_page((PrefsPage *) &prefs_page);
}
static void create_trayicon_prefs_page(PrefsPage *page,
GtkWindow *window,
gpointer data)
{
TrayIconPage *prefs_page = (TrayIconPage *) page;
GtkWidget *vbox;
GtkWidget *hide_at_startup_checkbox;
GtkWidget *close_to_tray_checkbox;
GtkWidget *hide_when_iconified_checkbox;
vbox = gtk_vbox_new(FALSE, 3);
gtk_container_set_border_width(GTK_CONTAINER(vbox), VBOX_BORDER);
gtk_widget_show(vbox);
hide_at_startup_checkbox = gtk_check_button_new_with_label
(_("Hide at start-up"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hide_at_startup_checkbox),
trayicon_prefs.hide_at_startup);
gtk_box_pack_start(GTK_BOX(vbox), hide_at_startup_checkbox, FALSE, FALSE, 0);
gtk_widget_show(hide_at_startup_checkbox);
CLAWS_SET_TIP(hide_at_startup_checkbox,
_("Hide Claws Mail at start-up"));
close_to_tray_checkbox = gtk_check_button_new_with_label
(_("Close to tray"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(close_to_tray_checkbox),
trayicon_prefs.close_to_tray);
gtk_box_pack_start(GTK_BOX(vbox), close_to_tray_checkbox, FALSE, FALSE, 0);
gtk_widget_show(close_to_tray_checkbox);
CLAWS_SET_TIP(close_to_tray_checkbox,
_("Hide Claws Mail using the tray icon instead of closing it\nwhen the window close button is clicked"));
hide_when_iconified_checkbox = gtk_check_button_new_with_label
(_("Minimize to tray"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hide_when_iconified_checkbox),
trayicon_prefs.hide_when_iconified);
gtk_box_pack_start(GTK_BOX(vbox), hide_when_iconified_checkbox, FALSE, FALSE, 0);
gtk_widget_show(hide_when_iconified_checkbox);
CLAWS_SET_TIP(hide_when_iconified_checkbox,
_("Hide Claws Mail using the tray icon instead of minimizing it"));
prefs_page->hide_at_startup = hide_at_startup_checkbox;
prefs_page->close_to_tray = close_to_tray_checkbox;
prefs_page->hide_when_iconified = hide_when_iconified_checkbox;
prefs_page->page.widget = vbox;
}
static void destroy_trayicon_prefs_page(PrefsPage *page)
{
/* Do nothing! */
}
static void save_trayicon_prefs(PrefsPage *page)
{
TrayIconPage *prefs_page = (TrayIconPage *) page;
PrefFile *pref_file;
gchar *rc_file_path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
COMMON_RC, NULL);
trayicon_prefs.hide_at_startup = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON(prefs_page->hide_at_startup));
trayicon_prefs.close_to_tray = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON(prefs_page->close_to_tray));
trayicon_prefs.hide_when_iconified = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON(prefs_page->hide_when_iconified));
pref_file = prefs_write_open(rc_file_path);
g_free(rc_file_path);
if (!(pref_file) ||
(prefs_set_block_label(pref_file, "TrayIcon") < 0))
return;
if (prefs_write_param(param, pref_file->fp) < 0) {
g_warning("failed to write TrayIcon Plugin configuration\n");
prefs_file_close_revert(pref_file);
return;
}
if (fprintf(pref_file->fp, "\n") < 0) {
FILE_OP_ERROR(rc_file_path, "fprintf");
prefs_file_close_revert(pref_file);
} else
prefs_file_close(pref_file);
}

View file

@ -1,38 +0,0 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 2007-2012 the Claws Mail Team
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRAYICONPREFS_H
#define TRAYICONPREFS_H
#include <glib.h>
typedef struct _TrayIconPrefs TrayIconPrefs;
struct _TrayIconPrefs
{
gboolean hide_at_startup; /**< hide main-window at startup */
gboolean close_to_tray; /**< hide main-window when [X] is clicked */
gboolean hide_when_iconified; /**< hide main-window when it got iconified */
};
extern TrayIconPrefs trayicon_prefs;
void trayicon_prefs_init(void);
void trayicon_prefs_done(void);
#endif