[gnome-autoar] Move GTK+ widgets to a separate library



commit 58b80f986969f5ba6419a961d188936a555256df
Author: Ting-Wei Lan <lantw44 gmail com>
Date:   Sun Jan 26 11:46:57 2014 +0800

    Move GTK+ widgets to a separate library
    
    GTK+ support is optional now, but building API documentation requires GTK+
    support to be enabled.

 Makefile.am                                        |  106 ++++++++++++++++----
 configure.ac                                       |   36 ++++++-
 docs/reference/Makefile.am                         |    1 +
 docs/reference/gnome-autoar-docs.xml               |    5 +-
 .../{autoar-gtk.c => autoar-gtk-chooser.c}         |   70 +++++++-------
 gnome-autoar/autoar-gtk-chooser.h                  |   49 +++++++++
 gnome-autoar/autoar-gtk.h                          |   32 ++-----
 gnome-autoar/autoar.h                              |    6 +-
 gnome-autoar/gnome-autoar-gtk.pc.in                |   11 ++
 gnome-autoar/gnome-autoar.pc.in                    |    2 +-
 tests/test-ui.c                                    |    5 +-
 11 files changed, 233 insertions(+), 90 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 0430124..db8f6da 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,7 +7,7 @@ ACLOCAL_AMFLAGS = -I m4
 
 EXTRA_DIST =
 BUILT_SOURCES =
-DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk --enable-gtk-doc --enable-introspection
 
 
 # Top-level directory
@@ -21,14 +21,11 @@ EXTRA_DIST += \
        gnome-autoar/gnome-autoar.pc.in                 \
        $(NULL)
 
-lib_LTLIBRARIES = gnome-autoar/libgnome-autoar.la
-
 libgnome_autoar_la_headers = \
        gnome-autoar/autoar-common.h            \
        gnome-autoar/autoar-create.h            \
        gnome-autoar/autoar-extract.h           \
        gnome-autoar/autoar-format-filter.h     \
-       gnome-autoar/autoar-gtk.h               \
        gnome-autoar/autoar-pref.h              \
        $(NULL)
 libgnome_autoar_la_sources = \
@@ -36,27 +33,34 @@ libgnome_autoar_la_sources = \
        gnome-autoar/autoar-create.c            \
        gnome-autoar/autoar-extract.c           \
        gnome-autoar/autoar-format-filter.c     \
-       gnome-autoar/autoar-gtk.c               \
        gnome-autoar/autoar-pref.c              \
        $(NULL)
 libgnome_autoar_la_generated_files = \
        gnome-autoar/autoar-enum-types.h        \
        gnome-autoar/autoar-enum-types.c        \
        $(NULL)
+libgnome_autoar_gtk_la_headers = \
+       gnome-autoar/autoar-gtk-chooser.h       \
+       $(NULL)
+libgnome_autoar_gtk_la_sources = \
+       gnome-autoar/autoar-gtk-chooser.c       \
+       $(NULL)
 
 BUILT_SOURCES += \
        $(libgnome_autoar_la_generated_files)   \
        $(NULL)
 
+lib_LTLIBRARIES = gnome-autoar/libgnome-autoar.la
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gnome-autoar/gnome-autoar.pc
+
 autoarincludedir = $(includedir)/gnome-autoar
 autoarinclude_HEADERS = \
        gnome-autoar/autoar.h                   \
        $(libgnome_autoar_la_headers)           \
        $(NULL)
 
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = gnome-autoar/gnome-autoar.pc
-
 gnome_autoar_libgnome_autoar_la_SOURCES = \
        $(libgnome_autoar_la_generated_files)   \
        $(libgnome_autoar_la_headers)           \
@@ -66,7 +70,6 @@ gnome_autoar_libgnome_autoar_la_CPPFLAGS = \
        $(AM_CPPFLAGS)                          \
        $(NULL)
 gnome_autoar_libgnome_autoar_la_CFLAGS = \
-       $(GTK_CFLAGS)                           \
        $(GIO_CFLAGS)                           \
        $(LIBARCHIVE_CFLAGS)                    \
        -I$(top_srcdir)                         \
@@ -74,12 +77,42 @@ gnome_autoar_libgnome_autoar_la_CFLAGS = \
        $(AM_CFLAGS)                            \
        $(NULL)
 gnome_autoar_libgnome_autoar_la_LIBADD = \
-       $(GTK_LIBS)                             \
        $(GIO_LIBS)                             \
        $(LIBARCHIVE_LIBS)                      \
        $(DEPENDENCIES_LIBS)                    \
        $(NULL)
 
+if ENABLE_GTK
+
+lib_LTLIBRARIES += gnome-autoar/libgnome-autoar-gtk.la
+
+pkgconfig_DATA += gnome-autoar/gnome-autoar-gtk.pc
+
+autoarinclude_HEADERS += \
+       gnome-autoar/autoar-gtk.h               \
+       $(libgnome_autoar_gtk_la_headers)       \
+       $(NULL)
+
+gnome_autoar_libgnome_autoar_gtk_la_SOURCES = \
+       $(libgnome_autoar_gtk_la_headers)       \
+       $(libgnome_autoar_gtk_la_sources)       \
+       $(NULL)
+gnome_autoar_libgnome_autoar_gtk_la_CPPFLAGS = \
+       $(AM_CPPFLAGS)
+       $(NULL)
+gnome_autoar_libgnome_autoar_gtk_la_CFLAGS = \
+       $(GTK_CFLAGS)                           \
+       -I$(top_srcdir)                         \
+       -I$(top_builddir)/gnome-autoar          \
+       $(AM_CFLAGS)                            \
+       $(NULL)
+gnome_autoar_libgnome_autoar_gtk_la_LIBADD = \
+       $(GTK_LIBS)                             \
+       $(top_builddir)/gnome-autoar/libgnome-autoar.la \
+       $(NULL)
+
+endif
+
 gnome-autoar/autoar-enum-types.h: gnome-autoar/autoar-enum-types.h.template $(libgnome_autoar_la_headers)
        $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template gnome-autoar/autoar-enum-types.h.template 
$(libgnome_autoar_la_headers) ) > $@
 gnome-autoar/autoar-enum-types.c: gnome-autoar/autoar-enum-types.c.template $(libgnome_autoar_la_headers)
@@ -90,29 +123,47 @@ DISTCLEANFILES = $(BUILT_SOURCES)
 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
 
 -include $(INTROSPECTION_MAKEFILE)
-INTROSPECTION_GIRS = gnome-autoar/GnomeAutoar-0.1.gir
-INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all
-INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(top_builddir)/gnome-autoar
+INTROSPECTION_COMPILER_ARGS = --includedir=$(top_builddir)/gnome-autoar
 
 if HAVE_INTROSPECTION
 
+INTROSPECTION_GIRS += gnome-autoar/GnomeAutoar-0.1.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)
+
 gnome-autoar/GnomeAutoar-0.1.gir: gnome-autoar/libgnome-autoar.la
 gnome_autoar_GnomeAutoar_0_1_gir_SCANNERFLAGS = --identifier-prefix=Autoar
 gnome_autoar_GnomeAutoar_0_1_gir_CFLAGS = -I$(top_srcdir) $(AM_CFLAGS)
-gnome_autoar_GnomeAutoar_0_1_gir_INCLUDES = GLib-2.0 GObject-2.0 Gio-2.0 Gtk-3.0
+gnome_autoar_GnomeAutoar_0_1_gir_INCLUDES = GLib-2.0 GObject-2.0 Gio-2.0
 gnome_autoar_GnomeAutoar_0_1_gir_LIBS = gnome-autoar/libgnome-autoar.la
 gnome_autoar_GnomeAutoar_0_1_gir_FILES = \
        $(libgnome_autoar_la_headers)           \
        $(libgnome_autoar_la_sources)           \
        $(NULL)
 
-CLEANFILES += $(gir_DATA) $(typelib_DATA)
+if ENABLE_GTK
+
+INTROSPECTION_GIRS += gnome-autoar/GnomeAutoarGtk-0.1.gir
+
+gnome-autoar/GnomeAutoarGtk-0.1.gir: gnome-autoar/libgnome-autoar-gtk.la
+gnome_autoar_GnomeAutoarGtk_0_1_gir_SCANNERFLAGS = --identifier-prefix=AutoarGtk
+gnome_autoar_GnomeAutoarGtk_0_1_gir_CFLAGS = -I$(top_srcdir) $(AM_CFLAGS)
+gnome_autoar_GnomeAutoarGtk_0_1_gir_INCLUDES = GnomeAutoar-0.1 Gtk-3.0
+gnome_autoar_GnomeAutoarGtk_0_1_gir_LIBS = gnome-autoar/libgnome-autoar-gtk.la
+gnome_autoar_GnomeAutoarGtk_0_1_gir_FILES = \
+       $(libgnome_autoar_gtk_la_headers)               \
+       $(libgnome_autoar_gtk_la_sources)               \
+       $(NULL)
+
+endif
 
 endif
 
@@ -132,11 +183,9 @@ noinst_PROGRAMS = \
        tests/test-extract      \
        tests/test-pref         \
        tests/test-create       \
-       tests/test-ui           \
        $(NULL)
 
 test_cflags = \
-       $(GTK_CFLAGS)           \
        $(GIO_CFLAGS)           \
        $(LIBARCHIVE_CFLAGS)    \
        -I$(top_srcdir)         \
@@ -159,8 +208,27 @@ tests_test_create_SOURCES = tests/test-create.c
 tests_test_create_CFLAGS = $(test_cflags)
 tests_test_create_LDADD = $(test_libs)
 
+if ENABLE_GTK
+
+noinst_PROGRAMS += \
+       tests/test-ui           \
+       $(NULL)
+
+test_gtk_cflags = \
+       $(GTK_CFLAGS)           \
+       -I$(top_srcdir)         \
+       $(AM_CFLAGS)            \
+       $(NULL)
+
+test_gtk_libs = \
+       $(top_builddir)/gnome-autoar/libgnome-autoar-gtk.la     \
+       $(top_builddir)/gnome-autoar/libgnome-autoar.la \
+       $(NULL)
+
 tests_test_ui_SOURCES = tests/test-ui.c
-tests_test_ui_CFLAGS = $(test_cflags)
-tests_test_ui_LDADD = $(test_libs)
+tests_test_ui_CFLAGS = $(test_gtk_cflags)
+tests_test_ui_LDADD = $(test_gtk_libs)
+
+endif
 
 SUBDIRS = . docs
diff --git a/configure.ac b/configure.ac
index 87c4d85..e7def91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,7 +48,33 @@ PKG_CHECK_MODULES([GIO], [
         gio-2.0     >= $GLIB_REQUIRED
         ])
 
-PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_REQUIRED])
+AC_ARG_ENABLE([gtk],
+        [AS_HELP_STRING([--enable-gtk], [Build some common GTK+ widgets])],
+        [enable_gtk="$enableval"], [enable_gtk=yes])
+if test x"$enable_gtk" = xyes; then
+        PKG_CHECK_MODULES(
+                [GTK], [gtk+-3.0 >= $GTK_REQUIRED], [],
+                [AC_MSG_ERROR([
+
+        gtk+-3.0 not found (or version < $GTK_REQUIRED)
+
+        If you want to disable support for common GTK+ widgets,
+        please append --disable-gtk to configure.
+
+        ])])
+fi
+AC_SUBST(GTK_CFLAGS)
+AC_SUBST(GTK_LIBS)
+AM_CONDITIONAL(ENABLE_GTK, [test x"$enable_gtk" = xyes])
+
+if test x"$enable_gtk_doc" = xyes && test x"$enable_gtk" '!=' xyes; then
+        AC_MSG_ERROR([
+
+        GTK+ widgets support must be enabled to build API documentation.
+        Please append --enable-gtk to configure.
+
+        ])
+fi
 
 AM_CPPFLAGS="$AM_CPPFLAGS $DEPRECATION_FLAGS"
 AM_CFLAGS="$AM_CFLAGS $WARN_CFLAGS $MORE_WARN_FLAGS"
@@ -69,7 +95,8 @@ AC_CHECK_FUNCS([getgrnam getpwnam link mkfifo mknod stat])
 AC_CONFIG_FILES([Makefile
                  docs/Makefile
                  docs/reference/Makefile
-                 gnome-autoar/gnome-autoar.pc])
+                 gnome-autoar/gnome-autoar.pc
+                 gnome-autoar/gnome-autoar-gtk.pc])
 AS_MKDIR_P([data])
 AC_OUTPUT
 
@@ -80,4 +107,9 @@ Configuration:
         Prefix                  : ${prefix}
         Compiler                : ${CC}
         CFLAGS                  : ${CFLAGS}
+
+Optional features:
+
+        Build API documentation : ${enable_gtk_doc}
+        GTK+ widgets            : ${enable_gtk}
 "
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index 3f83fa7..f2e4903 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -15,6 +15,7 @@ CFILE_GLOB=$(top_srcdir)/gnome-autoar/*.c
 
 IGNORE_HFILES = \
        autoar.h \
+       autoar-gtk.h \
        autoar-enum-types.h \
        $(NULL)
 
diff --git a/docs/reference/gnome-autoar-docs.xml b/docs/reference/gnome-autoar-docs.xml
index 2ffff02..ead4aa4 100644
--- a/docs/reference/gnome-autoar-docs.xml
+++ b/docs/reference/gnome-autoar-docs.xml
@@ -23,9 +23,12 @@
   <chapter>
     <title>gnome-autoar Utilities</title>
     <xi:include href="xml/autoar-format-filter.xml"/>
-    <xi:include href="xml/autoar-gtk.xml"/>
     <xi:include href="xml/autoar-common.xml"/>
   </chapter>
+  <chapter>
+    <title>gnome-autoar GTK+ Widgets</title>
+    <xi:include href="xml/autoar-gtk-chooser.xml"/>
+  </chapter>
 
   <chapter id="object-tree">
     <title>Object Hierarchy</title>
diff --git a/gnome-autoar/autoar-gtk.c b/gnome-autoar/autoar-gtk-chooser.c
similarity index 91%
rename from gnome-autoar/autoar-gtk.c
rename to gnome-autoar/autoar-gtk-chooser.c
index 939bd24..67e51be 100644
--- a/gnome-autoar/autoar-gtk.c
+++ b/gnome-autoar/autoar-gtk-chooser.c
@@ -1,10 +1,10 @@
 /* vim: set sw=2 ts=2 sts=2 et: */
 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
- * autoar-gtk.c
- * GTK+ user interfaces related to archives
+ * autoar-gtk-chooser.c
+ * GTK+ widgets to choose archive format and filter
  *
- * Copyright (C) 2013  Ting-Wei Lan
+ * Copyright (C) 2013, 2014  Ting-Wei Lan
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,7 +25,7 @@
 
 #include "config.h"
 
-#include "autoar-gtk.h"
+#include "autoar-gtk-chooser.h"
 
 #include <glib.h>
 #include <glib/gi18n.h>
@@ -33,16 +33,16 @@
 
 
 /**
- * SECTION:autoar-gtk
- * @Short_description: GTK+ widgets for integrating archives into applications
- * @Title: autoar-gtk
- * @Include: gnome-autoar/autoar.h
+ * SECTION:autoar-gtk-chooser
+ * @Short_description: GTK+ widgets to choose archive format and filter
+ * @Title: autoar-gtk-chooser
+ * @Include: gnome-autoar/autoar-gtk.h
  *
- * autoar-gtk is a collection of widgets providing user interfaces related
- * to archive integration in applications.
+ * autoar-gtk-chooser contains two widgets for users to choose preferred
+ * archive format and filter.
  **/
 
-/* autoar_gtk_format_filter_simple */
+/* autoar_gtk_chooser_simple */
 
 enum
 {
@@ -210,7 +210,7 @@ simple_changed_cb (GtkComboBox *simple,
     gtk_dialog_set_default_response (dialog, GTK_RESPONSE_ACCEPT);
 
     dialog_content = gtk_dialog_get_content_area (dialog);
-    advanced_widget = autoar_gtk_format_filter_advanced_new (previous[0],
+    advanced_widget = autoar_gtk_chooser_advanced_new (previous[0],
                                                              previous[1]);
     gtk_container_add (GTK_CONTAINER (dialog_content), advanced_widget);
     gtk_widget_show_all (dialog_widget);
@@ -218,7 +218,7 @@ simple_changed_cb (GtkComboBox *simple,
     response = gtk_dialog_run (dialog);
     if (response == GTK_RESPONSE_ACCEPT &&
         gtk_tree_model_iter_previous (model, &iter) &&
-        autoar_gtk_format_filter_advanced_get (advanced_widget, &format, &filter))
+        autoar_gtk_chooser_advanced_get (advanced_widget, &format, &filter))
       simple_set_active (simple, model, format, filter);
     else
       simple_set_active (simple, model, previous[0], previous[1]);
@@ -231,14 +231,14 @@ simple_changed_cb (GtkComboBox *simple,
 }
 
 /**
- * autoar_gtk_format_filter_simple_new:
+ * autoar_gtk_chooser_simple_new:
  * @default_format: an #AutoarFormat
  * @default_filter: an #AutoarFilter
  *
  * Create a #GtkComboBox with a list of common archive format. There is also
  * an option called "Other format…", which will use
- * autoar_gtk_format_filter_advanced_new() and
- * autoar_gtk_format_filter_advanced_get() to select less common archive
+ * autoar_gtk_chooser_advanced_new() and
+ * autoar_gtk_chooser_advanced_get() to select less common archive
  * format. Arguments @default_format and @default_filter are the default archive
  * format selected on the returned widget. You may want to get the preferred
  * format of users using autoar_pref_get_default_format() and
@@ -248,8 +248,8 @@ simple_changed_cb (GtkComboBox *simple,
  * Returns: (transfer full): a new #GtkComboBox widget
  **/
 GtkWidget*
-autoar_gtk_format_filter_simple_new (AutoarFormat default_format,
-                                     AutoarFilter default_filter)
+autoar_gtk_chooser_simple_new (AutoarFormat default_format,
+                               AutoarFilter default_filter)
 {
   GtkWidget *simple_widget;
   GtkComboBox *simple_combo;
@@ -328,21 +328,21 @@ autoar_gtk_format_filter_simple_new (AutoarFormat default_format,
 }
 
 /**
- * autoar_gtk_format_filter_simple_get:
- * @simple: a #GtkComboBox returned by autoar_gtk_format_filter_simple_new()
+ * autoar_gtk_chooser_simple_get:
+ * @simple: a #GtkComboBox returned by autoar_gtk_chooser_simple_new()
  * @format: the place to store the #AutoarFormat selected by the user
  * @filter: the place to store the #AutoarFilter selected by the user
  *
  * Gets the selected archive format of the widget created by
- * autoar_gtk_format_filter_simple_new().
+ * autoar_gtk_chooser_simple_new().
  *
  * Returns: %TRUE if @format and @filter are set. %FALSE if there is no
  * selected item on @simple, so @format and @filter are not modified.
  **/
 gboolean
-autoar_gtk_format_filter_simple_get (GtkWidget *simple,
-                                     int *format,
-                                     int *filter)
+autoar_gtk_chooser_simple_get (GtkWidget *simple,
+                               int *format,
+                               int *filter)
 {
   GtkComboBox *combo;
   GtkTreeModel *model;
@@ -359,7 +359,7 @@ autoar_gtk_format_filter_simple_get (GtkWidget *simple,
 }
 
 
-/* autoar_gtk_format_filter_advanced */
+/* autoar_gtk_chooser_advanced */
 
 enum
 {
@@ -384,7 +384,7 @@ advanced_update_description_cb (GtkTreeView *unused_variable,
   GtkLabel *description;
   char *description_string;
 
-  if (!autoar_gtk_format_filter_advanced_get (advanced, &format, &filter))
+  if (!autoar_gtk_chooser_advanced_get (advanced, &format, &filter))
     return;
 
   description = GTK_LABEL (gtk_grid_get_child_at (GTK_GRID (advanced), 0, 1));
@@ -438,7 +438,7 @@ advanced_filter_store (void)
 }
 
 /**
- * autoar_gtk_format_filter_advanced_new:
+ * autoar_gtk_chooser_advanced_new:
  * @default_format: an #AutoarFormat
  * @default_filter: an #AutoarFilter
  *
@@ -448,8 +448,8 @@ advanced_filter_store (void)
  * Returns: (transfer full): a new #GtkGrid widget
  **/
 GtkWidget*
-autoar_gtk_format_filter_advanced_new (AutoarFormat default_format,
-                                       AutoarFilter default_filter)
+autoar_gtk_chooser_advanced_new (AutoarFormat default_format,
+                                 AutoarFilter default_filter)
 {
   GtkWidget *advanced_widget;
   GtkGrid *advanced;
@@ -564,21 +564,21 @@ autoar_gtk_format_filter_advanced_new (AutoarFormat default_format,
 }
 
 /**
- * autoar_gtk_format_filter_advanced_get:
- * @advanced: a #GtkGrid returned by autoar_gtk_format_filter_advanced_new()
+ * autoar_gtk_chooser_advanced_get:
+ * @advanced: a #GtkGrid returned by autoar_gtk_chooser_advanced_new()
  * @format: the place to store the #AutoarFormat selected by the user
  * @filter: the place to store the #AutoarFilter selected by the user
  *
  * Gets the selected archive format of the widget created by
- * autoar_gtk_format_filter_advanced_new().
+ * autoar_gtk_chooser_advanced_new().
  *
  * Returns: %TRUE if @format and @filter are set. %FALSE if there is no
  * selected item on @advanced, so @format and @filter are not modified.
  **/
 gboolean
-autoar_gtk_format_filter_advanced_get (GtkWidget *advanced,
-                                       int *format,
-                                       int *filter)
+autoar_gtk_chooser_advanced_get (GtkWidget *advanced,
+                                 int *format,
+                                 int *filter)
 {
   GtkGrid *grid;
   GtkTreeIter format_iter, filter_iter;
diff --git a/gnome-autoar/autoar-gtk-chooser.h b/gnome-autoar/autoar-gtk-chooser.h
new file mode 100644
index 0000000..55099b8
--- /dev/null
+++ b/gnome-autoar/autoar-gtk-chooser.h
@@ -0,0 +1,49 @@
+/* vim: set sw=2 ts=2 sts=2 et: */
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * autoar-gtk-chooser.h
+ * GTK+ widgets to choose archive format and filter
+ *
+ * Copyright (C) 2013, 2014  Ting-Wei Lan
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ *
+ */
+
+#ifndef AUTOAR_GTK_CHOOSER_H
+#define AUTOAR_GTK_CHOOSER_H
+
+#include <gtk/gtk.h>
+
+#include "autoar-format-filter.h"
+
+G_BEGIN_DECLS
+
+GtkWidget *autoar_gtk_chooser_simple_new          (AutoarFormat default_format,
+                                                   AutoarFilter default_filter);
+gboolean   autoar_gtk_chooser_simple_get          (GtkWidget *simple,
+                                                   int *format,
+                                                   int *filter);
+
+GtkWidget *autoar_gtk_chooser_advanced_new        (AutoarFormat default_format,
+                                                   AutoarFilter default_filter);
+gboolean   autoar_gtk_chooser_advanced_get        (GtkWidget *advanced,
+                                                   int *format,
+                                                   int *filter);
+
+G_END_DECLS
+
+#endif /* AUTOAR_GTK_H */
diff --git a/gnome-autoar/autoar-gtk.h b/gnome-autoar/autoar-gtk.h
index 3df1ae0..0415b44 100644
--- a/gnome-autoar/autoar-gtk.h
+++ b/gnome-autoar/autoar-gtk.h
@@ -1,10 +1,10 @@
 /* vim: set sw=2 ts=2 sts=2 et: */
 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
- * autoar-gtk.h
- * GTK+ user interfaces related to archives
+ * autoar-extract.h
+ * Automatically extract archives in some GNOME programs
  *
- * Copyright (C) 2013  Ting-Wei Lan
+ * Copyright (C) 2013, 2014  Ting-Wei Lan
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,27 +23,9 @@
  *
  */
 
-#ifndef AUTOAR_GTK_H
-#define AUTOAR_GTK_H
+#ifndef AUTOARCHIVE_GTK_H
+#define AUTOARHICVE_GTK_H
 
-#include <gtk/gtk.h>
+#include <gnome-autoar/autoar-gtk-chooser.h>
 
-#include "autoar-format-filter.h"
-
-G_BEGIN_DECLS
-
-GtkWidget *autoar_gtk_format_filter_simple_new    (AutoarFormat default_format,
-                                                   AutoarFilter default_filter);
-gboolean   autoar_gtk_format_filter_simple_get    (GtkWidget *simple,
-                                                   int *format,
-                                                   int *filter);
-
-GtkWidget *autoar_gtk_format_filter_advanced_new  (AutoarFormat default_format,
-                                                   AutoarFilter default_filter);
-gboolean   autoar_gtk_format_filter_advanced_get  (GtkWidget *advanced,
-                                                   int *format,
-                                                   int *filter);
-
-G_END_DECLS
-
-#endif /* AUTOAR_GTK_H */
+#endif /* AUTOARCHIVE_GTK_H */
diff --git a/gnome-autoar/autoar.h b/gnome-autoar/autoar.h
index ed5f509..2556546 100644
--- a/gnome-autoar/autoar.h
+++ b/gnome-autoar/autoar.h
@@ -1,10 +1,7 @@
 /* vim: set sw=2 ts=2 sts=2 et: */
 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
- * autoar-extract.h
- * Automatically extract archives in some GNOME programs
- *
- * Copyright (C) 2013  Ting-Wei Lan
+ * Copyright (C) 2013, 2014  Ting-Wei Lan
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -30,7 +27,6 @@
 #include <gnome-autoar/autoar-create.h>
 #include <gnome-autoar/autoar-format-filter.h>
 #include <gnome-autoar/autoar-extract.h>
-#include <gnome-autoar/autoar-gtk.h>
 #include <gnome-autoar/autoar-pref.h>
 
 #endif /* AUTOARCHIVE_H */
diff --git a/gnome-autoar/gnome-autoar-gtk.pc.in b/gnome-autoar/gnome-autoar-gtk.pc.in
new file mode 100644
index 0000000..1737592
--- /dev/null
+++ b/gnome-autoar/gnome-autoar-gtk.pc.in
@@ -0,0 +1,11 @@
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+includedir= includedir@
+
+Name: gnome-autoar
+Description: GTK+ widgets for gnome-autoar library
+Version: @VERSION@
+Requires: gtk+-3.0
+Libs: -L${libdir} -lgnome-autoar-gtk
+Cflags: -I${includedir}
diff --git a/gnome-autoar/gnome-autoar.pc.in b/gnome-autoar/gnome-autoar.pc.in
index 61a4f18..6d61605 100644
--- a/gnome-autoar/gnome-autoar.pc.in
+++ b/gnome-autoar/gnome-autoar.pc.in
@@ -6,6 +6,6 @@ includedir= includedir@
 Name: gnome-autoar
 Description: Archives integration support for GNOME
 Version: @VERSION@
-Requires: glib-2.0 gio-2.0 gobject-2.0 gtk+-3.0 libarchive
+Requires: gio-2.0 gobject-2.0 glib-2.0 libarchive
 Libs: -L${libdir} -lgnome-autoar
 Cflags: -I${includedir}
diff --git a/tests/test-ui.c b/tests/test-ui.c
index 16c9edb..fd37df0 100644
--- a/tests/test-ui.c
+++ b/tests/test-ui.c
@@ -1,6 +1,7 @@
 /* vim: set sw=2 ts=2 sts=2 et: */
 
 #include <gnome-autoar/autoar.h>
+#include <gnome-autoar/autoar-gtk.h>
 #include <gtk/gtk.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -14,7 +15,7 @@ before_deleted (GtkWindow *window,
   int filter;
   char *str;
 
-  autoar_gtk_format_filter_simple_get (simple, &format, &filter);
+  autoar_gtk_chooser_simple_get (simple, &format, &filter);
   if (!format || !filter) {
     GtkWidget *warning;
     warning = gtk_message_dialog_new (window,
@@ -53,7 +54,7 @@ main (int argc,
   format = (argc >= 2) ? atoi (argv[1]) : 0;
   filter = (argc >= 3) ? atoi (argv[2]) : 0;
 
-  simple = autoar_gtk_format_filter_simple_new (format, filter);
+  simple = autoar_gtk_chooser_simple_new (format, filter);
   gtk_container_add (GTK_CONTAINER (window), simple);
   g_signal_connect (window, "delete-event", G_CALLBACK (before_deleted), simple);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]