inspector: stop being a module

Moving the inspector into libgtk lets use reuse internals without
having to add public API for everything or inventing awkward private
call conventions.

https://bugzilla.gnome.org/show_bug.cgi?id=730095
This commit is contained in:
Matthias Clasen 2014-05-14 21:23:44 -04:00
parent 53b37b8f71
commit 59c9d24bbf
50 changed files with 162 additions and 138 deletions

View File

@ -1887,6 +1887,7 @@ gtk/makefile.msc
gtk/gtkversion.h
gtk/gtk-win32.rc
gtk/a11y/Makefile
gtk/inspector/Makefile
gtk/native/Makefile
libgail-util/Makefile
modules/Makefile
@ -1898,7 +1899,6 @@ modules/printbackends/lpr/Makefile
modules/printbackends/file/Makefile
modules/printbackends/papi/Makefile
modules/printbackends/test/Makefile
modules/inspector/Makefile
])
AC_OUTPUT

View File

@ -18,7 +18,7 @@ else
GTK_PRINT_PREVIEW_COMMAND="evince --unlink-tempfile --preview --print-settings %s %f"
endif
SUBDIRS = a11y native .
SUBDIRS = a11y inspector native .
if HAVE_CLOUDPRINT
if HAVE_PAPI_CUPS
@ -117,11 +117,13 @@ libgtkincludedir = $(includedir)/gtk-3.0/gtk
libadd = \
$(top_builddir)/gdk/libgdk-3.la \
$(top_builddir)/gtk/a11y/libgtka11y.la \
$(top_builddir)/gtk/inspector/libgtkinspector.la \
$(GMODULE_LIBS) \
$(GTK_DEP_LIBS)
deps = \
$(top_builddir)/gdk/libgdk-3.la \
$(top_builddir)/gtk/a11y/libgtka11y.la
$(top_builddir)/gtk/a11y/libgtka11y.la \
$(top_builddir)/gtk/inspector/libgtkinspector.la
# libtool stuff: set version and export symbols for resolving
# since automake doesn't support conditionalized libsomething_la_LDFLAGS

View File

@ -59,7 +59,8 @@
#include "a11y/gtkwindowaccessible.h"
#include "a11y/gtkcontaineraccessibleprivate.h"
#include "gtkapplicationprivate.h"
#include "gtkmodulesprivate.h"
#include "inspector/init.h"
#include "inspector/window.h"
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
@ -12445,22 +12446,10 @@ static GtkWidget *inspector_window = NULL;
void
gtk_window_set_interactive_debugging (gboolean enable)
{
static GType type = G_TYPE_NONE;
if (type == G_TYPE_NONE)
{
_gtk_modules_load_module ("gtkinspector");
type = g_type_from_name ("GtkInspectorWindow");
if (type == G_TYPE_INVALID)
g_warning ("Failed to load GtkInspector module, debugging not available.");
}
if (!g_type_is_a (type, GTK_TYPE_WINDOW))
return;
if (inspector_window == NULL)
{
inspector_window = GTK_WIDGET (g_object_new (type, NULL));
gtk_inspector_init ();
inspector_window = gtk_inspector_window_new ();
g_signal_connect (inspector_window, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
}

106
gtk/inspector/Makefile.am Normal file
View File

@ -0,0 +1,106 @@
include $(top_srcdir)/Makefile.decl
noinst_LTLIBRARIES = libgtkinspector.la
resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/inspector.gresource.xml)
resources.h: inspector.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
--target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-header --manual-register
resources.c: inspector.gresource.xml $(resource_files) $(template_headers)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
--target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-source --manual-register
BUILT_SOURCES = \
resources.h \
resources.c
libgtkinspector_la_SOURCES = \
button-path.h \
button-path.c \
classes-list.h \
classes-list.c \
css-editor.h \
css-editor.c \
data-list.h \
data-list.c \
init.h \
init.c \
inspect-button.c \
object-hierarchy.h \
object-hierarchy.c \
prop-list.h \
prop-list.c \
property-cell-renderer.h \
property-cell-renderer.c \
python-hooks.h \
python-hooks.c \
python-shell.h \
python-shell.c \
resources.h \
resources.c \
signals-list.h \
signals-list.c \
themes.h \
themes.c \
visual.h \
visual.c \
widget-tree.h \
widget-tree.c \
window.h \
window.c
libgtkinspector_la_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/gtk \
-I$(top_builddir)/gtk \
-I$(top_srcdir)/gdk \
-I$(top_builddir)/gdk \
-DGTK_VERSION=\"$(GTK_VERSION)\"\
-DGTK_DATADIR=\"$(datadir)\" \
-DGTK_COMPILATION \
$(AM_CPPFLAGS)
libgtkinspector_la_CFLAGS = \
$(GDK_HIDDEN_VISIBILITY_CFLAGS) \
$(GTK_DEP_CFLAGS) \
$(GTK_DEBUG_FLAGS) \
$(AM_CFLAGS)
libgtkinspector_la_LIBADD = \
$(GTK_DEP_LIBS) \
$(INTLLIBS)
libgtkinspector_la_LDFLAGS = \
$(LDFLAGS)
templates = \
button-path.ui \
classes-list.ui \
css-editor.ui \
data-list.ui \
object-hierarchy.ui \
prop-list.ui \
signals-list.ui \
themes.ui \
visual.ui \
widget-tree.ui \
window.ui
template_headers = $(templates:.ui=.ui.h)
extract_strings = $(top_builddir)/gtk/extract-strings$(BUILD_EXEEXT)
%.ui.h: %.ui $(extract_strings)
$(AM_V_GEN) $(extract_strings) $< > $@
distclean-local:
if test $(srcdir) != .; then \
rm -f $(template_headers); \
fi
EXTRA_DIST += \
inspector.gresource.xml \
$(resource_files) \
$(templates)
-include $(top_srcdir)/git.mk

View File

@ -39,7 +39,7 @@
#include "window.h"
void
gtk_module_init (gint *argc, gchar ***argv)
gtk_inspector_init (void)
{
#ifdef ENABLE_PYTHON
gtk_inspector_python_init ();

29
gtk/inspector/init.h Normal file
View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2014 Red Hat, Inc.
*
* This library 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 library 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 library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _GTK_INSPECTOR_INIT_H_
#define _GTK_INSPECTOR_INIT_H_
G_BEGIN_DECLS
void gtk_inspector_init (void);
G_END_DECLS
#endif // _GTK_INSPECTOR_INIT_H_
// vim: set et sw=2 ts=2:

View File

@ -1,6 +1,6 @@
include $(top_srcdir)/Makefile.decl
SUBDIRS = input inspector
SUBDIRS = input
if OS_UNIX
SUBDIRS += printbackends

View File

@ -1,102 +0,0 @@
moduledir = $(libdir)/gtk-3.0/modules
module_LTLIBRARIES = libgtkinspector.la
resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/inspector.gresource.xml)
resources.h: inspector.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
--target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-header --manual-register
resources.c: inspector.gresource.xml $(resource_files) $(template_headers)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
--target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-source --manual-register
BUILT_SOURCES = \
resources.h \
resources.c
libgtkinspector_la_SOURCES = \
resources.h \
resources.c \
inspect-button.c \
module.c \
prop-list.h \
prop-list.c \
property-cell-renderer.h \
property-cell-renderer.c \
python-hooks.h \
python-hooks.c \
python-shell.h \
python-shell.c \
widget-tree.h \
widget-tree.c \
window.h \
window.c \
button-path.h \
button-path.c \
classes-list.h \
classes-list.c \
css-editor.h \
css-editor.c \
object-hierarchy.h \
object-hierarchy.c \
themes.h \
themes.c \
signals-list.h \
signals-list.c \
data-list.h \
data-list.c \
visual.h \
visual.c
libgtkinspector_la_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/gtk \
-I$(top_builddir)/gtk \
-I$(top_srcdir)/gdk \
-I$(top_builddir)/gdk \
-DGTK_DATADIR=\"$(datadir)\" \
-DGTK_COMPILATION \
$(GTK_DEP_CFLAGS) \
$(GTK_DEBUG_FLAGS)
if PLATFORM_WIN32
no_undefined = -no-undefined
endif
libgtkinspector_la_LDFLAGS = -avoid-version -module $(no_undefined)
libgtkinspector_la_LIBADD = \
$(top_builddir)/gtk/libgtk-3.la \
$(GTK_DEP_LIBS)
templates = \
button-path.ui \
classes-list.ui \
css-editor.ui \
data-list.ui \
object-hierarchy.ui \
prop-list.ui \
signals-list.ui \
themes.ui \
visual.ui \
widget-tree.ui \
window.ui
template_headers = $(templates:.ui=.ui.h)
extract_strings = $(top_builddir)/gtk/extract-strings$(BUILD_EXEEXT)
%.ui.h: %.ui $(extract_strings)
$(AM_V_GEN) $(extract_strings) $< > $@
distclean-local:
if test $(srcdir) != .; then \
rm -f $(template_headers); \
fi
EXTRA_DIST = \
inspector.gresource.xml \
$(resource_files) \
$(templates)
-include $(top_srcdir)/git.mk

View File

@ -268,6 +268,22 @@ gtk/gtkviewport.c
gtk/gtkvolumebutton.c
gtk/gtkwidget.c
gtk/gtkwindow.c
gtk/inspector/button-path.ui.h
gtk/inspector/classes-list.c
gtk/inspector/classes-list.ui.h
gtk/inspector/css-editor.c
gtk/inspector/css-editor.ui.h
gtk/inspector/data-list.ui.h
gtk/inspector/inspect-button.c
gtk/inspector/object-hierarchy.ui.h
gtk/inspector/prop-list.ui.h
gtk/inspector/signals-list.c
gtk/inspector/signals-list.ui.h
gtk/inspector/themes.ui.h
gtk/inspector/visual.ui.h
gtk/inspector/widget-tree.ui.h
gtk/inspector/window.c
gtk/inspector/window.ui.h
gtk/paper_names_offsets.c
gtk/updateiconcache.c
modules/input/gtkimcontextxim.c
@ -282,22 +298,6 @@ modules/input/imti-er.c
modules/input/imti-et.c
modules/input/imviqr.c
modules/input/imxim.c
modules/inspector/button-path.ui.h
modules/inspector/classes-list.c
modules/inspector/classes-list.ui.h
modules/inspector/css-editor.c
modules/inspector/css-editor.ui.h
modules/inspector/data-list.ui.h
modules/inspector/inspect-button.c
modules/inspector/object-hierarchy.ui.h
modules/inspector/prop-list.ui.h
modules/inspector/signals-list.c
modules/inspector/signals-list.ui.h
modules/inspector/themes.ui.h
modules/inspector/visual.ui.h
modules/inspector/widget-tree.ui.h
modules/inspector/window.c
modules/inspector/window.ui.h
modules/printbackends/cloudprint/gtkprintbackendcloudprint.c
modules/printbackends/cloudprint/gtkprintercloudprint.c
modules/printbackends/cups/gtkprintbackendcups.c