/soc/2013/ankitkv/gobjectification: 661347ff47e6: Added GObject ...

Ankit Vani a at nevitus.org
Tue Sep 24 18:28:17 EDT 2013


Changeset: 661347ff47e6067717338965ed0eed8b0b154ca1
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-25 03:55 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/661347ff47e6

Description:

Added GObject introspection for libgnt, finch and pidgin.
Various fixes for libpurple as well.
However, libgnt and pidgin are still giving trouble :/

diffstat:

 configure.ac             |   9 +++++++--
 finch/Makefile.am        |  29 +++++++++++++++++++++++++++++
 finch/finch.c            |  30 +++++++++++++++++++-----------
 finch/libgnt/Makefile.am |  30 ++++++++++++++++++++++++++++--
 libpurple/Makefile.am    |  12 +++++++-----
 pidgin/Makefile.am       |  30 ++++++++++++++++++++++++++++--
 pidgin/gtkmain.c         |  39 ++++++++++++++++++++++++++-------------
 7 files changed, 144 insertions(+), 35 deletions(-)

diffs (truncated from 346 to 300 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -74,11 +74,10 @@ fi
 
 AC_CANONICAL_HOST
 AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4macros])
 AM_INIT_AUTOMAKE([1.11 -Wno-portability dist-bzip2])
 AM_SILENT_RULES([yes])
 
-AC_CONFIG_MACRO_DIR([m4macros])
-
 PURPLE_MAJOR_VERSION=purple_major_version
 PURPLE_MINOR_VERSION=purple_minor_version
 PURPLE_MICRO_VERSION=purple_micro_version
@@ -467,7 +466,9 @@ running configure.
 	AC_SUBST(GTK_LIBS)
 
 	GTK_PC_MODULE="gtk+-${with_gtk}.0"
+	GTK_VERSION=${with_gtk}
 	AC_SUBST(GTK_PC_MODULE)
+	AC_SUBST(GTK_VERSION)
 
 	dnl We only really need Pango >= 1.4 for decent RTL support
 	PKG_CHECK_MODULES(PANGO, [pango >= 1.4.0],
@@ -1710,6 +1711,10 @@ fi
 dnl # Check for gobject introspection
 GOBJECT_INTROSPECTION_CHECK([1.30.0])
 
+if test "x$enable_introspection" = "xyes" ; then
+	AC_DEFINE(ENABLE_INTROSPECTION, 1, [Define if GObject introspection is enabled.])
+fi
+
 dnl #######################################################################
 dnl # Check for Python
 dnl #######################################################################
diff --git a/finch/Makefile.am b/finch/Makefile.am
--- a/finch/Makefile.am
+++ b/finch/Makefile.am
@@ -76,6 +76,7 @@ finch_LDADD = \
 	$(LIBXML_LIBS) \
 	$(GNT_LIBS) \
 	$(GSTREAMER_LIBS) \
+	$(INTROSPECTION_LIBS) \
 	./libgnt/libgnt.la \
 	$(top_builddir)/libpurple/libpurple.la
 
@@ -94,4 +95,32 @@ AM_CPPFLAGS = \
 	$(DBUS_CFLAGS) \
 	$(LIBXML_CFLAGS) \
 	$(GSTREAMER_CFLAGS) \
+	$(INTROSPECTION_CFLAGS) \
 	$(GNT_CFLAGS)
+
+if ENABLE_GNT
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(builddir) --add-include-path=$(builddir)/libgnt --add-include-path=$(top_builddir)/libpurple
+INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir)/libgnt --includedir=$(top_builddir)/libpurple
+
+if HAVE_INTROSPECTION
+introspection_sources = $(finchinclude_HEADERS)
+
+Finch-$(PURPLE_MAJOR_VERSION).$(PURPLE_MINOR_VERSION).gir: $(builddir)/finch
+Finch_3_0_gir_INCLUDES = GObject-2.0 Purple-$(PURPLE_MAJOR_VERSION).$(PURPLE_MINOR_VERSION) Gnt-$(GNT_MAJOR_VERSION).$(GNT_MINOR_VERSION)
+Finch_3_0_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS)
+Finch_3_0_gir_PROGRAM = $(builddir)/finch
+Finch_3_0_gir_FILES = $(introspection_sources)
+INTROSPECTION_GIRS += Finch-$(PURPLE_MAJOR_VERSION).$(PURPLE_MINOR_VERSION).gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES = $(gir_DATA) $(typelib_DATA)
+endif
+
+endif # ENABLE_GNT
diff --git a/finch/finch.c b/finch/finch.c
--- a/finch/finch.c
+++ b/finch/finch.c
@@ -50,6 +50,10 @@
 #include "config.h"
 #include "package_revision.h"
 
+#ifdef ENABLE_INTROSPECTION
+# include <girepository.h>
+#endif
+
 static void
 debug_init(void)
 {
@@ -268,11 +272,14 @@ init_libpurple(int argc, char **argv)
 	GStatBuf st;
 
 	struct option long_options[] = {
-		{"config",   required_argument, NULL, 'c'},
-		{"debug",    no_argument,       NULL, 'd'},
-		{"help",     no_argument,       NULL, 'h'},
-		{"nologin",  no_argument,       NULL, 'n'},
-		{"version",  no_argument,       NULL, 'v'},
+		{"config",          required_argument, NULL, 'c'},
+		{"debug",           no_argument,       NULL, 'd'},
+		{"help",            no_argument,       NULL, 'h'},
+		{"nologin",         no_argument,       NULL, 'n'},
+		{"version",         no_argument,       NULL, 'v'},
+#ifdef ENABLE_INTROSPECTION
+        {"introspect-dump", required_argument, NULL, 'i'},
+#endif
 		{0, 0, 0, 0}
 	};
 
@@ -288,12 +295,7 @@ init_libpurple(int argc, char **argv)
 
 	/* scan command-line options */
 	opterr = 1;
-	while ((opt = getopt_long(argc, argv,
-#ifndef _WIN32
-				  "c:dhn::v",
-#else
-				  "c:dhn::v",
-#endif
+	while ((opt = getopt_long(argc, argv, "c:dhn::vi:",
 				  long_options, NULL)) != -1) {
 		switch (opt) {
 		case 'c':	/* config dir */
@@ -312,6 +314,12 @@ init_libpurple(int argc, char **argv)
 		case 'v':	/* version */
 			opt_version = TRUE;
 			break;
+#ifdef ENABLE_INTROSPECTION
+		case 'i':	/* introspection */
+			g_irepository_dump(optarg, NULL);
+			return 0;
+			break;
+#endif
 		case '?':	/* show terse help */
 		default:
 			show_usage(argv[0], TRUE);
diff --git a/finch/libgnt/Makefile.am b/finch/libgnt/Makefile.am
--- a/finch/libgnt/Makefile.am
+++ b/finch/libgnt/Makefile.am
@@ -89,11 +89,37 @@ libgnt_la_LIBADD = \
 	$(GLIB_LIBS) \
 	$(GNT_LIBS) \
 	$(LIBXML_LIBS) \
-	$(PY_LIBS)
+	$(PY_LIBS) \
+	$(INTROSPECTION_LIBS)
 
 AM_CPPFLAGS = \
 	$(GLIB_CFLAGS) \
 	$(GNT_CFLAGS) \
 	$(DEBUG_CFLAGS) \
 	$(LIBXML_CFLAGS) \
-	$(PY_CFLAGS)
+	$(PY_CFLAGS) \
+	$(INTROSPECTION_CFLAGS)
+
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(builddir)
+INTROSPECTION_COMPILER_ARGS =
+
+if HAVE_INTROSPECTION
+introspection_sources = $(libgnt_lainclude_HEADERS)
+
+Gnt-$(GNT_MAJOR_VERSION).$(GNT_MINOR_VERSION).gir: $(builddir)/libgnt.la
+Gnt_2_8_gir_INCLUDES = GObject-2.0
+Gnt_2_8_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS)
+Gnt_2_8_gir_LIBS = $(builddir)/libgnt.la
+Gnt_2_8_gir_FILES = $(introspection_sources)
+INTROSPECTION_GIRS += Gnt-$(GNT_MAJOR_VERSION).$(GNT_MINOR_VERSION).gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif
diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -398,6 +398,7 @@ libpurple_la_LIBADD = \
 	$(JSON_LIBS) \
 	$(GNUTLS_LIBS) \
 	$(NSS_LIBS) \
+	$(INTROSPECTION_LIBS) \
 	-lm
 
 AM_CPPFLAGS = \
@@ -418,7 +419,8 @@ AM_CPPFLAGS = \
 	$(NETWORKMANAGER_CFLAGS) \
 	$(JSON_CFLAGS) \
 	$(GNUTLS_CFLAGS) \
-	$(NSS_CFLAGS)
+	$(NSS_CFLAGS) \
+	$(INTROSPECTION_CFLAGS)
 
 # INSTALL_SSL_CERTIFICATES is true when SSL_CERTIFICATES_DIR is empty.
 # We want to use SSL_CERTIFICATES_DIR when it's not empty.
@@ -428,8 +430,8 @@ endif
 
 -include $(INTROSPECTION_MAKEFILE)
 INTROSPECTION_GIRS =
-INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
-INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(builddir)
+INTROSPECTION_COMPILER_ARGS =
 
 if HAVE_INTROSPECTION
 introspection_sources = \
@@ -438,10 +440,10 @@ introspection_sources = \
 	$(addprefix media/, $(purple_mediaheaders)) \
 	$(purple_builtheaders)
 
-Purple-$(PURPLE_MAJOR_VERSION).$(PURPLE_MINOR_VERSION).gir: libpurple.la
+Purple-$(PURPLE_MAJOR_VERSION).$(PURPLE_MINOR_VERSION).gir: $(builddir)/libpurple.la
 Purple_3_0_gir_INCLUDES = GObject-2.0
 Purple_3_0_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS)
-Purple_3_0_gir_LIBS = libpurple.la
+Purple_3_0_gir_LIBS = $(builddir)/libpurple.la
 Purple_3_0_gir_FILES = $(introspection_sources)
 INTROSPECTION_GIRS += Purple-$(PURPLE_MAJOR_VERSION).$(PURPLE_MINOR_VERSION).gir
 
diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am
--- a/pidgin/Makefile.am
+++ b/pidgin/Makefile.am
@@ -182,6 +182,7 @@ pidgin_LDADD = \
 	$(WEBKIT_LIBS) \
 	$(GTK_LIBS) \
 	$(X11_LIBS) \
+	$(INTROSPECTION_LIBS) \
 	$(top_builddir)/libpurple/libpurple.la
 
 if USE_INTERNAL_LIBGADU
@@ -210,6 +211,31 @@ AM_CPPFLAGS = \
 	$(GTKSPELL_CFLAGS) \
 	$(LIBXML_CFLAGS) \
 	$(WEBKIT_CFLAGS) \
-	$(INTGG_CFLAGS)
+	$(INTGG_CFLAGS) \
+	$(INTROSPECTION_CFLAGS)
+
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(builddir) --add-include-path=$(top_builddir)/libpurple
+INTROSPECTION_COMPILER_ARGS = --includedir=$(top_builddir)/libpurple
+
+if HAVE_INTROSPECTION
+introspection_sources = $(pidgininclude_HEADERS)
+
+Pidgin-$(PURPLE_MAJOR_VERSION).$(PURPLE_MINOR_VERSION).gir: $(builddir)/pidgin
+Pidgin_3_0_gir_INCLUDES = GObject-2.0 Gtk-$(GTK_VERSION).0 Purple-$(PURPLE_MAJOR_VERSION).$(PURPLE_MINOR_VERSION)
+Pidgin_3_0_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS)
+Pidgin_3_0_gir_PROGRAM = $(builddir)/pidgin
+Pidgin_3_0_gir_FILES = $(introspection_sources)
+INTROSPECTION_GIRS += Pidgin-$(PURPLE_MAJOR_VERSION).$(PURPLE_MINOR_VERSION).gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES = $(gir_DATA) $(typelib_DATA)
+endif
+
 endif  # ENABLE_GTK
-
diff --git a/pidgin/gtkmain.c b/pidgin/gtkmain.c
--- a/pidgin/gtkmain.c
+++ b/pidgin/gtkmain.c
@@ -74,6 +74,10 @@
 # include <signal.h>
 #endif
 
+#ifdef ENABLE_INTROSPECTION
+# include <girepository.h>
+#endif
+
 #include <getopt.h>
 
 
@@ -462,17 +466,20 @@ int main(int argc, char *argv[])
 	GStatBuf st;
 
 	struct option long_options[] = {
-		{"config",       required_argument, NULL, 'c'},
-		{"debug",        optional_argument, NULL, 'd'},
-		{"force-online", no_argument,       NULL, 'f'},
-		{"help",         no_argument,       NULL, 'h'},
-		{"login",        optional_argument, NULL, 'l'},
-		{"multiple",     no_argument,       NULL, 'm'},
-		{"nologin",      no_argument,       NULL, 'n'},



More information about the Commits mailing list