[geany/geany-plugins] de034e: Merge pull request #91 from b4n/gtk3-support

Frank Lanitz git-noreply at xxxxx
Mon Mar 18 08:31:47 UTC 2013


Branch:      refs/heads/master
Author:      Frank Lanitz <frank at frank.uvena.de>
Committer:   Frank Lanitz <frank at frank.uvena.de>
Date:        Mon, 18 Mar 2013 08:31:47 UTC
Commit:      de034e64ddda3badd111a8accbcc92157eed29ed
             https://github.com/geany/geany-plugins/commit/de034e64ddda3badd111a8accbcc92157eed29ed

Log Message:
-----------
Merge pull request #91 from b4n/gtk3-support

Initial GTK3 support for GP


Modified Paths:
--------------
    build/addons.m4
    build/commander.m4
    build/common.m4
    build/debugger.m4
    build/geanydoc.m4
    build/geanygendoc.m4
    build/geanyinsertnum.m4
    build/geanylatex.m4
    build/geanylipsum.m4
    build/geanylua.m4
    build/geanymacro.m4
    build/geanyminiscript.m4
    build/geanynumberedbookmarks.m4
    build/geanyprj.m4
    build/geanyvc.m4
    build/gproject.m4
    build/gtk.m4
    build/pretty-printer.m4
    build/scope.m4
    build/spellcheck.m4
    build/status.m4
    build/treebrowser.m4
    build/webhelper.m4
    configure.ac
    geanygendoc/src/ggd-options.h
    webhelper/src/gwh-browser.c
    webhelper/src/gwh-settings.c

Modified: build/addons.m4
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -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


Modified: build/commander.m4
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -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])


Modified: build/common.m4
7 files changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -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


Modified: build/debugger.m4
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -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])


Modified: build/geanydoc.m4
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -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


Modified: build/geanygendoc.m4
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -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}])


Modified: build/geanyinsertnum.m4
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -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


Modified: build/geanylatex.m4
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -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


Modified: build/geanylipsum.m4
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -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


Modified: build/geanylua.m4
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -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],


Modified: build/geanymacro.m4
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -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


Modified: build/geanyminiscript.m4
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -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


Modified: build/geanynumberedbookmarks.m4
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -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


Modified: build/geanyprj.m4
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -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


Modified: build/geanyvc.m4
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -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],


Modified: build/gproject.m4
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -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


Modified: build/gtk.m4
51 files changed, 51 insertions(+), 0 deletions(-)
===================================================================
@@ -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])
+])


Modified: build/pretty-printer.m4
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -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])


Modified: build/scope.m4
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -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])


Modified: build/spellcheck.m4
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -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


Modified: build/status.m4
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -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}


Modified: build/treebrowser.m4
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -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],


Modified: build/webhelper.m4
6 files changed, 4 insertions(+), 2 deletions(-)
===================================================================
@@ -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])
 
 


Modified: configure.ac
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -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
 


Modified: geanygendoc/src/ggd-options.h
5 files changed, 5 insertions(+), 0 deletions(-)
===================================================================
@@ -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:


Modified: webhelper/src/gwh-browser.c
6 files changed, 6 insertions(+), 0 deletions(-)
===================================================================
@@ -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


Modified: webhelper/src/gwh-settings.c
11 files changed, 9 insertions(+), 2 deletions(-)
===================================================================
@@ -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 @@ struct _GwhSettingsPrivate
                              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;



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list