[balsa/gtk3] We always use gtksourceview-3.0
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] We always use gtksourceview-3.0
- Date: Sun, 5 Jun 2016 01:13:27 +0000 (UTC)
commit 43bc02948330a6cd1a4b9c1ad8df6ce9530aa953
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat Jun 4 21:02:53 2016 -0400
We always use gtksourceview-3.0
* Makefile.am: store helper files in a properly named folder;
* configure.ac: clean up setting the #define;
* libbalsa/libbalsa.c (libbalsa_source_view_new): clean up, use
proper helper files folder;
* src/balsa-mime-widget-text.c (create_text_widget): clean up;
* src/sendmsg-window.c (create_text_area): ditto.
ChangeLog | 11 +++++++++++
Makefile.am | 2 +-
configure.ac | 6 ++----
libbalsa/libbalsa.c | 18 ++++++------------
src/balsa-mime-widget-text.c | 33 ++-------------------------------
src/sendmsg-window.c | 25 ++-----------------------
6 files changed, 24 insertions(+), 71 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7164b41..3dbaad3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2016-06-04 Albrecht Dreß
+ We always use gtksourceview-3.0
+
+ * Makefile.am: store helper files in a properly named folder;
+ * configure.ac: clean up setting the #define;
+ * libbalsa/libbalsa.c (libbalsa_source_view_new): clean up, use
+ proper helper files folder;
+ * src/balsa-mime-widget-text.c (create_text_widget): clean up;
+ * src/sendmsg-window.c (create_text_area): ditto.
+
+2016-06-04 Albrecht Dreß
+
Delete the Gtkhtml2 code
* libbalsa/html.c (libbalsa_html_print): delete the Gtkhtml2 code.
diff --git a/Makefile.am b/Makefile.am
index b11ec1e..08e5a4e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,7 +38,7 @@ EXTRA_DIST = \
$(balsa_extra_dist)
if BUILD_WITH_GTKSOURCEVIEW
-gtksourceviewdir = $(BALSA_DATA_PREFIX)/gtksourceview-2.0
+gtksourceviewdir = $(BALSA_DATA_PREFIX)/gtksourceview-3.0
gtksourceview_DATA = balsa-mail.lang \
balsa-mail-style.xml
endif
diff --git a/configure.ac b/configure.ac
index 409826a..f247038 100644
--- a/configure.ac
+++ b/configure.ac
@@ -641,13 +641,11 @@ fi
#
if test x$with_gtksourceview != xno; then
PKG_CHECK_MODULES(GTKSOURCEVIEW, [ gtksourceview-3.0 >= 3.2.0 ])
- AC_DEFINE(HAVE_GTKSOURCEVIEW,3,[Defined when GtkSourceView-3 can be used.])
- AC_MSG_NOTICE([Note: using GtkSourceview Version 3])
- with_gtksourceview=3
+ AC_DEFINE(HAVE_GTKSOURCEVIEW,1,[Defined when GtkSourceView-3 can be used.])
BALSA_CFLAGS="$BALSA_CFLAGS $GTKSOURCEVIEW_CFLAGS"
BALSA_LIBS="$BALSA_LIBS $GTKSOURCEVIEW_LIBS"
fi
-AM_CONDITIONAL([BUILD_WITH_GTKSOURCEVIEW], [test x$with_gtksourceview = x3 ])
+AM_CONDITIONAL([BUILD_WITH_GTKSOURCEVIEW], [test x$with_gtksourceview = x1 ])
# libcanberra configuration
#
diff --git a/libbalsa/libbalsa.c b/libbalsa/libbalsa.c
index 49468f6..4b4d590 100644
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@ -52,16 +52,10 @@
#if HAVE_GTKSOURCEVIEW
#include <gtksourceview/gtksourceview.h>
#include <gtksourceview/gtksourcebuffer.h>
-/* note GtkSourceview 1 and 2 have a slightly different API */
-#if (HAVE_GTKSOURCEVIEW == 1)
-# include <gtksourceview/gtksourcetag.h>
-# include <gtksourceview/gtksourcetagstyle.h>
-#else
-# include <gtksourceview/gtksourcelanguage.h>
-# include <gtksourceview/gtksourcelanguagemanager.h>
-# include <gtksourceview/gtksourcestylescheme.h>
-# include <gtksourceview/gtksourcestyleschememanager.h>
-#endif
+#include <gtksourceview/gtksourcelanguage.h>
+#include <gtksourceview/gtksourcelanguagemanager.h>
+#include <gtksourceview/gtksourcestylescheme.h>
+#include <gtksourceview/gtksourcestyleschememanager.h>
#endif
#include "misc.h"
@@ -899,7 +893,7 @@ libbalsa_source_view_new(gboolean highlight_phrases)
lm_rpaths = g_new0(gchar *, n + 2);
for (n = 0; lm_dpaths[n]; n++)
lm_rpaths[n] = g_strdup(lm_dpaths[n]);
- lm_rpaths[n] = g_strdup(BALSA_DATA_PREFIX "/gtksourceview-2.0");
+ lm_rpaths[n] = g_strdup(BALSA_DATA_PREFIX "/gtksourceview-3.0");
gtk_source_language_manager_set_search_path(lm, lm_rpaths);
g_strfreev(lm_rpaths);
@@ -909,7 +903,7 @@ libbalsa_source_view_new(gboolean highlight_phrases)
GtkSourceStyleSchemeManager *smgr =
gtk_source_style_scheme_manager_new();
gchar * sm_paths[] = {
- BALSA_DATA_PREFIX "/gtksourceview-2.0",
+ BALSA_DATA_PREFIX "/gtksourceview-3.0",
NULL };
/* try to load the colouring scheme */
diff --git a/src/balsa-mime-widget-text.c b/src/balsa-mime-widget-text.c
index 1bbf070..b528a6f 100644
--- a/src/balsa-mime-widget-text.c
+++ b/src/balsa-mime-widget-text.c
@@ -40,11 +40,7 @@
#include <gtksourceview/gtksourceview.h>
#include <gtksourceview/gtksourcebuffer.h>
#include <gtksourceview/gtksourcelanguage.h>
-#if (HAVE_GTKSOURCEVIEW == 1)
-# include <gtksourceview/gtksourcelanguagesmanager.h>
-#else
-# include <gtksourceview/gtksourcelanguagemanager.h>
-#endif
+#include <gtksourceview/gtksourcelanguagemanager.h>
#endif
@@ -258,32 +254,7 @@ balsa_mime_widget_new_text(BalsaMessage * bm, LibBalsaMessageBody * mime_body,
static GtkWidget *
create_text_widget(const char * content_type)
{
-#if (HAVE_GTKSOURCEVIEW == 1)
- static GtkSourceLanguagesManager * lm = NULL;
- GtkSourceLanguage * lang;
- GtkSourceBuffer * buffer;
- GtkWidget * widget;
-
- /* we use or own highlighting for text/plain */
- if (!g_ascii_strcasecmp(content_type, "text/plain"))
- return gtk_text_view_new();
-
- /* check if GtkSourceView knows our content type */
- if (!lm)
- lm = gtk_source_languages_manager_new();
- if (!lm ||
- !(lang = gtk_source_languages_manager_get_language_from_mime_type(lm, content_type)))
- return gtk_text_view_new();
-
- /* create a GtkSourceView for our content type */
- buffer = gtk_source_buffer_new_with_language(lang);
- gtk_source_buffer_set_highlight(buffer, TRUE);
- // TODO: maybe we want to use (a) our own highlighting styles or (b) use
- // GEdit-2's here?
- widget = gtk_source_view_new_with_buffer(buffer);
- g_object_unref(buffer);
- return widget;
-#elif (HAVE_GTKSOURCEVIEW > 1)
+#if HAVE_GTKSOURCEVIEW
static GtkSourceLanguageManager * lm = NULL;
static const gchar * const * lm_ids = NULL;
GtkWidget * widget = NULL;
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index ca54c83..bc2813b 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -2875,23 +2875,7 @@ drag_data_quote(GtkWidget * widget,
/* create_text_area
Creates the text entry part of the compose window.
*/
-#if (HAVE_GTKSOURCEVIEW == 1)
-
-static void
-sw_can_undo_cb(GtkSourceBuffer * source_buffer, gboolean can_undo,
- BalsaSendmsg * bsmsg)
-{
- sw_action_set_enabled(bsmsg, "undo", can_undo);
-}
-
-static void
-sw_can_redo_cb(GtkSourceBuffer * source_buffer, gboolean can_redo,
- BalsaSendmsg * bsmsg)
-{
- sw_action_set_enabled(bsmsg, "redo", can_redo);
-}
-
-#elif (HAVE_GTKSOURCEVIEW >= 2)
+#ifdef HAVE_GTKSOURCEVIEW
static void
sw_can_undo_cb(GtkSourceBuffer * source_buffer, GParamSpec *arg1,
@@ -2952,12 +2936,7 @@ create_text_area(BalsaSendmsg * bsmsg)
}
buffer = gtk_text_view_get_buffer(text_view);
-#if (HAVE_GTKSOURCEVIEW == 1)
- g_signal_connect(buffer, "can-undo",
- G_CALLBACK(sw_can_undo_cb), bsmsg);
- g_signal_connect(buffer, "can-redo",
- G_CALLBACK(sw_can_redo_cb), bsmsg);
-#elif (HAVE_GTKSOURCEVIEW)
+#ifdef HAVE_GTKSOURCEVIEW
g_signal_connect(G_OBJECT(buffer), "notify::can-undo",
G_CALLBACK(sw_can_undo_cb), bsmsg);
g_signal_connect(G_OBJECT(buffer), "notify::can-redo",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]