[file-roller/wip/jtojnar/gtk4: 7/8] Add support for introspection
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller/wip/jtojnar/gtk4: 7/8] Add support for introspection
- Date: Tue, 21 Dec 2021 06:55:26 +0000 (UTC)
commit 9d3e64663359e499dc9edd2cc39f75464c96a584
Author: Jan Tojnar <jtojnar gmail com>
Date: Tue Dec 21 02:46:29 2021 +0100
Add support for introspection
It is required for Tartan to properly analyze our types.
meson.build | 5 ++++
src/fr-application.c | 24 ++++++++++++++++++++
src/meson.build | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 92 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index dd2ed956..06b7ad23 100644
--- a/meson.build
+++ b/meson.build
@@ -31,6 +31,8 @@ gthread_dep = dependency('gthread-2.0')
gtk_dep = dependency('gtk+-3.0', version : gtk_version)
# Optional dependencies
+gobject_introspection_dep = dependency('gobject-introspection-1.0', required : false)
+use_gobject_introspection = gobject_introspection_dep.found()
libnautilus_extension_dep = dependency('libnautilus-extension', version : nautilus_version, required :
get_option('nautilus-actions'))
build_nautilus_actions = libnautilus_extension_dep.found()
@@ -73,6 +75,9 @@ else
config_data.set_quoted('UIDIR', join_paths(datadir, meson.project_name(), 'ui'))
config_data.set_quoted('SHDIR', join_paths(prefix, get_option('libexecdir'), meson.project_name()))
endif
+if use_gobject_introspection
+ config_data.set('ENABLE_INTROSPECTION', 1)
+endif
if use_json_glib
config_data.set('HAVE_JSON_GLIB', 1)
endif
diff --git a/src/fr-application.c b/src/fr-application.c
index 573fac4a..d9c49256 100644
--- a/src/fr-application.c
+++ b/src/fr-application.c
@@ -31,6 +31,9 @@
#ifdef ENABLE_NOTIFICATION
# include <libnotify/notify.h>
#endif
+#ifdef ENABLE_INTROSPECTION
+# include <girepository.h>
+#endif
#include "file-utils.h"
#include "fr-application.h"
#include "fr-application-menu.h"
@@ -54,6 +57,9 @@ static gboolean arg_version = FALSE;
static gboolean arg_service = FALSE;
static gboolean arg_notify = FALSE;
static const char *program_argv0 = NULL; /* argv[0] from main(); used as the command to restart the program
*/
+#ifdef ENABLE_INTROSPECTION
+static char *introspection_dump = NULL;
+#endif
static const GOptionEntry options[] = {
@@ -94,6 +100,12 @@ static const GOptionEntry options[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &arg_version,
N_("Show version"), NULL },
+#ifdef ENABLE_INTROSPECTION
+ { "introspect-dump", '\0', 0, G_OPTION_ARG_STRING, &introspection_dump,
+ N_("Dump gobject introspection file"),
+ N_("input.txt,output.xml") },
+#endif
+
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining_args,
NULL,
NULL },
@@ -548,6 +560,18 @@ fr_application_command_line (GApplication *application,
g_strfreev (argv);
g_option_context_free (context);
+#ifdef ENABLE_INTROSPECTION
+ if (introspection_dump) {
+ if (!g_irepository_dump (introspection_dump, &error)) {
+ g_critical ("Failed to dump introspection data: %s", error->message);
+ g_error_free (error);
+ return fr_application_command_line_finished (application, EXIT_FAILURE);
+ }
+
+ return fr_application_command_line_finished (application, EXIT_SUCCESS);
+ }
+#endif
+
if (remaining_args == NULL) { /* No archive specified. */
if (! arg_service)
gtk_widget_show (fr_window_new ());
diff --git a/src/meson.build b/src/meson.build
index 8083aacc..2eb4a95f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -56,11 +56,50 @@ source_files = files(
'preferences.c',
'rar-utils.c'
)
+
+fr_headers = files(
+ 'fr-application-menu.h',
+ 'fr-application.h',
+ 'fr-archive.h',
+ 'fr-command-7z.h',
+ 'fr-command-ace.h',
+ 'fr-command-alz.h',
+ 'fr-command-ar.h',
+ 'fr-command-arj.h',
+ 'fr-command-cfile.h',
+ 'fr-command-cpio.h',
+ 'fr-command-dpkg.h',
+ 'fr-command-iso.h',
+ 'fr-command-jar.h',
+ 'fr-command-lha.h',
+ 'fr-command-lrzip.h',
+ 'fr-command-rar.h',
+ 'fr-command-rpm.h',
+ 'fr-command-tar.h',
+ 'fr-command-unsquashfs.h',
+ 'fr-command-unstuff.h',
+ 'fr-command-zip.h',
+ 'fr-command-zoo.h',
+ 'fr-command.h',
+ 'fr-error.h',
+ 'fr-file-selector-dialog.h',
+ 'fr-init.h',
+ 'fr-list-model.h',
+ 'fr-location-bar.h',
+ 'fr-new-archive-dialog.h',
+ 'fr-process.h',
+ 'fr-window-actions-callbacks.h',
+ 'fr-window-actions-entries.h',
+ 'fr-window.h',
+)
+
if libjson_glib_dep.found()
source_files += [ 'fr-command-unarchiver.c' ]
+ fr_headers += [ 'fr-command-unarchiver.h' ]
endif
if use_libarchive
source_files += [ 'fr-archive-libarchive.c' ]
+ fr_headers += [ 'fr-archive-libarchive.h' ]
endif
if not have_mkdtemp
source_files += [ 'mkdtemp.c' ]
@@ -76,7 +115,7 @@ enum_files = gnome.mkenums_simple('fr-enum-types',
# Build targets
-executable('file-roller',
+fr_exe = executable('file-roller',
sources : [
config_file,
source_files,
@@ -90,15 +129,38 @@ executable('file-roller',
glib_dep,
gthread_dep,
gtk_dep,
+ use_gobject_introspection ? gobject_introspection_dep : [],
use_json_glib ? libjson_glib_dep : [],
use_libnotify ? libnotify_dep : [],
use_libarchive ? libarchive_dep : []
],
+ link_args: [
+ # Required for GIRepository to be able to dump symbols.
+ use_gobject_introspection ? '-Wl,--export-dynamic' : [],
+ ],
include_directories : config_inc,
c_args : c_args,
install : true
)
+if use_gobject_introspection
+ fr_gir = gnome.generate_gir(
+ fr_exe,
+ sources: [
+ source_files,
+ fr_headers,
+ ],
+ namespace: 'FileRoller',
+ nsversion: '1.0',
+ identifier_prefix: 'Fr',
+ includes : [
+ 'Gio-2.0',
+ 'GObject-2.0',
+ 'Gtk-3.0',
+ ],
+ )
+endif
+
executable('test-server', 'test-server.c',
dependencies : [
libm_dep,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]