Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #91 from b4n/gtk3-support

Initial GTK3 support for GP
  • Loading branch information...
commit de034e64ddda3badd111a8accbcc92157eed29ed 2 parents 39c1599 + 43934f2
@frlan frlan authored
View
3  build/addons.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_ADDONS],
[
- GP_ARG_DISABLE(Addons, yes)
+ GP_ARG_DISABLE([Addons], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([Addons])
GP_COMMIT_PLUGIN_STATUS([Addons])
AC_CONFIG_FILES([
addons/Makefile
View
2  build/commander.m4
@@ -3,7 +3,7 @@ AC_DEFUN([GP_CHECK_COMMANDER],
GP_ARG_DISABLE([Commander], [auto])
GP_CHECK_PLUGIN_DEPS([Commander], [COMMANDER],
- [gtk+-2.0 >= 2.16
+ [$GP_GTK_PACKAGE >= 2.16
glib-2.0 >= 2.4])
GP_COMMIT_PLUGIN_STATUS([Commander])
View
7 build/common.m4
@@ -18,6 +18,13 @@ dnl Checks whether modules exist using PKG_CHECK_MODULES, and enables/disables
dnl plugins appropriately if enable_$plugin=auto
AC_DEFUN([GP_CHECK_PLUGIN_DEPS],
[
+ AC_REQUIRE([GP_CHECK_GTK_VERSION])
+
+ gtk_dep=m4_bmatch([$3], [gtk\+-2\.0], [2], [gtk\+-3\.0], [3], [0])
+ if test $gtk_dep -ne 0; then
+ GP_CHECK_PLUGIN_GTKN_ONLY([$1], [$gtk_dep])
+ fi
+
if test "$m4_tolower(AS_TR_SH(enable_$1))" = "yes"; then
PKG_CHECK_MODULES([$2], [$3])
elif test "$m4_tolower(AS_TR_SH(enable_$1))" = "auto"; then
View
1  build/debugger.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_DEBUGGER],
[
GP_ARG_DISABLE([Debugger], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([Debugger])
GP_CHECK_PLUGIN_DEPS([debugger], [VTE],
[vte >= 0.24])
GP_COMMIT_PLUGIN_STATUS([Debugger])
View
3  build/geanydoc.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_GEANYDOC],
[
- GP_ARG_DISABLE([GeanyDoc], [yes])
+ GP_ARG_DISABLE([GeanyDoc], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([GeanyDoc])
GP_COMMIT_PLUGIN_STATUS([GeanyDoc])
AC_CONFIG_FILES([
geanydoc/Makefile
View
2  build/geanygendoc.m4
@@ -8,7 +8,7 @@ AC_DEFUN([GP_CHECK_GEANYGENDOC],
CTPL_VERSION=0.3
GP_CHECK_PLUGIN_DEPS([GeanyGenDoc], GEANYGENDOC,
- [gtk+-2.0 >= ${GTK_VERSION}
+ [$GP_GTK_PACKAGE >= ${GTK_VERSION}
glib-2.0 >= ${GLIB_VERSION}
gio-2.0 >= ${GIO_VERSION}
ctpl >= ${CTPL_VERSION}])
View
3  build/geanyinsertnum.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_GEANYINSERTNUM],
[
- GP_ARG_DISABLE([GeanyInsertNum], [yes])
+ GP_ARG_DISABLE([GeanyInsertNum], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([GeanyInsertNum])
GP_COMMIT_PLUGIN_STATUS([GeanyInsertNum])
AC_CONFIG_FILES([
geanyinsertnum/Makefile
View
3  build/geanylatex.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_GEANYLATEX],
[
- GP_ARG_DISABLE([GeanyLaTeX], [yes])
+ GP_ARG_DISABLE([GeanyLaTeX], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([GeanyLaTeX])
GP_COMMIT_PLUGIN_STATUS([GeanyLaTeX])
AC_CONFIG_FILES([
geanylatex/Makefile
View
3  build/geanylipsum.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_GEANYLIPSUM],
[
- GP_ARG_DISABLE([GeanyLipsum], [yes])
+ GP_ARG_DISABLE([GeanyLipsum], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([GeanyLipsum])
GP_COMMIT_PLUGIN_STATUS([GeanyLipsum])
AC_CONFIG_FILES([
geanylipsum/Makefile
View
1  build/geanylua.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_GEANYLUA],
[
GP_ARG_DISABLE([GeanyLua], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([GeanyLua])
AC_ARG_WITH([lua-pkg],
AC_HELP_STRING([--with-lua-pkg=ARG],
View
3  build/geanymacro.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_GEANYMACRO],
[
- GP_ARG_DISABLE([GeanyMacro], [yes])
+ GP_ARG_DISABLE([GeanyMacro], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([GeanyMacro])
GP_COMMIT_PLUGIN_STATUS([GeanyMacro])
AC_CONFIG_FILES([
geanymacro/Makefile
View
3  build/geanyminiscript.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_GEANYMINISCRIPT],
[
- GP_ARG_DISABLE([GeanyMiniScript], [yes])
+ GP_ARG_DISABLE([GeanyMiniScript], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([GeanyMiniScript])
GP_COMMIT_PLUGIN_STATUS([GeanyMiniScript])
AC_CONFIG_FILES([
geanyminiscript/Makefile
View
3  build/geanynumberedbookmarks.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_GEANYNUMBEREDBOOKMARKS],
[
- GP_ARG_DISABLE([GeanyNumberedBookmarks], [yes])
+ GP_ARG_DISABLE([GeanyNumberedBookmarks], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([GeanyNumberedBookmarks])
GP_COMMIT_PLUGIN_STATUS([GeanyNumberedBookmarks])
AC_CONFIG_FILES([
geanynumberedbookmarks/Makefile
View
3  build/geanyprj.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_GEANYPRJ],
[
- GP_ARG_DISABLE([GeanyPrj], [yes])
+ GP_ARG_DISABLE([GeanyPrj], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([GeanyPrj])
GP_COMMIT_PLUGIN_STATUS([GeanyPrj])
AC_CONFIG_FILES([
geanyprj/Makefile
View
3  build/geanyvc.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_GEANYVC],
[
- GP_ARG_DISABLE([GeanyVC], [yes])
+ GP_ARG_DISABLE([GeanyVC], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([GeanyVC])
GP_COMMIT_PLUGIN_STATUS([GeanyVC])
AC_ARG_ENABLE(gtkspell,
AC_HELP_STRING([--enable-gtkspell=ARG],
View
3  build/gproject.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_GPROJECT],
[
- GP_ARG_DISABLE([GProject], [yes])
+ GP_ARG_DISABLE([GProject], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([GProject])
GP_COMMIT_PLUGIN_STATUS([GProject])
AC_CONFIG_FILES([
gproject/Makefile
View
51 build/gtk.m4
@@ -0,0 +1,51 @@
+dnl checks for the GTK version to build against (2 or 3)
+dnl defines GP_GTK_PACKAGE (e.g. "gtk+-2.0"), GP_GTK_VERSION (e.g. "2.24") and
+dnl GP_GTK_VERSION_MAJOR (e.g. "2")
+AC_DEFUN([GP_CHECK_GTK_VERSION],
+[
+ AC_REQUIRE([AC_PROG_AWK])
+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+
+ _gtk_req=$(${PKG_CONFIG} --print-requires geany | ${AWK} '/^gtk\+-/{print}')
+ GP_GTK_PACKAGE=$(echo ${_gtk_req} | ${AWK} '{print $[]1}')
+ GP_GTK_VERSION=$(echo ${_gtk_req} | ${AWK} '{print $[]3}')
+ GP_GTK_VERSION_MAJOR=$(echo ${GP_GTK_VERSION} | cut -d. -f1)
+ AC_SUBST([GP_GTK_PACKAGE])
+ AC_SUBST([GP_GTK_VERSION])
+ AC_SUBST([GP_GTK_VERSION_MAJOR])
+])
+
+dnl executes $1 if GTK3 is used, and $2 otherwise
+AC_DEFUN([GP_CHECK_GTK3],
+[
+ AC_REQUIRE([GP_CHECK_GTK_VERSION])
+ AS_IF([test ${GP_GTK_VERSION_MAJOR} = 3],[$1],[$2])
+])
+
+dnl GP_CHECK_PLUGIN_GTKN_ONLY pluginname gtkversion
+AC_DEFUN([GP_CHECK_PLUGIN_GTKN_ONLY],
+[
+ AC_REQUIRE([GP_CHECK_GTK_VERSION])
+
+ AS_IF([test "$m4_tolower(AS_TR_SH(enable_$1))" = no],[],
+ [AC_MSG_CHECKING([whether the GTK version in use is compatible with plugin $1])
+ AS_IF([test ${GP_GTK_VERSION_MAJOR} = $2],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AS_IF([test "$m4_tolower(AS_TR_SH(enable_$1))" = yes],
+ [AC_MSG_ERROR([$1 is not compatible with the GTK version in use])],
+ [test "$m4_tolower(AS_TR_SH(enable_$1))" = auto],
+ [m4_tolower(AS_TR_SH(enable_$1))=no])])])
+])
+
+dnl GP_CHECK_PLUGIN_GTK2_ONLY pluginname
+AC_DEFUN([GP_CHECK_PLUGIN_GTK2_ONLY],
+[
+ GP_CHECK_PLUGIN_GTKN_ONLY([$1], [2])
+])
+
+dnl GP_CHECK_PLUGIN_GTK3_ONLY pluginname
+AC_DEFUN([GP_CHECK_PLUGIN_GTK3_ONLY],
+[
+ GP_CHECK_PLUGIN_GTKN_ONLY([$1], [3])
+])
View
1  build/pretty-printer.m4
@@ -3,6 +3,7 @@ AC_DEFUN([GP_CHECK_PRETTYPRINTER],
LIBXML_VERSION=2.6.27
GP_ARG_DISABLE([pretty-printer], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([pretty-printer])
GP_CHECK_PLUGIN_DEPS([pretty-printer], [LIBXML],
[libxml-2.0 >= ${LIBXML_VERSION}])
GP_COMMIT_PLUGIN_STATUS([Pretty Printer])
View
1  build/scope.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_SCOPE],
[
GP_ARG_DISABLE([Scope], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([Scope])
GP_CHECK_PLUGIN_DEPS([scope], [VTE],
[vte >= 0.17])
View
1  build/spellcheck.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_SPELLCHECK],
[
GP_ARG_DISABLE([spellcheck], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([spellcheck])
ENCHANT_VERSION=1.3
OPT_ENCHANT_VERSION=1.5
View
2  build/status.m4
@@ -50,7 +50,7 @@ AC_DEFUN([GP_STATUS_PRINT],
${PACKAGE}-${VERSION}
Build Environment:
- Geany version: ${GEANY_VERSION}
+ Geany version: ${GEANY_VERSION} (GTK${GP_GTK_VERSION_MAJOR})
Install prefix: ${prefix}
Datadir: ${expanded_datadir}/${PACKAGE_TARNAME}
Libdir: ${expanded_libdir}/${PACKAGE_TARNAME}
View
1  build/treebrowser.m4
@@ -1,6 +1,7 @@
AC_DEFUN([GP_CHECK_TREEBROWSER],
[
GP_ARG_DISABLE([Treebrowser], [auto])
+ GP_CHECK_PLUGIN_GTK2_ONLY([Treebrowser])
if [[ "$enable_treebrowser" != no ]]; then
AC_CHECK_FUNC([creat],
[enable_treebrowser=yes],
View
6 build/webhelper.m4
@@ -18,12 +18,14 @@ AC_DEFUN([GP_CHECK_WEBHELPER],
fi
fi
+ GP_CHECK_GTK3([webkit_package=webkitgtk-3.0],
+ [webkit_package=webkit-1.0])
GP_CHECK_PLUGIN_DEPS([WebHelper], [WEBHELPER],
- [gtk+-2.0 >= ${GTK_VERSION}
+ [$GP_GTK_PACKAGE >= ${GTK_VERSION}
glib-2.0 >= ${GLIB_VERSION}
gio-2.0 >= ${GIO_VERSION}
gdk-pixbuf-2.0 >= ${GDK_PIXBUF_VERSION}
- webkit-1.0 >= ${WEBKIT_VERSION}
+ $webkit_package >= ${WEBKIT_VERSION}
gthread-2.0])
View
1  configure.ac
@@ -20,6 +20,7 @@ GP_I18N
dnl common checks
GP_CHECK_GEANY(1.23)
GP_CHECK_UNITTESTS(0.9.4)
+GP_CHECK_GTK_VERSION
GP_CHECK_CPPCHECK
GP_CHECK_CFLAGS
View
5 geanygendoc/src/ggd-options.h
@@ -29,6 +29,11 @@
G_BEGIN_DECLS
GGD_BEGIN_PLUGIN_API
+#if GTK_CHECK_VERSION(3, 0, 0)
+# define GtkObject GtkWidget
+# define GTK_OBJECT GTK_WIDGET
+#endif
+
/**
* GgdOptGroup:
View
6 webhelper/src/gwh-browser.c
@@ -49,6 +49,12 @@
(GTK_WIDGET_MAPPED ((w)))
# endif /* defined (gtk_widget_get_mapped) */
#endif /* GTK_CHECK_VERSION (2, 20, 0) */
+#if GTK_CHECK_VERSION (3, 0, 0)
+/* alias GtkObject, we implement the :destroy signal */
+# define GtkObject GtkWidget
+# define GtkObjectClass GtkWidgetClass
+# define GTK_OBJECT_CLASS GTK_WIDGET_CLASS
+#endif /* GTK_CHECK_VERSION (3, 0, 0) */
struct _GwhBrowserPrivate
View
11 webhelper/src/gwh-settings.c
@@ -29,6 +29,13 @@
#include <gtk/gtk.h>
+#if ! GTK_CHECK_VERSION (3, 0, 0)
+/* make gtk_adjustment_new() return a real GtkAdjustment, not a GtkObject */
+# define gtk_adjustment_new(v, l, u, si, pi, ps) \
+ (GtkAdjustment *) (gtk_adjustment_new ((v), (l), (u), (si), (pi), (ps)))
+#endif
+
+
struct _GwhSettingsPrivate
{
GPtrArray *prop_array;
@@ -619,14 +626,14 @@ gwh_settings_widget_int_new (GwhSettings *self,
gboolean *needs_label)
{
GtkWidget *button;
- GtkObject *adj;
+ GtkAdjustment *adj;
GParamSpecInt *pspec_int = G_PARAM_SPEC_INT (pspec);
adj = gtk_adjustment_new ((gdouble)g_value_get_int (value),
(gdouble)pspec_int->minimum,
(gdouble)pspec_int->maximum,
1.0, 10.0, 0.0);
- button = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0.0, 0);
+ button = gtk_spin_button_new (adj, 0.0, 0);
*needs_label = TRUE;
return button;
Please sign in to comment.
Something went wrong with that request. Please try again.