[balsa] bump version to 2.4.0, and require GMime-2.4, GLib-2.16, and Gtk-2.14
- From: Peter Bloomfield <PeterB src gnome org>
- To: svn-commits-list gnome org
- Subject: [balsa] bump version to 2.4.0, and require GMime-2.4, GLib-2.16, and Gtk-2.14
- Date: Thu, 23 Apr 2009 22:36:04 -0400 (EDT)
commit d3c29a519e16c86a3effdd1d48c065e25142cd29
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Apr 23 22:33:48 2009 -0400
bump version to 2.4.0, and require GMime-2.4, GLib-2.16, and Gtk-2.14
---
ChangeLog | 5 +
configure.in | 84 +--
libbalsa/Makefile.am | 2 -
libbalsa/address-view.c | 4 -
libbalsa/files.c | 59 -
libbalsa/filter-funcs.c | 14 -
libbalsa/gmime-stream-gio.c | 4 -
libbalsa/gmime-stream-gio.h | 5 -
libbalsa/gmime-stream-gnome-vfs.c | 466 -------
libbalsa/gmime-stream-gnome-vfs.h | 77 --
libbalsa/html.c | 109 --
libbalsa/html.h | 24 -
libbalsa/identity.c | 12 -
libbalsa/libbalsa-conf.c | 75 --
libbalsa/libbalsa-vfs.c | 408 +------
libbalsa/mailbox.c | 31 -
libbalsa/mailbox_local.c | 39 -
libbalsa/mailbox_mbox.c | 14 +-
libbalsa/smtp-server.c | 14 -
libinit_balsa/Makefile.am | 51 -
libinit_balsa/balsa-druid-page-defclient.c | 131 --
libinit_balsa/balsa-druid-page-defclient.h | 56 -
libinit_balsa/balsa-druid-page-directory.c | 392 ------
libinit_balsa/balsa-druid-page-directory.h | 75 --
libinit_balsa/balsa-druid-page-finish.c | 108 --
libinit_balsa/balsa-druid-page-finish.h | 44 -
libinit_balsa/balsa-druid-page-user.c | 327 -----
libinit_balsa/balsa-druid-page-user.h | 78 --
libinit_balsa/balsa-druid-page-welcome.c | 66 -
libinit_balsa/balsa-druid-page-welcome.h | 44 -
libinit_balsa/balsa-initdruid.c | 91 --
libinit_balsa/balsa-initdruid.h | 42 -
libinit_balsa/helper.c | 257 ----
libinit_balsa/helper.h | 64 -
src/Makefile.am | 21 +-
src/address-book-config.c | 12 -
src/balsa-app.c | 13 -
src/balsa-app.h | 21 -
src/balsa-icons.c | 8 -
src/balsa-icons.h | 2 -
src/balsa-index.c | 10 -
src/balsa-mblist.c | 100 +--
src/balsa-message.c | 30 -
src/balsa-mime-widget-message.c | 8 -
src/balsa-mime-widget-text.c | 17 -
src/balsa-mime-widget.c | 5 -
src/filter-edit-callbacks.c | 22 -
src/filter-run-callbacks.c | 14 -
src/folder-conf.c | 14 -
src/main-window.c | 10 -
src/main-window.h | 2 -
src/message-window.c | 8 -
src/pref-manager.c | 34 -
src/print.c | 1906 ----------------------------
src/print.h | 2 -
src/save-restore.c | 59 -
src/sendmsg-window.c | 75 --
src/spell-check.c | 42 -
src/toolbar-factory.c | 16 +-
src/toolbar-prefs.c | 14 -
60 files changed, 22 insertions(+), 5715 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a7f9e4c..04bc309 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-23 Peter Bloomfield
+
+ bump version to 2.4.0, and require GMime-2.4, GLib-2.16, and
+ Gtk-2.14.
+
2009-04-21 Peter Bloomfield
port to GMime-2.4
diff --git a/configure.in b/configure.in
index da6e843..281a554 100644
--- a/configure.in
+++ b/configure.in
@@ -154,14 +154,6 @@ AC_ARG_WITH([gtksourceview],
with_gtksourceview=no
])
-AC_ARG_WITH([gtkprint],
- AC_HELP_STRING([--with-gtkprint],
- [Use GtkPrint instead of libgnomeprint (default=yes for gtk+ > 2.10.0)]),[
- with_gtkprint=$withval
-],[
- with_gtkprint=testme
-])
-
AC_ARG_WITH([sqlite],
AC_HELP_STRING([--with-sqlite=DIR],
[Use SQLite for GPE address books (default=no)]),[
@@ -294,34 +286,11 @@ AC_DEFINE_UNQUOTED(SENDMAIL, "$ac_cv_path_SENDMAIL",
[Path to sendmail program.])
fi
-# GIO in glib 2.16.0 and above
-AC_MSG_CHECKING([for gio >= 2.16])
-if $PKG_CONFIG --atleast-version=2.16.0 gio-2.0 ; then
- with_gio=yes
- gio_extra=gio-2.0
- AC_DEFINE(HAVE_GIO,1,[Defined when GIO can be used.])
- giover=`$PKG_CONFIG --modversion gio-2.0`
- AC_MSG_RESULT($giover)
-else
- with_gio=no
- AC_MSG_RESULT($with_gio)
-fi
-
dnl #####################################################################
dnl GNOME libs
dnl #####################################################################
if test x$with_gnome != xno; then
gnome_extras="libgnome-2.0 libgnomeui-2.0 libbonobo-2.0 gconf-2.0"
- if test x$with_gio != xyes ; then
- gnome_extras="$gnome_extras gnome-vfs-2.0 >= 2.4.0 gnome-vfs-module-2.0"
- AC_DEFINE(HAVE_GNOME_VFS,1,
- [Defined when gnome-vfs shall be used])
- if $PKG_CONFIG --atleast-version=2.9.0 gnome-vfs-2.0 ; then
- AC_DEFINE(HAVE_GNOME_VFS29,1,
- [Defined when gnome-vfs-2.0 version is at least 2.9.0])
- fi
- fi
- gnome_print_extras="libgnomeprint-2.2 >= 2.1.4 libgnomeprintui-2.2 >= 2.1.4"
AC_MSG_CHECKING([whether we have gnome-keyring])
if $PKG_CONFIG --atleast-version=1.0 gnome-keyring-1; then
gnome_extras="$gnome_extras gnome-keyring-1"
@@ -339,55 +308,19 @@ if test x$with_gnome != xno; then
AC_DEFINE(HAVE_GNOME,1,[Defined when gnome libs are available.])
else
gnome_extras=""
- gnome_print_extras=""
fi
AM_CONDITIONAL([BUILD_WITH_GNOME], [test $with_gnome = "yes"])
dnl #####################################################################
-dnl GtkPrint
-dnl #####################################################################
-
-if test x"$with_gtkprint" = xtestme ; then
- AC_MSG_CHECKING([for gtk+ >= 2.10])
- if $PKG_CONFIG --atleast-version=2.10.0 gtk+-2.0 ; then
- with_gtkprint=yes
- else
- with_gtkprint=no
- fi
- AC_MSG_RESULT($with_gtkprint)
-elif test x"$with_gtkprint" = xyes ; then
- AC_MSG_CHECKING([whether gtk+ supports native printing])
- if $PKG_CONFIG --atleast-version=2.10.0 gtk+-2.0 ; then
- with_gtkprint=yes
- AC_MSG_RESULT($with_gtkprint)
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([gtk+ >= 2.10.0 must be installed to use native printing support])
- fi
-else
- with_gtkprint=no
-fi
-
-AM_CONDITIONAL([BUILD_WITH_GTK_PRINT], [test $with_gtkprint = "yes"])
-if test $with_gtkprint = yes ; then
- AC_DEFINE(HAVE_GTK_PRINT,1,
- [Defined when native Gtk+-2.0 printing support is available])
- gnome_print_extras=""
-else
- gnome_print_extras="libgnomeprint-2.2 >= 2.1.4 libgnomeprintui-2.2 >= 2.1.4"
-fi
-
-dnl #####################################################################
dnl 4. Libraries.
dnl #####################################################################
PKG_CHECK_MODULES(BALSA, [
-glib-2.0 >= 2.6.0
-gtk+-2.0 >= 2.6.0
+glib-2.0 >= 2.16.0
+gtk+-2.0 >= 2.14.0
gmime-2.4
-$gio_extra
+gio-2.0
$gnome_extras
-$gnome_print_extras
])
PKG_CHECK_MODULES(BALSA_AB, [
@@ -923,15 +856,6 @@ dnl 7. extra functions.
dnl #####################################################################
AC_CHECK_FUNCS(getaddrinfo getnameinfo gai_strerror)
-AC_MSG_CHECKING([Whether GtkAssistant widget is available])
-if pkg-config --atleast-version=2.10 gtk+-2.0; then
- has_assistant=yes
-else
- has_assistant=no
-fi
-AC_MSG_RESULT($has_assistant)
-AM_CONDITIONAL([BUILD_WITH_ASSISTANT], [test x$has_assistant = xyes])
-
# isblank()
AC_MSG_CHECKING([for isblank])
AC_TRY_LINK( [#include <ctype.h>], [return isblank('a');],
@@ -1027,7 +951,6 @@ echo " Use ESMTP : $with_esmtp"
echo " Use WebKit (experimental): $use_webkit"
echo " Use Unique (experimental): $with_unique"
echo " Use GNOME: $with_gnome"
-echo " Use GIO: $with_gio"
echo " Use GtkHTML: $use_gtkhtml"
echo " Use GPGME: $gpgmecfg"
echo " Use LDAP: $with_ldap"
@@ -1037,7 +960,6 @@ echo " Use SSL: $with_ssl"
echo " Use GtkSpell: $with_gtkspell"
echo " Use Libnotify: $with_libnotify"
echo " Use GtkSourceView: $with_gtksourceview"
-echo " Use GtkPrint: $with_gtkprint"
echo " Use Compface: $with_compface"
echo " Install extra MIME icons: $install_mimeicons"
dnl echo " Use SASL: $need_sasl"
diff --git a/libbalsa/Makefile.am b/libbalsa/Makefile.am
index 19052fb..0a1c03a 100644
--- a/libbalsa/Makefile.am
+++ b/libbalsa/Makefile.am
@@ -74,8 +74,6 @@ libbalsa_a_SOURCES = \
filter.h \
folder-scanners.c \
folder-scanners.h \
- gmime-stream-gnome-vfs.c\
- gmime-stream-gnome-vfs.h\
gmime-stream-gio.c \
gmime-stream-gio.h \
html.c \
diff --git a/libbalsa/address-view.c b/libbalsa/address-view.c
index 1f0b95a..d2f0b75 100644
--- a/libbalsa/address-view.c
+++ b/libbalsa/address-view.c
@@ -931,11 +931,7 @@ lbav_selection_changed_cb(GtkTreeSelection * selection,
GtkTreePath *path;
GtkTreeViewColumn *column;
-#if GTK_CHECK_VERSION(2, 12, 0)
gtk_tree_view_convert_widget_to_bin_window_coords
-#else /* GTK_CHECK_VERSION(2, 12, 0) */
- gtk_tree_view_widget_to_tree_coords
-#endif /* GTK_CHECK_VERSION(2, 12, 0) */
(tree_view, (gint) event_button->x,
(gint) event_button->y, &x, &y);
diff --git a/libbalsa/files.c b/libbalsa/files.c
index aac1acd..98fc36d 100644
--- a/libbalsa/files.c
+++ b/libbalsa/files.c
@@ -28,17 +28,7 @@
#include <ctype.h>
#include <string.h>
-#if HAVE_GIO
#include <gio/gio.h>
-#endif
-
-#if HAVE_GNOME
-#include <gnome.h>
-#endif
-#if HAVE_GNOME_VFS
-#include <libgnomevfs/gnome-vfs-mime-info.h>
-#include <libgnomevfs/gnome-vfs.h>
-#endif
#include "misc.h"
#include "libbalsa.h"
@@ -146,12 +136,7 @@ libbalsa_icon_finder(const char *mime_type, const LibbalsaVfs * for_file,
GdkPixbuf *pixbuf = NULL;
gint width, height;
const gchar * filename = NULL;
-#if HAVE_GIO || HAVE_GNOME
GtkIconTheme *icon_theme;
-#ifdef HAVE_GNOME_VFS
- const gchar *icon_file;
-#endif
-#endif
if (!gtk_icon_size_lookup(size, &width, &height))
width = height = 16;
@@ -164,7 +149,6 @@ libbalsa_icon_finder(const char *mime_type, const LibbalsaVfs * for_file,
} else
content_type = g_strdup("application/octet-stream");
-#if HAVE_GIO
/* ask GIO for the icon */
if ((icon_theme = gtk_icon_theme_get_default())) {
GIcon * icon = g_content_type_get_icon(content_type);
@@ -204,49 +188,6 @@ libbalsa_icon_finder(const char *mime_type, const LibbalsaVfs * for_file,
}
}
}
-#elif HAVE_GNOME
- /* gtk+ 2.4.0 and above: use the default icon theme to get the icon */
- if ((icon_theme = gtk_icon_theme_get_default()))
- if ((icon =
- gnome_icon_lookup(icon_theme, NULL, filename, NULL, NULL,
- content_type, 0, NULL))) {
- pixbuf =
- gtk_icon_theme_load_icon(icon_theme, icon, width, 0, NULL);
- g_free(icon);
- if (pixbuf) {
- if (used_type)
- *used_type = content_type;
- else
- g_free(content_type);
- return pixbuf;
- }
- }
-
-#if HAVE_GNOME_VFS
- icon_file = gnome_vfs_mime_get_value(content_type, "icon_filename");
-
- /* check if the icon file is good and try harder otherwise */
- if (icon_file && g_file_test (icon_file, G_FILE_TEST_IS_REGULAR))
- icon = g_strdup(icon_file);
- else {
- gchar *gnome_icon, *p_gnome_icon, *tmp;
-
- gnome_icon = g_strdup_printf ("gnome-%s.png", content_type);
- p_gnome_icon = strchr (gnome_icon, '/');
- if (p_gnome_icon != NULL)
- *p_gnome_icon = '-';
-
- tmp = g_strconcat("document-icons/", gnome_icon, NULL);
- icon = gnome_vfs_icon_path_from_filename(tmp);
- g_free(tmp);
-
- if (icon == NULL)
- icon = balsa_pixmap_finder_no_warn (gnome_icon);
-
- g_free (gnome_icon);
- }
-#endif /* HAVE_GNOME_VFS */
-#endif /* HAVE_GNOME */
/* load the pixbuf */
if (icon == NULL)
diff --git a/libbalsa/filter-funcs.c b/libbalsa/filter-funcs.c
index 5f09898..cb20d4f 100644
--- a/libbalsa/filter-funcs.c
+++ b/libbalsa/filter-funcs.c
@@ -312,11 +312,7 @@ static void
cond_to_string(LibBalsaCondition * cond, GString *res)
{
char str[80];
-#if GLIB_CHECK_VERSION(2,10,0)
GDate date;
-#else
- struct tm date;
-#endif
if(cond->negate)
g_string_append(res, "NOT ");
@@ -338,24 +334,14 @@ cond_to_string(LibBalsaCondition * cond, GString *res)
case CONDITION_DATE:
g_string_append(res, "DATE ");
if (cond->match.date.date_low) {
-#if GLIB_CHECK_VERSION(2,10,0)
g_date_set_time_t(&date, cond->match.date.date_low);
g_date_strftime(str, sizeof(str), "%Y-%m-%d", &date);
-#else
- localtime_r(&cond->match.date.date_low, &date);
- strftime(str,sizeof(str),"%Y-%m-%d", &date);
-#endif
} else str[0]='\0';
append_quoted_string(res, str);
g_string_append_c(res, ' ');
if (cond->match.date.date_high) {
-#if GLIB_CHECK_VERSION(2,10,0)
g_date_set_time_t(&date, cond->match.date.date_high);
g_date_strftime(str, sizeof(str), "%Y-%m-%d", &date);
-#else
- localtime_r(&cond->match.date.date_high, &date);
- strftime(str,sizeof(str),"%Y-%m-%d", &date);
-#endif
} else str[0]='\0';
append_quoted_string(res, str);
break;
diff --git a/libbalsa/gmime-stream-gio.c b/libbalsa/gmime-stream-gio.c
index ba5c292..bb6ed16 100644
--- a/libbalsa/gmime-stream-gio.c
+++ b/libbalsa/gmime-stream-gio.c
@@ -26,7 +26,6 @@
#include "gmime-stream-gio.h"
/* note: this module will be compiled only if GIO is available */
-#if HAVE_GIO
#include <sys/types.h>
#include <sys/stat.h>
@@ -480,6 +479,3 @@ g_mime_stream_gio_new_with_bounds(GFile * gfile, gint64 start, gint64 end)
return (GMimeStream *) gios;
}
-
-
-#endif /* HAVE_GIO */
diff --git a/libbalsa/gmime-stream-gio.h b/libbalsa/gmime-stream-gio.h
index 251fcf6..73e86fd 100644
--- a/libbalsa/gmime-stream-gio.h
+++ b/libbalsa/gmime-stream-gio.h
@@ -28,9 +28,6 @@
# error "Include config.h before this file."
#endif
-/* note: this module will be compiled only if GIO is available */
-#if HAVE_GIO
-
#include <gio/gio.h>
#include <gmime/gmime-stream.h>
@@ -68,6 +65,4 @@ GMimeStream *g_mime_stream_gio_new_with_bounds(GFile * gfile,
G_END_DECLS
-#endif /* HAVE_GIO */
-
#endif /* __GMIME_STREAM_GIO_H__ */
diff --git a/libbalsa/gmime-stream-gnome-vfs.c b/libbalsa/gmime-stream-gnome-vfs.c
deleted file mode 100644
index d7bafa1..0000000
--- a/libbalsa/gmime-stream-gnome-vfs.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* GMime Gnome VFS stream module
- * Written/Copyright (c) by Albrecht Dreß <albrecht dress arcor de>
- * The basic structure of this file has been shamelessly stolen from the
- * gmime-stream-fs module, written by Jeffrey Stedfast.
- *
- * This library 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.1
- * of the License, or (at your option) any later version.
- *
- * This library 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 this library; if not, write to the Free
- * Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
-#endif /* HAVE_CONFIG_H */
-#include "gmime-stream-gnome-vfs.h"
-
-/* note: this module will be compiled only if Gnome-Vfs is available */
-#ifdef HAVE_GNOME_VFS
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-
-/**
- * SECTION: gmime-stream-gvfs
- * @title: GMimeStreamGvfs
- * @short_description: A low-level FileSystem stream
- * @see_also: #GMimeStream
- *
- * A simple #GMimeStream implementation that sits on top of the
- * low-level UNIX file descriptor based I/O layer.
- **/
-
-
-static void g_mime_stream_gvfs_class_init(GMimeStreamGvfsClass * klass);
-static void g_mime_stream_gvfs_init(GMimeStreamGvfs * stream,
- GMimeStreamGvfsClass * klass);
-static void g_mime_stream_gvfs_finalize(GObject * object);
-
-static ssize_t stream_read(GMimeStream * stream, char *buf, size_t len);
-static ssize_t stream_write(GMimeStream * stream, const char *buf,
- size_t len);
-static int stream_flush(GMimeStream * stream);
-static int stream_close(GMimeStream * stream);
-static gboolean stream_eos(GMimeStream * stream);
-static int stream_reset(GMimeStream * stream);
-static gint64 stream_seek(GMimeStream * stream, gint64 offset,
- GMimeSeekWhence whence);
-static gint64 stream_tell(GMimeStream * stream);
-static ssize_t stream_length(GMimeStream * stream);
-static GMimeStream *stream_substream(GMimeStream * stream, gint64 start,
- gint64 end);
-
-
-static GMimeStreamClass *parent_class = NULL;
-
-
-GType
-g_mime_stream_gvfs_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof(GMimeStreamGvfsClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) g_mime_stream_gvfs_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GMimeStreamGvfs),
- 0, /* n_preallocs */
- (GInstanceInitFunc) g_mime_stream_gvfs_init,
- };
-
- type =
- g_type_register_static(GMIME_TYPE_STREAM, "GMimeStreamGvfs",
- &info, 0);
- }
-
- return type;
-}
-
-
-static void
-g_mime_stream_gvfs_class_init(GMimeStreamGvfsClass * klass)
-{
- GMimeStreamClass *stream_class = GMIME_STREAM_CLASS(klass);
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
-
- parent_class = g_type_class_ref(GMIME_TYPE_STREAM);
-
- object_class->finalize = g_mime_stream_gvfs_finalize;
-
- stream_class->read = stream_read;
- stream_class->write = stream_write;
- stream_class->flush = stream_flush;
- stream_class->close = stream_close;
- stream_class->eos = stream_eos;
- stream_class->reset = stream_reset;
- stream_class->seek = stream_seek;
- stream_class->tell = stream_tell;
- stream_class->length = stream_length;
- stream_class->substream = stream_substream;
-}
-
-static void
-g_mime_stream_gvfs_init(GMimeStreamGvfs * stream,
- GMimeStreamGvfsClass * klass)
-{
- stream->owner = TRUE;
- stream->eos = FALSE;
- stream->handle = NULL;
-}
-
-static void
-g_mime_stream_gvfs_finalize(GObject * object)
-{
- GMimeStreamGvfs *stream = (GMimeStreamGvfs *) object;
-
- if (stream->owner && stream->handle)
- gnome_vfs_close(stream->handle);
-
- G_OBJECT_CLASS(parent_class)->finalize(object);
-}
-
-static ssize_t
-stream_read(GMimeStream * stream, char *buf, size_t len)
-{
- GMimeStreamGvfs *gvfs = (GMimeStreamGvfs *) stream;
- GnomeVFSFileSize nread = 0;
- GnomeVFSResult result;
-
- if (stream->bound_end != -1 && stream->position >= stream->bound_end)
- return -1;
-
- if (stream->bound_end != -1)
- len = MIN(stream->bound_end - stream->position, (gint64) len);
-
- /* make sure we are at the right position */
- gnome_vfs_seek(gvfs->handle, GNOME_VFS_SEEK_START, stream->position);
-
- do {
- result = gnome_vfs_read(gvfs->handle, buf, len, &nread);
- } while (result == GNOME_VFS_ERROR_INTERRUPTED);
-
- if (result == GNOME_VFS_OK)
- stream->position += nread;
- else if (result == GNOME_VFS_ERROR_EOF || nread == 0)
- gvfs->eos = TRUE;
- else
- nread = -1;
-
- return nread;
-}
-
-static ssize_t
-stream_write(GMimeStream * stream, const char *buf, size_t len)
-{
- GMimeStreamGvfs *gvfs = (GMimeStreamGvfs *) stream;
- size_t nwritten = 0;
- GnomeVFSFileSize chunk;
- GnomeVFSResult result;
-
- if (stream->bound_end != -1 && stream->position >= stream->bound_end)
- return -1;
-
- if (stream->bound_end != -1)
- len = MIN(stream->bound_end - stream->position, (gint64) len);
-
- /* make sure we are at the right position */
- gnome_vfs_seek(gvfs->handle, GNOME_VFS_SEEK_START, stream->position);
-
- do {
- chunk = 0;
- do {
- result = gnome_vfs_write(gvfs->handle, buf, len, &chunk);
- } while (result == GNOME_VFS_ERROR_INTERRUPTED ||
- result == GNOME_VFS_ERROR_IN_PROGRESS);
-
- if (chunk > 0)
- nwritten += chunk;
- } while (result == GNOME_VFS_OK && nwritten < len);
-
- if (result == GNOME_VFS_ERROR_TOO_BIG ||
- result == GNOME_VFS_ERROR_NO_SPACE)
- gvfs->eos = TRUE;
-
- if (nwritten > 0)
- stream->position += nwritten;
- else if (result != GNOME_VFS_OK)
- return -1;
-
- return nwritten;
-}
-
-static int
-stream_flush(GMimeStream * stream)
-{
- GMimeStreamGvfs *gvfs = (GMimeStreamGvfs *) stream;
-
- g_return_val_if_fail(gvfs->handle != NULL, -1);
-
- return 0;
-}
-
-static int
-stream_close(GMimeStream * stream)
-{
- GMimeStreamGvfs *gvfs = (GMimeStreamGvfs *) stream;
- GnomeVFSResult rv;
-
- if (gvfs->handle == NULL)
- return 0;
-
- do {
- if ((rv = gnome_vfs_close(gvfs->handle)) == GNOME_VFS_OK)
- gvfs->handle = NULL;
- } while (rv == GNOME_VFS_ERROR_INTERRUPTED);
-
- return (rv == GNOME_VFS_OK) ? 0 : -1;
-}
-
-static gboolean
-stream_eos(GMimeStream * stream)
-{
- GMimeStreamGvfs *gvfs = (GMimeStreamGvfs *) stream;
-
- g_return_val_if_fail(gvfs->handle != NULL, TRUE);
-
- return gvfs->eos;
-}
-
-static int
-stream_reset(GMimeStream * stream)
-{
- GMimeStreamGvfs *gvfs = (GMimeStreamGvfs *) stream;
-
- if (gvfs->handle == NULL)
- return -1;
-
- if (stream->position == stream->bound_start) {
- gvfs->eos = FALSE;
- return 0;
- }
-
- /* FIXME: if stream_read/write is always going to lseek to
- * make sure fd's seek position matches our own, we could just
- * set stream->position = stream->bound_start and be done. */
- if (gnome_vfs_seek(gvfs->handle, GNOME_VFS_SEEK_START, stream->bound_start) != GNOME_VFS_OK)
- return -1;
-
- gvfs->eos = FALSE;
-
- return 0;
-}
-
-static gint64
-stream_seek(GMimeStream * stream, gint64 offset, GMimeSeekWhence whence)
-{
- GMimeStreamGvfs *gvfs = (GMimeStreamGvfs *) stream;
- gint64 real;
- GnomeVFSFileSize gvfs_real;
-
- g_return_val_if_fail(gvfs->handle != NULL, -1);
-
- switch (whence) {
- case GMIME_STREAM_SEEK_SET:
- real = offset;
- break;
- case GMIME_STREAM_SEEK_CUR:
- real = stream->position + offset;
- break;
- case GMIME_STREAM_SEEK_END:
- if (offset > 0 || (stream->bound_end == -1 && !gvfs->eos)) {
- /* need to do an actual lseek() here because
- * we either don't know the offset of the end
- * of the stream and/or don't know if we can
- * seek past the end */
- if (gnome_vfs_seek(gvfs->handle, GNOME_VFS_SEEK_END, offset) != GNOME_VFS_OK ||
- gnome_vfs_tell(gvfs->handle, &gvfs_real) != GNOME_VFS_OK)
- return -1;
- real = (off_t) gvfs_real;
- } else if (gvfs->eos && stream->bound_end == -1) {
- /* seeking backwards from eos (which happens
- * to be our current position) */
- real = stream->position + offset;
- } else {
- /* seeking backwards from a known position */
- real = stream->bound_end + offset;
- }
-
- break;
- default:
- g_assert_not_reached();
- return -1;
- }
-
- /* sanity check the resultant offset */
- if (real < stream->bound_start)
- return -1;
-
- /* short-cut if we are seeking to our current position */
- if (real == stream->position)
- return real;
-
- if (stream->bound_end != -1 && real > stream->bound_end)
- return -1;
-
- if (gnome_vfs_seek(gvfs->handle, GNOME_VFS_SEEK_START, real) != GNOME_VFS_OK ||
- gnome_vfs_tell(gvfs->handle, &gvfs_real) != GNOME_VFS_OK)
- return -1;
- else
- real = (gint64) gvfs_real;
-
- /* reset eos if appropriate */
- if ((stream->bound_end != -1 && real < stream->bound_end) ||
- (gvfs->eos && real < stream->position))
- gvfs->eos = FALSE;
-
- stream->position = real;
-
- return real;
-}
-
-static gint64
-stream_tell(GMimeStream * stream)
-{
- return stream->position;
-}
-
-static ssize_t
-stream_length(GMimeStream * stream)
-{
- GMimeStreamGvfs *gvfs = (GMimeStreamGvfs *) stream;
- GnomeVFSFileSize bound_end;
-
- if (stream->bound_end != -1)
- return stream->bound_end - stream->bound_start;
-
- if (gnome_vfs_seek(gvfs->handle, GNOME_VFS_SEEK_END, 0) != GNOME_VFS_OK ||
- gnome_vfs_tell(gvfs->handle, &bound_end) != GNOME_VFS_OK ||
- gnome_vfs_seek(gvfs->handle, GNOME_VFS_SEEK_START, stream->position) != GNOME_VFS_OK ||
- (gint64) bound_end < stream->bound_start)
- return -1;
-
- return (ssize_t) bound_end - stream->bound_start;
-}
-
-static GMimeStream *
-stream_substream(GMimeStream * stream, gint64 start, gint64 end)
-{
- GMimeStreamGvfs *gvfs;
-
- gvfs = g_object_new(GMIME_TYPE_STREAM_GVFS, NULL);
- g_mime_stream_construct(GMIME_STREAM(gvfs), start, end);
- gvfs->handle = GMIME_STREAM_GVFS(stream)->handle;
- gvfs->owner = FALSE;
- gvfs->eos = FALSE;
-
- return (GMimeStream *) gvfs;
-}
-
-
-/**
- * g_mime_stream_gvfs_new:
- * @handle: Gnome VFS handle
- *
- * Creates a new GMimeStreamGvfs object around @handle.
- *
- * Returns a stream using @handle.
- **/
-GMimeStream *
-g_mime_stream_gvfs_new(GnomeVFSHandle * handle)
-{
- GMimeStreamGvfs *gvfs;
- GnomeVFSFileSize start;
-
- if (gnome_vfs_tell(handle, &start) != GNOME_VFS_OK)
- start = 0;
-
- gvfs = g_object_new(GMIME_TYPE_STREAM_GVFS, NULL);
- g_mime_stream_construct(GMIME_STREAM(gvfs), (gint64) start, -1);
- gvfs->owner = TRUE;
- gvfs->eos = FALSE;
- gvfs->handle = handle;
-
- return (GMimeStream *) gvfs;
-}
-
-
-/**
- * g_mime_stream_gvfs_new_with_bounds:
- * @handle: Gnome VFS handle
- * @start: start boundary
- * @end: end boundary
- *
- * Creates a new GMimeStreamGvfs object around @handle with bounds @start
- * and @end.
- *
- * Returns a stream using @handle with bounds @start and @end.
- **/
-GMimeStream *
-g_mime_stream_gvfs_new_with_bounds(GnomeVFSHandle * handle, gint64 start, gint64 end)
-{
- GMimeStreamGvfs *gvfs;
-
- gvfs = g_object_new(GMIME_TYPE_STREAM_GVFS, NULL);
- g_mime_stream_construct(GMIME_STREAM(gvfs), start, end);
- gvfs->owner = TRUE;
- gvfs->eos = FALSE;
- gvfs->handle = handle;
-
- return (GMimeStream *) gvfs;
-}
-
-
-/**
- * g_mime_stream_gvfs_get_owner:
- * @stream: gvfs stream
- *
- * Gets whether or not @stream owns the backend file descriptor.
- *
- * Returns %TRUE if @stream owns the backend file descriptor or %FALSE
- * otherwise.
- **/
-gboolean
-g_mime_stream_gvfs_get_owner(GMimeStreamGvfs * stream)
-{
- g_return_val_if_fail(GMIME_IS_STREAM_GVFS(stream), FALSE);
-
- return stream->owner;
-}
-
-
-/**
- * g_mime_stream_gvfs_set_owner:
- * @stream: gvfs stream
- * @owner: owner
- *
- * Sets whether or not @stream owns the backend GVFS pointer.
- *
- * Note: @owner should be %TRUE if the stream should close() the
- * backend file descriptor when destroyed or %FALSE otherwise.
- **/
-void
-g_mime_stream_gvfs_set_owner(GMimeStreamGvfs * stream, gboolean owner)
-{
- g_return_if_fail(GMIME_IS_STREAM_GVFS(stream));
-
- stream->owner = owner;
-}
-
-#endif /* HAVE_GNOME_VFS */
diff --git a/libbalsa/gmime-stream-gnome-vfs.h b/libbalsa/gmime-stream-gnome-vfs.h
deleted file mode 100644
index 0916829..0000000
--- a/libbalsa/gmime-stream-gnome-vfs.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* GMime Gnome VFS stream module
- * Written/Copyright (c) by Albrecht Dreß <albrecht dress arcor de>
- * The basic structure of this file has been shamelessly stolen from the
- * gmime-stream-fs module, written by Jeffrey Stedfast.
- *
- * This library 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.1
- * of the License, or (at your option) any later version.
- *
- * This library 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 this library; if not, write to the Free
- * Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-
-#ifndef __GMIME_STREAM_GVFS_H__
-#define __GMIME_STREAM_GVFS_H__
-
-#ifndef BALSA_VERSION
-# error "Include config.h before this file."
-#endif
-
-/* note: this module will be compiled only if Gnome-Vfs is available */
-#ifdef HAVE_GNOME_VFS
-
-#include <libgnomevfs/gnome-vfs.h>
-#include <gmime/gmime-stream.h>
-
-G_BEGIN_DECLS
-
-#define GMIME_TYPE_STREAM_GVFS (g_mime_stream_gvfs_get_type ())
-#define GMIME_STREAM_GVFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMIME_TYPE_STREAM_GVFS, GMimeStreamGvfs))
-#define GMIME_STREAM_GVFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMIME_TYPE_STREAM_GVFS, GMimeStreamGvfsClass))
-#define GMIME_IS_STREAM_GVFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMIME_TYPE_STREAM_GVFS))
-#define GMIME_IS_STREAM_GVFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMIME_TYPE_STREAM_GVFS))
-#define GMIME_STREAM_GVFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMIME_TYPE_STREAM_GVFS, GMimeStreamGvfsClass))
-
-typedef struct _GMimeStreamGvfs GMimeStreamGvfs;
-typedef struct _GMimeStreamGvfsClass GMimeStreamGvfsClass;
-
-struct _GMimeStreamGvfs {
- GMimeStream parent_object;
-
- gboolean owner;
- gboolean eos;
- GnomeVFSHandle *handle;
-};
-
-struct _GMimeStreamGvfsClass {
- GMimeStreamClass parent_class;
-};
-
-
-GType g_mime_stream_gvfs_get_type(void);
-
-GMimeStream *g_mime_stream_gvfs_new(GnomeVFSHandle * handle);
-GMimeStream *g_mime_stream_gvfs_new_with_bounds(GnomeVFSHandle * handle,
- gint64 start,
- gint64 end);
-
-gboolean g_mime_stream_gvfs_get_owner(GMimeStreamGvfs * stream);
-void g_mime_stream_gvfs_set_owner(GMimeStreamGvfs * stream,
- gboolean owner);
-
-G_END_DECLS
-
-#endif /* HAVE_GNOME_VFS */
-
-#endif /* __GMIME_STREAM_GVFS_H__ */
diff --git a/libbalsa/html.c b/libbalsa/html.c
index b16249f..81b1acf 100644
--- a/libbalsa/html.c
+++ b/libbalsa/html.c
@@ -480,79 +480,6 @@ libbalsa_html_copy(GtkWidget * widget)
gtk_html_copy(GTK_HTML(widget));
}
-/*
- * GtkHTML printing suport.
- */
-
-#if defined(HAVE_GNOME) && !defined(HAVE_GTK_PRINT)
-#if !defined(HAVE_GTKHTML3_GTKPRINT)
-gboolean
-libbalsa_html_can_print(void)
-{
- return TRUE;
-}
-/*
- * Print the page(s) in the widget with a header and a footer.
- */
-void
-libbalsa_html_print(GtkWidget * widget,
- GnomePrintContext * print_context,
- gdouble header_height, gdouble footer_height,
- LibBalsaHTMLPrintCallback header_print,
- LibBalsaHTMLPrintCallback footer_print,
- gpointer user_data)
-{
- gtk_html_print_with_header_footer(GTK_HTML(widget), print_context,
- header_height, footer_height,
- (GtkHTMLPrintCallback) header_print,
- (GtkHTMLPrintCallback) footer_print,
- user_data);
-}
-
-/*
- * Return the number of pages that will be printed.
- */
-gint
-libbalsa_html_print_get_pages_num(GtkWidget * widget,
- GnomePrintContext * print_context,
- gdouble header_height,
- gdouble footer_height)
-{
- return gtk_html_print_get_pages_num(GTK_HTML(widget), print_context,
- header_height, footer_height);
-}
-#else /* HAVE_GTKHTML3_GTKPRINT */
-gboolean
-libbalsa_html_can_print(void)
-{
- return FALSE;
-}
-/*
- * Print the page(s) in the widget with a header and a footer.
- */
-void
-libbalsa_html_print(GtkWidget * widget,
- GnomePrintContext * print_context,
- gdouble header_height, gdouble footer_height,
- LibBalsaHTMLPrintCallback header_print,
- LibBalsaHTMLPrintCallback footer_print,
- gpointer user_data)
-{
-}
-
-/*
- * Return the number of pages that will be printed.
- */
-gint
-libbalsa_html_print_get_pages_num(GtkWidget * widget,
- GnomePrintContext * print_context,
- gdouble header_height,
- gdouble footer_height)
-{
- return 0;
-}
-#endif /* HAVE_GTKHTML3_GTKPRINT */
-#endif /* defined(HAVE_GNOME) && !defined(HAVE_GTK_PRINT) */
# else /* HAVE_GTKHTML3 */
/* Code for GtkHtml-2 */
@@ -688,42 +615,6 @@ libbalsa_html_copy(GtkWidget * widget)
{
}
-#if defined(HAVE_GNOME) && !defined(HAVE_GTK_PRINT)
-/*
- * HtmlView doesn't support printing.
- */
-gboolean
-libbalsa_html_can_print(void)
-{
- return FALSE;
-}
-
-/*
- * Do nothing.
- */
-void
-libbalsa_html_print(GtkWidget * widget,
- GnomePrintContext * print_context,
- gdouble header_height, gdouble footer_height,
- LibBalsaHTMLPrintCallback header_print,
- LibBalsaHTMLPrintCallback footer_print,
- gpointer user_data)
-{
-}
-
-/*
- * Return nothing.
- */
-gint
-libbalsa_html_print_get_pages_num(GtkWidget * widget,
- GnomePrintContext * print_context,
- gdouble header_height,
- gdouble footer_height)
-{
- return 0;
-}
-#endif /* defined(HAVE_GNOME) && !defined(HAVE_GTK_PRINT) */
-
# endif /* HAVE_GTKHTML3 */
/* Common code for both widgets. */
diff --git a/libbalsa/html.h b/libbalsa/html.h
index 4fcc7b4..1611668 100644
--- a/libbalsa/html.h
+++ b/libbalsa/html.h
@@ -60,30 +60,6 @@ void libbalsa_html_copy(GtkWidget * widget);
guint libbalsa_html_filter(LibBalsaHTMLType html_type, gchar ** text,
guint len);
-#if defined(HAVE_GNOME) && !defined(HAVE_GTK_PRINT)
-
-# include <libgnomeprint/gnome-print.h>
-
-gboolean libbalsa_html_can_print(void);
-typedef void (*LibBalsaHTMLPrintCallback) (GtkWidget * widget,
- GnomePrintContext *
- print_context, gdouble x,
- gdouble y, gdouble width,
- gdouble height,
- gpointer user_data);
-void libbalsa_html_print(GtkWidget * widget,
- GnomePrintContext * print_context,
- gdouble header_height, gdouble footer_height,
- LibBalsaHTMLPrintCallback header_print,
- LibBalsaHTMLPrintCallback footer_print,
- gpointer user_data);
-gint libbalsa_html_print_get_pages_num(GtkWidget * widget,
- GnomePrintContext * print_context,
- gdouble header_height,
- gdouble footer_height);
-
-#endif /* defined(HAVE_GNOME) && !defined(HAVE_GTK_PRINT) */
-
# endif /* HAVE_GTKHTML */
LibBalsaHTMLType libbalsa_html_type(const gchar * mime_type);
diff --git a/libbalsa/identity.c b/libbalsa/identity.c
index a480d5d..334a276 100644
--- a/libbalsa/identity.c
+++ b/libbalsa/identity.c
@@ -33,12 +33,6 @@
#include <glib/gi18n.h>
#include "misc.h"
-#if !GTK_CHECK_VERSION(2, 14, 0)
-#ifdef HAVE_GNOME
-#include <gnome.h>
-#endif
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
-
#if ENABLE_ESMTP
#include <string.h>
#include "smtp-server.h"
@@ -1666,22 +1660,16 @@ delete_ident_response(GtkWidget * confirm, gint response,
static void
help_ident_cb(void)
{
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
GError *err = NULL;
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, "ghelp:balsa?identities",
gtk_get_current_event_time(), &err);
-#else /* GTK_CHECK_VERSION(2, 14, 0) */
- gnome_help_display("balsa", "identities", &err);
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
if (err) {
g_print(_("Error displaying help for identities: %s\n"),
err->message);
g_error_free(err);
}
-#endif
}
/* libbalsa_identity_config_dialog displays an identity management
diff --git a/libbalsa/libbalsa-conf.c b/libbalsa/libbalsa-conf.c
index 47520fd..6441037 100644
--- a/libbalsa/libbalsa-conf.c
+++ b/libbalsa/libbalsa-conf.c
@@ -41,9 +41,6 @@
typedef struct {
GKeyFile *key_file;
gchar *path;
-#if !GLIB_CHECK_VERSION(2, 7, 0)
- gchar *new_path;
-#endif /* !GLIB_CHECK_VERSION(2, 7, 0) */
guint changes;
time_t mtime;
} LibBalsaConf;
@@ -97,9 +94,6 @@ lbc_init(LibBalsaConf * conf, const gchar * filename,
} else
conf->key_file = g_key_file_new();
-#if !GLIB_CHECK_VERSION(2, 7, 0)
- conf->new_path = g_strconcat(conf->path, ".new", NULL);
-#endif /* !GLIB_CHECK_VERSION(2, 7, 0) */
libbalsa_assure_balsa_dir();
if (!g_key_file_load_from_file
(conf->key_file, conf->path, G_KEY_FILE_NONE, &error)) {
@@ -360,19 +354,9 @@ libbalsa_conf_get_double_with_default_(const char *path,
GError *error = NULL;
key = lbc_get_key(path, &defval);
-#if GLIB_CHECK_VERSION(2, 12, 0)
retval =
g_key_file_get_double(LBC_KEY_FILE(priv), lbc_groups->data, key,
&error);
-#else
- {
- gchar *s =
- g_key_file_get_string(LBC_KEY_FILE(priv), lbc_groups->data, key,
- &error);
- retval = atof(s);
- g_free(s);
- }
-#endif
g_free(key);
if (error) {
g_error_free(error);
@@ -397,15 +381,8 @@ libbalsa_conf_set_int_(const char *path, int value, gboolean priv)
void
libbalsa_conf_set_double_(const char *path, double value, gboolean priv)
{
-#if GLIB_CHECK_VERSION(2, 12, 0)
g_key_file_set_double(LBC_KEY_FILE(priv), lbc_groups->data, path,
value);
-#else
- char buffer[20];
- snprintf(buffer, sizeof(buffer), "%19g", value);
- g_key_file_set_string(LBC_KEY_FILE(priv), lbc_groups->data, path,
- buffer);
-#endif
LBC_CHANGED(priv);
}
@@ -477,10 +454,6 @@ lbc_drop_all(LibBalsaConf * conf)
conf->key_file = NULL;
g_free(conf->path);
conf->path = NULL;
-#if !GLIB_CHECK_VERSION(2, 7, 0)
- g_free(conf->new_path);
- conf->new_path = NULL;
-#endif /* !GLIB_CHECK_VERSION(2, 7, 0) */
conf->changes = 0;
}
@@ -500,9 +473,6 @@ lbc_sync(LibBalsaConf * conf)
gchar *buf;
gsize len;
GError *error = NULL;
-#if !GLIB_CHECK_VERSION(2, 7, 0)
- gint fd;
-#endif /* !GLIB_CHECK_VERSION(2, 7, 0) */
if (!conf->changes)
return;
@@ -527,7 +497,6 @@ lbc_sync(LibBalsaConf * conf)
return;
}
-#if GLIB_CHECK_VERSION(2, 7, 0)
if (!g_file_set_contents(conf->path, buf, len, &error)) {
if (error) {
#if DEBUG
@@ -544,50 +513,6 @@ lbc_sync(LibBalsaConf * conf)
}
g_free(buf);
-#else /* GLIB_CHECK_VERSION(2, 7, 0) */
- fd = g_open(conf->new_path, O_WRONLY | O_CREAT | O_TRUNC,
- S_IRUSR | S_IWUSR);
- if (fd < 0) {
-#if DEBUG
- g_message("Failed to open temporary config file \"%s\"\n"
- " changes not saved", conf->new_path);
-#endif /* DEBUG */
- g_free(buf);
- return;
- }
-
- if (write(fd, buf, len) < (gssize) len) {
-#if DEBUG
- g_message("Failed to write temporary config file \"%s\"\n"
- " changes not saved", conf->new_path);
-#endif /* DEBUG */
- close(fd);
- g_unlink(conf->new_path);
- g_free(buf);
- return;
- }
- close(fd);
- g_free(buf);
-
- if (g_unlink(conf->path) < 0
- && g_file_error_from_errno(errno) != G_FILE_ERROR_NOENT) {
-#if DEBUG
- g_message("Failed to unlink config file \"%s\"\n"
- " new config file saved as \"%s\"", conf->path,
- conf->new_path);
- perror("Config");
-#endif /* DEBUG */
- return;
- }
-
- if (g_rename(conf->new_path, conf->path) < 0) {
-#if DEBUG
- g_message("Failed to rename temporary config file \"%s\"\n",
- conf->new_path);
-#endif /* DEBUG */
- return;
- }
-#endif /* GLIB_CHECK_VERSION(2, 7, 0) */
}
void
diff --git a/libbalsa/libbalsa-vfs.c b/libbalsa/libbalsa-vfs.c
index 8f132e9..8313044 100644
--- a/libbalsa/libbalsa-vfs.c
+++ b/libbalsa/libbalsa-vfs.c
@@ -36,14 +36,8 @@
#include "libbalsa.h"
#include "misc.h"
-#if HAVE_GIO
-# include <gio/gio.h>
-# include "gmime-stream-gio.h"
-#elif HAVE_GNOME_VFS
-# include <libgnomevfs/gnome-vfs.h>
-# include <libgnomevfs/gnome-vfs-mime-handlers.h>
-# include "gmime-stream-gnome-vfs.h"
-#endif
+#include <gio/gio.h>
+#include "gmime-stream-gio.h"
#define LIBBALSA_VFS_ERROR_QUARK (g_quark_from_static_string("libbalsa-vfs"))
@@ -51,13 +45,11 @@
#define LIBBALSA_VFS_MIME_ACTION "mime_action"
-#if HAVE_GIO
#define GIO_INFO_ATTS \
G_FILE_ATTRIBUTE_STANDARD_TYPE "," \
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," \
G_FILE_ATTRIBUTE_STANDARD_SIZE "," \
"access::*"
-#endif
struct _LibbalsaVfsPriv {
@@ -67,15 +59,8 @@ struct _LibbalsaVfsPriv {
gchar * mime_type;
gchar * charset;
LibBalsaTextAttribute text_attr;
-#if HAVE_GIO
GFile * gio_gfile;
GFileInfo * info;
-#elif HAVE_GNOME_VFS
- GnomeVFSURI * gvfs_uri;
- GnomeVFSFileInfo * info;
-#else
- gchar * local_name;
-#endif
};
@@ -90,11 +75,7 @@ static void libbalsa_vfs_finalize(LibbalsaVfs * self);
gboolean
libbalsa_vfs_local_only(void)
{
-#if (HAVE_GIO || HAVE_GNOME_VFS)
return FALSE;
-#else
- return TRUE;
-#endif
}
@@ -158,19 +139,10 @@ libbalsa_vfs_finalize(LibbalsaVfs * self)
g_free(priv->folder_uri);
g_free(priv->mime_type);
g_free(priv->charset);
-#if HAVE_GIO
if (priv->gio_gfile)
g_object_unref(priv->gio_gfile);
if (priv->info)
g_object_unref(priv->info);
-#elif HAVE_GNOME_VFS
- if (priv->gvfs_uri)
- gnome_vfs_uri_unref(priv->gvfs_uri);
- if (priv->info)
- gnome_vfs_file_info_unref(priv->info);
-#else
- g_free(priv->local_name);
-#endif
g_free(priv);
}
@@ -201,15 +173,7 @@ libbalsa_vfs_new_from_uri(const gchar * uri)
retval->priv->text_attr = (LibBalsaTextAttribute) -1;
retval->priv->file_uri = g_strdup(uri);
-#if HAVE_GIO
retval->priv->gio_gfile = g_file_new_for_uri(uri);
-#elif HAVE_GNOME_VFS
- retval->priv->gvfs_uri = gnome_vfs_uri_new(uri);
- if (!retval->priv->gvfs_uri)
- g_message(_("Failed to convert %s to a Gnome VFS URI"), uri);
-#else
- retval->priv->local_name = g_filename_from_uri(uri, NULL, NULL);
-#endif
return retval;
}
@@ -373,7 +337,6 @@ libbalsa_vfs_get_mime_type(const LibbalsaVfs * file)
g_return_val_if_fail(priv->file_uri, NULL);
if (!priv->mime_type) {
-#if HAVE_GIO
/* use GIO to determine the mime type of the file */
g_return_val_if_fail(priv->gio_gfile, FALSE);
@@ -385,25 +348,6 @@ libbalsa_vfs_get_mime_type(const LibbalsaVfs * file)
priv->mime_type =
g_strdup(g_file_info_get_attribute_string(priv->info,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE));
-#elif HAVE_GNOME_VFS
- /* use GnomeVFS to determine the mime type of the file */
- g_return_val_if_fail(priv->gvfs_uri, FALSE);
-
- if (!priv->info)
- priv->info = gnome_vfs_file_info_new();
-
- if (priv->info) {
- if ((priv->info->valid_fields &
- GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) == 0)
- gnome_vfs_get_file_info_uri(priv->gvfs_uri, priv->info,
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
- GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if ((priv->info->valid_fields &
- GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) != 0)
- priv->mime_type = g_strdup(gnome_vfs_file_info_get_mime_type(priv->info));
- }
-#endif
/* always fall back to application/octet-stream */
if (!priv->mime_type)
@@ -448,7 +392,6 @@ libbalsa_vfs_get_text_attr(const LibbalsaVfs * file)
g_return_val_if_fail(priv->file_uri, 0);
if (priv->text_attr == (LibBalsaTextAttribute) -1) {
-#if HAVE_GIO
GInputStream * stream;
/* use GIO to determine the text attributes of the file */
@@ -513,75 +456,6 @@ libbalsa_vfs_get_text_attr(const LibbalsaVfs * file)
if (is_utf8 && has_hi_bit)
priv->text_attr |= LIBBALSA_TEXT_HI_UTF8;
}
-#elif HAVE_GNOME_VFS
- GnomeVFSHandle *handle;
-
- /* use GnomeVFS to determine the text attributes of the file */
- g_return_val_if_fail(priv->gvfs_uri, 0);
- priv->text_attr = 0;
-
- /* read and check - see libbalsa_text_attr_file() */
- if (gnome_vfs_open_uri(&handle, priv->gvfs_uri, GNOME_VFS_OPEN_READ) ==
- GNOME_VFS_OK) {
- gchar buf[1024];
- gchar *new_chars = buf;
- gboolean has_esc = FALSE;
- gboolean has_hi_bit = FALSE;
- gboolean has_hi_ctrl = FALSE;
- gboolean is_utf8 = TRUE;
- GnomeVFSFileSize bytes_read;
-
- while ((is_utf8 || (!has_esc || !has_hi_bit || !has_hi_ctrl)) &&
- gnome_vfs_read(handle, new_chars, (sizeof buf) - (new_chars - buf) - 1,
- &bytes_read) == GNOME_VFS_OK) {
- new_chars[bytes_read] = '\0';
-
- if (!has_esc || !has_hi_bit || !has_hi_ctrl) {
- guchar * p;
-
- for (p = (guchar *) new_chars; *p; p++)
- if (*p == 0x1b)
- has_esc = TRUE;
- else if (*p >= 0x80) {
- has_hi_bit = TRUE;
- if (*p <= 0x9f)
- has_hi_ctrl = TRUE;
- }
- }
-
- if (is_utf8) {
- const gchar *end;
-
- new_chars = buf;
- if (!g_utf8_validate(buf, -1, &end)) {
- if (g_utf8_get_char_validated(end, -1) == (gunichar) (-1))
- is_utf8 = FALSE;
- else
- /* copy any remaining bytes, including the
- * terminating '\0', to start of buffer */
- while ((*new_chars = *end++) != '\0')
- new_chars++;
- }
- }
- }
-
- gnome_vfs_close(handle);
-
- if (has_esc)
- priv->text_attr |= LIBBALSA_TEXT_ESC;
- if (has_hi_bit)
- priv->text_attr |= LIBBALSA_TEXT_HI_BIT;
- if (has_hi_ctrl)
- priv->text_attr |= LIBBALSA_TEXT_HI_CTRL;
- if (is_utf8 && has_hi_bit)
- priv->text_attr |= LIBBALSA_TEXT_HI_UTF8;
- }
-#else
- /* use function from misc to get the text attributes */
- g_return_val_if_fail(priv->local_name, 0);
-
- priv->text_attr = libbalsa_text_attr_file(priv->local_name);
-#endif
}
return priv->text_attr;
@@ -591,9 +465,6 @@ libbalsa_vfs_get_text_attr(const LibbalsaVfs * file)
gsize
libbalsa_vfs_get_size(const LibbalsaVfs * file)
{
-#if (!defined(HAVE_GIO) && !defined(HAVE_GNOME_VFS))
- struct stat s;
-#endif
gsize retval = 0;
struct _LibbalsaVfsPriv * priv;
@@ -602,7 +473,6 @@ libbalsa_vfs_get_size(const LibbalsaVfs * file)
priv = file->priv;
g_return_val_if_fail(priv->file_uri, 0);
-#if HAVE_GIO
/* use GIO to determine the size of the file */
g_return_val_if_fail(priv->gio_gfile, 0);
@@ -614,30 +484,6 @@ libbalsa_vfs_get_size(const LibbalsaVfs * file)
retval =
(gsize) g_file_info_get_attribute_uint64(priv->info,
G_FILE_ATTRIBUTE_STANDARD_SIZE);
-#elif HAVE_GNOME_VFS
- /* use GnomeVFS to determine the size of the file */
- g_return_val_if_fail(priv->gvfs_uri, 0);
-
- if (!priv->info)
- priv->info = gnome_vfs_file_info_new();
-
- if (priv->info) {
- if ((priv->info->valid_fields &
- GNOME_VFS_FILE_INFO_FIELDS_SIZE) == 0)
- gnome_vfs_get_file_info_uri(priv->gvfs_uri, priv->info,
- GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if ((priv->info->valid_fields &
- GNOME_VFS_FILE_INFO_FIELDS_SIZE) != 0)
- retval = (gsize) priv->info->size;
- }
-#else
- /* call stat on the file to get the size */
- g_return_val_if_fail(priv->local_name, 0);
-
- if (g_stat(priv->local_name, &s) == 0)
- retval = (gsize) s.st_size;
-#endif
return retval;
}
@@ -649,15 +495,6 @@ GMimeStream *
libbalsa_vfs_create_stream(const LibbalsaVfs * file, mode_t mode,
gboolean rdwr, GError ** err)
{
-#if HAVE_GIO
-#elif HAVE_GNOME_VFS
- GnomeVFSOpenMode openmode = GNOME_VFS_OPEN_RANDOM | GNOME_VFS_OPEN_READ;
- GnomeVFSHandle * handle;
- GnomeVFSResult result;
-#else
- int fd;
- int flags = O_EXCL;
-#endif
struct _LibbalsaVfsPriv * priv;
g_return_val_if_fail(file, NULL);
@@ -665,43 +502,10 @@ libbalsa_vfs_create_stream(const LibbalsaVfs * file, mode_t mode,
priv = file->priv;
g_return_val_if_fail(priv->file_uri, NULL);
-#if HAVE_GIO
/* use GIO to create a GMime stream */
g_return_val_if_fail(priv->gio_gfile, NULL);
return g_mime_stream_gio_new(priv->gio_gfile);
-#elif HAVE_GNOME_VFS
- /* use GnomeVFS to create a GMime stream */
- g_return_val_if_fail(priv->gvfs_uri, NULL);
-
- if (rdwr) {
- openmode |= GNOME_VFS_OPEN_WRITE;
- result = gnome_vfs_create_uri(&handle, priv->gvfs_uri,
- openmode, TRUE, mode);
- } else
- result = gnome_vfs_open_uri(&handle, priv->gvfs_uri, openmode);
- if (result != GNOME_VFS_OK) {
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, result,
- "%s", gnome_vfs_result_to_string(result));
- return NULL;
- }
-
- return g_mime_stream_gvfs_new(handle);
-#else
- /* use libc to create a GMime file system stream */
- g_return_val_if_fail(priv->local_name, NULL);
-
- flags |= rdwr ? O_CREAT | O_RDWR : O_RDONLY;
-
-#ifdef O_NOFOLLOW
- flags |= O_NOFOLLOW;
-#endif
-
- if ((fd = libbalsa_safe_open(priv->local_name, flags, mode, err)) < 0)
- return NULL;
-
- return g_mime_stream_fs_new(fd);
-#endif
}
@@ -717,7 +521,6 @@ libbalsa_vfs_file_exists(const LibbalsaVfs * file)
priv = file->priv;
g_return_val_if_fail(priv->file_uri, FALSE);
-#if HAVE_GIO
/* use GIO to get the file's attributes - fails if the file does not exist */
g_return_val_if_fail(priv->gio_gfile, 0);
@@ -726,29 +529,6 @@ libbalsa_vfs_file_exists(const LibbalsaVfs * file)
g_file_query_info(priv->gio_gfile, GIO_INFO_ATTS,
G_FILE_QUERY_INFO_NONE, NULL, NULL);
result = priv->info != NULL;
-#elif HAVE_GNOME_VFS
- /* use GnomeVFS to check if the file exists */
- g_return_val_if_fail(priv->gvfs_uri, FALSE);
-
- if (!priv->info)
- priv->info = gnome_vfs_file_info_new();
-
- if (priv->info) {
- if ((priv->info->valid_fields &
- GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS) == 0)
- gnome_vfs_get_file_info_uri(priv->gvfs_uri, priv->info,
- GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if ((priv->info->valid_fields &
- GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS))
- result = TRUE;
- }
-#else
- /* use g_access to check if the (local) file exists */
- g_return_val_if_fail(priv->local_name, FALSE);
-
- result = (g_access(priv->local_name, F_OK) == 0);
-#endif
return result;
}
@@ -757,9 +537,6 @@ libbalsa_vfs_file_exists(const LibbalsaVfs * file)
gboolean
libbalsa_vfs_is_regular_file(const LibbalsaVfs * file, GError **err)
{
-#if (!defined(HAVE_GIO) && !defined(HAVE_GNOME_VFS))
- struct stat s;
-#endif
gboolean result = FALSE;
struct _LibbalsaVfsPriv * priv;
@@ -768,7 +545,6 @@ libbalsa_vfs_is_regular_file(const LibbalsaVfs * file, GError **err)
priv = file->priv;
g_return_val_if_fail(priv->file_uri, FALSE);
-#if HAVE_GIO
/* use GIO to check if the file is a regular one which can be read */
g_return_val_if_fail(priv->gio_gfile, 0);
@@ -792,51 +568,6 @@ libbalsa_vfs_is_regular_file(const LibbalsaVfs * file, GError **err)
} else
result = TRUE;
}
-#elif HAVE_GNOME_VFS
- /* use GnomeVFS to check if the file is a regular one which can be read */
- g_return_val_if_fail(priv->gvfs_uri, FALSE);
-
- if (!priv->info)
- priv->info = gnome_vfs_file_info_new();
-
- if (priv->info) {
- if ((priv->info->valid_fields &
- (GNOME_VFS_FILE_INFO_FIELDS_TYPE |
- GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS)) == 0)
- gnome_vfs_get_file_info_uri(priv->gvfs_uri, priv->info,
- GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if ((priv->info->valid_fields &
- (GNOME_VFS_FILE_INFO_FIELDS_TYPE |
- GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS)) !=
- (GNOME_VFS_FILE_INFO_FIELDS_TYPE |
- GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS))
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, -1,
- _("cannot read file information"));
- else if (priv->info->type != GNOME_VFS_FILE_TYPE_REGULAR)
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, -1,
- _("not a regular file"));
- else if ((priv->info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_ACCESS) &&
- !(priv->info->permissions & GNOME_VFS_PERM_ACCESS_READABLE))
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, -1, _("cannot read"));
- else
- result = TRUE;
- } else
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, -1, _("cannot access file"));
-#else
- /* use libc to check if the file is a regular one which can be read */
- g_return_val_if_fail(priv->local_name, FALSE);
-
- if (g_stat(priv->local_name, &s) != 0)
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, errno,
- g_strerror(errno));
- else if (!S_ISREG(s.st_mode))
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, -1, _("not a regular file"));
- else if (g_access(priv->local_name, R_OK) != 0)
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, -1, _("cannot read"));
- else
- result = TRUE;
-#endif
return result;
}
@@ -846,9 +577,6 @@ libbalsa_vfs_is_regular_file(const LibbalsaVfs * file, GError **err)
gint
libbalsa_vfs_file_unlink(const LibbalsaVfs * file, GError **err)
{
-#ifdef HAVE_GNOME_VFS
- GnomeVFSResult vfs_res;
-#endif
gint result = -1;
struct _LibbalsaVfsPriv * priv;
@@ -857,29 +585,10 @@ libbalsa_vfs_file_unlink(const LibbalsaVfs * file, GError **err)
priv = file->priv;
g_return_val_if_fail(priv->file_uri, -1);
-#if HAVE_GIO
/* use GIO to delete the file */
g_return_val_if_fail(priv->gio_gfile, -1);
if (g_file_delete(priv->gio_gfile, NULL, err))
result = 0;
-#elif HAVE_GNOME_VFS
- /* use GnomeVFS to unlink the file */
- g_return_val_if_fail(priv->gvfs_uri, -1);
-
- if ((vfs_res = gnome_vfs_unlink_from_uri(priv->gvfs_uri)) != GNOME_VFS_OK)
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, vfs_res,
- "%s", gnome_vfs_result_to_string(vfs_res));
- else
- result = 0;
-#else
- /* use g_unlink to unlink the (local) file */
- g_return_val_if_fail(priv->local_name, -1);
-
- result = g_unlink(priv->local_name);
- if (result != 0)
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, errno,
- g_strerror(errno));
-#endif
return result;
}
@@ -888,22 +597,13 @@ libbalsa_vfs_file_unlink(const LibbalsaVfs * file, GError **err)
gboolean
libbalsa_vfs_launch_app(const LibbalsaVfs * file, GObject * object, GError **err)
{
-#if HAVE_GIO
GAppInfo *app;
GList * args;
gboolean result;
-#elif HAVE_GNOME_VFS
- gchar *id;
- GnomeVFSMimeApplication *app;
- GnomeVFSResult gvfs_result;
- GList *uris;
-#endif
g_return_val_if_fail(file != NULL, FALSE);
g_return_val_if_fail(object != NULL, FALSE);
-#if HAVE_GIO /* -- launch the requested application using GIO */
-
app = G_APP_INFO(g_object_get_data(object, LIBBALSA_VFS_MIME_ACTION));
if (!app) {
g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, -1,
@@ -914,40 +614,6 @@ libbalsa_vfs_launch_app(const LibbalsaVfs * file, GObject * object, GError **err
result = g_app_info_launch(app, args, NULL, err);
g_list_free(args);
return result;
-
-#elif HAVE_GNOME_VFS /* -- launch the requested application using Gnome-VFS -- */
-
- id = (gchar *) g_object_get_data(object, LIBBALSA_VFS_MIME_ACTION);
- if (!id) {
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, -1,
- _("Cannot launch, missing application"));
- return FALSE;
- }
-#if HAVE_GNOME_VFS29
- app = gnome_vfs_mime_application_new_from_desktop_id(id);
-#else /* HAVE_GNOME_VFS29 */
- app = gnome_vfs_mime_application_new_from_id(id);
-#endif /* HAVE_GNOME_VFS29 */
- if (!app) {
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, -1,
- _("Cannot find application for id %s"), id);
- return FALSE;
- }
-
- uris = g_list_prepend(NULL, file->priv->file_uri);
- gvfs_result = gnome_vfs_mime_application_launch(app, uris);
- g_list_free(uris);
- if (gvfs_result != GNOME_VFS_OK)
- g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, -1,
- _("Cannot launch %s: %s"), app->name,
- gnome_vfs_result_to_string(gvfs_result));
- return gvfs_result == GNOME_VFS_OK;
-
-#else /* -- no GIO or Gnome-VFS support -- */
-
- return FALSE;
-
-#endif
}
@@ -980,43 +646,28 @@ libbalsa_vfs_content_description(const gchar * mime_type)
{
g_return_val_if_fail(mime_type != NULL, NULL);
-#if HAVE_GIO
return g_content_type_get_description(mime_type);
-#elif HAVE_GNOME_VFS
- return g_strdup(gnome_vfs_mime_get_description(mime_type));
-#else
- return NULL;
-#endif
}
gchar *
libbalsa_vfs_content_type_of_buffer(const guchar * buffer,
gsize length)
{
-#if HAVE_GIO
gchar * retval;
gboolean content_uncertain;
-#endif
g_return_val_if_fail(buffer != NULL, NULL);
g_return_val_if_fail(length > 0, NULL);
-#if HAVE_GIO
retval = g_content_type_guess(NULL, buffer, length, &content_uncertain);
if (content_uncertain) {
g_free(retval);
retval = g_strdup("application/octet-stream");
}
return retval;
-#elif HAVE_GNOME_VFS
- return g_strdup(gnome_vfs_get_mime_type_for_data(buffer, length));
-#else
- return g_strdup("application/octet-stream");
-#endif
}
-#ifdef HAVE_GIO
static void
gio_add_vfs_menu_item(GtkMenu * menu, GAppInfo *app, GCallback callback,
gpointer data)
@@ -1032,21 +683,6 @@ gio_add_vfs_menu_item(GtkMenu * menu, GAppInfo *app, GCallback callback,
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
g_free(menu_label);
}
-#elif HAVE_GNOME_VFS
-static void
-gvfs_add_vfs_menu_item(GtkMenu * menu, const GnomeVFSMimeApplication *app,
- GCallback callback, gpointer data)
-{
- gchar *menu_label = g_strdup_printf(_("Open with %s"), app->name);
- GtkWidget *menu_item = gtk_menu_item_new_with_label (menu_label);
-
- g_object_set_data_full(G_OBJECT (menu_item), LIBBALSA_VFS_MIME_ACTION,
- g_strdup(app->id), g_free);
- g_signal_connect(G_OBJECT (menu_item), "activate", callback, data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
- g_free (menu_label);
-}
-#endif
/* fill the passed menu with vfs items */
@@ -1055,7 +691,6 @@ libbalsa_vfs_fill_menu_by_content_type(GtkMenu * menu,
const gchar * content_type,
GCallback callback, gpointer data)
{
-#if HAVE_GIO
GList* list;
GAppInfo *def_app;
GList *app_list;
@@ -1079,27 +714,6 @@ libbalsa_vfs_fill_menu_by_content_type(GtkMenu * menu,
g_list_foreach(app_list, (GFunc) g_object_unref, NULL);
g_list_free(app_list);
}
-#elif HAVE_GNOME_VFS
- GList* list;
- GnomeVFSMimeApplication *def_app;
- GList *app_list;
-
- g_return_if_fail(data != NULL);
-
- if((def_app=gnome_vfs_mime_get_default_application(content_type)))
- gvfs_add_vfs_menu_item(menu, def_app, callback, data);
-
- app_list = gnome_vfs_mime_get_all_applications(content_type);
- for (list = app_list; list; list = g_list_next(list)) {
- GnomeVFSMimeApplication *app = (GnomeVFSMimeApplication *) list->data;
-
- if (app && (!def_app || strcmp(app->name, def_app->name) != 0))
- gvfs_add_vfs_menu_item(menu, app, callback, data);
- }
- gnome_vfs_mime_application_free(def_app);
-
- gnome_vfs_mime_application_list_free (app_list);
-#endif /* HAVE_GNOME_VFS */
}
GtkWidget *
@@ -1108,7 +722,6 @@ libbalsa_vfs_mime_button(LibBalsaMessageBody * mime_body,
GCallback callback, gpointer data)
{
GtkWidget *button = NULL;
-#if HAVE_GIO
gchar *msg;
GAppInfo *app = g_app_info_get_default_for_type(content_type, FALSE);
@@ -1122,23 +735,6 @@ libbalsa_vfs_mime_button(LibBalsaMessageBody * mime_body,
g_signal_connect(G_OBJECT(button), "clicked",
callback, data);
}
-#elif HAVE_GNOME_VFS
- gchar *msg;
- GnomeVFSMimeApplication *app =
- gnome_vfs_mime_get_default_application(content_type);
-
- if (app) {
- msg = g_strdup_printf(_("Open _part with %s"), app->name);
- button = gtk_button_new_with_mnemonic(msg);
- g_object_set_data_full(G_OBJECT(button), LIBBALSA_VFS_MIME_ACTION,
- (gpointer) g_strdup(app->id), g_free);
- g_free(msg);
- gnome_vfs_mime_application_free(app);
-
- g_signal_connect(G_OBJECT(button), "clicked",
- callback, data);
- }
-#endif
return button;
}
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index 7ee9b6f..9c6110a 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -2869,39 +2869,8 @@ mbox_model_get_value(GtkTreeModel *tree_model,
g_value_set_uint(value, msgno);
return;
}
- /* gtk2-2.3.5 can in principle do it but we want to be sure.
- */
g_return_if_fail(msgno<=libbalsa_mailbox_total_messages(lmm));
- /* With gtk-2.8.0, we can finally use fixed-row-height model
- without workarounds. */
-#if GTK_CHECK_VERSION(2,8,0)
msg = lbm_get_index_entry(lmm, (GNode *) iter->user_data);
-#else
- { GdkRectangle a, b, c, d;
- /* assumed that only one view is showing the mailbox */
- GtkTreeView *tree = g_object_get_data(G_OBJECT(tree_model), "tree-view");
-
- if (GTK_WIDGET_REALIZED(GTK_WIDGET(tree))) {
- GtkTreePath *path;
- GtkTreeViewColumn *col;
-
- path = gtk_tree_model_get_path(tree_model, iter);
- col = gtk_tree_view_get_column(tree, ((column == LB_MBOX_WEIGHT_COL
- || column == LB_MBOX_STYLE_COL)
- ? LB_MBOX_FROM_COL : column));
- gtk_tree_view_get_visible_rect(tree, &a);
- gtk_tree_view_get_cell_area(tree, path, col, &b);
- gtk_tree_view_widget_to_tree_coords(tree, b.x, b.y, &c.x, &c.y);
- gtk_tree_view_widget_to_tree_coords(tree, b.x + b.width,
- b.y + b.height,
- &c.width, &c.height);
- c.width -= c.x; c.height -= c.y;
- if (gdk_rectangle_intersect(&a, &c, &d))
- msg = lbm_get_index_entry(lmm, (GNode *) iter->user_data);
- gtk_tree_path_free(path);
- }
- }
-#endif
switch(column) {
/* case LB_MBOX_MSGNO_COL: handled above */
case LB_MBOX_MARKED_COL:
diff --git a/libbalsa/mailbox_local.c b/libbalsa/mailbox_local.c
index 6b66437..316e294 100644
--- a/libbalsa/mailbox_local.c
+++ b/libbalsa/mailbox_local.c
@@ -439,11 +439,7 @@ libbalsa_mailbox_local_load_config(LibBalsaMailbox * mailbox,
*/
typedef struct {
-#if GLIB_CHECK_VERSION(2, 8, 0)
GArray * array;
-#else /* GLIB_CHECK_VERSION(2, 8, 0) */
- int fd;
-#endif /* GLIB_CHECK_VERSION(2, 8, 0) */
guint (*fileno)(LibBalsaMailboxLocal * local, guint msgno);
LibBalsaMailboxLocal *local;
} LibBalsaMailboxLocalSaveTreeInfo;
@@ -476,11 +472,7 @@ lbm_local_save_tree_item(guint msgno, guint a,
info.value.parent = a;
}
-#if GLIB_CHECK_VERSION(2, 8, 0)
return g_array_append_val(save_info->array, info) == NULL;
-#else /* GLIB_CHECK_VERSION(2, 8, 0) */
- return write(save_info->fd, &info, sizeof info) != sizeof info;
-#endif /* GLIB_CHECK_VERSION(2, 8, 0) */
}
static gboolean
@@ -514,11 +506,7 @@ lbm_local_save_tree(LibBalsaMailboxLocal * local)
LibBalsaMailbox *mailbox = LIBBALSA_MAILBOX(local);
gchar *filename;
LibBalsaMailboxLocalSaveTreeInfo save_info;
-#if GLIB_CHECK_VERSION(2, 8, 0)
GError *err = NULL;
-#else /* GLIB_CHECK_VERSION(2, 8, 0) */
- gchar *template;
-#endif /* GLIB_CHECK_VERSION(2, 8, 0) */
if (!mailbox->msg_tree || !mailbox->msg_tree_changed)
return;
@@ -538,32 +526,16 @@ lbm_local_save_tree(LibBalsaMailboxLocal * local)
save_info.fileno = LIBBALSA_MAILBOX_LOCAL_GET_CLASS(local)->fileno;
save_info.local = local;
-#if GLIB_CHECK_VERSION(2, 8, 0)
save_info.array =
g_array_new(FALSE, FALSE, sizeof(LibBalsaMailboxLocalTreeInfo));
lbm_local_save_tree_item(0, libbalsa_mailbox_get_total(mailbox),
&save_info);
-#else /* GLIB_CHECK_VERSION(2, 8, 0) */
- template = g_strconcat(filename, ":XXXXXX", NULL);
- save_info.fd = g_mkstemp(template);
- if (save_info.fd < 0
- || lbm_local_save_tree_item(0, libbalsa_mailbox_get_total(mailbox),
- &save_info)) {
- libbalsa_information(LIBBALSA_INFORMATION_WARNING,
- _("Failed to create temporary file \"%s\": %s"),
- template, strerror(errno));
- g_free(template);
- g_free(filename);
- return;
- }
-#endif /* GLIB_CHECK_VERSION(2, 8, 0) */
/* Pre-order is required for the file to be created correctly. */
g_node_traverse(mailbox->msg_tree, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
(GNodeTraverseFunc) lbm_local_save_tree_func,
&save_info);
-#if GLIB_CHECK_VERSION(2, 8, 0)
if (!g_file_set_contents(filename, save_info.array->data,
save_info.array->len *
sizeof(LibBalsaMailboxLocalTreeInfo), &err)) {
@@ -573,17 +545,6 @@ lbm_local_save_tree(LibBalsaMailboxLocal * local)
g_error_free(err);
}
g_array_free(save_info.array, TRUE);
-#else /* GLIB_CHECK_VERSION(2, 8, 0) */
- if (close(save_info.fd) != 0
- || (unlink(filename) != 0 && errno != ENOENT)
- || libbalsa_safe_rename(template, filename) != 0)
- libbalsa_information(LIBBALSA_INFORMATION_WARNING,
- _("Failed to save cache file \"%s\": %s. "
- "New version saved as \"%s\""),
- filename, strerror(errno), template);
-
- g_free(template);
-#endif /* GLIB_CHECK_VERSION(2, 8, 0) */
g_free(filename);
}
diff --git a/libbalsa/mailbox_mbox.c b/libbalsa/mailbox_mbox.c
index 7428fac..a50fc80 100644
--- a/libbalsa/mailbox_mbox.c
+++ b/libbalsa/mailbox_mbox.c
@@ -394,9 +394,9 @@ static void
lbm_mbox_save(LibBalsaMailboxMbox * mbox)
{
gchar *filename;
-#if GLIB_CHECK_VERSION(2, 8, 0) && !defined(__APPLE__)
+#if !defined(__APPLE__)
GError *err = NULL;
-#endif /* GLIB_CHECK_VERSION(2, 8, 0) */
+#endif /* !defined(__APPLE__) */
if (!mbox->messages_info_changed)
return;
@@ -410,10 +410,10 @@ lbm_mbox_save(LibBalsaMailboxMbox * mbox)
g_array_sized_new(FALSE, FALSE, sizeof(struct message_info),
mbox->msgno_2_msg_info->len);
guint msgno;
-#if !GLIB_CHECK_VERSION(2, 8, 0) || defined(__APPLE__)
+#if defined(__APPLE__)
gchar *template;
gint fd;
-#endif /* GLIB_CHECK_VERSION(2, 8, 0) */
+#endif /* !defined(__APPLE__) */
for (msgno = 1; msgno <= mbox->msgno_2_msg_info->len; msgno++) {
struct message_info *msg_info =
@@ -421,7 +421,7 @@ lbm_mbox_save(LibBalsaMailboxMbox * mbox)
g_array_append_val(messages_info, *msg_info);
}
-#if GLIB_CHECK_VERSION(2, 8, 0) && !defined(__APPLE__)
+#if !defined(__APPLE__)
if (!g_file_set_contents(filename, messages_info->data,
messages_info->len
* sizeof(struct message_info), &err)) {
@@ -430,7 +430,7 @@ lbm_mbox_save(LibBalsaMailboxMbox * mbox)
filename, err->message);
g_error_free(err);
}
-#else /* GLIB_CHECK_VERSION(2, 8, 0) */
+#else /* !defined(__APPLE__) */
template = g_strconcat(filename, ":XXXXXX", NULL);
fd = g_mkstemp(template);
if (fd < 0 || write(fd, messages_info->data,
@@ -454,7 +454,7 @@ lbm_mbox_save(LibBalsaMailboxMbox * mbox)
"New version saved as \"%s\""),
filename, strerror(errno), template);
g_free(template);
-#endif /* GLIB_CHECK_VERSION(2, 8, 0) */
+#endif /* !defined(__APPLE__) */
g_array_free(messages_info, TRUE);
} else if (unlink(filename) < 0)
libbalsa_information(LIBBALSA_INFORMATION_WARNING,
diff --git a/libbalsa/smtp-server.c b/libbalsa/smtp-server.c
index 436ebf5..bb8edc6 100644
--- a/libbalsa/smtp-server.c
+++ b/libbalsa/smtp-server.c
@@ -37,12 +37,6 @@
#include "misc.h"
#include <glib/gi18n.h>
-#if !GTK_CHECK_VERSION(2, 14, 0)
-#ifdef HAVE_GNOME
-#include <gnome.h>
-#endif
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
-
static LibBalsaServerClass *parent_class = NULL;
struct _LibBalsaSmtpServer {
@@ -414,26 +408,18 @@ smtp_server_response(GtkDialog * dialog, gint response,
struct smtp_server_dialog_info *sdi)
{
LibBalsaServer *server = LIBBALSA_SERVER(sdi->smtp_server);
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
GError *error = NULL;
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
switch (response) {
case GTK_RESPONSE_HELP:
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, "ghelp:balsa?smtp-server-config",
gtk_get_current_event_time(), &error);
-#else /* GTK_CHECK_VERSION(2, 14, 0) */
- gnome_help_display("balsa", "smtp-server-config", &error);
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
if (error) {
libbalsa_information(LIBBALSA_INFORMATION_WARNING,
_("Error displaying server help: %s\n"),
error->message);
g_error_free(error);
}
-#endif
return;
case GTK_RESPONSE_OK:
libbalsa_smtp_server_set_name(sdi->smtp_server,
diff --git a/libinit_balsa/Makefile.am b/libinit_balsa/Makefile.am
index 282c955..8271e7a 100644
--- a/libinit_balsa/Makefile.am
+++ b/libinit_balsa/Makefile.am
@@ -1,6 +1,5 @@
noinst_LIBRARIES = libinit_balsa.a
-if BUILD_WITH_ASSISTANT
libinit_balsa_a_SOURCES = \
assistant_page_defclient.c \
assistant_page_defclient.h \
@@ -16,56 +15,6 @@ libinit_balsa_a_SOURCES = \
assistant_init.h \
assistant_helper.c \
assistant_helper.h
-EXTRA_DIST = \
- balsa-druid-page-defclient.c \
- balsa-druid-page-defclient.h \
- balsa-druid-page-directory.c \
- balsa-druid-page-directory.h \
- balsa-druid-page-finish.c \
- balsa-druid-page-finish.h \
- balsa-druid-page-user.c \
- balsa-druid-page-user.h \
- balsa-druid-page-welcome.c \
- balsa-druid-page-welcome.h \
- balsa-initdruid.c \
- balsa-initdruid.h \
- helper.c \
- helper.h
-else
-EXTRA_DIST = \
- assistant_page_defclient.c \
- assistant_page_defclient.h \
- assistant_page_directory.c \
- assistant_page_directory.h \
- assistant_page_finish.c \
- assistant_page_finish.h \
- assistant_page_user.c \
- assistant_page_user.h \
- assistant_page_welcome.c \
- assistant_page_welcome.h \
- assistant_init.c \
- assistant_init.h \
- assistant_helper.c \
- assistant_helper.h
-
-libinit_balsa_a_SOURCES = \
- balsa-druid-page-defclient.c \
- balsa-druid-page-defclient.h \
- balsa-druid-page-directory.c \
- balsa-druid-page-directory.h \
- balsa-druid-page-finish.c \
- balsa-druid-page-finish.h \
- balsa-druid-page-user.c \
- balsa-druid-page-user.h \
- balsa-druid-page-welcome.c \
- balsa-druid-page-welcome.h \
- balsa-initdruid.c \
- balsa-initdruid.h \
- init_balsa.c \
- init_balsa.h \
- helper.c \
- helper.h
-endif
INCLUDES=-I$(top_builddir) -I$(top_srcdir) \
-I$(top_srcdir)/libbalsa \
diff --git a/libinit_balsa/balsa-druid-page-defclient.c b/libinit_balsa/balsa-druid-page-defclient.c
deleted file mode 100644
index 2546255..0000000
--- a/libinit_balsa/balsa-druid-page-defclient.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include "balsa-druid-page-defclient.h"
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <gconf/gconf-client.h>
-
-#include <glib/gi18n.h>
-#include "balsa-app.h"
-
-/* here are local prototypes */
-
-static void balsa_druid_page_defclient_init(BalsaDruidPageDefclient *defclient,
- GnomeDruidPageStandard *page,
- GnomeDruid *druid);
-static void balsa_druid_page_defclient_toggle(GnomeDruidPage * page,
- BalsaDruidPageDefclient * defclient);
-static void balsa_druid_page_defclient_prepare(GnomeDruidPage * page,
- GnomeDruid * druid,
- BalsaDruidPageDefclient * defclient);
-static gboolean balsa_druid_page_defclient_next(GnomeDruidPage * page,
- GnomeDruid * druid,
- BalsaDruidPageDefclient * defclient);
-
-static void
-balsa_druid_page_defclient_init(BalsaDruidPageDefclient * defclient,
- GnomeDruidPageStandard * page,
- GnomeDruid * druid)
-{
- GtkLabel *label;
- GtkWidget *yes, *no;
-
- defclient->default_client = 1;
-
- label =
- GTK_LABEL(gtk_label_new
- (_("Use balsa as default email client?")));
- gtk_label_set_justify(label, GTK_JUSTIFY_CENTER);
- gtk_label_set_line_wrap(label, TRUE);
-
- yes = gtk_radio_button_new_with_mnemonic(NULL, _("_Yes"));
- no = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(yes),
- _("_No"));
-
- g_signal_connect(G_OBJECT(yes), "toggled",
- G_CALLBACK(balsa_druid_page_defclient_toggle),
- defclient);
-
- gtk_box_pack_start(GTK_BOX(page->vbox), GTK_WIDGET(label), TRUE, TRUE, 8);
- gtk_box_pack_start(GTK_BOX(page->vbox), GTK_WIDGET(yes), TRUE, TRUE, 2);
- gtk_box_pack_start(GTK_BOX(page->vbox), GTK_WIDGET(no), TRUE, TRUE, 2);
-
- return;
-}
-
-void
-balsa_druid_page_defclient(GnomeDruid *druid, GdkPixbuf *default_logo)
-{
- BalsaDruidPageDefclient *defclient;
- GnomeDruidPageStandard *page;
- GConfClient *gc;
-
- gc = gconf_client_get_default(); /* FIXME: error handling */
- if(gc) {
- GError *err = NULL;
- gchar *cmd;
- gboolean set_to_balsa_already;
- cmd =
- gconf_client_get_string
- (gc, "/desktop/gnome/url-handlers/mailto/command", &err);
- set_to_balsa_already = !err && cmd && strncmp(cmd,"balsa",5)==0;
- if(err) g_error_free(err);
- g_free(cmd);
- if(set_to_balsa_already)
- return;
- }
- defclient = g_new0(BalsaDruidPageDefclient, 1);
- page = GNOME_DRUID_PAGE_STANDARD(gnome_druid_page_standard_new());
- gnome_druid_page_standard_set_title(page, _("Default Client"));
- gnome_druid_page_standard_set_logo(page, default_logo);
- balsa_druid_page_defclient_init(defclient, page, druid);
- gnome_druid_append_page(druid, GNOME_DRUID_PAGE(page));
- g_signal_connect(G_OBJECT(page), "prepare",
- G_CALLBACK(balsa_druid_page_defclient_prepare),
- defclient);
- g_signal_connect(G_OBJECT(page), "next",
- G_CALLBACK(balsa_druid_page_defclient_next), defclient);
-}
-
-static void
-balsa_druid_page_defclient_toggle(GnomeDruidPage * page,
- BalsaDruidPageDefclient * defclient)
-{
- defclient->default_client = ! (defclient->default_client);
-}
-
-static void
-balsa_druid_page_defclient_prepare(GnomeDruidPage * page, GnomeDruid * druid,
- BalsaDruidPageDefclient * defclient)
-{
- gnome_druid_set_show_finish(druid, FALSE);
-}
-
-static gboolean
-balsa_druid_page_defclient_next(GnomeDruidPage * page, GnomeDruid * druid,
- BalsaDruidPageDefclient * defclient)
-{
- balsa_app.default_client = defclient->default_client;
- return FALSE;
-}
diff --git a/libinit_balsa/balsa-druid-page-defclient.h b/libinit_balsa/balsa-druid-page-defclient.h
deleted file mode 100644
index c629d66..0000000
--- a/libinit_balsa/balsa-druid-page-defclient.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <gtk/gtk.h>
-
-#ifndef __BALSA_DRUID_PAGE_DEFCLIENT_H__
-#define __BALSA_DRUID_PAGE_DEFCLIENT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include "helper.h"
-#include "balsa-initdruid.h"
-
-/*
- * Main object structure
- */
-#ifndef __TYPEDEF_BALSA_DRUID_PAGE_DEFCLIENT__
-#define __TYPEDEF_BALSA_DRUID_PAGE_DEFCLIENT__
- typedef struct _BalsaDruidPageDefclient BalsaDruidPageDefclient;
-#endif
-#define BALSA_DRUID_PAGE_DEFCLIENT(obj) ((BalsaDruidPageDefclient *) obj)
- struct _BalsaDruidPageDefclient {
- int default_client;
- };
-
-/*
- * Public methods
- */
- void balsa_druid_page_defclient(GnomeDruid * druid,
- GdkPixbuf * default_logo);
- void balsa_druid_page_defclient_save(BalsaDruidPageDefclient * defclient);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif
diff --git a/libinit_balsa/balsa-druid-page-directory.c b/libinit_balsa/balsa-druid-page-directory.c
deleted file mode 100644
index 917fe61..0000000
--- a/libinit_balsa/balsa-druid-page-directory.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "balsa-druid-page-directory.h"
-
-#include <glib/gi18n.h>
-#include "balsa-app.h"
-#include "save-restore.h"
-#include "misc.h"
-#include "url.h"
-#include "server.h"
-
-
-static gchar *init_mbnames[NUM_EDs] = {
-#if defined(ENABLE_TOUCH_UI)
- "_In:", "_Out:", "_Sent:", "_Drafts:", "_Trash:"
-#else
- N_("_Inbox:"), N_("_Outbox:"), N_("_Sentbox:"), N_("_Draftbox:"),
- N_("_Trash:")
-#endif
-};
-
-static void unconditional_mailbox(const gchar * path,
- const gchar * prettyname,
- LibBalsaMailbox ** box, gchar ** error);
-
-static void
-unconditional_mailbox(const gchar * path, const gchar * prettyname,
- LibBalsaMailbox ** box, gchar ** error)
-{
- gchar *dup;
- gchar *index;
- char tmp[32] = "/tmp/balsa.XXXXXX";
- ciss_url_t url;
- gboolean ssl = FALSE;
-
- if ((*error) != NULL)
- return;
-
- dup = g_strdup(path);
- index = strrchr(dup, G_DIR_SEPARATOR);
-
- if (index == NULL) {
- (*error) =
- g_strdup_printf(_
- ("The pathname \"%s\" must be specified"
- " canonically -- it must start with a \'/\'."),
- dup);
- g_free(dup);
- return;
- }
-
- *index = '\0'; /*Split off the dirs from the file. */
-
- if (balsa_init_create_to_directory(dup, error)) {
- /*TRUE->error */
- g_free(dup);
- return;
- }
-
- *index = G_DIR_SEPARATOR;
-
- url_parse_ciss(&url, dup);
-
- switch (url.scheme) {
- case U_IMAPS:
- ssl = TRUE;
- case U_IMAP:
- *box = (LibBalsaMailbox *) libbalsa_mailbox_imap_new();
- libbalsa_mailbox_imap_set_path((LibBalsaMailboxImap *) * box,
- url.path);
- break;
- case U_POPS:
- ssl = TRUE;
- case U_POP:
- *box = (LibBalsaMailbox *) libbalsa_mailbox_pop3_new();
- break;
- case U_FILE:
- *box =
- (LibBalsaMailbox *) libbalsa_mailbox_local_new(url.path, TRUE);
- break;
- default:
- *box = (LibBalsaMailbox *) libbalsa_mailbox_local_new(path, TRUE);
- }
-
- if (url.host && LIBBALSA_IS_MAILBOX_REMOTE(*box)) {
- libbalsa_server_set_host(LIBBALSA_MAILBOX_REMOTE_SERVER(*box),
- url.host, ssl);
- libbalsa_server_set_username(LIBBALSA_MAILBOX_REMOTE_SERVER(*box),
- getenv("USER"));
- }
- g_free(dup);
-
-
- if (*box == NULL) {
- if (strcmp("/var/spool/mail/", path)) {
- /* Don't fail if you can't create the spool mailbox. */
- close(mkstemp(tmp));
- *box = (LibBalsaMailbox*)libbalsa_mailbox_local_new(tmp, FALSE);
- if (*box) {
- free((*box)->url);
- (*box)->url = g_strdup_printf("file://%s",path);
- }
- unlink(tmp);
- }
- }
- if ( *box == NULL) {
- (*error) =
- g_strdup_printf(_
- ("The mailbox \"%s\" does not appear to be valid."),
- path);
- return;
- }
-
- (*box)->name = g_strdup(gettext(prettyname));
-
- config_mailbox_add(*box, (char *) prettyname);
-}
-
-/* here are local prototypes */
-static void balsa_druid_page_directory_init(BalsaDruidPageDirectory * dir,
- GnomeDruidPageStandard * page,
- GnomeDruid * druid);
-static void balsa_druid_page_directory_prepare(GnomeDruidPage * page,
- GnomeDruid * druid,
- BalsaDruidPageDirectory *
- dir);
-static gboolean balsa_druid_page_directory_next(GnomeDruidPage * page,
- GtkWidget * druid,
- BalsaDruidPageDirectory *
- dir);
-static gboolean balsa_druid_page_directory_back(GnomeDruidPage * page,
- GtkWidget * druid,
- BalsaDruidPageDirectory *
- dir);
-
-static void
-balsa_druid_page_directory_init(BalsaDruidPageDirectory * dir,
- GnomeDruidPageStandard * page,
- GnomeDruid * druid)
-{
- GtkTable *table;
- GtkLabel *label;
- int i;
- GtkWidget **init_widgets[NUM_EDs];
- gchar *imap_inbox = libbalsa_guess_imap_inbox();
- gchar *init_presets[NUM_EDs] = { NULL, NULL, NULL, NULL, NULL };
-
- dir->paths_locked = FALSE;
-
- dir->emaster.setbits = 0;
- dir->emaster.numentries = 0;
- dir->emaster.donemask = 0;
-
- table = GTK_TABLE(gtk_table_new(NUM_EDs + 1, 2, FALSE));
-
- label =
- GTK_LABEL(gtk_label_new
- (_
- ("Please verify the locations of your default mail files.\n"
- "These will be created if necessary.")));
- gtk_label_set_justify(label, GTK_JUSTIFY_RIGHT);
- gtk_label_set_line_wrap(label, TRUE);
-
- gtk_table_attach(table, GTK_WIDGET(label), 0, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 8, 4);
-
- if (0 /* FIXME: libbalsa_mailbox_exists(imap_inbox) */ )
- init_presets[INBOX] = imap_inbox;
- else {
- g_free(imap_inbox);
- init_presets[INBOX] = libbalsa_guess_mail_spool();
- }
-
- init_widgets[INBOX] = &(dir->inbox);
- init_widgets[OUTBOX] = &(dir->outbox);
- init_widgets[SENTBOX] = &(dir->sentbox);
- init_widgets[DRAFTBOX] = &(dir->draftbox);
- init_widgets[TRASH] = &(dir->trash);
-
- for (i = 0; i < NUM_EDs; i++) {
- gchar *preset;
-
- dir->ed[i].master = &(dir->emaster);
-
- init_mbnames[i] = _(init_mbnames[i]);
-
- if (init_presets[i])
- preset = init_presets[i];
- else
- preset = g_strdup("[Dummy value]");
-
- balsa_init_add_table_entry(table, i, init_mbnames[i], preset,
- &(dir->ed[i]), druid, init_widgets[i]);
-
- g_free(preset);
- }
-
- gtk_box_pack_start(GTK_BOX(page->vbox), GTK_WIDGET(table), FALSE, TRUE,
- 8);
- gtk_widget_show_all(GTK_WIDGET(table));
-
- return;
-}
-
-
-void
-balsa_druid_page_directory(GnomeDruid * druid, GdkPixbuf * default_logo)
-{
- BalsaDruidPageDirectory *dir;
- GnomeDruidPageStandard *page;
-
- dir = g_new0(BalsaDruidPageDirectory, 1);
- page = GNOME_DRUID_PAGE_STANDARD(gnome_druid_page_standard_new());
- gnome_druid_page_standard_set_title(page, _("Mail Files"));
- gnome_druid_page_standard_set_logo(page, default_logo);
- balsa_druid_page_directory_init(dir, page, druid);
- gnome_druid_append_page(druid, GNOME_DRUID_PAGE(page));
- g_signal_connect(G_OBJECT(page), "prepare",
- G_CALLBACK(balsa_druid_page_directory_prepare), dir);
- g_signal_connect(G_OBJECT(page), "next",
- G_CALLBACK(balsa_druid_page_directory_next), dir);
- g_signal_connect(G_OBJECT(page), "back",
- G_CALLBACK(balsa_druid_page_directory_back), dir);
-}
-
-static void
-balsa_druid_page_directory_prepare(GnomeDruidPage * page,
- GnomeDruid * druid,
- BalsaDruidPageDirectory * dir)
-{
- gchar *buf;
-
- /* We want a change in the local mailroot to be reflected in the directories
- * here, but we don't want to trash user's custom settings if needed. Hence
- * the paths_locked variable; it should work pretty well, because only a movement
- * backwards should change the mailroot; going forward should not lock the paths:
- * envision an error occurring; upon return to the Dir page the entries should be
- * the same.
- */
-
- if (!dir->paths_locked) {
- buf = g_strconcat(balsa_app.local_mail_directory, "/outbox", NULL);
- gtk_entry_set_text(GTK_ENTRY(dir->outbox), buf);
- g_free(buf);
-
- buf =
- g_strconcat(balsa_app.local_mail_directory, "/sentbox", NULL);
- gtk_entry_set_text(GTK_ENTRY(dir->sentbox), buf);
- g_free(buf);
-
- buf =
- g_strconcat(balsa_app.local_mail_directory, "/draftbox", NULL);
- gtk_entry_set_text(GTK_ENTRY(dir->draftbox), buf);
- g_free(buf);
-
- buf = g_strconcat(balsa_app.local_mail_directory, "/trash", NULL);
- gtk_entry_set_text(GTK_ENTRY(dir->trash), buf);
- g_free(buf);
- }
-
-
- /* Don't let them continue unless all entries have something. */
- if (ENTRY_MASTER_DONE(dir->emaster)) {
- gnome_druid_set_buttons_sensitive(druid, TRUE, TRUE, TRUE, FALSE);
- } else {
- gnome_druid_set_buttons_sensitive(druid, TRUE, FALSE, TRUE, FALSE);
- }
-
- gnome_druid_set_show_finish(druid, FALSE);
-}
-
-#if !defined(ENABLE_TOUCH_UI)
-#define INBOX_NAME "Inbox"
-#define OUTBOX_NAME "Outbox"
-#define SENTBOX_NAME "Sentbox"
-#define DRAFTBOX_NAME "Draftbox"
-#else /* defined(ENABLE_TOUCH_UI) */
-#define INBOX_NAME "In"
-#define OUTBOX_NAME "Out"
-#define SENTBOX_NAME "Sent"
-#define DRAFTBOX_NAME "Drafts"
-#endif /* defined(ENABLE_TOUCH_UI) */
-#define TRASH_NAME "Trash"
-
-static gboolean
-balsa_druid_page_directory_next(GnomeDruidPage * page, GtkWidget * druid,
- BalsaDruidPageDirectory * dir)
-{
- gchar *error = NULL;
-
- unconditional_mailbox(gtk_entry_get_text
- (GTK_ENTRY(dir->inbox)), INBOX_NAME,
- &balsa_app.inbox, &error);
- unconditional_mailbox(gtk_entry_get_text
- (GTK_ENTRY(dir->outbox)), OUTBOX_NAME,
- &balsa_app.outbox, &error);
- unconditional_mailbox(gtk_entry_get_text
- (GTK_ENTRY(dir->sentbox)), SENTBOX_NAME,
- &balsa_app.sentbox, &error);
- unconditional_mailbox(gtk_entry_get_text
- (GTK_ENTRY(dir->draftbox)), DRAFTBOX_NAME,
- &balsa_app.draftbox, &error);
- unconditional_mailbox(gtk_entry_get_text
- (GTK_ENTRY(dir->trash)), TRASH_NAME,
- &balsa_app.trash, &error);
-
- dir->paths_locked = TRUE;
-
- if (error) {
- GtkWidget *dlg =
- gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_ancestor
- (GTK_WIDGET(druid),
- GTK_TYPE_WINDOW)),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Problem Creating Mailboxes\n%s"),
- error);
- g_free(error);
- gtk_dialog_run(GTK_DIALOG(dlg));
- gtk_widget_destroy(dlg);
- return TRUE;
- }
-
- return FALSE;
-}
-
-#define SET_MAILBOX(fname, config, mbx) \
-do { gchar *t=g_strconcat(balsa_app.local_mail_directory,"/",(fname),NULL);\
- unconditional_mailbox(t, config, (mbx), &error); g_free(t);}while(0)
-
-void
-balsa_druid_page_directory_later(GtkWidget *druid)
-{
- gchar *error = NULL;
- gchar *spool = libbalsa_guess_mail_spool();
- unconditional_mailbox(spool, INBOX_NAME, &balsa_app.inbox, &error);
- g_free(spool);
- SET_MAILBOX("trash", TRASH_NAME, &balsa_app.trash);
- SET_MAILBOX("outbox", OUTBOX_NAME, &balsa_app.outbox);
- SET_MAILBOX("sentbox", SENTBOX_NAME, &balsa_app.sentbox);
- SET_MAILBOX("draftbox", DRAFTBOX_NAME, &balsa_app.draftbox);
- if (error) {
- GtkWidget *dlg =
- gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_ancestor
- (GTK_WIDGET(druid),
- GTK_TYPE_WINDOW)),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Problem Creating Mailboxes\n%s"),
- error);
- g_free(error);
- gtk_dialog_run(GTK_DIALOG(dlg));
- gtk_widget_destroy(dlg);
- }
-}
-
-static gboolean
-balsa_druid_page_directory_back(GnomeDruidPage * page, GtkWidget * druid,
- BalsaDruidPageDirectory * dir)
-{
- dir->paths_locked = FALSE;
- return FALSE;
-}
diff --git a/libinit_balsa/balsa-druid-page-directory.h b/libinit_balsa/balsa-druid-page-directory.h
deleted file mode 100644
index 741b50d..0000000
--- a/libinit_balsa/balsa-druid-page-directory.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <gtk/gtk.h>
-
-#ifndef __BALSA_DRUID_PAGE_DIRECTORY_H__
-#define __BALSA_DRUID_PAGE_DIRECTORY_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <gnome.h>
-#include "helper.h"
-#include "balsa-initdruid.h"
-
-/*
- * Main object structure
- */
-#ifndef __TYPEDEF_BALSA_DRUID_PAGE_DIRECTORY__
-#define __TYPEDEF_BALSA_DRUID_PAGE_DIRECTORY__
- typedef struct _BalsaDruidPageDirectory BalsaDruidPageDirectory;
-#endif
-#define BALSA_DRUID_PAGE_DIRECTORY(obj) ((BalsaDruidPageDirectory *) obj)
-
- enum __ed_types {
- INBOX,
- OUTBOX,
- SENTBOX,
- DRAFTBOX,
- TRASH,
- NUM_EDs
- };
-
- struct _BalsaDruidPageDirectory {
- GtkWidget *inbox;
- GtkWidget *outbox;
- GtkWidget *sentbox;
- GtkWidget *draftbox;
- GtkWidget *trash;
- gboolean paths_locked;
- EntryMaster emaster;
- EntryData ed[NUM_EDs];
- };
-
-/*
- * Public methods
- */
- void balsa_druid_page_directory(GnomeDruid * druid,
- GdkPixbuf * default_logo);
- void balsa_druid_page_directory_later(GtkWidget *druid);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif
diff --git a/libinit_balsa/balsa-druid-page-finish.c b/libinit_balsa/balsa-druid-page-finish.c
deleted file mode 100644
index 3690b3a..0000000
--- a/libinit_balsa/balsa-druid-page-finish.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
-#endif /* HAVE_CONFIG_H */
-#include "balsa-druid-page-finish.h"
-
-#include "balsa-druid-page-directory.h"
-
-#include <glib/gi18n.h>
-#include "save-restore.h"
-#include "balsa-app.h"
-
-/* here are local prototypes */
-static void balsa_druid_page_finish_prepare(GnomeDruidPage * page,
- GnomeDruid * druid);
-static void balsa_druid_page_finish_finish(GnomeDruidPage * page,
- GnomeDruid * druid);
-
-void
-balsa_druid_page_finish(GnomeDruid * druid, GdkPixbuf * default_logo)
-{
- static const gchar bye[] =
- N_("You've successfully set up Balsa. Have fun!\n"
- " -- The Balsa development team");
- GnomeDruidPageEdge *page =
- GNOME_DRUID_PAGE_EDGE(gnome_druid_page_edge_new
- (GNOME_EDGE_FINISH));
-
- gnome_druid_page_edge_set_title(page, _("All Done!"));
- gnome_druid_page_edge_set_logo(page, default_logo);
- gnome_druid_page_edge_set_text(page, _(bye));
-
- g_signal_connect(G_OBJECT(page), "prepare",
- G_CALLBACK(balsa_druid_page_finish_prepare), NULL);
- g_signal_connect(G_OBJECT(page), "finish",
- G_CALLBACK(balsa_druid_page_finish_finish), NULL);
-
- gnome_druid_append_page(druid, GNOME_DRUID_PAGE(page));
-}
-
-static void
-balsa_druid_page_finish_prepare(GnomeDruidPage * page, GnomeDruid * druid)
-{
- gnome_druid_set_buttons_sensitive(druid, TRUE, FALSE, TRUE, FALSE);
- gnome_druid_set_show_finish(druid, TRUE);
-}
-
-static void
-balsa_druid_page_finish_finish(GnomeDruidPage * page, GnomeDruid * druid)
-{
- gchar *address_book;
- LibBalsaAddressBook *ab = NULL;
-
-#if defined(ENABLE_TOUCH_UI)
- balsa_druid_page_directory_later(GTK_WIDGET(druid));
-#endif
- address_book = gnome_util_home_file("GnomeCard.gcrd");
- if (g_file_test(address_book, G_FILE_TEST_EXISTS))
- ab = libbalsa_address_book_vcard_new(_("GnomeCard Address Book"),
- address_book);
- g_free(address_book);
- if(!ab) {
- address_book = g_strconcat(g_get_home_dir(),
- "/.addressbook.ldif", NULL);
- if (g_file_test(address_book, G_FILE_TEST_EXISTS))
- ab = libbalsa_address_book_ldif_new(_("Address Book"),
- address_book);
- g_free(address_book);
- }
- if(!ab) {
- /* This will be the default address book and its location */
- address_book = g_strconcat(g_get_home_dir(),
- "/.balsa/addressbook.ldif", NULL);
- ab = libbalsa_address_book_ldif_new(_("Address Book"),
- address_book);
- g_free(address_book);
- libbalsa_assure_balsa_dir();
- }
-
- balsa_app.address_book_list =
- g_list_prepend(balsa_app.address_book_list, ab);
- balsa_app.default_address_book = ab;
-
- g_signal_handlers_disconnect_by_func(G_OBJECT(druid),
- G_CALLBACK(exit), NULL);
- config_save();
- gtk_main_quit();
-}
diff --git a/libinit_balsa/balsa-druid-page-finish.h b/libinit_balsa/balsa-druid-page-finish.h
deleted file mode 100644
index e4c2ff4..0000000
--- a/libinit_balsa/balsa-druid-page-finish.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <gtk/gtk.h>
-
-#ifndef __BALSA_DRUID_PAGE_FINISH_H__
-#define __BALSA_DRUID_PAGE_FINISH_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <gnome.h>
-#include "helper.h"
-#include "balsa-initdruid.h"
-
-/*
- * Public methods
- */
- void balsa_druid_page_finish(GnomeDruid * druid,
- GdkPixbuf * default_logo);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif
diff --git a/libinit_balsa/balsa-druid-page-user.c b/libinit_balsa/balsa-druid-page-user.c
deleted file mode 100644
index 6d0a5a8..0000000
--- a/libinit_balsa/balsa-druid-page-user.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
-#endif /* HAVE_CONFIG_H */
-#include "balsa-druid-page-user.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-
-#include <glib/gi18n.h>
-#include "imap-server.h"
-#include "smtp-server.h"
-#include "balsa-app.h"
-#include "save-restore.h"
-#include "server.h"
-
-/* here are local prototypes */
-
-static void balsa_druid_page_user_init(BalsaDruidPageUser * user,
- GnomeDruidPageStandard * page,
- GnomeDruid * druid);
-static void balsa_druid_page_user_prepare(GnomeDruidPage * page,
- GnomeDruid * druid,
- BalsaDruidPageUser * user);
-static gboolean balsa_druid_page_user_next(GnomeDruidPage * page,
- GnomeDruid * druid,
- BalsaDruidPageUser * user);
-
-
-static void
-balsa_druid_page_user_init(BalsaDruidPageUser * user,
- GnomeDruidPageStandard * page,
- GnomeDruid * druid)
-{
- static const char *header2 =
- N_("The following settings are also needed "
- "(and you can find them later, if need be, in the Email "
- "application in the 'Preferences' and 'Identities' "
- "commands on the 'Tools' menu)");
- static const char *header21 =
- N_(" Whoever provides your email account should be able "
- "to give you the following information (if you have "
- "a Network Administrator, they may already have set "
- "this up for you):");
- static const char* server_types[] = { "POP3", "IMAP", NULL };
- static const char* remember_passwd[] = {
- N_("Yes, remember it"), N_("No, type it in every time"), NULL };
- GtkTable *table;
- GtkLabel *label;
- gchar *preset;
- int row = 0;
-
- user->emaster.setbits = 0;
- user->emaster.numentries = 0;
- user->emaster.donemask = 0;
- user->ed0.master = &(user->emaster);
- user->ed1.master = &(user->emaster);
-#if ENABLE_ESMTP
- user->ed2.master = &(user->emaster);
-#endif
- user->ed3.master = &(user->emaster);
-#if !defined(ENABLE_TOUCH_UI)
- user->ed4.master = &(user->emaster);
-#endif
- label = GTK_LABEL(gtk_label_new(_(header2)));
- gtk_label_set_line_wrap(label, TRUE);
- gtk_box_pack_start(GTK_BOX(page->vbox), GTK_WIDGET(label),
- TRUE, TRUE, 0);
-
- table = GTK_TABLE(gtk_table_new(10, 2, FALSE));
-
- label = GTK_LABEL(gtk_label_new(_(header21)));
- gtk_label_set_justify(label, GTK_JUSTIFY_CENTER);
- gtk_label_set_line_wrap(label, TRUE);
- gtk_table_attach(table, GTK_WIDGET(label), 0, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 8, 4);
-
- /* 2.1 */
- balsa_init_add_table_entry(table, row++,
- _("Name of mail server for incoming _mail:"),
- "", /* no guessing here */
- NULL, druid, &(user->incoming_srv));
-
- balsa_init_add_table_option(table, row++,
- _("_Type of mail server:"),
- server_types, druid, &(user->incoming_type));
-
- balsa_init_add_table_checkbox(table, row++,
- _("Connect using _SSL:"), FALSE,
- druid, &(user->using_ssl));
-
- balsa_init_add_table_entry(table, row++, _("Your email _login name:"),
- g_get_user_name(),
- NULL, druid, &(user->login));
- balsa_init_add_table_entry(table, row++, _("Your _password:"),
- "",
- NULL, druid, &(user->passwd));
- gtk_entry_set_visibility(GTK_ENTRY(user->passwd), FALSE);
- /* separator line here */
-
-#if ENABLE_ESMTP
- preset = "localhost:25";
- balsa_init_add_table_entry(table, row++, _("_SMTP Server:"), preset,
- &(user->ed2), druid, &(user->smtp));
-#endif
-
- /* 2.1 */
- balsa_init_add_table_entry(table, row++, _("Your real _name:"),
- g_get_real_name(),
- &(user->ed0), druid, &(user->name));
-
- preset = libbalsa_guess_email_address();
- balsa_init_add_table_entry
- (table, row++, _("Your _Email Address, for this email account:"),
- preset, &(user->ed1), druid, &(user->email));
- g_free(preset);
-
- balsa_init_add_table_option(table, row++,
- _("_Remember your password:"),
- remember_passwd, druid,
- &(user->remember_passwd));
- gtk_table_set_row_spacing(table, row++, 10);
-#if !defined(ENABLE_TOUCH_UI)
- preset = g_strconcat(g_get_home_dir(), "/mail", NULL);
- balsa_init_add_table_entry(table, row++, _("_Local mail directory:"),
- preset,
- &(user->ed4), druid, &(user->localmaildir));
- g_free(preset);
-#endif
- gtk_box_pack_start(GTK_BOX(page->vbox), GTK_WIDGET(table), TRUE, TRUE,
- 8);
-}
-
-void
-balsa_druid_page_user(GnomeDruid * druid, GdkPixbuf * default_logo)
-{
- BalsaDruidPageUser *user;
- GnomeDruidPageStandard *page;
-
- user = g_new0(BalsaDruidPageUser, 1);
- page = GNOME_DRUID_PAGE_STANDARD(gnome_druid_page_standard_new());
- gnome_druid_page_standard_set_title(page, _("User Settings"));
- gnome_druid_page_standard_set_logo(page, default_logo);
- balsa_druid_page_user_init(user, page, druid);
- gnome_druid_append_page(druid, GNOME_DRUID_PAGE(page));
- g_signal_connect(G_OBJECT(page), "prepare",
- G_CALLBACK(balsa_druid_page_user_prepare),
- user);
- g_signal_connect(G_OBJECT(page), "next",
- G_CALLBACK(balsa_druid_page_user_next), user);
-}
-
-static void
-balsa_druid_page_user_prepare(GnomeDruidPage * page, GnomeDruid * druid,
- BalsaDruidPageUser * user)
-{
- /* Don't let them continue unless all entries have something. */
-
- if (ENTRY_MASTER_DONE(user->emaster)) {
- gnome_druid_set_buttons_sensitive(druid, TRUE, TRUE, TRUE, FALSE);
- } else {
- gnome_druid_set_buttons_sensitive(druid, TRUE, FALSE, TRUE, FALSE);
- }
-
- gnome_druid_set_show_finish(druid, FALSE);
- gtk_widget_grab_focus(user->incoming_srv);
-}
-
-static LibBalsaMailbox*
-create_pop3_mbx(const gchar *name, const gchar* host, gboolean ssl,
- const gchar *login, const gchar *passwd,
- gboolean remember)
-{
- LibBalsaMailboxPop3 *pop = libbalsa_mailbox_pop3_new();
- LibBalsaMailbox *mbx = LIBBALSA_MAILBOX(pop);
- LibBalsaServer *server = LIBBALSA_MAILBOX_REMOTE_SERVER(pop);
-
- libbalsa_server_set_username(server, login);
- libbalsa_server_set_password(server, passwd);
- libbalsa_server_set_host(server, host, ssl);
- server->tls_mode = LIBBALSA_TLS_ENABLED;
- server->remember_passwd = remember;
- mbx->name = g_strdup(name && *name ? name : host);
- pop->check = TRUE;
- pop->disable_apop = FALSE;
- pop->delete_from_server = TRUE;
- pop->filter = FALSE;
- pop->filter_cmd = g_strdup("procmail -f -");
-
- return mbx;
-}
-
-static void
-create_imap_mbx(const gchar *name, const gchar* host, gboolean ssl,
- const gchar *login, const gchar *passwd,
- gboolean remember)
-{
- BalsaMailboxNode *mbnode;
- LibBalsaServer *server =
- LIBBALSA_SERVER(libbalsa_imap_server_new(login, host));
- libbalsa_server_set_username(server, login);
- libbalsa_server_set_password(server, passwd);
- libbalsa_server_set_host(server, host, ssl);
- server->tls_mode = LIBBALSA_TLS_ENABLED;
- server->remember_passwd = remember;
- mbnode = balsa_mailbox_node_new_imap_folder(server, NULL);
- mbnode->name = g_strdup(name && *name ? name : host);
-
- config_folder_add(mbnode, NULL);
- /* memory leak? */
- g_object_unref(mbnode);
-}
-
-static gboolean
-balsa_druid_page_user_next(GnomeDruidPage * page, GnomeDruid * druid,
- BalsaDruidPageUser * user)
-{
- const gchar *host, *mailbox;
- gchar *uhoh;
- LibBalsaIdentity *ident;
-#if ENABLE_ESMTP
- LibBalsaSmtpServer *smtp_server;
-#endif /* ENABLE_ESMTP */
-
- /* incoming mail */
- host = gtk_entry_get_text(GTK_ENTRY(user->incoming_srv));
- if(host && *host) {
- LibBalsaMailbox *mbx = NULL;
- const gchar *login = gtk_entry_get_text(GTK_ENTRY(user->login));
- const gchar *passwd = gtk_entry_get_text(GTK_ENTRY(user->passwd));
- gboolean ssl =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(user->using_ssl));
- gboolean remember =
- balsa_option_get_active(user->remember_passwd) == 0;
- switch(balsa_option_get_active(user->incoming_type)) {
- case 0: /* POP */
- mbx = create_pop3_mbx(host, host, ssl, login, passwd, remember);
- if(mbx)
- config_mailbox_add(mbx, NULL);
- break;
- case 1: /* IMAP */
- create_imap_mbx(host, host, ssl, login, passwd, remember);
- break;
- default: /* hm */;
- }
- }
-
- /* identity */
- mailbox = gtk_entry_get_text(GTK_ENTRY(user->email));
- if (balsa_app.identities == NULL) {
- gchar *domain = strrchr(mailbox, '@');
- ident = LIBBALSA_IDENTITY(libbalsa_identity_new_with_name
- (_("Default Identity")));
- balsa_app.identities = g_list_append(NULL, ident);
- if(domain)
- libbalsa_identity_set_domain(ident, domain+1);
- } else {
- ident = balsa_app.current_ident;
- }
- internet_address_set_name(ident->ia,
- gtk_entry_get_text(GTK_ENTRY(user->name)));
- internet_address_set_addr(ident->ia, mailbox);
-
- /* outgoing mail */
-#if ENABLE_ESMTP
- if (balsa_app.smtp_servers == NULL) {
- smtp_server = libbalsa_smtp_server_new();
- libbalsa_smtp_server_set_name(smtp_server,
- libbalsa_smtp_server_get_name(NULL));
- balsa_app.smtp_servers = g_slist_prepend(NULL, smtp_server);
- } else {
- smtp_server = balsa_app.smtp_servers->data;
- }
- libbalsa_server_set_host(LIBBALSA_SERVER(smtp_server),
- gtk_entry_get_text(GTK_ENTRY(user->smtp)),
- FALSE);
-#endif
-
- g_free(balsa_app.local_mail_directory);
-#if defined(ENABLE_TOUCH_UI)
- balsa_app.local_mail_directory =
- g_strconcat(g_get_home_dir(), "/mail", NULL);
-#else
- balsa_app.local_mail_directory =
- gtk_editable_get_chars(GTK_EDITABLE(user->localmaildir), 0, -1);
-#endif /* ENABLE_TOUCH_UI */
-
- if (balsa_init_create_to_directory
- (balsa_app.local_mail_directory, &uhoh)) {
- GtkWidget* err =
- gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_ancestor
- (GTK_WIDGET(druid),
- GTK_TYPE_WINDOW)),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Local Mail Problem\n%s"), uhoh);
- gtk_dialog_run(GTK_DIALOG(err));
- gtk_widget_destroy(err);
- g_free(uhoh);
- return TRUE;
- }
-
- balsa_app.current_ident = ident;
- return FALSE;
-}
diff --git a/libinit_balsa/balsa-druid-page-user.h b/libinit_balsa/balsa-druid-page-user.h
deleted file mode 100644
index 633df39..0000000
--- a/libinit_balsa/balsa-druid-page-user.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <gtk/gtk.h>
-
-#ifndef __BALSA_DRUID_PAGE_USER_H__
-#define __BALSA_DRUID_PAGE_USER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <gnome.h>
-#include "helper.h"
-#include "balsa-initdruid.h"
-
-/*
- * Main object structure
- */
-#ifndef __TYPEDEF_BALSA_DRUID_PAGE_USER__
-#define __TYPEDEF_BALSA_DRUID_PAGE_USER__
- typedef struct _BalsaDruidPageUser BalsaDruidPageUser;
-#endif
-#define BALSA_DRUID_PAGE_USER(obj) ((BalsaDruidPageUser *) obj)
- struct _BalsaDruidPageUser {
- GtkWidget *incoming_srv;
- GtkWidget *incoming_type;
- GtkWidget *using_ssl;
- GtkWidget *login;
- GtkWidget *passwd;
- GtkWidget *remember_passwd;
-#if ENABLE_ESMTP
- GtkWidget *smtp;
-#endif
- GtkWidget *name;
- GtkWidget *email;
-#if !defined(ENABLE_TOUCH_UI)
- GtkWidget *localmaildir;
-#endif /* ENABLE_TOUCH_UI */
- EntryMaster emaster;
- EntryData ed0;
- EntryData ed1;
- EntryData ed2;
- EntryData ed3;
- EntryData ed4;
- EntryData ed5;
- EntryData ed6;
- EntryData ed7;
- };
-
-/*
- * Public methods
- */
- void balsa_druid_page_user(GnomeDruid * druid,
- GdkPixbuf * default_logo);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif
diff --git a/libinit_balsa/balsa-druid-page-welcome.c b/libinit_balsa/balsa-druid-page-welcome.c
deleted file mode 100644
index aa6f9ce..0000000
--- a/libinit_balsa/balsa-druid-page-welcome.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include "balsa-druid-page-welcome.h"
-#include <glib/gi18n.h>
-
-static void balsa_druid_page_welcome_prepare(GnomeDruidPage * page,
- GnomeDruid * druid);
-
-void
-balsa_druid_page_welcome(GnomeDruid * druid, GdkPixbuf * default_logo)
-{
- GnomeDruidPageEdge *page;
- static const gchar title[] = N_("Welcome to Balsa!");
- static const gchar text[] =
- N_
- ("Before you can send or receive email:\n\n"
- "-- either you should already have Internet access and an "
- "email account, provided by an Internet Service Provider, "
- "and you should have made that Internet connection on your "
- "computer\n\n"
- "-- or your Network Administrator at your place of "
- "work/study/similar may have set up your computer to "
- "connect to the network.");
-
- page =
- GNOME_DRUID_PAGE_EDGE(gnome_druid_page_edge_new
- (GNOME_EDGE_START));
- gnome_druid_page_edge_set_title(page, _(title));
- gnome_druid_page_edge_set_text(page, _(text));
- gnome_druid_page_edge_set_logo(page, default_logo);
- gnome_druid_page_edge_set_watermark(page,
- balsa_init_get_png
- ("balsa-watermark.png"));
- g_signal_connect(G_OBJECT(page), "prepare",
- G_CALLBACK(balsa_druid_page_welcome_prepare),
- NULL);
- gnome_druid_append_page(druid, GNOME_DRUID_PAGE(page));
- gnome_druid_set_page(druid, GNOME_DRUID_PAGE(page));
-}
-
-static void
-balsa_druid_page_welcome_prepare(GnomeDruidPage * page, GnomeDruid * druid)
-{
- /* FIXME: provide help */
- gnome_druid_set_buttons_sensitive(druid, FALSE, TRUE, TRUE, FALSE);
- gnome_druid_set_show_finish(druid, FALSE);
-}
diff --git a/libinit_balsa/balsa-druid-page-welcome.h b/libinit_balsa/balsa-druid-page-welcome.h
deleted file mode 100644
index 35103c2..0000000
--- a/libinit_balsa/balsa-druid-page-welcome.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <gtk/gtk.h>
-
-#ifndef __BALSA_DRUID_PAGE_WELCOME_H__
-#define __BALSA_DRUID_PAGE_WELCOME_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <gnome.h>
-#include "helper.h"
-#include "balsa-initdruid.h"
-
-/*
- * Public methods
- */
- void balsa_druid_page_welcome(GnomeDruid * druid,
- GdkPixbuf * default_logo);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif
diff --git a/libinit_balsa/balsa-initdruid.c b/libinit_balsa/balsa-initdruid.c
deleted file mode 100644
index efd8726..0000000
--- a/libinit_balsa/balsa-initdruid.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include "balsa-initdruid.h"
-
-#include <glib/gi18n.h>
-#include "libbalsa-conf.h"
-#include "save-restore.h"
-
-#include "balsa-druid-page-welcome.h"
-#include "balsa-druid-page-user.h"
-#include "balsa-druid-page-directory.h"
-#include "balsa-druid-page-defclient.h"
-#include "balsa-druid-page-finish.h"
-
-/* here are local prototypes */
-static void balsa_initdruid_init(GnomeDruid * druid);
-static void balsa_initdruid_cancel(GnomeDruid * druid);
-
-static void
-balsa_initdruid_init(GnomeDruid * druid)
-{
- GdkPixbuf *default_logo = balsa_init_get_png("balsa-logo.png");
-
- balsa_druid_page_welcome(druid, default_logo);
- balsa_druid_page_user(druid, default_logo);
-#if !defined(ENABLE_TOUCH_UI)
- balsa_druid_page_directory(druid, default_logo);
- balsa_druid_page_defclient(druid, default_logo);
-#endif
- balsa_druid_page_finish(druid, default_logo);
-}
-
-void
-balsa_initdruid(GtkWindow * window)
-{
- GnomeDruid *druid;
-
- g_return_if_fail(window != NULL);
- g_return_if_fail(GTK_IS_WINDOW(window));
-
- druid = GNOME_DRUID(gnome_druid_new());
- gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(druid));
- g_signal_connect(G_OBJECT(druid), "cancel",
- G_CALLBACK(balsa_initdruid_cancel), NULL);
- g_signal_connect(G_OBJECT(druid), "destroy",
- G_CALLBACK(exit), NULL);
- g_object_ref(G_OBJECT(window));
-
- balsa_initdruid_init(druid);
-}
-
-static void
-balsa_initdruid_cancel(GnomeDruid * druid)
-{
- GtkWidget *dialog =
- gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_ancestor
- (GTK_WIDGET(druid),
- GTK_TYPE_WINDOW)),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_YES_NO,
- _("This will exit Balsa.\n"
- "Do you really want to do this?"));
- GtkResponseType reply =
- gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
-
- if (reply == GTK_RESPONSE_YES) {
- libbalsa_conf_drop_all();
- exit(0);
- }
-}
diff --git a/libinit_balsa/balsa-initdruid.h b/libinit_balsa/balsa-initdruid.h
deleted file mode 100644
index b235fad..0000000
--- a/libinit_balsa/balsa-initdruid.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <gtk/gtk.h>
-
-#ifndef __BALSA_INITDRUID_H__
-#define __BALSA_INITDRUID_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <gnome.h>
-#include "helper.h"
-
-/*
- * Public methods
- */
- void balsa_initdruid(GtkWindow * window);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif
diff --git a/libinit_balsa/helper.c b/libinit_balsa/helper.c
deleted file mode 100644
index 9465591..0000000
--- a/libinit_balsa/helper.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
-#endif /* HAVE_CONFIG_H */
-#include "helper.h"
-
-#include <gnome.h>
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <glib/gi18n.h>
-#include "libbalsa.h"
-#include "url.h"
-
-/*
- * #ifdef BALSA_LOCAL_INSTALL
- * #define gnome_pixmap_file(s) g_strconcat(BALSA_RESOURCE_PREFIX, "/pixmaps/", s, NULL)
- * #define gnome_unconditional_pixmap_file(s) g_strconcat(BALSA_RESOURCE_PREFIX, "/pixmaps", s, NULL)
- * #endif
- */
-
-/* ************************************************************************** */
-
-static void entry_changed_cb(GtkEntry * entry, EntryData * ed);
-
-/* ************************************************************************** */
-
-GdkPixbuf *
-balsa_init_get_png(const gchar * fname)
-{
- GdkPixbuf *img;
- GError *err = NULL;
- gchar *fullpath;
-
- g_return_val_if_fail(fname != NULL, NULL);
-
- fullpath = balsa_pixmap_finder(fname);
-
- if (!fullpath)
- return NULL;
-
- img = gdk_pixbuf_new_from_file(fullpath, &err);
- if (err) {
- g_print(_("Error loading %s: %s\n"), fullpath, err->message);
- g_error_free(err);
- }
- g_free(fullpath);
-
- return img;
-}
-
-void
-balsa_init_add_table_entry(GtkTable * table, guint num, gchar * ltext,
- const gchar * etext, EntryData * ed,
- GnomeDruid * druid, GtkWidget ** dest)
-{
- GtkWidget *l, *e;
-
- l = gtk_label_new_with_mnemonic(ltext);
- gtk_label_set_justify(GTK_LABEL(l), GTK_JUSTIFY_RIGHT);
- gtk_misc_set_alignment(GTK_MISC(l), 1.0, 0.5);
- gtk_table_attach(table, GTK_WIDGET(l), 0, 1, num + 1, num + 2,
- GTK_FILL, GTK_FILL, 8, 4);
-
- e = gtk_entry_new();
- gtk_label_set_mnemonic_widget(GTK_LABEL(l), e);
- gtk_table_attach(table, GTK_WIDGET(e), 1, 2, num + 1, num + 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 8, 4);
- (*dest) = e;
- if(ed) {
- g_signal_connect(G_OBJECT(e), "changed",
- G_CALLBACK(entry_changed_cb), ed);
- ed->num = ed->master->numentries++;
- ed->druid = druid;
- if (etext && etext[0] != '\0')
- ed->master->setbits |= (1 << num);
-
- ed->master->donemask = (ed->master->donemask << 1) | 1;
- }
- gtk_entry_set_text(GTK_ENTRY(e), etext);
-}
-
-static void
-entry_changed_cb(GtkEntry * entry, EntryData * ed)
-{
- g_assert(ed != NULL);
-
- if (entry->text_length) {
- ed->master->setbits |= (1 << ed->num);
- } else {
- ed->master->setbits &= ~(1 << ed->num);
- }
-
- /* The stuff below is only when we are displayed... which is not
- * always the case.
- */
- if (!GTK_WIDGET_VISIBLE(GTK_WIDGET(entry)))
- return;
-
- if (GNOME_IS_DRUID(ed->druid)) {
- /* Don't let them continue unless all entries have something. */
- if (ENTRY_MASTER_P_DONE(ed->master)) {
- gnome_druid_set_buttons_sensitive(ed->druid, TRUE, TRUE, TRUE,
- FALSE);
- } else {
- gnome_druid_set_buttons_sensitive(ed->druid, TRUE, FALSE, TRUE,
- FALSE);
- }
- }
-}
-
-
-void
-balsa_init_add_table_option(GtkTable *table, guint num,
- const gchar *ltext, const gchar **optns,
- GnomeDruid *druid, GtkWidget **dest)
-{
- GtkWidget *l, *om;
- int i;
- l = gtk_label_new_with_mnemonic(ltext);
- gtk_label_set_justify(GTK_LABEL(l), GTK_JUSTIFY_RIGHT);
- gtk_misc_set_alignment(GTK_MISC(l), 1.0, 0.5);
- gtk_table_attach(table, l, 0, 1, num + 1, num + 2,
- GTK_FILL, GTK_FILL, 8, 4);
-
- *dest = om = gtk_combo_box_new_text();
- for(i=0; optns[i]; i++)
- gtk_combo_box_append_text(GTK_COMBO_BOX(om), _(optns[i]));
- gtk_label_set_mnemonic_widget(GTK_LABEL(l), om);
- gtk_combo_box_set_active(GTK_COMBO_BOX(om), 0);
- gtk_table_attach(table, om, 1, 2, num + 1, num + 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 8, 4);
-}
-
-gint
-balsa_option_get_active(GtkWidget *option_widget)
-{
- return gtk_combo_box_get_active(GTK_COMBO_BOX(option_widget));
-}
-
-void
-balsa_init_add_table_checkbox(GtkTable *table, guint num,
- const gchar *ltext, gboolean defval,
- GnomeDruid *druid, GtkWidget **dest)
-{
- GtkWidget *l;
-
- l = gtk_label_new_with_mnemonic(ltext);
- gtk_label_set_justify(GTK_LABEL(l), GTK_JUSTIFY_RIGHT);
- gtk_misc_set_alignment(GTK_MISC(l), 1.0, 0.5);
- gtk_table_attach(table, l, 0, 1, num + 1, num + 2,
- GTK_FILL, GTK_FILL, 8, 4);
-
- *dest = gtk_check_button_new();
- gtk_table_attach(table, *dest, 1, 2, num + 1, num + 2,
- GTK_FILL, GTK_FILL, 8, 4);
- if(defval)
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(*dest), TRUE);
- gtk_label_set_mnemonic_widget(GTK_LABEL(l), *dest);
-}
-
-gboolean
-balsa_init_create_to_directory(const gchar * dir, gchar ** complaint)
-{
- /* Security. Well, we could create some weird directories, but
- a) that's not very destructive and b) unless we have root
- privileges (which would be so, so, wrong) we can't do any
- damage. */
- struct stat sb;
- gchar *sofar;
- guint32 i;
- url_scheme_t scheme = url_check_scheme(dir);
-
- if (scheme == U_IMAP || scheme == U_POP)
- return FALSE; /* *** For now */
-
- if (dir[0] != '/') {
- (*complaint) =
- g_strdup_printf(_
- ("The path %s must be relative to the filesystem root (start with /)."),
- dir);
- return TRUE;
- }
-
- for (i = 1; dir[i] != '\0'; i++) {
- if (dir[i] == '/') {
- sofar = g_strndup(dir, i);
-
- if (stat(sofar, &sb) < 0) {
- if (mkdir(sofar, S_IRUSR | S_IWUSR | S_IXUSR) < 0) {
- (*complaint) =
- g_strdup_printf(_
- ("Couldn't create a directory: mkdir() failed on pathname \"%s\"."),
- sofar);
- g_free(sofar);
- return TRUE;
- }
- }
-
- if (!S_ISDIR(sb.st_mode)) {
- (*complaint) =
- g_strdup_printf(_
- ("The file with pathname \"%s\" is not a directory."),
- sofar);
- g_free(sofar);
- return TRUE;
- }
-
- g_free(sofar);
- }
- }
-
- if (stat(dir, &sb) < 0) {
- if (mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR) < 0) {
- (*complaint) =
- g_strdup_printf(_
- ("Couldn't create a directory: mkdir() failed on pathname \"%s\"."),
- dir);
- return TRUE;
- }
- }
-
- if (!S_ISDIR(sb.st_mode)) {
- (*complaint) =
- g_strdup_printf(_
- ("The file with pathname \"%s\" is not a directory."),
- dir);
- return TRUE;
- }
-
- return FALSE;
-}
diff --git a/libinit_balsa/helper.h b/libinit_balsa/helper.h
deleted file mode 100644
index 8ba8053..0000000
--- a/libinit_balsa/helper.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef LIBINIT_BALSA_HELPER_H
-#define LIBINIT_BALSA_HELPER_H
-
-#include <gnome.h>
-
-typedef struct EntryData_s EntryData;
-typedef struct EntryMaster_s EntryMaster;
-
-struct EntryData_s {
- GnomeDruid *druid;
- guint num;
- EntryMaster *master;
-};
-
-#define ENTRY_DATA_INIT { NULL, 0 }
-
-struct EntryMaster_s {
- guint32 setbits;
- guint32 numentries;
- guint32 donemask;
-};
-
-#define ENTRY_MASTER_INIT { 0, 0, 0 }
-#define ENTRY_MASTER_P_DONE( ep ) ( ((ep)->setbits & (ep)->donemask) == (ep)->donemask )
-#define ENTRY_MASTER_DONE( e ) ( ((e).setbits & (e).donemask) == (e).donemask )
-
-GdkPixbuf *balsa_init_get_png(const gchar * fname);
-
-void balsa_init_add_table_entry(GtkTable * table, guint num, gchar * ltext,
- const gchar * etext, EntryData * ed,
- GnomeDruid * druid, GtkWidget ** dest);
-void balsa_init_add_table_option(GtkTable *table, guint num,
- const gchar *ltext, const gchar **optns,
- GnomeDruid *druid, GtkWidget **dest);
-void balsa_init_add_table_checkbox(GtkTable *table, guint num,
- const gchar *ltext, gboolean defval,
- GnomeDruid *druid, GtkWidget **dest);
-gint balsa_option_get_active(GtkWidget *option_widget);
-
-gboolean balsa_init_create_to_directory(const gchar * dir,
- gchar ** complaint);
-
-#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 2a6e9b7..28fd4c4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,7 +72,6 @@ balsa_BASE_SRCLIST = \
toolbar-prefs.c \
toolbar-prefs.h
-if BUILD_WITH_GTK_PRINT
balsa_print_source = print-gtk.c \
balsa-print-object.c \
balsa-print-object.h \
@@ -86,23 +85,6 @@ balsa_print_source = print-gtk.c \
balsa-print-object-image.h \
balsa-print-object-text.c \
balsa-print-object-text.h
-balsa_print_extra_dist = print.c
-else
-balsa_print_source = print.c
-balsa_print_extra_dist = print-gtk.c \
- balsa-print-object.c \
- balsa-print-object.h \
- balsa-print-object-decor.c \
- balsa-print-object-decor.h \
- balsa-print-object-default.c \
- balsa-print-object-default.h \
- balsa-print-object-header.c \
- balsa-print-object-header.h \
- balsa-print-object-image.c \
- balsa-print-object-image.h \
- balsa-print-object-text.c \
- balsa-print-object-text.h
-endif
if BUILD_WITH_GTKSPELL
balsa_gtkspell_extra =
@@ -147,8 +129,7 @@ DISTCLEANFILES = $(balsa_IDL_SRCLIST)
EXTRA_DIST = \
$(balsa_gtkspell_extra_dist) \
- $(balsa_bonobo_extra_dist) \
- $(balsa_print_extra_dist)
+ $(balsa_bonobo_extra_dist)
AM_CPPFLAGS = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
diff --git a/src/address-book-config.c b/src/address-book-config.c
index 59f34c6..5e70827 100644
--- a/src/address-book-config.c
+++ b/src/address-book-config.c
@@ -26,12 +26,6 @@
#include <gtk/gtk.h>
-#if !GTK_CHECK_VERSION(2, 14, 0)
-#ifdef HAVE_GNOME
-#include <gnome.h>
-#endif
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
-
#include "balsa-app.h"
#include <glib/gi18n.h>
@@ -516,15 +510,10 @@ create_rubrica_dialog(AddressBookConfig * abc)
static void
help_button_cb(AddressBookConfig * abc)
{
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
GError *err = NULL;
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, "ghelp:balsa?preferences-address-books",
gtk_get_current_event_time(), &err);
-#else /* GTK_CHECK_VERSION(2, 14, 0) */
- gnome_help_display("balsa", "preferences-1", &err);
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
if (err) {
libbalsa_information(LIBBALSA_INFORMATION_WARNING,
@@ -532,7 +521,6 @@ help_button_cb(AddressBookConfig * abc)
err->message);
g_error_free(err);
}
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
}
diff --git a/src/balsa-app.c b/src/balsa-app.c
index 11c9696..5dcff57 100644
--- a/src/balsa-app.c
+++ b/src/balsa-app.c
@@ -381,20 +381,14 @@ balsa_app_init(void)
balsa_app.date_string = g_strdup(DEFAULT_DATE_FORMAT);
/* printing */
-#ifdef HAVE_GTK_PRINT
balsa_app.print_settings = gtk_print_settings_new();
balsa_app.page_setup = gtk_page_setup_new();
-#else
- balsa_app.paper_size = g_strdup(DEFAULT_PAPER_SIZE);
-#endif
balsa_app.print_header_font = g_strdup(DEFAULT_PRINT_HEADER_FONT);
balsa_app.print_footer_font = g_strdup(DEFAULT_PRINT_FOOTER_FONT);
balsa_app.print_body_font = g_strdup(DEFAULT_PRINT_BODY_FONT);
balsa_app.print_highlight_cited = FALSE;
-#ifdef HAVE_GTK_PRINT
balsa_app.print_highlight_phrases = FALSE;
-#endif
/* address book */
balsa_app.address_book_list = NULL;
@@ -425,14 +419,7 @@ balsa_app_init(void)
balsa_app.notify_new_mail_sound = 1;
balsa_app.notify_new_mail_dialog = 0;
-#if GTK_CHECK_VERSION(2, 10, 0)
balsa_app.notify_new_mail_icon = 1;
-#endif /* GTK_CHECK_VERSION(2, 10, 0) */
-
-#if !GTK_CHECK_VERSION(2, 11, 0)
- /* Tooltips */
- balsa_app.tooltips = gtk_tooltips_new();
-#endif /* !GTK_CHECK_VERSION(2, 11, 0) */
/* Local and IMAP */
balsa_app.local_scan_depth = 1;
diff --git a/src/balsa-app.h b/src/balsa-app.h
index f4b0ebc..8e63aae 100644
--- a/src/balsa-app.h
+++ b/src/balsa-app.h
@@ -211,9 +211,7 @@ extern struct BalsaApplication {
gint notify_new_mail_sound;
gint notify_new_mail_dialog;
-#if GTK_CHECK_VERSION(2, 10, 0)
gint notify_new_mail_icon;
-#endif /* GTK_CHECK_VERSION(2, 10, 0) */
/* automatically close mailboxes after XX minutes */
gboolean close_mailbox_auto;
@@ -346,31 +344,17 @@ extern struct BalsaApplication {
gchar *date_string;
/* printing */
-#ifdef HAVE_GTK_PRINT
GtkPageSetup *page_setup;
GtkPrintSettings *print_settings;
gdouble margin_left;
gdouble margin_top;
gdouble margin_right;
gdouble margin_bottom;
-#else
- gchar* paper_size; /* A4 or Letter */
- gchar* margin_left;
- gchar* margin_top;
- gchar* margin_right;
- gchar* margin_bottom;
- gchar* print_unit;
- gchar* print_layout;
- gchar* paper_orientation;
- gchar* page_orientation;
-#endif
gchar* print_header_font; /* font for printing headers */
gchar* print_body_font; /* font for printing text parts */
gchar* print_footer_font; /* font for printing footers */
gboolean print_highlight_cited;
-#ifdef HAVE_GTK_PRINT
gboolean print_highlight_phrases;
-#endif
/* compose */
gchar *compose_headers;
@@ -403,11 +387,6 @@ extern struct BalsaApplication {
BalsaInformationShow debug_message;
BalsaInformationShow fatal_message;
-#if !GTK_CHECK_VERSION(2, 11, 0)
- /* Tooltips */
- GtkTooltips *tooltips;
-#endif /* !GTK_CHECK_VERSION(2, 11, 0) */
-
/* how to act if a MDN request is received */
BalsaMDNReply mdn_reply_clean;
BalsaMDNReply mdn_reply_notclean;
diff --git a/src/balsa-icons.c b/src/balsa-icons.c
index bd336dd..66eff2a 100644
--- a/src/balsa-icons.c
+++ b/src/balsa-icons.c
@@ -65,9 +65,7 @@ balsa_icon_create(const gchar ** data, GdkPixmap ** pmap, GdkBitmap ** bmap)
bmap, 0, (gchar **) data);
}
-#if GTK_CHECK_VERSION(2, 8, 0)
static GHashTable *balsa_icon_table;
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
static void
load_balsa_pixmap(GtkIconTheme *icon_theme, GtkIconFactory *factory,
@@ -110,10 +108,8 @@ load_balsa_pixmap(GtkIconTheme *icon_theme, GtkIconFactory *factory,
} else
use_id = bpixmap->stock_id;
-#if GTK_CHECK_VERSION(2, 8, 0)
g_hash_table_insert(balsa_icon_table, g_strdup(bpixmap->name),
g_strdup(use_id));
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
if (!gtk_icon_size_lookup(bpixmap->sizes[0], &width, &height)) {
BICONS_ERR("failed: could not look up default icon size %d",
@@ -295,10 +291,8 @@ register_balsa_pixmaps(void)
GtkIconFactory *factory = gtk_icon_factory_new();
GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
-#if GTK_CHECK_VERSION(2, 8, 0)
balsa_icon_table =
g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
gtk_icon_factory_add_default(factory);
gtk_icon_theme_append_search_path(icon_theme, BALSA_DATA_PREFIX);
@@ -341,7 +335,6 @@ register_balsa_pixbufs(GtkWidget * widget)
NULL));
}
-#if GTK_CHECK_VERSION(2, 8, 0)
const gchar *
balsa_icon_id(const gchar * name)
{
@@ -349,4 +342,3 @@ balsa_icon_id(const gchar * name)
return retval ? retval : name;
}
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
diff --git a/src/balsa-icons.h b/src/balsa-icons.h
index 6f632be..6e70ff5 100644
--- a/src/balsa-icons.h
+++ b/src/balsa-icons.h
@@ -97,7 +97,5 @@ void register_balsa_pixmaps(void);
void register_balsa_pixbufs(GtkWidget * widget);
void balsa_icon_create(const gchar ** data, GdkPixmap ** pmap,
GdkBitmap ** bmap);
-#if GTK_CHECK_VERSION(2, 8, 0)
const gchar * balsa_icon_id(const gchar * name);
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
#endif
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 69b093a..bf5ff5b 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -376,12 +376,7 @@ bndx_instance_init(BalsaIndex * index)
/* Initialize some other members */
index->mailbox_node = NULL;
index->popup_menu = bndx_popup_menu_create(index);
-#if GLIB_CHECK_VERSION(2, 10, 0)
g_object_ref_sink(index->popup_menu);
-#else /* GLIB_CHECK_VERSION(2, 10, 0) */
- g_object_ref(index->popup_menu);
- gtk_object_sink(GTK_OBJECT(index->popup_menu));
-#endif /* GLIB_CHECK_VERSION(2, 10, 0) */
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
@@ -2687,14 +2682,9 @@ balsa_index_ensure_visible(BalsaIndex * index)
/* Current message not displayed, make sure that something
else is... */
gtk_tree_view_get_visible_rect(tree_view, &rect);
-#if GTK_CHECK_VERSION(2, 11, 0)
gtk_tree_view_convert_tree_to_widget_coords(tree_view,
rect.x, rect.y,
&rect.x, &rect.y);
-#else /* GTK_CHECK_VERSION(2, 11, 0) */
- gtk_tree_view_tree_to_widget_coords(tree_view, rect.x, rect.y,
- &rect.x, &rect.y);
-#endif /* GTK_CHECK_VERSION(2, 11, 0) */
if (gtk_tree_view_get_path_at_pos(tree_view, rect.x, rect.y, &path,
NULL, NULL, NULL)) {
diff --git a/src/balsa-mblist.c b/src/balsa-mblist.c
index a85c2cb..42ca044 100644
--- a/src/balsa-mblist.c
+++ b/src/balsa-mblist.c
@@ -226,11 +226,7 @@ bmbl_set_property_node_style(GSList * list)
GtkTreeModel *model;
GtkTreeIter iter;
-#if GTK_CHECK_VERSION(2, 8, 0)
model = gtk_tree_row_reference_get_model(reference);
-#else /* GTK_CHECK_VERSION(2, 8, 0) */
- model = GTK_TREE_MODEL(balsa_app.mblist_tree_store);
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
if (gtk_tree_model_get_iter(model, &iter, path))
bmbl_node_style(model, &iter);
gtk_tree_path_free(path);
@@ -360,11 +356,7 @@ bmbl_init(BalsaMBList * mblist)
renderer = gtk_cell_renderer_pixbuf_new();
gtk_tree_view_column_pack_start(column, renderer, FALSE);
gtk_tree_view_column_set_attributes(column, renderer,
-#if GTK_CHECK_VERSION(2, 8, 0)
"icon-name", ICON_COLUMN,
-#else /* GTK_CHECK_VERSION(2, 8, 0) */
- "pixbuf", ICON_COLUMN,
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
NULL);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(column, renderer, FALSE);
@@ -488,11 +480,7 @@ balsa_mblist_get_store(void)
balsa_app.mblist_tree_store =
gtk_tree_store_new(N_COLUMNS,
G_TYPE_OBJECT, /* MBNODE_COLUMN */
-#if GTK_CHECK_VERSION(2, 8, 0)
G_TYPE_STRING, /* ICON_COLUMN */
-#else /* GTK_CHECK_VERSION(2, 8, 0) */
- GDK_TYPE_PIXBUF, /* ICON_COLUMN */
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
G_TYPE_STRING, /* NAME_COLUMN */
PANGO_TYPE_WEIGHT, /* WEIGHT_COLUMN */
PANGO_TYPE_STYLE, /* STYLE_COLUMN */
@@ -557,30 +545,11 @@ bmbl_tree_expand(GtkTreeView * tree_view, GtkTreeIter * iter,
gtk_tree_model_get(model, iter, MBNODE_COLUMN, &mbnode, -1);
balsa_mailbox_node_scan_children(mbnode);
- if (!mbnode->mailbox) {
-#if GTK_CHECK_VERSION(2, 8, 0)
+ if (!mbnode->mailbox)
gtk_tree_store_set(GTK_TREE_STORE(model), iter,
ICON_COLUMN,
balsa_icon_id(BALSA_PIXMAP_MBOX_DIR_OPEN),
-1);
-#else /* GTK_CHECK_VERSION(2, 8, 0) */
- GdkPixbuf *pixbuf =
- gtk_widget_render_icon(GTK_WIDGET(balsa_app.main_window),
- BALSA_PIXMAP_MBOX_DIR_OPEN,
- GTK_ICON_SIZE_MENU, NULL);
- gtk_tree_store_set(GTK_TREE_STORE(model), iter,
- ICON_COLUMN, pixbuf,
- -1);
- if(pixbuf) g_object_unref(pixbuf);
- else {
- static int p=1;
- if(p){
- printf("icon %s not found.\n", BALSA_PIXMAP_MBOX_DIR_OPEN);
- p = 0;
- }
- }
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
- }
g_object_unref(mbnode);
if (gtk_tree_model_iter_children(model, &child_iter, iter)) {
@@ -648,30 +617,11 @@ bmbl_tree_collapse(GtkTreeView * tree_view, GtkTreeIter * iter,
gtk_tree_model_get(model, iter, MBNODE_COLUMN, &mbnode, -1);
- if (!mbnode->mailbox) {
-#if GTK_CHECK_VERSION(2, 8, 0)
+ if (!mbnode->mailbox)
gtk_tree_store_set(GTK_TREE_STORE(model), iter,
ICON_COLUMN,
balsa_icon_id(BALSA_PIXMAP_MBOX_DIR_CLOSED),
-1);
-#else /* GTK_CHECK_VERSION(2, 8, 0) */
- GdkPixbuf *pixbuf =
- gtk_widget_render_icon(GTK_WIDGET(balsa_app.main_window),
- BALSA_PIXMAP_MBOX_DIR_CLOSED,
- GTK_ICON_SIZE_MENU, NULL);
- gtk_tree_store_set(GTK_TREE_STORE(model), iter,
- ICON_COLUMN, pixbuf,
- -1);
- if(pixbuf) g_object_unref(pixbuf);
- else {
- static int p=1;
- if(p){
- printf("icon %s not found.\n", BALSA_PIXMAP_MBOX_DIR_CLOSED);
- p = 0;
- }
- }
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
- }
g_object_unref(mbnode);
bmbl_tree_collapse_helper(model, iter);
@@ -804,12 +754,7 @@ bmbl_do_popup(GtkTreeView * tree_view, GtkTreePath * path,
menu = balsa_mailbox_node_get_context_menu(mbnode);
g_object_ref(menu);
-#if GLIB_CHECK_VERSION(2, 10, 0)
g_object_ref_sink(menu);
-#else /* GLIB_CHECK_VERSION(2, 10, 0) */
- g_object_ref(menu);
- gtk_object_sink(GTK_OBJECT(menu));
-#endif /* GLIB_CHECK_VERSION(2, 10, 0) */
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
event_button, event_time);
g_object_unref(menu);
@@ -1337,9 +1282,6 @@ bmbl_store_redraw_mbnode(GtkTreeIter * iter, BalsaMailboxNode * mbnode)
const gchar *icon;
const gchar *name;
gchar *tmp = NULL;
-#if !GTK_CHECK_VERSION(2, 8, 0)
- GdkPixbuf *pixbuf;
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
gboolean expose = FALSE;
g_return_val_if_fail(mbnode, FALSE);
@@ -1414,7 +1356,6 @@ bmbl_store_redraw_mbnode(GtkTreeIter * iter, BalsaMailboxNode * mbnode)
name = tmp = g_path_get_basename(mbnode->name);
}
-#if GTK_CHECK_VERSION(2, 8, 0)
gtk_tree_store_set(balsa_app.mblist_tree_store, iter,
MBNODE_COLUMN, mbnode,
ICON_COLUMN, balsa_icon_id(icon),
@@ -1424,25 +1365,6 @@ bmbl_store_redraw_mbnode(GtkTreeIter * iter, BalsaMailboxNode * mbnode)
UNREAD_COLUMN, "",
TOTAL_COLUMN, "",
-1);
-#else /* GTK_CHECK_VERSION(2, 8, 0) */
- /* render icon may fail if the installation was incomplete */
- pixbuf = gtk_widget_render_icon(GTK_WIDGET(balsa_app.main_window),
- icon, GTK_ICON_SIZE_MENU, NULL);
- gtk_tree_store_set(balsa_app.mblist_tree_store, iter,
- MBNODE_COLUMN, mbnode,
- ICON_COLUMN, pixbuf,
- NAME_COLUMN, name,
- WEIGHT_COLUMN, PANGO_WEIGHT_NORMAL,
- STYLE_COLUMN, PANGO_STYLE_NORMAL,
- UNREAD_COLUMN, "",
- TOTAL_COLUMN, "",
- -1);
- if(pixbuf) g_object_unref(pixbuf);
- else {
- static int p=1;
- if(p){ printf("icon %s not found.\n", icon); p = 0; }
- }
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
g_free(tmp);
if (mbnode->mailbox) {
@@ -1533,9 +1455,6 @@ bmbl_node_style(GtkTreeModel * model, GtkTreeIter * iter)
const gchar *name;
gchar *tmp = NULL;
PangoWeight weight;
-#if !GTK_CHECK_VERSION(2, 8, 0)
- GdkPixbuf *pixbuf;
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
/* Set the style appropriate for unread_messages; we do this
* even if the state hasn't changed, because we might be
@@ -1563,26 +1482,11 @@ bmbl_node_style(GtkTreeModel * model, GtkTreeIter * iter)
mbnode->style &= ~MBNODE_STYLE_NEW_MAIL;
}
-#if GTK_CHECK_VERSION(2, 8, 0)
gtk_tree_store_set(GTK_TREE_STORE(model), iter,
ICON_COLUMN, balsa_icon_id(icon),
NAME_COLUMN, name,
WEIGHT_COLUMN, weight,
-1);
-#else /* GTK_CHECK_VERSION(2, 8, 0) */
- pixbuf = gtk_widget_render_icon(GTK_WIDGET(balsa_app.main_window),
- icon, GTK_ICON_SIZE_MENU, NULL);
- gtk_tree_store_set(GTK_TREE_STORE(model), iter,
- ICON_COLUMN, pixbuf,
- NAME_COLUMN, name,
- WEIGHT_COLUMN, weight,
- -1);
- if(pixbuf) g_object_unref(pixbuf);
- else {
- static int p=1;
- if(p){ printf("icon %s not found.\n", icon); p = 0; }
- }
-#endif /* GTK_CHECK_VERSION(2, 8, 0) */
g_free(tmp);
}
diff --git a/src/balsa-message.c b/src/balsa-message.c
index 3da2db5..b65db21 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -280,11 +280,6 @@ bm_header_tl_buttons(BalsaMessage * bm)
GtkWidget *vbox;
GtkWidget *button;
-#if !GTK_CHECK_VERSION(2, 11, 0)
- /* the event box is needed to set the background correctly */
- GtkTooltips *tooltips = gtk_tooltips_new();
-#endif /* !GTK_CHECK_VERSION(2, 11, 0) */
-
ebox = gtk_event_box_new();
hbox2 = gtk_hbox_new(FALSE, 6);
@@ -300,13 +295,8 @@ bm_header_tl_buttons(BalsaMessage * bm)
gtk_box_pack_start(GTK_BOX(hbox2), vbox, FALSE, FALSE, 0);
button = gtk_button_new();
-#if GTK_CHECK_VERSION(2, 11, 0)
gtk_widget_set_tooltip_text(button,
_("Check cryptographic signature"));
-#else /* GTK_CHECK_VERSION(2, 11, 0) */
- gtk_tooltips_set_tip(tooltips, button,
- _("Check cryptographic signature"), NULL);
-#endif /* GTK_CHECK_VERSION(2, 11, 0) */
g_signal_connect(G_OBJECT(button), "focus_in_event",
G_CALLBACK(balsa_mime_widget_limit_focus),
(gpointer) bm);
@@ -326,13 +316,8 @@ bm_header_tl_buttons(BalsaMessage * bm)
gtk_box_pack_start(GTK_BOX(hbox2), vbox, FALSE, FALSE, 0);
button = gtk_button_new();
-#if GTK_CHECK_VERSION(2, 11, 0)
gtk_widget_set_tooltip_text(button,
_("Select message part to display"));
-#else /* GTK_CHECK_VERSION(2, 11, 0) */
- gtk_tooltips_set_tip(tooltips, button,
- _("Select message part to display"), NULL);
-#endif /* GTK_CHECK_VERSION(2, 11, 0) */
g_signal_connect(G_OBJECT(button), "focus_in_event",
G_CALLBACK(balsa_mime_widget_limit_focus),
(gpointer) bm);
@@ -918,12 +903,7 @@ tree_mult_selection_popup(BalsaMessage * bm, GdkEventButton * event,
GtkWidget *menu_item;
bm->save_all_popup = gtk_menu_new ();
-#if GLIB_CHECK_VERSION(2, 10, 0)
g_object_ref_sink(bm->save_all_popup);
-#else /* GLIB_CHECK_VERSION(2, 10, 0) */
- g_object_ref(bm->save_all_popup);
- gtk_object_sink(GTK_OBJECT(bm->save_all_popup));
-#endif /* GLIB_CHECK_VERSION(2, 10, 0) */
menu_item =
gtk_menu_item_new_with_label (_("Save selected as..."));
gtk_widget_show(menu_item);
@@ -1526,12 +1506,7 @@ display_content(BalsaMessage * bm)
if (bm->parts_popup)
g_object_unref(bm->parts_popup);
bm->parts_popup = gtk_menu_new();
-#if GLIB_CHECK_VERSION(2, 10, 0)
g_object_ref_sink(bm->parts_popup);
-#else /* GLIB_CHECK_VERSION(2, 10, 0) */
- g_object_ref(bm->parts_popup);
- gtk_object_sink(GTK_OBJECT(bm->parts_popup));
-#endif /* GLIB_CHECK_VERSION(2, 10, 0) */
display_parts(bm, bm->message->body_list, NULL, NULL);
if (bm->info_count > 1) {
gtk_widget_show_all(bm->parts_popup);
@@ -1587,12 +1562,7 @@ part_create_menu (BalsaPartInfo* info)
gchar* content_type;
info->popup_menu = gtk_menu_new ();
-#if GLIB_CHECK_VERSION(2, 10, 0)
g_object_ref_sink(info->popup_menu);
-#else /* GLIB_CHECK_VERSION(2, 10, 0) */
- g_object_ref(info->popup_menu);
- gtk_object_sink(GTK_OBJECT(info->popup_menu));
-#endif /* GLIB_CHECK_VERSION(2, 10, 0) */
content_type = libbalsa_message_body_get_mime_type (info->body);
libbalsa_vfs_fill_menu_by_content_type(GTK_MENU(info->popup_menu),
diff --git a/src/balsa-mime-widget-message.c b/src/balsa-mime-widget-message.c
index ad4a102..e234e03 100644
--- a/src/balsa-mime-widget-message.c
+++ b/src/balsa-mime-widget-message.c
@@ -27,10 +27,6 @@
#include <string.h>
#include <gtk/gtk.h>
-#if !GTK_CHECK_VERSION(2, 14, 0)
-#include <libgnome/gnome-url.h>
-#endif
-
#include "balsa-app.h"
#include "balsa-icons.h"
#include "send.h"
@@ -294,11 +290,7 @@ extbody_call_url(GtkWidget * button, gpointer data)
GError *err = NULL;
g_return_if_fail(url);
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, url, gtk_get_current_event_time(), &err);
-#else
- gnome_url_show(url, &err);
-#endif
if (err) {
balsa_information(LIBBALSA_INFORMATION_WARNING,
_("Error showing %s: %s\n"), url, err->message);
diff --git a/src/balsa-mime-widget-text.c b/src/balsa-mime-widget-text.c
index e59da62..8ee306e 100644
--- a/src/balsa-mime-widget-text.c
+++ b/src/balsa-mime-widget-text.c
@@ -36,10 +36,6 @@
#include "balsa-mime-widget-callbacks.h"
#include "balsa-cite-bar.h"
-#if !GTK_CHECK_VERSION(2, 14, 0)
-#include <libgnome/gnome-url.h>
-#endif
-
#if HAVE_GTKSOURCEVIEW
#include <gtksourceview/gtksourceview.h>
#include <gtksourceview/gtksourcebuffer.h>
@@ -933,11 +929,7 @@ handle_url(const message_url_t* url)
gtk_statusbar_push(statusbar, context_id, notice);
SCHEDULE_BAR_REFRESH();
g_free(notice);
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, url->url, gtk_get_current_event_time(), &err);
-#else
- gnome_url_show(url->url, &err);
-#endif
if (err) {
balsa_information(LIBBALSA_INFORMATION_WARNING,
_("Error showing %s: %s\n"), url->url,
@@ -1183,12 +1175,7 @@ balsa_gtk_html_popup(GtkWidget * html, BalsaMessage * bm)
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show_all(menu);
-#if GLIB_CHECK_VERSION(2, 10, 0)
g_object_ref_sink(menu);
-#else /* GLIB_CHECK_VERSION(2, 10, 0) */
- g_object_ref(menu);
- gtk_object_sink(GTK_OBJECT(menu));
-#endif /* GLIB_CHECK_VERSION(2, 10, 0) */
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
0, gtk_get_current_event_time());
g_object_unref(menu);
@@ -1208,11 +1195,7 @@ bm_widget_link_clicked(const gchar *url)
{
GError *err = NULL;
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, url, gtk_get_current_event_time(), &err);
-#else
- gnome_url_show(url, &err);
-#endif
if (err) {
balsa_information(LIBBALSA_INFORMATION_WARNING,
_("Error showing %s: %s\n"), url, err->message);
diff --git a/src/balsa-mime-widget.c b/src/balsa-mime-widget.c
index 749875f..bbb6040 100644
--- a/src/balsa-mime-widget.c
+++ b/src/balsa-mime-widget.c
@@ -175,12 +175,7 @@ balsa_mime_widget_new(BalsaMessage * bm, LibBalsaMessageBody * mime_body, gpoint
signature);
}
#endif
-#if GLIB_CHECK_VERSION(2, 10, 0)
g_object_ref_sink(mw->widget);
-#else /* GLIB_CHECK_VERSION(2, 10, 0) */
- g_object_ref(G_OBJECT(mw->widget));
- gtk_object_sink(GTK_OBJECT(mw->widget));
-#endif /* GLIB_CHECK_VERSION(2, 10, 0) */
if (GTK_IS_LAYOUT(mw->widget))
g_signal_connect(G_OBJECT(gtk_layout_get_vadjustment(GTK_LAYOUT(mw->widget))),
diff --git a/src/filter-edit-callbacks.c b/src/filter-edit-callbacks.c
index cca1d13..6a37312 100644
--- a/src/filter-edit-callbacks.c
+++ b/src/filter-edit-callbacks.c
@@ -45,12 +45,6 @@
#include "libbalsa-conf.h"
#include "missing.h"
-#if !GTK_CHECK_VERSION(2, 14, 0)
-#ifdef HAVE_GNOME
-#include <gnome.h>
-#endif
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
-
/* Defined in filter-edit-dialog.c*/
extern option_list fe_search_type[4];
extern GList * fe_user_headers_list;
@@ -822,9 +816,7 @@ condition_dialog_response(GtkWidget * dialog, gint response,
gpointer throwaway)
{
LibBalsaCondition *new_cnd;
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
GError *err = NULL;
-#endif
switch (response) {
case GTK_RESPONSE_OK: /* OK button */
@@ -880,13 +872,8 @@ condition_dialog_response(GtkWidget * dialog, gint response,
gtk_widget_hide(dialog);
break;
case GTK_RESPONSE_HELP: /* Help button */
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, "ghelp:balsa?win-condition",
gtk_get_current_event_time(), &err);
-#else /* GTK_CHECK_VERSION(2, 14, 0) */
- gnome_help_display("balsa", "win-condition", &err);
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
if (err) {
balsa_information_parented(GTK_WINDOW(dialog),
LIBBALSA_INFORMATION_WARNING,
@@ -894,7 +881,6 @@ condition_dialog_response(GtkWidget * dialog, gint response,
err->message);
g_error_free(err);
}
-#endif
break;
}
gtk_widget_set_sensitive(fe_window, TRUE);
@@ -1450,9 +1436,7 @@ fe_dialog_response(GtkWidget * dialog, gint response, gpointer data)
gtk_tree_view_get_model(fe_filters_list);
GtkTreeIter iter;
gboolean valid;
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
GError *err = NULL;
-#endif
switch (response) {
case GTK_RESPONSE_OK: /* OK button */
@@ -1491,13 +1475,8 @@ fe_dialog_response(GtkWidget * dialog, gint response, gpointer data)
break;
case GTK_RESPONSE_HELP: /* Help button */
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, "ghelp:balsa?win-filters",
gtk_get_current_event_time(), &err);
-#else /* GTK_CHECK_VERSION(2, 14, 0) */
- gnome_help_display("balsa", "win-filters", &err);
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
if (err) {
balsa_information_parented(GTK_WINDOW(dialog),
LIBBALSA_INFORMATION_WARNING,
@@ -1505,7 +1484,6 @@ fe_dialog_response(GtkWidget * dialog, gint response, gpointer data)
err->message);
g_error_free(err);
}
-#endif
break;
default:
diff --git a/src/filter-run-callbacks.c b/src/filter-run-callbacks.c
index 1e2c006..b6c1138 100644
--- a/src/filter-run-callbacks.c
+++ b/src/filter-run-callbacks.c
@@ -37,12 +37,6 @@
#include <glib/gi18n.h> /* Must come after balsa-app.h. */
-#if !GTK_CHECK_VERSION(2, 14, 0)
-#ifdef HAVE_GNOME
-#include <gnome.h>
-#endif
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
-
/* Global vars */
extern GList * fr_dialogs_opened;
@@ -167,9 +161,7 @@ void fr_dialog_response(GtkWidget * widget, gint response,
gpointer throwaway)
{
BalsaFilterRunDialog * p;
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
GError *err = NULL;
-#endif
p=BALSA_FILTER_RUN_DIALOG(widget);
switch (response) {
@@ -184,13 +176,8 @@ void fr_dialog_response(GtkWidget * widget, gint response,
break;
case GTK_RESPONSE_HELP: /* Help button */
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, "ghelp:balsa?win-run-filters",
gtk_get_current_event_time(), &err);
-#else /* GTK_CHECK_VERSION(2, 14, 0) */
- gnome_help_display("balsa", "win-run-filters", &err);
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
if (err) {
balsa_information_parented(GTK_WINDOW(widget),
LIBBALSA_INFORMATION_WARNING,
@@ -198,7 +185,6 @@ void fr_dialog_response(GtkWidget * widget, gint response,
err->message);
g_error_free(err);
}
-#endif
return;
default:
diff --git a/src/folder-conf.c b/src/folder-conf.c
index a8416a0..fc46073 100644
--- a/src/folder-conf.c
+++ b/src/folder-conf.c
@@ -34,12 +34,6 @@
#include "imap-server.h"
#include <glib/gi18n.h>
-#if !GTK_CHECK_VERSION(2, 14, 0)
-#ifdef HAVE_GNOME
-#include <gnome.h>
-#endif
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
-
typedef struct _CommonDialogData CommonDialogData;
typedef struct _FolderDialogData FolderDialogData;
typedef struct _SubfolderDialogData SubfolderDialogData;
@@ -95,9 +89,7 @@ static void
folder_conf_response(GtkDialog * dialog, int response,
CommonDialogData * cdd)
{
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
GError *err = NULL;
-#endif
/* If mbnode's parent gets rescanned, mbnode will be finalized,
* which triggers folder_conf_destroy_cdd, and recursively calls
@@ -107,20 +99,14 @@ folder_conf_response(GtkDialog * dialog, int response,
g_object_ref(cdd->mbnode);
switch (response) {
case GTK_RESPONSE_HELP:
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, "ghelp:balsa?folder-config",
gtk_get_current_event_time(), &err);
-#else /* GTK_CHECK_VERSION(2, 14, 0) */
- gnome_help_display("balsa", "folder-config", &err);
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
if (err) {
balsa_information(LIBBALSA_INFORMATION_WARNING,
_("Error displaying config help: %s\n"),
err->message);
g_error_free(err);
}
-#endif
if (cdd->mbnode)
g_object_unref(cdd->mbnode);
return;
diff --git a/src/main-window.c b/src/main-window.c
index b0a0f09..a7d983e 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -152,9 +152,7 @@ static void bw_show_about_box(GtkAction *, gpointer data);
/* callbacks */
static void bw_send_outbox_messages_cb (GtkAction *, gpointer data);
static void bw_send_receive_messages_cb (GtkAction *, gpointer data);
-#ifdef HAVE_GTK_PRINT
static void bw_page_setup_cb (GtkAction * action, gpointer data);
-#endif
static void bw_message_print_cb (GtkAction * action, gpointer data);
static void bw_new_message_cb (GtkAction * action, gpointer data);
@@ -352,10 +350,8 @@ static const GtkActionEntry entries[] = {
N_("Send and _Receive Mail"), "<control>B",
N_("Send and Receive messages"),
G_CALLBACK(bw_send_receive_messages_cb)},
-#ifdef HAVE_GTK_PRINT
{"PageSetup", NULL, N_("Page _Setup"), NULL,
N_("Set up page for printing"), G_CALLBACK(bw_page_setup_cb)},
-#endif /* HAVE_GTK_PRINT */
{"AddressBook", BALSA_PIXMAP_BOOK_RED, N_("_Address Book..."), "B",
N_("Open the address book"), G_CALLBACK(bw_address_book_cb)},
{"Quit", GTK_STOCK_QUIT, N_("_Quit"), "<control>Q", N_("Quit Balsa"),
@@ -671,9 +667,7 @@ static const char *ui_description =
" <menuitem action='SendQueuedMail'/>"
" <menuitem action='SendAndReceiveMail'/>"
" <separator/>"
-#ifdef HAVE_GTK_PRINT
" <menuitem action='PageSetup'/>"
-#endif /* HAVE_GTK_PRINT */
" <menuitem action='Print'/>"
" <separator/>"
" <menuitem action='AddressBook'/>"
@@ -808,9 +802,7 @@ static const char *ui_description =
" <menuitem action='MailboxEdit'/>"
" <separator/>"
" </menu>"
-#ifdef HAVE_GTK_PRINT
" <menuitem action='PageSetup'/>"
-#endif /* HAVE_GTK_PRINT */
" <menuitem action='Print'/>"
" <separator/>"
" <menuitem action='Quit'/>"
@@ -2897,14 +2889,12 @@ bw_send_outbox_messages_cb(GtkAction * action, gpointer data)
balsa_app.debug);
}
-#ifdef HAVE_GTK_PRINT
/* Callback for `Page setup' item on the `File' menu */
static void
bw_page_setup_cb(GtkAction * action, gpointer data)
{
message_print_page_setup(GTK_WINDOW(data));
}
-#endif
/* Callback for `Print current message' item on the `File' menu,
* and the toolbar button. */
diff --git a/src/main-window.h b/src/main-window.h
index 275c09f..c439f1b 100644
--- a/src/main-window.h
+++ b/src/main-window.h
@@ -85,9 +85,7 @@ struct _BalsaWindow {
GSList *activity_messages;
/* New mail notification: */
-#if GTK_CHECK_VERSION(2, 10, 0)
GtkStatusIcon *new_mail_tray;
-#endif /* GTK_CHECK_VERSION(2, 10, 0) */
#ifdef HAVE_NOTIFY
NotifyNotification *new_mail_note;
#endif /* HAVE_NOTIFY */
diff --git a/src/message-window.c b/src/message-window.c
index b8c33d1..944e0fa 100644
--- a/src/message-window.c
+++ b/src/message-window.c
@@ -64,9 +64,7 @@ static void next_message_cb (GtkAction * action, gpointer data);
static void previous_message_cb (GtkAction * action, gpointer data);
static void next_unread_cb (GtkAction * action, gpointer);
static void next_flagged_cb (GtkAction * action, gpointer);
-#ifdef HAVE_GTK_PRINT
static void page_setup_cb (GtkAction * action, gpointer data);
-#endif
static void print_cb (GtkAction * action, gpointer);
static void trash_cb (GtkAction * action, gpointer);
#ifdef HAVE_GTKHTML
@@ -237,10 +235,8 @@ static const GtkActionEntry entries[] = {
{"ViewMenu", NULL, N_("_View")},
{"MoveMenu", NULL, N_("M_ove")},
{"MessageMenu", NULL, N_("_Message")},
-#ifdef HAVE_GTK_PRINT
{"PageSetup", NULL, N_("Page _Setup"), "<control>S",
N_("Set up page for printing"), G_CALLBACK(page_setup_cb)},
-#endif /* HAVE_GTK_PRINT */
{"Print", GTK_STOCK_PRINT, N_("_Print..."), "<control>P",
N_("Print current message"), G_CALLBACK(print_cb)},
{"Close", GTK_STOCK_CLOSE, N_("_Close"), "<control>W",
@@ -331,9 +327,7 @@ static const char *ui_description =
"<ui>"
" <menubar name='MainMenu'>"
" <menu action='FileMenu'>"
-#ifdef HAVE_GTK_PRINT
" <menuitem action='PageSetup'/>"
-#endif /* HAVE_GTK_PRINT */
" <menuitem action='Print'/>"
" <separator/>"
" <menuitem action='Close'/>"
@@ -936,7 +930,6 @@ next_flagged_cb(GtkAction * action, gpointer data)
}
-#ifdef HAVE_GTK_PRINT
static void
page_setup_cb(GtkAction * action, gpointer data)
{
@@ -944,7 +937,6 @@ page_setup_cb(GtkAction * action, gpointer data)
message_print_page_setup(GTK_WINDOW(mw->window));
}
-#endif
static void
diff --git a/src/pref-manager.c b/src/pref-manager.c
index 454beab..41e1a97 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -37,12 +37,6 @@
#include "misc.h"
#include "imap-server.h"
-#if !GTK_CHECK_VERSION(2, 14, 0)
-#ifdef HAVE_GNOME
-#include <gnome.h>
-#endif
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
-
#if ENABLE_ESMTP
#include <libesmtp.h>
#include <string.h>
@@ -100,9 +94,7 @@ typedef struct _PropertyUI {
GtkWidget *check_imap_inbox;
GtkWidget *notify_new_mail_dialog;
GtkWidget *notify_new_mail_sound;
-#if GTK_CHECK_VERSION(2, 10, 0)
GtkWidget *notify_new_mail_icon;
-#endif /* GTK_CHECK_VERSION(2, 10, 0) */
GtkWidget *mdn_reply_clean_menu, *mdn_reply_notclean_menu;
GtkWidget *close_mailbox_auto;
@@ -647,10 +639,8 @@ open_preferences_manager(GtkWidget * widget, gpointer data)
g_signal_connect(G_OBJECT(pui->notify_new_mail_sound), "toggled",
G_CALLBACK(properties_modified_cb), property_box);
-#if GTK_CHECK_VERSION(2, 10, 0)
g_signal_connect(G_OBJECT(pui->notify_new_mail_icon), "toggled",
G_CALLBACK(properties_modified_cb), property_box);
-#endif /* GTK_CHECK_VERSION(2, 10, 0) */
g_signal_connect(G_OBJECT(pui->close_mailbox_auto), "toggled",
G_CALLBACK(mailbox_close_timer_modified_cb),
@@ -880,10 +870,8 @@ apply_prefs(GtkDialog * pbox)
GTK_TOGGLE_BUTTON(pui->notify_new_mail_dialog)->active;
balsa_app.notify_new_mail_sound =
GTK_TOGGLE_BUTTON(pui->notify_new_mail_sound)->active;
-#if GTK_CHECK_VERSION(2, 10, 0)
balsa_app.notify_new_mail_icon =
GTK_TOGGLE_BUTTON(pui->notify_new_mail_icon)->active;
-#endif /* GTK_CHECK_VERSION(2, 10, 0) */
balsa_app.mdn_reply_clean =
pm_combo_box_get_level(pui->mdn_reply_clean_menu);
balsa_app.mdn_reply_notclean =
@@ -1117,11 +1105,9 @@ set_prefs(void)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
(pui->notify_new_mail_sound),
balsa_app.notify_new_mail_sound);
-#if GTK_CHECK_VERSION(2, 10, 0)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
(pui->notify_new_mail_icon),
balsa_app.notify_new_mail_icon);
-#endif /* GTK_CHECK_VERSION(2, 10, 0) */
if (!balsa_app.check_imap)
gtk_widget_set_sensitive(GTK_WIDGET(pui->check_imap_inbox), FALSE);
@@ -1817,12 +1803,10 @@ checking_group(GtkWidget * page)
gtk_box_pack_start(GTK_BOX(hbox), pui->notify_new_mail_sound,
FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION(2, 10, 0)
pui->notify_new_mail_icon =
gtk_check_button_new_with_label(_("Show icon"));
gtk_box_pack_start(GTK_BOX(hbox), pui->notify_new_mail_icon,
FALSE, FALSE, 0);
-#endif /* GTK_CHECK_VERSION(2, 10, 0) */
gtk_table_attach(GTK_TABLE(table), hbox,
0, 3, row, row + 1, GTK_FILL, 0, 0, 0);
@@ -3069,12 +3053,7 @@ address_book_add_cb(void)
GTK_WINDOW(property_box));
gtk_widget_show_all(menu);
-#if GLIB_CHECK_VERSION(2, 10, 0)
g_object_ref_sink(menu);
-#else /* GLIB_CHECK_VERSION(2, 10, 0) */
- g_object_ref(menu);
- gtk_object_sink(GTK_OBJECT(menu));
-#endif /* GLIB_CHECK_VERSION(2, 10, 0) */
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, 0);
g_object_unref(menu);
}
@@ -3135,12 +3114,7 @@ server_add_cb(void)
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show(menuitem);
gtk_widget_show(menu);
-#if GLIB_CHECK_VERSION(2, 10, 0)
g_object_ref_sink(menu);
-#else /* GLIB_CHECK_VERSION(2, 10, 0) */
- g_object_ref(menu);
- gtk_object_sink(GTK_OBJECT(menu));
-#endif /* GLIB_CHECK_VERSION(2, 10, 0) */
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, 0);
g_object_unref(menu);
}
@@ -3361,16 +3335,13 @@ refresh_preferences_manager(void)
static void
balsa_help_pbox_display(void)
{
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
gchar *text, *p;
gchar *link_id;
GError *err = NULL;
-#if GTK_CHECK_VERSION(2, 14, 0)
gchar *uri;
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pui->view));
if (!gtk_tree_selection_get_selected(selection, &model, &iter))
@@ -3382,13 +3353,9 @@ balsa_help_pbox_display(void)
link_id = g_strconcat("preferences-", text, NULL);
g_free(text);
-#if GTK_CHECK_VERSION(2, 14, 0)
uri = g_strconcat("ghelp:balsa?", link_id, NULL);
gtk_show_uri(NULL, uri, gtk_get_current_event_time(), &err);
g_free(uri);
-#else /* GTK_CHECK_VERSION(2, 14, 0) */
- gnome_help_display("balsa", link_id, &err);
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
if (err) {
balsa_information(LIBBALSA_INFORMATION_WARNING,
_("Error displaying link_id %s: %s\n"),
@@ -3397,7 +3364,6 @@ balsa_help_pbox_display(void)
}
g_free(link_id);
-#endif
}
/* pm_page: methods for making the contents of a notebook page
diff --git a/src/print.c b/src/print.c
deleted file mode 100644
index 8690604..0000000
--- a/src/print.c
+++ /dev/null
@@ -1,1906 +0,0 @@
-/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* Balsa E-Mail Client
- * Copyright (C) 1997-2002 Stuart Parmenter and others,
- * See the file AUTHORS for a list.
- *
- * 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, 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 Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-# include "config.h"
-#endif /* HAVE_CONFIG_H */
-#include "print.h"
-
-#include <gnome.h>
-#include "balsa-app.h"
-
-#include "misc.h"
-#include "balsa-message.h"
-
-#include <ctype.h>
-#include <libgnomeprint/gnome-print.h>
-#include <libgnomeprint/gnome-font.h>
-
-#include <libgnomeprintui/gnome-font-dialog.h>
-# include <libgnomeprint/gnome-print-job.h>
-# include <libgnomeprintui/gnome-print-job-preview.h>
-# define BALSA_GNOME_PRINT_UI GnomePrintJob
-# define BALSA_GNOME_PRINT_UI_GET_CONFIG gnome_print_job_get_config
-# define BALSA_GNOME_PRINT_UI_GET_PAGE_SIZE_FROM_CONFIG gnome_print_job_get_page_size_from_config
-# define BALSA_GNOME_PRINT_UI_GET_CONTEXT gnome_print_job_get_context
-# define BALSA_GNOME_PRINT_DIALOG_NEW gnome_print_dialog_new
-# define BALSA_GNOME_PRINT_UI_NEW gnome_print_job_new(NULL)
-# define BALSA_GNOME_PRINT_UI_CLOSE gnome_print_job_close
-# define BALSA_GNOME_PRINT_UI_PREVIEW_NEW gnome_print_job_preview_new
-# define BALSA_GNOME_PRINT_UI_PRINT gnome_print_job_print
-
-#include <libgnomeprint/gnome-print-paper.h>
-#include <libgnomeprintui/gnome-print-dialog.h>
-
-#include <libbalsa.h>
-#include "html.h"
-
-#if !USE_GREGEX
-# ifdef HAVE_PCRE
-# include <pcreposix.h>
-# else
-# include <sys/types.h>
-# include <regex.h>
-# endif
-#endif /* USE_GREGEX */
-
-#include "quote-color.h"
-
-#include <string.h>
-#include <glib/gi18n.h>
-
-#define BALSA_PRINT_TYPE_HEADER 1
-#define BALSA_PRINT_TYPE_SEPARATOR 2
-#define BALSA_PRINT_TYPE_PLAINTEXT 3
-#define BALSA_PRINT_TYPE_IMAGE 4
-#define BALSA_PRINT_TYPE_DEFAULT 5
-#ifdef HAVE_GPGME
-#define BALSA_PRINT_TYPE_CRYPT_SIGN 6
-#endif
-#ifdef HAVE_GTKHTML
-# define BALSA_PRINT_TYPE_HTML 7
-#endif /* HAVE_GTKHTML */
-
-
-typedef struct _PrintInfo {
- /* gnome print info */
- GnomePrintContext *pc;
-
- /* page info */
- gint pages, current_page;
- float ypos;
- gdouble page_width, page_height;
- float margin_top, margin_bottom, margin_left, margin_right;
- float printable_width, printable_height;
- float pgnum_from_top;
-
- /* wrapping */
- gint tab_width;
-
- /* balsa data */
- LibBalsaMessage *message;
- gchar *footer;
- GList *print_parts;
-
- /* fonts */
- GnomeFont *header_font;
- GnomeFont *body_font;
- GnomeFont *footer_font;
-} PrintInfo;
-
-typedef struct _FontInfo FontInfo;
-typedef struct _CommonInfo CommonInfo;
-
-struct _FontInfo {
- guchar **font_name;
- GnomeFont *font;
- GtkWidget* font_status, *name_label;
- CommonInfo *common_info;
-};
-
-struct _CommonInfo {
- FontInfo header_font_info;
- FontInfo body_font_info;
- FontInfo footer_font_info;
- /* Some other per-dialog data: */
- GtkWidget *dialog;
- BALSA_GNOME_PRINT_UI *master;
- LibBalsaMessage *message;
- gboolean have_ref;
- GObject *parent_object;
-};
-
-typedef void (*prepare_func_t)(PrintInfo * pi, LibBalsaMessageBody * body,
- gpointer data);
-
-typedef struct _mime_action_t {
- gchar *mime_type;
- prepare_func_t prepare_func;
-}mime_action_t;
-
-static int
-print_wrap_string(gchar ** str, GnomeFont * font, gint width, gint tab_width)
-{
- gchar *ptr, *line = *str;
- gchar *eol;
- gint lines = 1;
- GString *wrapped;
- gdouble space_width = gnome_font_get_width_utf8(font, " ");
-
- g_return_val_if_fail(*str, 0);
-
- g_strchomp(*str);
- wrapped = g_string_new("");
- while (line) {
- gdouble line_width = 0.0;
-
- eol = strchr(line, '\n');
- if (eol)
- *eol = '\0';
- ptr = line;
- while (*ptr) {
- gint pos = 0;
- gint last_space = 0;
-
- while (*ptr && (line_width <= width || !last_space)) {
- if (*ptr == '\t') {
- gint i, spc = ((pos / tab_width) + 1) * tab_width - pos;
-
- for (i = 0; line_width <= width && i < spc; i++, pos++) {
- wrapped = g_string_append_c(wrapped, ' ');
- last_space = wrapped->len - 1;
- line_width += space_width;
- }
- } else {
- if (isspace((int)*ptr)) {
- wrapped = g_string_append_c(wrapped, ' ');
- last_space = wrapped->len - 1;
- line_width += space_width;
- } else {
- wrapped = g_string_append_c(wrapped, *ptr);
- line_width +=
- gnome_font_get_width_utf8_sized(font, ptr, 1);
- }
- pos++;
- }
- ptr++;
- }
- if (*ptr && last_space) {
- wrapped->str[last_space] = '\n';
- lines++;
- line_width =
- gnome_font_get_width_utf8(font,
- &wrapped->str[last_space + 1]);
- }
- }
- line = eol;
- if (eol) {
- wrapped = g_string_append_c(wrapped, '\n');
- lines++;
- line++;
- }
- }
- g_free(*str);
- *str = wrapped->str;
- g_string_free(wrapped, FALSE);
- return lines;
-}
-
-static void
-print_foot_lines(PrintInfo * pi, GnomeFont * font, float y,
- gint line_height, gchar * val)
-{
- gchar *ptr, *eol;
- gint width;
-
- ptr = val;
- while (ptr) {
- eol = strchr(ptr, '\n');
- if (eol)
- *eol = '\0';
- width = gnome_font_get_width_utf8(font, ptr);
- gnome_print_moveto(pi->pc,
- pi->margin_left + (pi->printable_width - width) / 2.0,
- y);
- gnome_print_show(pi->pc, (guchar *) ptr);
- ptr = eol;
- if (eol) {
- *eol = '\n';
- ptr++;
- }
- y -= line_height;
- }
-}
-
-static void
-start_new_page_real(PrintInfo * pi)
-{
- gdouble font_size;
- gchar *page_no;
- int width, ypos;
- gchar buf[20];
-
- pi->current_page++;
- snprintf(buf, sizeof(buf ) - 1, "%d", pi->current_page);
- if (balsa_app.debug)
- g_print("Processing page %s\n", buf);
-
- gnome_print_beginpage(pi->pc, (guchar *) buf);
- /* print the page number */
- if (balsa_app.print_highlight_cited)
- gnome_print_setrgbcolor (pi->pc, 0.0, 0.0, 0.0);
- page_no = g_strdup_printf(_("Page: %i/%i"), pi->current_page, pi->pages);
- ypos = pi->page_height - pi->pgnum_from_top;
- gnome_print_setfont(pi->pc, pi->header_font);
- width = gnome_font_get_width_utf8(pi->header_font, page_no);
- gnome_print_moveto(pi->pc, pi->page_width - pi->margin_left - width,
- ypos);
- gnome_print_show(pi->pc, (guchar *) page_no);
- g_free(page_no);
-
- /* print the footer */
- gnome_print_setfont(pi->pc, pi->footer_font);
- font_size = gnome_font_get_size(pi->footer_font);
- print_foot_lines(pi, pi->footer_font,
- pi->margin_bottom - 2 * font_size,
- font_size, pi->footer);
- pi->ypos = pi->margin_bottom + pi->printable_height;
-}
-
-static void
-start_new_page(PrintInfo * pi)
-{
- gnome_print_showpage(pi->pc);
- start_new_page_real(pi);
-}
-
-/*
- * ~~~ generic stuff for print tasks ~~~
- */
-typedef struct _TaskInfo {
- guint id_tag;
-} TaskInfo;
-
-/*
- * ~~~ stuff for the message and embedded headers ~~~
- */
-
-typedef struct _HeaderInfo {
- guint id_tag;
- float header_label_width;
- GList *headers;
-#ifdef HAVE_GPGME
- gchar *sig_status;
-#endif
-} HeaderInfo;
-
-static void
-print_header_string(GList **header_list, const gchar *field_id,
- const gchar *label, const gchar *value)
-{
- gchar **hdr_pair;
-
- if (!value || balsa_app.shown_headers == HEADERS_NONE ||
- !(balsa_app.show_all_headers ||
- balsa_app.shown_headers == HEADERS_ALL ||
- libbalsa_find_word(field_id, balsa_app.selected_headers)))
- return;
-
- hdr_pair = g_new0(gchar *, 3);
- hdr_pair[0] = g_strdup(label);
- hdr_pair[1] = g_strdup(value);
- libbalsa_utf8_sanitize(&hdr_pair[1], balsa_app.convert_unknown_8bit,
- NULL);
- *header_list = g_list_append(*header_list, hdr_pair);
-}
-
-static void
-print_header_list(GList **header_list, const gchar *field_id,
- const gchar *label, InternetAddressList * values)
-{
- gchar **hdr_pair;
-
- if (!values || balsa_app.shown_headers == HEADERS_NONE ||
- !(balsa_app.show_all_headers ||
- balsa_app.shown_headers == HEADERS_ALL ||
- libbalsa_find_word(field_id, balsa_app.selected_headers)))
- return;
-
- hdr_pair = g_new0(gchar *, 3);
- hdr_pair[0] = g_strdup(label);
- hdr_pair[1] = internet_address_list_to_string(values, FALSE);
- libbalsa_utf8_sanitize(&hdr_pair[1], balsa_app.convert_unknown_8bit,
- NULL);
- *header_list = g_list_append(*header_list, hdr_pair);
-}
-
-static HeaderInfo *
-prepare_header_real(PrintInfo * pi, LibBalsaMessageBody * sig_body,
- LibBalsaMessageHeaders *headers, gchar *the_subject)
-{
- gint lines;
- gdouble font_size;
- HeaderInfo *pdata;
- gchar *subject;
- gchar *date;
- GList *p;
-
- pdata = g_malloc(sizeof(HeaderInfo));
- pdata->id_tag = BALSA_PRINT_TYPE_HEADER;
- pdata->headers = NULL;
-
- subject = g_strdup(the_subject);
- libbalsa_utf8_sanitize(&subject, balsa_app.convert_unknown_8bit,
- NULL);
- if (subject) {
- print_header_string (&pdata->headers, "subject", _("Subject:"),
- subject);
- }
- g_free(subject);
-
- date = libbalsa_message_headers_date_to_utf8(headers, balsa_app.date_string);
- print_header_string (&pdata->headers, "date", _("Date:"), date);
- g_free(date);
-
- if (headers->from) {
- gchar *from = internet_address_list_to_string(headers->from, FALSE);
- print_header_string (&pdata->headers, "from", _("From:"), from);
- g_free(from);
- }
-
- print_header_list(&pdata->headers, "to", _("To:"), headers->to_list);
- print_header_list(&pdata->headers, "cc", _("Cc:"), headers->cc_list);
- print_header_list(&pdata->headers, "bcc", _("Bcc:"), headers->bcc_list);
- print_header_string (&pdata->headers, "fcc", _("Fcc:"), headers->fcc_url);
-
- if (headers->dispnotify_to) {
- gchar *mdn_to =
- internet_address_list_to_string(headers->dispnotify_to, FALSE);
- print_header_string (&pdata->headers, "disposition-notification-to",
- _("Disposition-Notification-To:"), mdn_to);
- g_free(mdn_to);
- }
-
- /* and now for the remaining headers... */
- p = g_list_first(headers->user_hdrs);
- while (p) {
- gchar **pair, *curr_hdr;
- pair = p->data;
- curr_hdr = g_strconcat(pair[0], ":", NULL);
- print_header_string (&pdata->headers, pair[0], curr_hdr, pair[1]);
- g_free(curr_hdr);
- p = g_list_next(p);
- }
-
- /* calculate the label width */
- pdata->header_label_width = 0;
- p = g_list_first(pdata->headers);
- while (p) {
- gchar **strgs = p->data;
- gint width;
-
- width = gnome_font_get_width_utf8(pi->header_font, strgs[0]);
- if (width > pdata->header_label_width)
- pdata->header_label_width = width;
- p = g_list_next(p);
- }
- pdata->header_label_width += 6; /* pts */
-
- /* wrap headers if necessary */
- lines = 0;
- p = g_list_first(pdata->headers);
- while (p) {
- gchar **strgs = p->data;
- lines +=
- print_wrap_string(&strgs[1], pi->header_font,
- pi->printable_width - pdata->header_label_width,
- pi->tab_width);
- p = g_list_next(p);
- }
-
-#ifdef HAVE_GPGME
- if (balsa_app.shown_headers != HEADERS_NONE && sig_body &&
- sig_body->parts && sig_body->parts->next &&
- sig_body->parts->next->sig_info) {
- gint prot = libbalsa_message_body_protection(sig_body);
-
- if ((prot & LIBBALSA_PROTECT_SIGN) &&
- (prot & (LIBBALSA_PROTECT_RFC3156 | LIBBALSA_PROTECT_SMIMEV3))) {
- GMimeGpgmeSigstat *siginfo = sig_body->parts->next->sig_info;
-
- pdata->sig_status =
- g_strconcat
- (libbalsa_gpgme_sig_protocol_name(siginfo->protocol),
- libbalsa_gpgme_sig_stat_to_gchar(siginfo->status),
- NULL);
- lines += print_wrap_string(&pdata->sig_status, pi->header_font,
- pi->printable_width, pi->tab_width);
- }
- } else {
- pdata->sig_status = NULL;
- }
-#endif
-
- font_size = gnome_font_get_size(pi->header_font);
- if (pi->ypos - lines * font_size < pi->margin_bottom) {
- lines -= (pi->ypos - pi->margin_bottom) / gnome_font_get_size(pi->header_font);
- pi->pages++;
- while (lines * font_size > pi->printable_height) {
- lines -= pi->printable_height / font_size;
- pi->pages++;
- }
- pi->ypos = pi->margin_bottom + pi->printable_height -
- lines * font_size;
- } else
- pi->ypos -= lines * font_size;
-
- return pdata;
-}
-
-static void
-prepare_message_header(PrintInfo * pi, LibBalsaMessageBody * body)
-{
- HeaderInfo *pdata;
- GString *footer_string = NULL;
- gchar *subject;
- gchar *date;
-
- g_return_if_fail(pi->message->headers);
-
- /* create the headers */
- subject = g_strdup(LIBBALSA_MESSAGE_GET_SUBJECT(pi->message));
- pdata = prepare_header_real(pi, body, pi->message->headers, subject);
- pi->print_parts = g_list_append (pi->print_parts, pdata);
-
- /* create the footer */
- libbalsa_utf8_sanitize(&subject, balsa_app.convert_unknown_8bit,
- NULL);
- if (subject)
- footer_string = g_string_new(subject);
- g_free(subject);
-
- date = libbalsa_message_date_to_utf8(pi->message, balsa_app.date_string);
- if (footer_string) {
- footer_string = g_string_append(footer_string, " - ");
- footer_string = g_string_append(footer_string, date);
- } else {
- footer_string = g_string_new(date);
- }
- g_free(date);
-
- if (pi->message->headers->from) {
- gchar *from =
- internet_address_list_to_string(pi->message->headers->from,
- FALSE);
- if (footer_string) {
- footer_string = g_string_prepend(footer_string, " - ");
- footer_string = g_string_prepend(footer_string, from);
- } else {
- footer_string = g_string_new(from);
- }
- g_free(from);
- }
-
- /* wrap the footer if necessary */
- pi->footer = footer_string->str;
- g_string_free(footer_string, FALSE);
-
- print_wrap_string(&pi->footer, pi->footer_font, pi->printable_width, pi->tab_width);
-}
-
-static void
-prepare_embedded_header(PrintInfo * pi, LibBalsaMessageBody * body, gpointer data)
-{
- HeaderInfo *pdata;
-
- g_return_if_fail(body->embhdrs);
-
- pdata = prepare_header_real(pi, body->parts, body->embhdrs, body->embhdrs->subject);
- pi->print_parts = g_list_append (pi->print_parts, pdata);
-}
-
-static void
-print_header_val(PrintInfo * pi, gint x, float * y,
- gint line_height, gchar * val, GnomeFont *font)
-{
- gchar *ptr, *eol;
-
- ptr = val;
- while (ptr) {
- eol = strchr(ptr, '\n');
- if (eol)
- *eol = '\0';
- gnome_print_moveto(pi->pc, x, *y);
- gnome_print_show(pi->pc, (guchar *) ptr);
- ptr = eol;
- if (eol)
- ptr++;
- if (ptr) {
- *y -= line_height;
- if (*y < pi->margin_bottom) {
- start_new_page(pi);
- gnome_print_setfont(pi->pc, font);
- }
- }
- }
-}
-
-static void
-print_header(PrintInfo * pi, gpointer * data)
-{
- HeaderInfo *pdata = (HeaderInfo *)data;
- GList *p;
- gdouble font_size = gnome_font_get_size(pi->header_font);
-
- g_return_if_fail(pdata->id_tag == BALSA_PRINT_TYPE_HEADER);
-
- if (balsa_app.print_highlight_cited)
- gnome_print_setrgbcolor (pi->pc, 0.0, 0.0, 0.0);
- gnome_print_setfont(pi->pc, pi->header_font);
- p = g_list_first(pdata->headers);
- while (p) {
- gchar **pair = p->data;
-
- pi->ypos -= font_size;
- if (pi->ypos < pi->margin_bottom)
- start_new_page(pi);
- gnome_print_moveto(pi->pc, pi->margin_left, pi->ypos);
- gnome_print_show(pi->pc, (guchar *) pair[0]);
- print_header_val(pi, pi->margin_left + pdata->header_label_width,
- &pi->ypos, font_size, pair[1], pi->header_font);
- g_strfreev(pair);
- p = g_list_next(p);
- }
-#ifdef HAVE_GPGME
- if (pdata->sig_status) {
- pi->ypos -= font_size;
- if (pi->ypos < pi->margin_bottom)
- start_new_page(pi);
- print_header_val(pi, pi->margin_left, &pi->ypos, font_size,
- pdata->sig_status, pi->header_font);
- g_free(pdata->sig_status);
- }
-#endif
-}
-
-/*
- * ~~~ stuff to print a separator line ~~~
- */
-typedef struct _SeparatorInfo {
- guint id_tag;
-} SeparatorInfo;
-
-static void
-prepare_separator(PrintInfo * pi, LibBalsaMessageBody * body, gpointer data)
-{
- SeparatorInfo *pdata;
- gdouble font_size = gnome_font_get_size(pi->header_font);
-
- pdata = g_malloc(sizeof(SeparatorInfo));
- pdata->id_tag = BALSA_PRINT_TYPE_SEPARATOR;
- pi->ypos -= (font_size / 2.0);
- if (pi->ypos < pi->margin_bottom) {
- pi->pages++;
- pi->ypos = pi->margin_bottom + pi->printable_height -
- (font_size / 2.0);
- } else
- pi->ypos -= (font_size / 2.0);
-
- pi->print_parts = g_list_append (pi->print_parts, pdata);
-}
-
-static void
-print_separator(PrintInfo * pi, gpointer * data)
-{
- SeparatorInfo *pdata = (SeparatorInfo *)data;
- gdouble font_size = gnome_font_get_size(pi->header_font);
-
- g_return_if_fail(pdata->id_tag == BALSA_PRINT_TYPE_SEPARATOR);
-
- if (balsa_app.print_highlight_cited)
- gnome_print_setrgbcolor (pi->pc, 0.0, 0.0, 0.0);
- pi->ypos -= (font_size / 2.0);
- if (pi->ypos < pi->margin_bottom)
- start_new_page(pi);
- gnome_print_setlinewidth(pi->pc, 0.5);
- gnome_print_newpath(pi->pc);
- gnome_print_moveto(pi->pc, pi->margin_left, pi->ypos);
- gnome_print_lineto(pi->pc, pi->printable_width + pi->margin_left, pi->ypos);
- gnome_print_stroke (pi->pc);
- pi->ypos -= (font_size / 2.0);
-}
-
-#ifdef HAVE_GTKHTML
-/*
- * ~~~ stuff to print an html part ~~~
- */
-typedef struct _HtmlInfo {
- guint id_tag;
- GtkWidget *html;
-} HtmlInfo;
-
-static void prepare_default(PrintInfo * pi, LibBalsaMessageBody * body, gpointer data);
-
-static void
-prepare_html(PrintInfo * pi, LibBalsaMessageBody * body, gpointer data)
-{
- GtkWidget *dialog;
- gint response;
- HtmlInfo *pdata;
- size_t len;
- gchar *html_text;
- gchar *conttype;
- LibBalsaHTMLType html_type;
- GError *err = NULL;
-
- conttype = libbalsa_message_body_get_mime_type(body);
- html_type = libbalsa_html_type(conttype);
- g_free(conttype);
-
- if (!libbalsa_html_can_print() || !html_type) {
- prepare_default(pi, body, data);
- return;
- }
-
- dialog =
- gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
- _("Preparing an HTML part, "
- "which must start on a new page.\n"
- "Print this part?"));
- response = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
- if (response != GTK_RESPONSE_YES) {
- prepare_default(pi, body, data);
- return;
- }
-
- len = libbalsa_message_body_get_content(body, &html_text, &err);
- if (!html_text) {
- balsa_information(LIBBALSA_INFORMATION_ERROR,
- _("Could not get a part: %s"),
- err ? err->message : "Unknown error");
- g_clear_error(&err);
- return;
- }
-
- len = libbalsa_html_filter(html_type, &html_text, len);
-
- pdata = g_new(HtmlInfo, 1);
- pdata->id_tag = BALSA_PRINT_TYPE_HTML;
- pdata->html =
- libbalsa_html_new(html_text, len,
- libbalsa_message_body_charset(body),
- pi->message, NULL);
- g_free(html_text);
-
- if (libbalsa_html_can_zoom(pdata->html)) {
- gint zoom = GPOINTER_TO_INT(g_object_get_data
- (G_OBJECT(pi->message),
- BALSA_MESSAGE_ZOOM_KEY));
-
- if (zoom > 0)
- do
- libbalsa_html_zoom(pdata->html, 1);
- while (--zoom);
- else if (zoom < 0)
- do
- libbalsa_html_zoom(pdata->html, -1);
- while (++zoom);
- }
-
- pi->pages +=
- libbalsa_html_print_get_pages_num(pdata->html, pi->pc,
- pi->margin_top,
- pi->margin_bottom);
- pi->ypos = 0; /* Must start a new page for the next part. */
- pi->print_parts = g_list_append(pi->print_parts, pdata);
-}
-
-static void
-print_html_header(GtkWidget * html, GnomePrintContext * print_context,
- gdouble x, gdouble y, gdouble width, gdouble height,
- PrintInfo * pi)
-{
- gchar *page_no;
- int page_no_width, ypos;
-
- if (balsa_app.print_highlight_cited)
- gnome_print_setrgbcolor(pi->pc, 0.0, 0.0, 0.0);
-
- pi->current_page++;
- page_no =
- g_strdup_printf(_("Page: %i/%i"), pi->current_page, pi->pages);
- ypos = pi->page_height - pi->pgnum_from_top;
- gnome_print_setfont(pi->pc, pi->header_font);
- page_no_width = gnome_font_get_width_utf8(pi->header_font, page_no);
- gnome_print_moveto(pi->pc,
- pi->page_width - pi->margin_left - page_no_width,
- ypos);
- gnome_print_show(pi->pc, (guchar *) page_no);
- g_free(page_no);
-}
-
-static void
-print_html_footer(GtkWidget * html, GnomePrintContext * print_context,
- gdouble x, gdouble y, gdouble width, gdouble height,
- PrintInfo * pi)
-{
- gdouble font_size;
-
- gnome_print_setfont(pi->pc, pi->footer_font);
- font_size = gnome_font_get_size(pi->footer_font);
- print_foot_lines(pi, pi->footer_font,
- pi->margin_bottom - 2 * font_size,
- font_size, pi->footer);
-}
-
-static void
-print_html(PrintInfo * pi, HtmlInfo * pdata)
-{
- g_return_if_fail(pdata->id_tag == BALSA_PRINT_TYPE_HTML);
-
- libbalsa_html_print(pdata->html, pi->pc,
- pi->margin_top,
- pi->margin_bottom,
- (LibBalsaHTMLPrintCallback)
- print_html_header,
- (LibBalsaHTMLPrintCallback)
- print_html_footer, pi);
- gtk_widget_destroy(pdata->html);
-}
-
-#endif /* HAVE_GTKHTML */
-/*
- * ~~~ stuff to print a plain text part ~~~
- */
-typedef struct _lineInfo {
- gchar *lineData;
- gint quoteLevel;
-} lineInfo_T;
-
-typedef struct _PlainTextInfo {
- guint id_tag;
- GList *textlines;
-} PlainTextInfo;
-
-static GList *
-print_wrap_body(gchar * str, GnomeFont * font, gint width, gint tab_width)
-{
- gchar *ptr, *line = str;
- gchar *eol;
-#if USE_GREGEX
- GRegex *rex = NULL;
-#else /* USE_GREGEX */
- regex_t rex;
-#endif /* USE_GREGEX */
- gboolean checkQuote = balsa_app.print_highlight_cited;
- GList *wrappedLines = NULL;
- gdouble space_width = gnome_font_get_width_utf8(font, " ");
-
-#if USE_GREGEX
- if (checkQuote && !(rex = balsa_quote_regex_new()))
- checkQuote = FALSE;
-#else /* USE_GREGEX */
- if (checkQuote)
- if (regcomp(&rex, balsa_app.quote_regex, REG_EXTENDED) != 0) {
- g_warning("quote regex compilation failed.");
- checkQuote = FALSE;
- }
-#endif /* USE_GREGEX */
-
- g_strchomp(str);
- while (line) {
- gdouble line_width = 0.0;
- GString *wrLine = g_string_new("");
- lineInfo_T *lineInfo = g_malloc(sizeof(lineInfo_T));
-
- eol = strchr(line, '\n');
- if (eol)
- *eol = '\0';
- ptr = line;
-#if USE_GREGEX
- lineInfo->quoteLevel = checkQuote ? is_a_quote(ptr, rex) : 0;
-#else /* USE_GREGEX */
- lineInfo->quoteLevel = checkQuote ? is_a_quote(ptr, &rex) : 0;
-#endif /* USE_GREGEX */
- while (*ptr) {
- gint pos = 0;
- gint last_space = 0;
-
- while (*ptr && (line_width <= width || !last_space)) {
- if (*ptr == '\t') {
- gint i, spc = ((pos / tab_width) + 1) * tab_width - pos;
-
- for (i = 0; line_width <= width && i < spc; i++, pos++) {
- wrLine = g_string_append_c(wrLine, ' ');
- last_space = wrLine->len - 1;
- line_width += space_width;
- }
- } else {
- if (isspace((int)*ptr)) {
- wrLine = g_string_append_c(wrLine, ' ');
- last_space = wrLine->len - 1;
- line_width += space_width;
- } else {
- wrLine = g_string_append_c(wrLine, *ptr);
- line_width +=
- gnome_font_get_width_utf8_sized(font, ptr, 1);
- }
- pos++;
- }
- ptr++;
- }
- if (*ptr && last_space) {
- gint lastQLevel = lineInfo->quoteLevel;
- lineInfo->lineData = g_strndup(wrLine->str, last_space);
- wrappedLines = g_list_prepend(wrappedLines, lineInfo);
- lineInfo = g_malloc(sizeof(lineInfo_T));
- lineInfo->quoteLevel = lastQLevel;
- wrLine = g_string_erase(wrLine, 0, last_space + 1);
- line_width =
- gnome_font_get_width_utf8(font, wrLine->str);
- last_space = 0;
- }
- }
- lineInfo->lineData = wrLine->str;
- wrappedLines = g_list_prepend(wrappedLines, lineInfo);
- g_string_free(wrLine, FALSE);
- line = eol;
- if (eol)
- line++;
- }
-
- if (checkQuote)
-#if USE_GREGEX
- g_regex_unref(rex);
-#else /* USE_GREGEX */
- regfree(&rex);
-#endif /* USE_GREGEX */
-
- return g_list_reverse(wrappedLines);
-}
-
-static void
-prepare_plaintext(PrintInfo * pi, LibBalsaMessageBody * body, gpointer data)
-{
- PlainTextInfo *pdata;
- gdouble font_size;
- gchar *textbuf;
- guint lines;
-
- pdata = g_malloc(sizeof(PlainTextInfo));
- pdata->id_tag = BALSA_PRINT_TYPE_PLAINTEXT;
-
- /* copy the text body to a buffer */
- if (body->buffer)
- textbuf = g_strdup(body->buffer);
- else
- libbalsa_message_body_get_content(body, &textbuf, NULL);
-
- /* fake an empty buffer if textbuf is NULL */
- if (!textbuf)
- textbuf = g_strdup("");
-
- /* be sure the we have correct utf-8 stuff here... */
- libbalsa_utf8_sanitize(&textbuf, balsa_app.convert_unknown_8bit,
- NULL);
-
- /* wrap lines (if necessary) */
- pdata->textlines =
- print_wrap_body(textbuf, pi->body_font, pi->printable_width, pi->tab_width);
- g_free(textbuf);
- lines = g_list_length(pdata->textlines);
-
- /* calculate the y end position */
- font_size = gnome_font_get_size(pi->body_font);
- if (pi->ypos - lines * font_size < pi->margin_bottom) {
- int lines_left = lines;
-
- lines_left -= (pi->ypos - pi->margin_bottom) / font_size;
- pi->pages++;
- while (lines_left * font_size > pi->printable_height) {
- lines_left -= pi->printable_height / font_size;
- pi->pages++;
- }
- pi->ypos = pi->margin_bottom + pi->printable_height -
- lines_left * font_size;
- } else
- pi->ypos -= lines * font_size;
-
- pi->print_parts = g_list_append (pi->print_parts, pdata);
-}
-
-static void
-print_plaintext(PrintInfo * pi, gpointer * data)
-{
- PlainTextInfo *pdata = (PlainTextInfo *)data;
- GList *l;
-
- g_return_if_fail(pdata->id_tag == BALSA_PRINT_TYPE_PLAINTEXT);
-
- gnome_print_setfont(pi->pc, pi->body_font);
- l = pdata->textlines;
- while (l) {
- lineInfo_T *lineInfo = (lineInfo_T *)l->data;
-
- pi->ypos -= gnome_font_get_size(pi->body_font);
- if (pi->ypos < pi->margin_bottom) {
- start_new_page(pi);
- gnome_print_setfont(pi->pc, pi->body_font);
- }
- if (balsa_app.print_highlight_cited) {
- if (lineInfo->quoteLevel != 0) {
- GdkColor *col;
-
- col = &balsa_app.quoted_color[(lineInfo->quoteLevel - 1) %
- MAX_QUOTED_COLOR];
- gnome_print_setrgbcolor (pi->pc,
- col->red / 65535.0,
- col->green / 65535.0,
- col->blue / 65535.0);
- } else
- gnome_print_setrgbcolor (pi->pc, 0.0, 0.0, 0.0);
- }
- gnome_print_moveto(pi->pc, pi->margin_left, pi->ypos);
- gnome_print_show(pi->pc, (guchar *) lineInfo->lineData);
- g_free(lineInfo->lineData);
- g_free(l->data);
- l = l->next;
- }
- g_list_free(pdata->textlines);
-}
-
-/*
- * ~~~ default print method: print an icon plus a description ~~~
- */
-typedef struct _DefaultInfo {
- guint id_tag;
- float label_width, image_width, image_height, text_height, part_height;
- gchar **labels;
- GdkPixbuf *pixbuf;
-} DefaultInfo;
-
-static void
-prepare_default(PrintInfo * pi, LibBalsaMessageBody * body, gpointer data)
-{
- DefaultInfo *pdata;
- gchar *conttype;
- gint hdr = 0, lines;
-
- pdata = g_malloc(sizeof(DefaultInfo));
- pdata->id_tag = BALSA_PRINT_TYPE_DEFAULT;
-
- conttype = libbalsa_message_body_get_mime_type(body);
-
- /* get a pixbuf according to the mime type */
- pdata->pixbuf = libbalsa_icon_finder(conttype, NULL, NULL,
- GTK_ICON_SIZE_DND);
- pdata->image_width = gdk_pixbuf_get_width (pdata->pixbuf);
- pdata->image_height = gdk_pixbuf_get_height (pdata->pixbuf);
-
- /* gather some info about this part */
- pdata->labels = g_new0(gchar *, 5); /* four fields, one terminator */
- pdata->labels[hdr++] = g_strdup(_("Type:"));
- pdata->labels[hdr++] = g_strdup(conttype);
- if (body->filename) {
- pdata->labels[hdr++] = g_strdup(_("File name:"));
- pdata->labels[hdr++] = g_strdup(body->filename);
- }
- pdata->label_width = gnome_font_get_width_utf8(pi->header_font, pdata->labels[0]);
- if (pdata->labels[2] &&
- gnome_font_get_width_utf8(pi->header_font, pdata->labels[2]) > pdata->label_width)
- pdata->label_width = gnome_font_get_width_utf8(pi->header_font, pdata->labels[2]);
- pdata->label_width += 6;
-
- lines = print_wrap_string(&pdata->labels[1], pi->header_font,
- pi->printable_width - pdata->label_width -
- pdata->image_width - 10, pi->tab_width);
- if (!lines)
- lines = 1;
- if (pdata->labels[3])
- lines += print_wrap_string(&pdata->labels[3], pi->header_font,
- pi->printable_width - pdata->label_width -
- pdata->image_width - 10, pi->tab_width);
- pdata->text_height = lines * gnome_font_get_size(pi->header_font);
-
- pdata->part_height = (pdata->text_height > pdata->image_height) ?
- pdata->text_height : pdata->image_height;
- if (pi->ypos - pdata->part_height < pi->margin_bottom) {
- pi->pages++;
- pi->ypos = pi->margin_bottom + pi->printable_height - pdata->part_height;
- } else
- pi->ypos -= pdata->part_height;
-
- g_free(conttype);
-
- pi->print_parts = g_list_append (pi->print_parts, pdata);
-}
-
-/* print_image_from_pixbuf:
- *
- * replacement for gnome_print_pixbuf, straight out of
- * libgnomeprintui/examples/example_02.c
- */
-static void
-print_image_from_pixbuf(GnomePrintContext * gpc, GdkPixbuf * pixbuf)
-{
- guchar *raw_image;
- gboolean has_alpha;
- gint rowstride, height, width;
-
- raw_image = gdk_pixbuf_get_pixels(pixbuf);
- has_alpha = gdk_pixbuf_get_has_alpha(pixbuf);
- rowstride = gdk_pixbuf_get_rowstride(pixbuf);
- height = gdk_pixbuf_get_height(pixbuf);
- width = gdk_pixbuf_get_width(pixbuf);
-
- if (has_alpha)
- gnome_print_rgbaimage(gpc, (guchar *) raw_image, width, height,
- rowstride);
- else
- gnome_print_rgbimage(gpc, (guchar *) raw_image, width, height,
- rowstride);
-}
-
-static void
-print_default(PrintInfo * pi, gpointer data)
-{
- double matrix[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
- DefaultInfo *pdata = (DefaultInfo *)data;
- gdouble font_size;
- gint i, offset;
-
- g_return_if_fail(pdata->id_tag == BALSA_PRINT_TYPE_DEFAULT);
-
- if (pi->ypos - pdata->part_height < pi->margin_bottom)
- start_new_page(pi);
-
- if (balsa_app.print_highlight_cited)
- gnome_print_setrgbcolor (pi->pc, 0.0, 0.0, 0.0);
- /* print the icon */
- gnome_print_gsave(pi->pc);
- matrix[0] = pdata->image_width;
- matrix[3] = pdata->image_height;
- matrix[4] = pi->margin_left;
- matrix[5] = pi->ypos - (pdata->part_height + pdata->image_height) / 2.0;
- gnome_print_concat(pi->pc, matrix);
- print_image_from_pixbuf(pi->pc, pdata->pixbuf);
- gnome_print_grestore (pi->pc);
- g_object_unref(pdata->pixbuf);
-
- /* print the description */
- gnome_print_setfont(pi->pc, pi->header_font);
- font_size = gnome_font_get_size(pi->header_font);
- pi->ypos -= (pdata->part_height - pdata->text_height) / 2.0 +
- font_size;
- offset = pi->margin_left + pdata->image_width + 10;
- for (i = 0; pdata->labels[i]; i += 2) {
- gnome_print_moveto(pi->pc, offset, pi->ypos);
- gnome_print_show(pi->pc, (guchar *) pdata->labels[i]);
- print_header_val(pi, offset + pdata->label_width, &pi->ypos,
- font_size, pdata->labels[i + 1], pi->header_font);
- pi->ypos -= font_size;
- }
- pi->ypos -= (pdata->part_height - pdata->text_height) / 2.0 -
- font_size;
- g_strfreev(pdata->labels);
-}
-
-/*
- * ~~~ stuff to print an image ~~~
- */
-typedef struct _ImageInfo {
- guint id_tag;
- GdkPixbuf *pixbuf;
- float print_width, print_height;
-} ImageInfo;
-
-static void
-prepare_image(PrintInfo * pi, LibBalsaMessageBody * body, gpointer data)
-{
- ImageInfo * pdata;
- GError *err = NULL;
- pdata = g_malloc(sizeof(ImageInfo));
- pdata->id_tag = BALSA_PRINT_TYPE_IMAGE;
-
- pdata->pixbuf = libbalsa_message_body_get_pixbuf(body, &err);
- if(err) {
- g_warning("Error loading image from file: %s", err->message);
- g_error_free(err);
- }
- /* fall back to default if the pixbuf could no be loaded */
- if (!pdata->pixbuf) {
- g_free(pdata);
- prepare_default(pi, body, data);
- return;
- }
-
- /* print with 72 dpi, or scale the image */
- pdata->print_width = gdk_pixbuf_get_width (pdata->pixbuf);
- pdata->print_height = gdk_pixbuf_get_height (pdata->pixbuf);
- if (pdata->print_height > pi->printable_height) {
- pdata->print_width *= pi->printable_height / pdata->print_height;
- pdata->print_height = pi->printable_height;
- }
- if (pdata->print_width > pi->printable_width) {
- pdata->print_height *= pi->printable_width / pdata->print_width;
- pdata->print_width = pi->printable_width;
- }
-
- if (pi->ypos - pdata->print_height < pi->margin_bottom) {
- pi->pages++;
- pi->ypos = pi->margin_bottom + pi->printable_height - pdata->print_height;
- } else
- pi->ypos -= pdata->print_height;
-
- pi->print_parts = g_list_append (pi->print_parts, pdata);
-}
-
-static void
-print_image(PrintInfo * pi, gpointer * data)
-{
- ImageInfo *pdata = (ImageInfo *)data;
- double matrix[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-
- g_return_if_fail(pdata->id_tag == BALSA_PRINT_TYPE_IMAGE);
-
- if (pi->ypos - pdata->print_height < pi->margin_bottom)
- start_new_page(pi);
-
- gnome_print_gsave(pi->pc);
- matrix[0] = pdata->print_width;
- matrix[3] = pdata->print_height;
- matrix[4] = pi->margin_left +
- (pi->printable_width - pdata->print_width) / 2.0;
- matrix[5] = pi->ypos - pdata->print_height;
- gnome_print_concat(pi->pc, matrix);
- print_image_from_pixbuf(pi->pc, pdata->pixbuf);
- gnome_print_grestore (pi->pc);
- pi->ypos -= pdata->print_height;
- g_object_unref(pdata->pixbuf);
-}
-
-#ifdef HAVE_GPGME
-/*
- * ~~~ print a gpg signature info (like plain text, but with header font) ~~~
- */
-static void
-prepare_crypto_signature(PrintInfo * pi, LibBalsaMessageBody * body, gpointer data)
-{
- PlainTextInfo *pdata;
- gdouble font_size;
- gchar *textbuf;
- guint lines;
-
- /* check if there is a sig_info and prepare as unknown if not */
- if (!body->sig_info) {
- prepare_default(pi, body, data);
- return;
- }
-
- pdata = g_malloc(sizeof(PlainTextInfo));
- pdata->id_tag = BALSA_PRINT_TYPE_CRYPT_SIGN;
-
- /* create a buffer with the signature info */
- textbuf =
- libbalsa_signature_info_to_gchar(body->sig_info, balsa_app.date_string);
- if (data) {
- gchar * newbuf = g_strconcat("\n", (gchar *)data, "\n", textbuf, NULL);
- g_free(textbuf);
- textbuf = newbuf;
- }
-
- /* wrap lines (if necessary) */
- pdata->textlines =
- print_wrap_body(textbuf, pi->header_font, pi->printable_width,
- pi->tab_width);
- g_free(textbuf);
- lines = g_list_length(pdata->textlines);
-
- /* calculate the y end position */
- font_size = gnome_font_get_size(pi->body_font);
- if (pi->ypos - lines * font_size < pi->margin_bottom) {
- int lines_left = lines;
-
- lines_left -= (pi->ypos - pi->margin_bottom) / font_size;
- pi->pages++;
- while (lines_left * font_size > pi->printable_height) {
- lines_left -= pi->printable_height / font_size;
- pi->pages++;
- }
- pi->ypos = pi->margin_bottom + pi->printable_height -
- lines_left * font_size;
- } else
- pi->ypos -= lines * font_size;
-
- pi->print_parts = g_list_append (pi->print_parts, pdata);
-}
-
-static void
-print_crypto_signature(PrintInfo * pi, gpointer * data)
-{
- PlainTextInfo *pdata = (PlainTextInfo *)data;
- GList *l;
-
- g_return_if_fail(pdata->id_tag == BALSA_PRINT_TYPE_CRYPT_SIGN);
-
- gnome_print_setfont(pi->pc, pi->header_font);
- l = pdata->textlines;
- gnome_print_setrgbcolor (pi->pc, 0.0, 0.0, 0.0);
- while (l) {
- lineInfo_T *lineInfo = (lineInfo_T *)l->data;
-
- pi->ypos -= gnome_font_get_size(pi->header_font);
- if (pi->ypos < pi->margin_bottom) {
- start_new_page(pi);
- gnome_print_setfont(pi->pc, pi->header_font);
- }
- gnome_print_moveto(pi->pc, pi->margin_left, pi->ypos);
- gnome_print_show(pi->pc, (guchar *) lineInfo->lineData);
- g_free(lineInfo->lineData);
- g_free(l->data);
- l = l->next;
- }
- g_list_free(pdata->textlines);
-}
-#endif
-
-/*
- * scan the body list and prepare print data according to the content type
- */
-static void
-scan_body(PrintInfo * pi, LibBalsaMessageBody * body)
-{
- static mime_action_t mime_actions [] = {
- {"multipart", NULL}, /* ignore `multipart' entries */
-#ifndef HAVE_GTKHTML
- {"text/html", prepare_default}, /* don't print html source */
-#else /* HAVE_GTKHTML */
- {"text/html", prepare_html},
- {"text/enriched", prepare_html},
- {"text/richtext", prepare_html},
-#endif /* HAVE_GTKHTML */
- {"text", prepare_plaintext},
- {"image", prepare_image},
- {"message/rfc822", prepare_embedded_header},
-#ifdef HAVE_GPGME
- {"application/pgp-signature", prepare_crypto_signature},
-#ifdef HAVE_SMIME
- {"application/pkcs7-signature", prepare_crypto_signature},
- {"application/x-pkcs7-signature", prepare_crypto_signature},
-#endif
-#endif
- {NULL, prepare_default} /* anything else... */
- };
- mime_action_t *action;
-
- while (body) {
- gchar *conttype;
-
- conttype = libbalsa_message_body_get_mime_type(body);
-
- for (action = mime_actions;
- action->mime_type &&
- g_ascii_strncasecmp(action->mime_type, conttype,
- strlen(action->mime_type));
- action++);
-
- if (action->prepare_func) {
- prepare_separator(pi, body, NULL);
- action->prepare_func(pi, body, NULL);
- }
-
- if (body->parts)
- scan_body(pi, body->parts);
-
-#ifdef HAVE_GPGME
- if (body->sig_info &&
- g_ascii_strcasecmp(conttype, "application/pgp-signature") &&
- g_ascii_strcasecmp(conttype, "application/pkcs7-signature") &&
- g_ascii_strcasecmp(conttype, "application/x-pkcs7-signature")) {
- gchar * header =
- g_strdup_printf(_("This is an inline %s signed %s message part:"),
- body->sig_info->protocol == GPGME_PROTOCOL_OpenPGP ?
- _("OpenPGP") : _("S/MIME"),
- conttype);
- prepare_crypto_signature(pi, body, header);
- g_free(header);
- }
-#endif
- g_free(conttype);
-
- body = body->next;
- }
-}
-
-/*
- * get the GnomeFont from a name returned by the font picker
- * libgnomeui-2.2, gtk-2.2, libgnomeprint-2.2
- * gnome_font_picker returns "URW Palladio L, Bold 12",
- * gnome_font_find_by_name expects "URW Palladio L Bold 12".
- */
-static GnomeFont *
-find_font(const gchar * name)
-{
-#ifdef GNOME_FONT_FIND_HANDLES_BAD_NAME_SANELY
- return gnome_font_find_from_full_name(name);
-#else
- gchar *copy;
- gchar *space;
- GnomeFontFace *face;
- GnomeFont *font = NULL;
-
- copy = g_strdup(name);
- space = strrchr(copy, ' ');
- if (space)
- *space = 0;
- face = gnome_font_face_find((guchar *) copy);
- g_free(copy);
- if (face) {
- gnome_font_face_unref(face);
- font = gnome_font_find_from_full_name((guchar *) name);
- }
- return font;
-#endif /* GNOME_FONT_FIND_HANDLES_BAD_NAME_SANELY */
-}
-
-static gdouble
-get_length_from_config(GnomePrintConfig * config, const gchar * key)
-{
- const GnomePrintUnit *unit;
- gdouble length = 0.0;
-
- if (gnome_print_config_get_length(config, (guchar *) key, &length, &unit))
- gnome_print_convert_distance(&length, unit, GNOME_PRINT_PS_UNIT);
-
- return length;
-}
-
-static PrintInfo *
-print_info_new(CommonInfo * ci)
-{
- GnomePrintConfig *config;
- PrintInfo *pi = g_new(PrintInfo, 1);
-
- config = BALSA_GNOME_PRINT_UI_GET_CONFIG(ci->master);
- BALSA_GNOME_PRINT_UI_GET_PAGE_SIZE_FROM_CONFIG(config,
- &pi->page_width,
- &pi->page_height);
- pi->margin_top =
- get_length_from_config(config, GNOME_PRINT_KEY_PAGE_MARGIN_TOP);
- pi->margin_bottom =
- get_length_from_config(config, GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM);
- pi->margin_left =
- get_length_from_config(config, GNOME_PRINT_KEY_PAGE_MARGIN_LEFT);
- pi->margin_right =
- get_length_from_config(config, GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT);
- gnome_print_config_unref(config);
-
- pi->pc = BALSA_GNOME_PRINT_UI_GET_CONTEXT(ci->master);
- pi->current_page = 0;
- pi->pgnum_from_top = pi->margin_top - 0.25 * 72;
- pi->printable_width =
- pi->page_width - pi->margin_left - pi->margin_right;
- pi->printable_height =
- pi->page_height - pi->margin_top - pi->margin_bottom;
-
- pi->tab_width = 8;
- pi->pages = 1;
- pi->ypos = pi->margin_bottom + pi->printable_height;
-
- /* we don't hold refs to these: */
- pi->header_font = ci->header_font_info.font;
- pi->body_font = ci->body_font_info.font;
- pi->footer_font = ci->footer_font_info.font;
-
- pi->message = ci->message;
- pi->print_parts = NULL;
-
- /* now get the message contents... */
- if (!pi->message->mailbox
- || libbalsa_message_body_ref(pi->message, TRUE,
- balsa_app.shown_headers == HEADERS_ALL||
- balsa_app.show_all_headers)) {
- prepare_message_header(pi, pi->message->body_list);
- scan_body(pi, pi->message->body_list);
- libbalsa_message_body_unref(pi->message);
- } else
- prepare_message_header(pi, NULL);
-
- return pi;
-}
-
-static void
-print_info_destroy(PrintInfo * pi)
-{
- g_list_foreach(pi->print_parts, (GFunc) g_free, NULL);
- g_list_free(pi->print_parts);
- g_free(pi->footer);
- g_free(pi);
-}
-
-/* print_message:
- prints given message
-*/
-static void
-print_message(PrintInfo * pi)
-{
-#ifdef HAVE_GTKHTML
- gboolean haspage;
-#endif /* HAVE_GTKHTML */
- GList *print_task;
-
- if (balsa_app.debug)
- g_print("Printing.\n");
-
-#ifndef HAVE_GTKHTML
- start_new_page_real(pi);
-
- print_task = pi->print_parts;
- while (print_task) {
- TaskInfo *pdata = print_task->data;
-
- switch (pdata->id_tag) {
- case BALSA_PRINT_TYPE_HEADER:
- print_header(pi, print_task->data);
- break;
- case BALSA_PRINT_TYPE_SEPARATOR:
- print_separator(pi, print_task->data);
- break;
- case BALSA_PRINT_TYPE_PLAINTEXT:
- print_plaintext(pi, print_task->data);
- break;
- case BALSA_PRINT_TYPE_DEFAULT:
- print_default(pi, print_task->data);
- break;
- case BALSA_PRINT_TYPE_IMAGE:
- print_image(pi, print_task->data);
- break;
-#ifdef HAVE_GPGME
- case BALSA_PRINT_TYPE_CRYPT_SIGN:
- print_crypto_signature(pi, print_task->data);
-#endif
- default:
- break;
- }
-
- print_task = g_list_next(print_task);
- }
- gnome_print_showpage(pi->pc);
-#else /* HAVE_GTKHTML */
- haspage = FALSE;
- for (print_task = pi->print_parts; print_task;
- print_task = g_list_next(print_task)) {
- TaskInfo *pdata = print_task->data;
-
- if (pdata->id_tag == BALSA_PRINT_TYPE_SEPARATOR) {
- if (haspage)
- print_separator(pi, print_task->data);
- } else if (pdata->id_tag == BALSA_PRINT_TYPE_HTML) {
- if (haspage)
- gnome_print_showpage(pi->pc);
- print_html(pi, print_task->data);
- haspage = FALSE;
- } else {
- if (!haspage)
- start_new_page_real(pi);
-
- switch (pdata->id_tag) {
- case BALSA_PRINT_TYPE_HEADER:
- print_header(pi, print_task->data);
- break;
- case BALSA_PRINT_TYPE_PLAINTEXT:
- print_plaintext(pi, print_task->data);
- break;
- case BALSA_PRINT_TYPE_DEFAULT:
- print_default(pi, print_task->data);
- break;
- case BALSA_PRINT_TYPE_IMAGE:
- print_image(pi, print_task->data);
- break;
-#ifdef HAVE_GPGME
- case BALSA_PRINT_TYPE_CRYPT_SIGN:
- print_crypto_signature(pi, print_task->data);
- break;
-#endif
- default:
- break;
- }
- haspage = TRUE;
- }
- }
-
- if (haspage)
- gnome_print_showpage(pi->pc);
-#endif /* HAVE_GTKHTML */
-}
-
-/* callback to read a toggle button */
-static void
-togglebut_changed (GtkToggleButton *tbut, gboolean *value)
-{
- *value = gtk_toggle_button_get_active (tbut);
-}
-
-/*
- * enable/disable the Print and Preview buttons
- */
-static void
-set_dialog_buttons_sensitive(CommonInfo * ci)
-{
- gboolean sensitive = (ci->header_font_info.font
- && ci->body_font_info.font
- && ci->footer_font_info.font);
-
- gtk_dialog_set_response_sensitive(GTK_DIALOG(ci->dialog),
- GNOME_PRINT_DIALOG_RESPONSE_PRINT,
- sensitive);
- gtk_dialog_set_response_sensitive(GTK_DIALOG(ci->dialog),
- GNOME_PRINT_DIALOG_RESPONSE_PREVIEW,
- sensitive);
-}
-
-static void
-set_font_status(FontInfo *fi)
-{
- gtk_label_set_text(GTK_LABEL(fi->name_label), (gchar *) *fi->font_name);
- if(fi->font)
- gtk_label_set_text(GTK_LABEL(fi->font_status),
- _("Font available for printing"));
- else {
- GnomeFont* fncl =
- gnome_font_find_closest_from_full_name(*fi->font_name);
- guchar* fn = gnome_font_get_full_name(fncl);
- gchar *msg =
- g_strdup_printf(_("Font <b>not</b> available for printing. "
- "Closest: %s"), fn);
-
- gtk_label_set_markup(GTK_LABEL(fi->font_status), msg);
- g_free(fn); g_free(msg);
- }
-}
-/*
- * callback for the button's font change signal.
- */
-static void
-font_change_cb(GtkWidget * widget, FontInfo *fi)
-{
- GtkWidget* dialog = gnome_font_dialog_new(_("Select Font"));
- GtkWidget* fontsel =
- gnome_font_dialog_get_fontsel(GNOME_FONT_DIALOG(dialog));
- if(fi->font) {
- gnome_font_selection_set_font(GNOME_FONT_SELECTION(fontsel),
- fi->font);
- } else {
- printf("font unknown\n");
- }
- switch(gtk_dialog_run(GTK_DIALOG(dialog))) {
- case GTK_RESPONSE_OK:
- g_free(*fi->font_name);
- if(fi->font) gnome_font_unref(fi->font);
- fi->font =
- gnome_font_selection_get_font(GNOME_FONT_SELECTION(fontsel));
- *fi->font_name = gnome_font_get_full_name(fi->font);
- set_font_status(fi);
- set_dialog_buttons_sensitive(fi->common_info);
- break;
- default: break;
- }
- gtk_widget_destroy(dialog);
-}
-
-/*
- * create a frame with a font-picker widget
- */
-static GtkWidget *
-font_frame(gchar * title, FontInfo * fi)
-{
- GtkWidget *frame = gtk_frame_new(title);
- GtkWidget *vbox = gtk_vbox_new(FALSE, 3);
- GtkWidget *hbox = gtk_hbox_new(FALSE, 3);
- GtkWidget *button = gtk_button_new_with_label(_("Change..."));
-
- fi->name_label = gtk_label_new((gchar *) *fi->font_name);
- gtk_box_pack_start(GTK_BOX(hbox), fi->name_label, TRUE, TRUE, 5);
- gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(font_change_cb), fi);
-
- gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 5);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
- fi->font_status = gtk_label_new("");
- set_font_status(fi);
- gtk_box_pack_start(GTK_BOX(vbox), fi->font_status, TRUE, TRUE, 3);
- gtk_container_set_border_width(GTK_CONTAINER(frame), 3);
-
- return frame;
-}
-
-/*
- * creates the print dialog, and adds a page for fonts
- */
-static void common_info_setup(CommonInfo * ci);
-static GtkWidget *
-print_dialog(CommonInfo * ci)
-{
- GtkWidget *dialog;
- GtkWidget *frame;
- GtkWidget *dlgVbox;
- GtkWidget *notebook;
- GtkWidget *vbox;
- GtkWidget *label;
- GtkWidget *chkbut;
- GList *childList;
-
- dialog = BALSA_GNOME_PRINT_DIALOG_NEW(ci->master,
- (guchar *) _("Print message"),
- GNOME_PRINT_DIALOG_COPIES);
- ci->dialog = dialog;
- common_info_setup(ci);
- gtk_window_set_wmclass(GTK_WINDOW(dialog), "print", "Balsa");
- dlgVbox = GTK_DIALOG(dialog)->vbox;
- childList = gtk_container_get_children(GTK_CONTAINER(dlgVbox));
- notebook = childList->data;
- g_list_free(childList);
-
- /* create a 2nd notebook page for the fonts */
- label = gtk_label_new_with_mnemonic(_("_Fonts"));
- vbox = gtk_vbox_new(FALSE, 3);
- gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label);
- frame = font_frame(_("Header font"), &ci->header_font_info);
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 3);
- frame = font_frame(_("Body font"), &ci->body_font_info);
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 3);
- frame = font_frame(_("Footer font"), &ci->footer_font_info);
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 3);
-
- /* highlight cited stuff */
- frame = gtk_frame_new(_("Highlight cited text"));
- gtk_container_set_border_width(GTK_CONTAINER(frame), 3);
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 3);
- chkbut = gtk_check_button_new_with_mnemonic
- (_("_Enable highlighting of cited text"));
- g_signal_connect(G_OBJECT(chkbut), "toggled",
- G_CALLBACK(togglebut_changed),
- &balsa_app.print_highlight_cited);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(chkbut),
- balsa_app.print_highlight_cited);
- gtk_container_add (GTK_CONTAINER (frame), chkbut);
-
- gtk_widget_show_all(vbox);
-
- return dialog;
-}
-
-/*
- * the FontInfo structure contains info used in the "font-set" callback
- * that's specific to a font, and a pointer to the CommonInfo structure
- */
-static void
-font_info_setup(FontInfo * fi, gchar ** font_name, CommonInfo * ci)
-{
- fi->font_name = (guchar **) font_name;
- fi->common_info = ci;
- fi->font = find_font(*font_name);
- if (!fi->font)
- balsa_information_parented
- (GTK_WINDOW(ci->dialog), LIBBALSA_INFORMATION_WARNING,
- _("Balsa could not find font \"%s\".\n"
- "Use the \"Fonts\" page on the "
- "\"Print message\" dialog to change it."),
- *fi->font_name);
-}
-
-static void
-font_info_cleanup(FontInfo * fi)
-{
- if (fi->font) {
- g_object_unref(fi->font);
- fi->font = NULL;
- }
-}
-
-/*
- * the CommonInfo structure contains info used in the "font-set" callback
- * that's common to all fonts
- */
-static void
-common_info_setup(CommonInfo * ci)
-{
- font_info_setup(&ci->header_font_info, &balsa_app.print_header_font, ci);
- font_info_setup(&ci->body_font_info, &balsa_app.print_body_font, ci);
- font_info_setup(&ci->footer_font_info, &balsa_app.print_footer_font, ci);
-}
-
-#define BALSA_PRINT_COMMON_INFO_KEY "balsa-print-common-info"
-
-/* GWeakNotify callback: destroy non-message-related stuff in
- * CommonInfo. */
-static void
-common_info_destroy(CommonInfo * ci)
-{
- font_info_cleanup(&ci->header_font_info);
- font_info_cleanup(&ci->body_font_info);
- font_info_cleanup(&ci->footer_font_info);
-
- gtk_widget_destroy(GTK_WIDGET(ci->dialog));
- g_object_unref(ci->master);
- if (ci->have_ref)
- g_object_unref(ci->message);
-
- g_free(ci);
-}
-
-/* Clean up message-related stuff in CommonInfo, then destroy the rest. */
-static void
-common_info_cleanup(CommonInfo * ci)
-{
- /* This triggers common_info_destroy(ci): */
- g_object_set_data(ci->parent_object, BALSA_PRINT_COMMON_INFO_KEY, NULL);
-}
-
-/* Callback for the "response" signal for the print dialog. */
-static void
-print_response_cb(GtkDialog * dialog, gint response, CommonInfo * ci)
-{
- GnomePrintConfig *config;
- PrintInfo *pi;
- gboolean preview;
-
- switch (response) {
- case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
- preview = FALSE;
- break;
- case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
- preview = TRUE;
- break;
- default:
- common_info_cleanup(ci);
- return;
- }
-
- config = BALSA_GNOME_PRINT_UI_GET_CONFIG(ci->master);
-#define CONFIG_GET(key) \
- ((gchar *) gnome_print_config_get(config, (guchar *) (key)))
- g_free(balsa_app.paper_size);
- balsa_app.paper_size = CONFIG_GET(GNOME_PRINT_KEY_PAPER_SIZE);
- balsa_app.print_unit = CONFIG_GET(GNOME_PRINT_KEY_PREFERED_UNIT);
- balsa_app.margin_left = CONFIG_GET(GNOME_PRINT_KEY_PAGE_MARGIN_LEFT);
- balsa_app.margin_top = CONFIG_GET(GNOME_PRINT_KEY_PAGE_MARGIN_TOP);
- balsa_app.margin_right = CONFIG_GET(GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT);
- balsa_app.margin_bottom = CONFIG_GET(GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM);
- balsa_app.print_layout = CONFIG_GET(GNOME_PRINT_KEY_LAYOUT);
- balsa_app.paper_orientation =
- CONFIG_GET(GNOME_PRINT_KEY_PAPER_ORIENTATION);
- balsa_app.page_orientation = CONFIG_GET(GNOME_PRINT_KEY_PAGE_ORIENTATION);
-#undef CONFIG_GET
-
- gnome_print_config_unref(config);
-
- pi = print_info_new(ci);
-
- /* do the Real Job */
- print_message(pi);
- BALSA_GNOME_PRINT_UI_CLOSE(ci->master);
- if (preview) {
- GtkWidget *preview_widget =
- BALSA_GNOME_PRINT_UI_PREVIEW_NEW(ci->master,
- (guchar *)
- _("Balsa: message print preview"));
- gtk_window_set_wmclass(GTK_WINDOW(preview_widget), "print-preview",
- "Balsa");
- gtk_widget_show(preview_widget);
- } else
- BALSA_GNOME_PRINT_UI_PRINT(ci->master);
-
- print_info_destroy(pi);
- common_info_cleanup(ci);
-}
-
-/*
- * message_print:
- *
- * the public method
- */
-void
-message_print(LibBalsaMessage * msg, GtkWindow * parent)
-{
- GObject *parent_object;
- CommonInfo *ci;
- GnomePrintConfig *config;
-
- g_return_if_fail(msg != NULL);
-
- /* Show only one dialog: */
- parent_object = (parent == GTK_WINDOW(balsa_app.main_window))
- ? G_OBJECT(msg) /* per message. */
- : G_OBJECT(parent); /* per window. */
- ci = g_object_get_data(parent_object, BALSA_PRINT_COMMON_INFO_KEY);
- if (ci) {
- gdk_window_raise(ci->dialog->window);
- return;
- }
-
- ci = g_new(CommonInfo, 1);
-
- /* Close the dialog if the parent object is destroyed. We should also
- * close if the message is destroyed, but that's covered:
- * - if called from the main window, the message is the parent;
- * - if called from the message window, that window is the parent,
- * but it's destroyed with the message, so we'll find out;
- * - if called from the compose window, we ref the message, so it
- * can't be destroyed. */
- g_object_set_data_full(parent_object, BALSA_PRINT_COMMON_INFO_KEY, ci,
- (GDestroyNotify) common_info_destroy);
- ci->parent_object = parent_object;
-
- ci->message = msg;
- if (!msg->mailbox) {
- /* temporary message from the compose window */
- g_object_ref(msg);
- ci->have_ref = TRUE;
- } else
- /* a message we're reading */
- ci->have_ref = FALSE;
-
- ci->master = BALSA_GNOME_PRINT_UI_NEW;
-
- /* FIXME: this sets the paper size in the GnomePrintConfig. We can
- * change it in the Paper page of the GnomePrintDialog, and retrieve
- * it from the GnomePrintConfig. However, it doesn't get set as the
- * initial value in the Paper page. Is there some Gnome-2-wide
- * repository for data like this? */
- config = BALSA_GNOME_PRINT_UI_GET_CONFIG(ci->master);
-#define CONFIG_SET(key, value) \
- gnome_print_config_set(config, (guchar *) (key), (guchar *) (value))
- CONFIG_SET(GNOME_PRINT_KEY_PAPER_SIZE, balsa_app.paper_size);
- if(balsa_app.print_unit)
- CONFIG_SET(GNOME_PRINT_KEY_PREFERED_UNIT, balsa_app.print_unit);
- if(balsa_app.margin_left)
- CONFIG_SET(GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, balsa_app.margin_left);
- if(balsa_app.margin_top)
- CONFIG_SET(GNOME_PRINT_KEY_PAGE_MARGIN_TOP, balsa_app.margin_top);
- if(balsa_app.margin_right)
- CONFIG_SET(GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, balsa_app.margin_right);
- if(balsa_app.margin_bottom)
- CONFIG_SET(GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM,
- balsa_app.margin_bottom);
- if(balsa_app.print_layout)
- CONFIG_SET(GNOME_PRINT_KEY_LAYOUT, balsa_app.print_layout);
- if(balsa_app.paper_orientation)
- CONFIG_SET(GNOME_PRINT_KEY_PAPER_ORIENTATION,
- balsa_app.paper_orientation);
- if(balsa_app.page_orientation)
- CONFIG_SET(GNOME_PRINT_KEY_PAPER_ORIENTATION,
- balsa_app.page_orientation);
- gnome_print_config_unref(config);
-#undef CONFIG_SET
-
- ci->dialog = print_dialog(ci);
- gtk_window_set_transient_for(GTK_WINDOW(ci->dialog), parent);
-
- set_dialog_buttons_sensitive(ci);
- g_signal_connect(G_OBJECT(ci->dialog), "response",
- G_CALLBACK(print_response_cb), ci);
-
- gtk_widget_show_all(ci->dialog);
-}
diff --git a/src/print.h b/src/print.h
index 449dfb4..d226aae 100644
--- a/src/print.h
+++ b/src/print.h
@@ -31,9 +31,7 @@ extern "C" {
#endif /* __cplusplus */
void message_print(LibBalsaMessage * msg, GtkWindow * parent);
-#ifdef HAVE_GTK_PRINT
void message_print_page_setup(GtkWindow * parent);
-#endif
#ifdef __cplusplus
}
diff --git a/src/save-restore.c b/src/save-restore.c
index 3a9de2a..8ae380f 100644
--- a/src/save-restore.c
+++ b/src/save-restore.c
@@ -513,7 +513,6 @@ config_load_smtp_server(const gchar * key, const gchar * value, gpointer data)
}
#endif /* ENABLE_ESMTP */
-#ifdef HAVE_GTK_PRINT
static gboolean
load_gtk_print_setting(const gchar * key, const gchar * value, gpointer data)
{
@@ -580,7 +579,6 @@ restore_gtk_page_setup()
return page_setup;
}
-#endif
static gint
config_global_load(void)
@@ -830,7 +828,6 @@ config_global_load(void)
libbalsa_conf_push_group("Printing");
/* ... Printing */
-#ifdef HAVE_GTK_PRINT
if (balsa_app.page_setup)
g_object_unref(G_OBJECT(balsa_app.page_setup));
balsa_app.page_setup = restore_gtk_page_setup();
@@ -838,27 +835,6 @@ config_global_load(void)
balsa_app.margin_top = libbalsa_conf_get_double("TopMargin");
balsa_app.margin_right = libbalsa_conf_get_double("RightMargin");
balsa_app.margin_bottom = libbalsa_conf_get_double("BottomMargin");
-#else
- g_free(balsa_app.paper_size);
- balsa_app.paper_size =
- libbalsa_conf_get_string("PaperSize=" DEFAULT_PAPER_SIZE);
- g_free(balsa_app.margin_left);
- balsa_app.margin_left = libbalsa_conf_get_string("LeftMargin");
- g_free(balsa_app.margin_top);
- balsa_app.margin_top = libbalsa_conf_get_string("TopMargin");
- g_free(balsa_app.margin_right);
- balsa_app.margin_right = libbalsa_conf_get_string("RightMargin");
- g_free(balsa_app.margin_bottom);
- balsa_app.margin_bottom = libbalsa_conf_get_string("BottomMargin");
- g_free(balsa_app.print_unit);
- balsa_app.print_unit = libbalsa_conf_get_string("PrintUnit");
- g_free(balsa_app.print_layout);
- balsa_app.print_layout = libbalsa_conf_get_string("PrintLayout");
- g_free(balsa_app.paper_orientation);
- balsa_app.paper_orientation = libbalsa_conf_get_string("PaperOrientation");
- g_free(balsa_app.page_orientation);
- balsa_app.page_orientation = libbalsa_conf_get_string("PageOrientation");
-#endif
g_free(balsa_app.print_header_font);
balsa_app.print_header_font =
@@ -874,19 +850,15 @@ config_global_load(void)
DEFAULT_PRINT_BODY_FONT);
balsa_app.print_highlight_cited =
libbalsa_conf_get_bool("PrintHighlightCited=false");
-#ifdef HAVE_GTK_PRINT
balsa_app.print_highlight_phrases =
libbalsa_conf_get_bool("PrintHighlightPhrases=false");
-#endif
libbalsa_conf_pop_group();
-#ifdef HAVE_GTK_PRINT
/* GtkPrint printing */
libbalsa_conf_push_group("GtkPrint");
libbalsa_conf_foreach_keys("GtkPrint", load_gtk_print_setting,
balsa_app.print_settings);
libbalsa_conf_pop_group();
-#endif
/* Spelling options ... */
libbalsa_conf_push_group("Spelling");
@@ -928,10 +900,8 @@ config_global_load(void)
d_get_gint("NewMailNotificationDialog", 0);
balsa_app.notify_new_mail_sound =
d_get_gint("NewMailNotificationSound", 1);
-#if GTK_CHECK_VERSION(2, 10, 0)
balsa_app.notify_new_mail_icon =
d_get_gint("NewMailNotificationIcon", 1);
-#endif /* GTK_CHECK_VERSION(2, 10, 0) */
balsa_app.check_mail_upon_startup =
libbalsa_conf_get_bool("OnStartup=false");
balsa_app.check_mail_auto = libbalsa_conf_get_bool("Auto=false");
@@ -1152,7 +1122,6 @@ config_global_load(void)
return TRUE;
} /* config_global_load */
-#ifdef HAVE_GTK_PRINT
static void
save_gtk_print_setting(const gchar *key, const gchar *value, gpointer user_data)
{
@@ -1198,7 +1167,6 @@ save_gtk_page_setup(GtkPageSetup *page_setup)
libbalsa_conf_set_int("Orientation",
gtk_page_setup_get_orientation(page_setup));
}
-#endif
gint
config_save(void)
@@ -1337,32 +1305,11 @@ config_save(void)
/* Printing options ... */
libbalsa_conf_push_group("Printing");
-#ifdef HAVE_GTK_PRINT
save_gtk_page_setup(balsa_app.page_setup);
libbalsa_conf_set_double("LeftMargin", balsa_app.margin_left);
libbalsa_conf_set_double("TopMargin", balsa_app.margin_top);
libbalsa_conf_set_double("RightMargin", balsa_app.margin_right);
libbalsa_conf_set_double("BottomMargin", balsa_app.margin_bottom);
-#else
- libbalsa_conf_set_string("PaperSize",balsa_app.paper_size);
- if(balsa_app.margin_left)
- libbalsa_conf_set_string("LeftMargin", balsa_app.margin_left);
- if(balsa_app.margin_top)
- libbalsa_conf_set_string("TopMargin", balsa_app.margin_top);
- if(balsa_app.margin_bottom)
- libbalsa_conf_set_string("RightMargin", balsa_app.margin_right);
- if(balsa_app.margin_bottom)
- libbalsa_conf_set_string("BottomMargin", balsa_app.margin_bottom);
- if(balsa_app.print_unit)
- libbalsa_conf_set_string("PrintUnit", balsa_app.print_unit);
- if(balsa_app.print_layout)
- libbalsa_conf_set_string("PrintLayout", balsa_app.print_layout);
- if(balsa_app.margin_bottom)
- libbalsa_conf_set_string("PaperOrientation",
- balsa_app.paper_orientation);
- if(balsa_app.margin_bottom)
- libbalsa_conf_set_string("PageOrientation", balsa_app.page_orientation);
-#endif
libbalsa_conf_set_string("PrintHeaderFont",
balsa_app.print_header_font);
@@ -1371,13 +1318,10 @@ config_save(void)
balsa_app.print_footer_font);
libbalsa_conf_set_bool("PrintHighlightCited",
balsa_app.print_highlight_cited);
-#ifdef HAVE_GTK_PRINT
libbalsa_conf_set_bool("PrintHighlightPhrases",
balsa_app.print_highlight_phrases);
-#endif
libbalsa_conf_pop_group();
-#ifdef HAVE_GTK_PRINT
/* GtkPrintSettings stuff */
libbalsa_conf_remove_group("GtkPrint");
libbalsa_conf_push_group("GtkPrint");
@@ -1385,7 +1329,6 @@ config_save(void)
gtk_print_settings_foreach(balsa_app.print_settings,
save_gtk_print_setting, NULL);
libbalsa_conf_pop_group();
-#endif
/* Spelling options ... */
libbalsa_conf_remove_group("Spelling");
@@ -1421,10 +1364,8 @@ config_save(void)
balsa_app.notify_new_mail_dialog);
libbalsa_conf_set_int("NewMailNotificationSound",
balsa_app.notify_new_mail_sound);
-#if GTK_CHECK_VERSION(2, 10, 0)
libbalsa_conf_set_int("NewMailNotificationIcon",
balsa_app.notify_new_mail_icon);
-#endif /* GTK_CHECK_VERSION(2, 10, 0) */
libbalsa_conf_set_bool("OnStartup", balsa_app.check_mail_upon_startup);
libbalsa_conf_set_bool("Auto", balsa_app.check_mail_auto);
libbalsa_conf_set_int("AutoDelay", balsa_app.check_mail_timer);
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index bcdec4a..986b4a6 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -37,12 +37,7 @@
#else
#define GNOME_PAD_SMALL 4
#endif
-#if HAVE_GIO
#include <gio/gio.h>
-#elif HAVE_GNOME_VFS
-#include <libgnomevfs/gnome-vfs.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-#endif
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <ctype.h>
@@ -112,11 +107,9 @@ static void save_message_cb (GtkAction * action, BalsaSendmsg * bsmsg);
static gint message_postpone(BalsaSendmsg * bsmsg);
static void postpone_message_cb(GtkAction * action, BalsaSendmsg * bsmsg);
-#ifdef HAVE_GTK_PRINT
#if !defined(ENABLE_TOUCH_UI)
static void page_setup_cb (GtkAction * action, BalsaSendmsg * bsmsg);
#endif /* ENABLE_TOUCH_UI */
-#endif
static void print_message_cb (GtkAction * action, BalsaSendmsg * bsmsg);
static void attach_clicked (GtkAction * action, gpointer data);
@@ -345,12 +338,10 @@ static const GtkActionEntry entries[] = {
N_("Attach selected message(s)"), G_CALLBACK(attach_message_cb)},
{"Save", GTK_STOCK_SAVE, N_("_Save"), "<control>S",
N_("Save this message"), G_CALLBACK(save_message_cb)},
-#ifdef HAVE_GTK_PRINT
#if !defined(ENABLE_TOUCH_UI)
{"PageSetup", NULL, N_("Page _Setup"), NULL,
N_("Set up page for printing"), G_CALLBACK(page_setup_cb)},
#endif /* ENABLE_TOUCH_UI */
-#endif /* HAVE_GTK_PRINT */
{"Print", GTK_STOCK_PRINT, N_("_Print..."), "<control>P",
N_("Print the edited message"), G_CALLBACK(print_message_cb)},
{"Close", GTK_STOCK_CLOSE, N_("_Close"), "<control>W",
@@ -488,9 +479,7 @@ static const char *ui_description =
" <menuitem action='Postpone'/>"
" <menuitem action='Save'/>"
" <separator/>"
-#ifdef HAVE_GTK_PRINT
" <menuitem action='PageSetup'/>"
-#endif /* HAVE_GTK_PRINT */
" <menuitem action='Print'/>"
" <separator/>"
" <menuitem action='Close'/>"
@@ -1194,23 +1183,14 @@ edit_with_gnome(GtkAction * action, BalsaSendmsg* bsmsg)
gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
GtkTextIter start, end;
gchar *p;
-#if HAVE_GIO
GAppInfo *app;
-#elif HAVE_GNOME_VFS
- GnomeVFSMimeApplication *app;
-#endif
char **argv;
int argc;
strcpy(filename, TMP_PATTERN);
tmpfd = mkstemp(filename);
-#if HAVE_GIO
app = g_app_info_get_default_for_type("text/plain", FALSE);
-#elif HAVE_GNOME_VFS
- app = gnome_vfs_mime_get_default_application ("text/plain");
-#endif
if (app) {
-#if HAVE_GIO
argc = 2;
argv = g_new0 (char *, argc + 1);
@@ -1219,46 +1199,6 @@ edit_with_gnome(GtkAction * action, BalsaSendmsg* bsmsg)
g_app_info_supports_uris(app) ? "file://" : "", filename);
// FIXME: how can I detect if the called application needs the terminal???
g_object_unref(app);
-#elif HAVE_GNOME_VFS
-#if HAVE_GNOME_VFS29
- gboolean adduri = gnome_vfs_mime_application_supports_uris(app);
- const gchar *exec, *pct;
-#else /* HAVE_GNOME_VFS29 */
- gboolean adduri = (app->expects_uris ==
- GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS);
-#endif /* HAVE_GNOME_VFS29 */
- argc = 2;
- argv = g_new0 (char *, argc+1);
-#if HAVE_GNOME_VFS29
- exec = gnome_vfs_mime_application_get_exec(app);
- pct = strstr(exec, " %");
- argv[0] = pct ? g_strndup(exec, pct - exec) : g_strdup(exec);
-#else /* HAVE_GNOME_VFS29 */
- argv[0] = g_strdup(app->command);
-#endif /* HAVE_GNOME_VFS29 */
- argv[1] = g_strdup_printf("%s%s", adduri ? "file://" : "", filename);
-
- /* this does not work really well with gnome-terminal
- * that quits before the text editing application quits.
- * Blame gnome-terminal.
- * WORKAROUND: if the terminal is gnome-terminal,
- * --disable-factory option is added as well.
- */
- if (app->requires_terminal) {
- gnome_prepend_terminal_to_vector(&argc, &argv);
- if(strstr(argv[0], "gnome-terminal")) {
- int i;
- gchar ** new_argv = g_new(char*, ++argc+1);
- new_argv[0] = argv[0];
- new_argv[1] = g_strdup("--disable-factory");
- for(i=2; i<=argc; i++)
- new_argv[i] = argv[i-1];
- g_free(argv);
- argv = new_argv;
- }
- }
- gnome_vfs_mime_application_free (app);
-#endif
} else {
balsa_information_parented(GTK_WINDOW(bsmsg->window),
LIBBALSA_INFORMATION_ERROR,
@@ -1833,11 +1773,7 @@ on_open_url_cb(GtkWidget * menu_item, BalsaAttachInfo * info)
g_return_if_fail(uri != NULL);
g_message("open URL %s", uri);
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, uri, gtk_get_current_event_time(), &err);
-#else
- gnome_url_show(uri, &err);
-#endif
if (err) {
balsa_information(LIBBALSA_INFORMATION_WARNING,
_("Error showing %s: %s\n"),
@@ -2856,17 +2792,8 @@ render_attach_size(GtkTreeViewColumn *column, GtkCellRenderer *cell,
ATTACH_SIZE_COLUMN, &size, -1);
if (mode == LIBBALSA_ATTACH_AS_EXTBODY)
sstr = g_strdup("-");
-#if GLIB_CHECK_VERSION(2, 16, 0)
else
sstr = g_format_size_for_display((goffset) size);
-#else /* GLIB_CHECK_VERSION(2, 16, 0) */
- else if (size > 1.2e6)
- sstr = g_strdup_printf("%.2fMB", size / (1024 * 1024));
- else if (size > 1.2e3)
- sstr = g_strdup_printf("%.2fkB", size / 1024);
- else
- sstr = g_strdup_printf("%dB", (gint) size);
-#endif /* GLIB_CHECK_VERSION(2, 16, 0) */
g_object_set(cell, "text", sstr, NULL);
g_free(sstr);
}
@@ -6088,7 +6015,6 @@ save_message_cb(GtkAction * action, BalsaSendmsg * bsmsg)
bsmsg->state = SENDMSG_STATE_CLEAN;
}
-#ifdef HAVE_GTK_PRINT
#if !defined(ENABLE_TOUCH_UI)
static void
page_setup_cb(GtkAction * action, BalsaSendmsg * bsmsg)
@@ -6100,7 +6026,6 @@ page_setup_cb(GtkAction * action, BalsaSendmsg * bsmsg)
g_object_unref(message);
}
#endif /* ENABLE_TOUCH_UI */
-#endif
static void
print_message_cb(GtkAction * action, BalsaSendmsg * bsmsg)
diff --git a/src/spell-check.c b/src/spell-check.c
index a857b0f..509af53 100644
--- a/src/spell-check.c
+++ b/src/spell-check.c
@@ -510,30 +510,16 @@ balsa_spell_check_init(BalsaSpellCheck * spell_check)
vbox = gtk_vbox_new(FALSE, padding);
change = balsa_stock_button_with_label(GTK_STOCK_REDO,
"_Change");
-#if GTK_CHECK_VERSION(2, 11, 0)
gtk_widget_set_tooltip_text(change,
_("Replace the current word "
"with the selected suggestion"));
-#else /* GTK_CHECK_VERSION(2, 11, 0) */
- gtk_tooltips_set_tip(balsa_app.tooltips, change,
- _("Replace the current word "
- "with the selected suggestion"),
- NULL);
-#endif /* GTK_CHECK_VERSION(2, 11, 0) */
gtk_box_pack_start(GTK_BOX(vbox), change, FALSE, FALSE, 0);
change_all = balsa_stock_button_with_label(GTK_STOCK_REFRESH,
"Change _All");
-#if GTK_CHECK_VERSION(2, 11, 0)
gtk_widget_set_tooltip_text(change_all,
_("Replace all occurrences of the current word "
"with the selected suggestion"));
-#else /* GTK_CHECK_VERSION(2, 11, 0) */
- gtk_tooltips_set_tip(balsa_app.tooltips, change_all,
- _("Replace all occurrences of the current word "
- "with the selected suggestion"),
- NULL);
-#endif /* GTK_CHECK_VERSION(2, 11, 0) */
gtk_box_pack_start(GTK_BOX(vbox), change_all, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(spell_check)->action_area),
vbox, FALSE, FALSE, 0);
@@ -542,25 +528,14 @@ balsa_spell_check_init(BalsaSpellCheck * spell_check)
ignore = balsa_stock_button_with_label(GTK_STOCK_GO_FORWARD,
"_Ignore");
-#if GTK_CHECK_VERSION(2, 11, 0)
gtk_widget_set_tooltip_text(ignore,
_("Skip the current word"));
-#else /* GTK_CHECK_VERSION(2, 11, 0) */
- gtk_tooltips_set_tip(balsa_app.tooltips, ignore,
- _("Skip the current word"), NULL);
-#endif /* GTK_CHECK_VERSION(2, 11, 0) */
gtk_box_pack_start(GTK_BOX(vbox), ignore, FALSE, FALSE, 0);
ignore_all = balsa_stock_button_with_label(GTK_STOCK_GOTO_LAST,
"Ignore A_ll");
-#if GTK_CHECK_VERSION(2, 11, 0)
gtk_widget_set_tooltip_text(ignore_all,
_("Skip all occurrences of the current word"));
-#else /* GTK_CHECK_VERSION(2, 11, 0) */
- gtk_tooltips_set_tip(balsa_app.tooltips, ignore_all,
- _("Skip all occurrences of the current word"),
- NULL);
-#endif /* GTK_CHECK_VERSION(2, 11, 0) */
gtk_box_pack_start(GTK_BOX(vbox), ignore_all, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(spell_check)->action_area),
vbox, FALSE, FALSE, 0);
@@ -568,37 +543,20 @@ balsa_spell_check_init(BalsaSpellCheck * spell_check)
vbox = gtk_vbox_new(FALSE, padding);
learn = balsa_stock_button_with_label(BALSA_PIXMAP_BOOK_OPEN,
"_Learn");
-#if GTK_CHECK_VERSION(2, 11, 0)
gtk_widget_set_tooltip_text(learn,
_("Add the current word to your personal dictionary"));
-#else /* GTK_CHECK_VERSION(2, 11, 0) */
- gtk_tooltips_set_tip(balsa_app.tooltips, learn,
- _("Add the current word to your personal dictionary"),
- NULL);
-#endif /* GTK_CHECK_VERSION(2, 11, 0) */
gtk_box_pack_start(GTK_BOX(vbox), learn, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(spell_check)->action_area),
vbox, FALSE, FALSE, 0);
vbox = gtk_vbox_new(FALSE, padding);
done = balsa_stock_button_with_label(GTK_STOCK_OK, "_Done");
-#if GTK_CHECK_VERSION(2, 11, 0)
gtk_widget_set_tooltip_text(done, _("Finish spell checking"));
-#else /* GTK_CHECK_VERSION(2, 11, 0) */
- gtk_tooltips_set_tip(balsa_app.tooltips, done,
- _("Finish spell checking"), NULL);
-#endif /* GTK_CHECK_VERSION(2, 11, 0) */
gtk_box_pack_start(GTK_BOX(vbox), done, FALSE, FALSE, 0);
cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
-#if GTK_CHECK_VERSION(2, 11, 0)
gtk_widget_set_tooltip_text(learn,
_("Revert all changes and finish spell checking"));
-#else /* GTK_CHECK_VERSION(2, 11, 0) */
- gtk_tooltips_set_tip(balsa_app.tooltips, cancel,
- _("Revert all changes and finish spell checking"),
- NULL);
-#endif /* GTK_CHECK_VERSION(2, 11, 0) */
gtk_box_pack_start(GTK_BOX(vbox), cancel, FALSE, FALSE, 0);
gtk_box_pack_end(GTK_BOX(GTK_DIALOG(spell_check)->action_area),
vbox, FALSE, FALSE, 0);
diff --git a/src/toolbar-factory.c b/src/toolbar-factory.c
index eb62058..9dd3c6f 100644
--- a/src/toolbar-factory.c
+++ b/src/toolbar-factory.c
@@ -454,12 +454,10 @@ tm_set_tool_item_label(GtkToolItem * tool_item, const gchar * stock_id,
gtk_tool_item_set_is_important(tool_item, TRUE);
-#if GTK_CHECK_VERSION(2, 12, 0)
if (strcmp(toolbar_buttons[button].pixmap_id, BALSA_PIXMAP_SEND) == 0
&& balsa_app.always_queue_sent_mail)
gtk_tool_item_set_tooltip_text(tool_item,
_("Queue this message for sending"));
-#endif /* GTK_CHECK_VERSION(2, 12, 0) */
return button;
}
@@ -479,19 +477,11 @@ tm_populate(BalsaToolbarModel * model, GtkUIManager * ui_manager,
g_array_append_val(merge_ids, merge_id);
- if (!*stock_id) {
-#if GTK_CHECK_VERSION(2, 11, 6)
+ if (!*stock_id)
gtk_ui_manager_add_ui(ui_manager, merge_id, "/Toolbar",
NULL, NULL, GTK_UI_MANAGER_SEPARATOR,
FALSE);
-#else /* GTK_CHECK_VERSION(2, 11, 6) */
- gchar *name = g_strdup_printf("Separator%d", merge_id);
- gtk_ui_manager_add_ui(ui_manager, merge_id, "/Toolbar",
- name, NULL, GTK_UI_MANAGER_SEPARATOR,
- FALSE);
- g_free(name);
-#endif /* GTK_CHECK_VERSION(2, 11, 6) */
- } else {
+ else {
gchar *path, *name;
GtkWidget *tool_item;
@@ -787,9 +777,7 @@ tm_do_popup_menu(GtkWidget * toolbar, GdkEventButton * event,
event_time = gtk_get_current_event_time();
}
-#if GTK_CHECK_VERSION(2, 10, 0)
gtk_menu_attach_to_widget(GTK_MENU(menu), toolbar, NULL);
-#endif /* GTK_CHECK_VERSION(2, 10, 0) */
if (button)
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button,
event_time);
diff --git a/src/toolbar-prefs.c b/src/toolbar-prefs.c
index ed7e6b3..de0f462 100644
--- a/src/toolbar-prefs.c
+++ b/src/toolbar-prefs.c
@@ -34,12 +34,6 @@
#include "sendmsg-window.h"
#include "toolbar-factory.h"
-#if !GTK_CHECK_VERSION(2, 14, 0)
-#ifdef HAVE_GNOME
-#include <gnome.h>
-#endif
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
-
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
@@ -390,9 +384,7 @@ current_selection_changed_cb(GtkTreeSelection * selection, ToolbarPage * page)
static void
tp_dialog_response_cb(GtkDialog * dialog, gint response, gpointer data)
{
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
GError *err = NULL;
-#endif
switch (response) {
case GTK_RESPONSE_DELETE_EVENT:
@@ -400,20 +392,14 @@ tp_dialog_response_cb(GtkDialog * dialog, gint response, gpointer data)
gtk_widget_destroy(GTK_WIDGET(dialog));
break;
case GTK_RESPONSE_HELP:
-#if GTK_CHECK_VERSION(2, 14, 0) || HAVE_GNOME
-#if GTK_CHECK_VERSION(2, 14, 0)
gtk_show_uri(NULL, "ghelp:balsa?toolbar-prefs",
gtk_get_current_event_time(), &err);
-#else /* GTK_CHECK_VERSION(2, 14, 0) */
- gnome_help_display("balsa", "toolbar-prefs", &err);
-#endif /* GTK_CHECK_VERSION(2, 14, 0) */
if (err) {
balsa_information(LIBBALSA_INFORMATION_WARNING,
_("Error displaying toolbar help: %s\n"),
err->message);
g_error_free(err);
}
-#endif
break;
default:
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]