[gnome-latex: 42/205] Support older versions of GTK+ than the 2.14
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex: 42/205] Support older versions of GTK+ than the 2.14
- Date: Fri, 14 Dec 2018 10:50:25 +0000 (UTC)
commit 8d39b93a0114acf6587074e63b34c54013a55e94
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date: Sat Sep 5 21:07:29 2009 +0200
Support older versions of GTK+ than the 2.14
gtk_dialog_get_action_area () and gtk_dialog_get_content_area ()
apperead in GTK+-2.14.
For GtkSourceView, the 2.4 release is required because of
gtk_source_language_manager_guess_language (). It is possible to support
older versions of GtkSourceView by checking with CMake if the version is
older, and then call an other function in that case. But I prefer not to do
that because GtkSourceView 2.4 was released one year ago, so it's not
worth it.
CMakeLists.txt | 2 +-
src/main.h | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index beff785..f113d78 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,7 +34,7 @@ ENDIF(ENABLE_NLS)
SET(CMAKE_C_FLAGS "-Wall -std=c99 -DGTK_DISABLE_DEPRECATED=1")
FIND_PACKAGE(PkgConfig REQUIRED)
-PKG_CHECK_MODULES(GTK2 REQUIRED gtk+-2.0 gtksourceview-2.0)
+PKG_CHECK_MODULES(GTK2 REQUIRED gtk+-2.0 gtksourceview-2.0>=2.4)
INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS} ${latexila_BINARY_DIR}/src)
diff --git a/src/main.h b/src/main.h
index abc5222..c2cc671 100644
--- a/src/main.h
+++ b/src/main.h
@@ -22,12 +22,23 @@
#include "config.h"
+// if Native Language Support is enabled
#ifdef LATEXILA_NLS_ENABLED
#define _(STRING) gettext(STRING)
#else
#define _(STRING) STRING
#endif
+// if GTK+ version is < 2.14.0
+#if !GTK_CHECK_VERSION(2, 14, 0)
+# if !defined(gtk_dialog_get_action_area)
+# define gtk_dialog_get_action_area(dialog) GTK_DIALOG(dialog)->action_area
+# endif
+# if !defined(gtk_dialog_get_content_area)
+# define gtk_dialog_get_content_area(dialog) GTK_DIALOG(dialog)->vbox
+# endif
+#endif
+
// each document opened is represented by a document_t structure
typedef struct
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]