forked from AuroraMiddleware/gtk
Merge branch 'wip/exalm/inspector' into 'main'
inspector: Register extension on startup See merge request GNOME/gtk!4296
This commit is contained in:
commit
aa19194f7b
@ -68,6 +68,7 @@
|
||||
#include "gtknative.h"
|
||||
#include "gtkpopcountprivate.h"
|
||||
|
||||
#include "inspector/init.h"
|
||||
#include "inspector/window.h"
|
||||
|
||||
#include "gdk/gdkeventsprivate.h"
|
||||
@ -566,6 +567,8 @@ do_post_parse_initialization (void)
|
||||
g_signal_connect (display_manager, "notify::default-display",
|
||||
G_CALLBACK (default_display_notify_cb),
|
||||
NULL);
|
||||
|
||||
gtk_inspector_register_extension ();
|
||||
}
|
||||
|
||||
#ifdef G_PLATFORM_WIN32
|
||||
|
@ -55,10 +55,14 @@
|
||||
|
||||
#include "gtkmodulesprivate.h"
|
||||
|
||||
static GIOExtensionPoint *extension_point = NULL;
|
||||
|
||||
void
|
||||
gtk_inspector_init (void)
|
||||
{
|
||||
static GIOExtensionPoint *extension_point = NULL;
|
||||
GIOModuleScope *scope;
|
||||
char **paths;
|
||||
int i;
|
||||
|
||||
g_type_ensure (G_TYPE_LIST_STORE);
|
||||
|
||||
@ -89,26 +93,25 @@ gtk_inspector_init (void)
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_VISUAL);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_WINDOW);
|
||||
|
||||
if (extension_point == NULL)
|
||||
{
|
||||
GIOModuleScope *scope;
|
||||
char **paths;
|
||||
int i;
|
||||
paths = _gtk_get_module_path ("inspector");
|
||||
scope = g_io_module_scope_new (G_IO_MODULE_SCOPE_BLOCK_DUPLICATES);
|
||||
|
||||
extension_point = g_io_extension_point_register ("gtk-inspector-page");
|
||||
g_io_extension_point_set_required_type (extension_point, GTK_TYPE_WIDGET);
|
||||
for (i = 0; paths[i] != NULL; i++)
|
||||
g_io_modules_load_all_in_directory_with_scope (paths[i], scope);
|
||||
|
||||
paths = _gtk_get_module_path ("inspector");
|
||||
scope = g_io_module_scope_new (G_IO_MODULE_SCOPE_BLOCK_DUPLICATES);
|
||||
|
||||
for (i = 0; paths[i] != NULL; i++)
|
||||
g_io_modules_load_all_in_directory_with_scope (paths[i], scope);
|
||||
|
||||
g_strfreev (paths);
|
||||
g_io_module_scope_free (scope);
|
||||
}
|
||||
g_strfreev (paths);
|
||||
g_io_module_scope_free (scope);
|
||||
|
||||
gtk_css_provider_set_keep_css_sections ();
|
||||
}
|
||||
|
||||
void
|
||||
gtk_inspector_register_extension (void)
|
||||
{
|
||||
if (extension_point == NULL) {
|
||||
extension_point = g_io_extension_point_register ("gtk-inspector-page");
|
||||
g_io_extension_point_set_required_type (extension_point, GTK_TYPE_WIDGET);
|
||||
}
|
||||
}
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -18,12 +18,10 @@
|
||||
#ifndef _GTK_INSPECTOR_INIT_H_
|
||||
#define _GTK_INSPECTOR_INIT_H_
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_inspector_init (void);
|
||||
void gtk_inspector_init (void);
|
||||
void gtk_inspector_register_extension (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user