Avoid warnings

When generating introspection data, we instantiate types without
calling gtk_init, so make sure that extension points are registered
before the type is trying to implement them.
This commit is contained in:
Matthias Clasen 2018-03-09 02:13:13 -05:00
parent 01fda3b85e
commit e0771a54a2
8 changed files with 34 additions and 10 deletions

View File

@ -23,7 +23,7 @@
#include "gtk/gtkimcontextbroadway.h"
#include "gtk/gtkintl.h"
#include "gtk/gtkimmodule.h"
#include "gtk/gtkimmoduleprivate.h"
#include "gdk/broadway/gdkbroadway.h"
@ -43,6 +43,7 @@ typedef struct _GtkIMContextBroadwayClass
} GtkIMContextBroadwayClass;
G_DEFINE_TYPE_WITH_CODE (GtkIMContextBroadway, gtk_im_context_broadway, GTK_TYPE_IM_CONTEXT_SIMPLE,
gtk_im_module_ensure_extension_point ();
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
g_define_type_id,
"broadway",

View File

@ -28,6 +28,7 @@
#endif
#include "gtkimcontextime.h"
#include "gtkimmoduleprivate.h"
#include "imm-extra.h"
@ -129,6 +130,7 @@ static void cb_client_widget_hierarchy_changed (GtkWidget *widget,
#define GTK_IM_CONTEXT_IME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IM_CONTEXT_IME, GtkIMContextIME))
G_DEFINE_TYPE_WITH_CODE (GtkIMContextIME, gtk_im_context_ime, GTK_TYPE_IM_CONTEXT,
gtk_im_module_ensure_extension_point ();
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
g_define_type_id,
"ime",

View File

@ -23,7 +23,7 @@
#include "gtk/gtkimcontextquartz.h"
#include "gtk/gtkintl.h"
#include "gtk/gtkimmodule.h"
#include "gtk/gtkimmoduleprivate.h"
#include "gdk/quartz/gdkquartz.h"
#include "gdk/quartz/GdkQuartzView.h"
@ -51,6 +51,7 @@ typedef struct _GtkIMContextQuartzClass
} GtkIMContextQuartzClass;
G_DEFINE_TYPE_WITH_CODE (GtkIMContextQuartz, gtk_im_context_quartz, GTK_TYPE_IM_CONTEXT,
gtk_im_module_ensure_extension_point ();
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
g_define_type_id,
"quartz",

View File

@ -40,7 +40,7 @@
#include "gtkdebug.h"
#include "gtkintl.h"
#include "gtkcomposetable.h"
#include "gtkimmodule.h"
#include "gtkimmoduleprivate.h"
#include "gtkimcontextsimpleprivate.h"
#include "gtkimcontextsimpleseqs.h"
@ -167,6 +167,7 @@ static void gtk_im_context_simple_set_client_widget (GtkIMContext
G_DEFINE_TYPE_WITH_CODE (GtkIMContextSimple, gtk_im_context_simple, GTK_TYPE_IM_CONTEXT,
G_ADD_PRIVATE (GtkIMContextSimple)
gtk_im_module_ensure_extension_point ();
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
g_define_type_id,
"gtk-im-context-simple",

View File

@ -22,7 +22,7 @@
#include "gtk/gtkimcontextwayland.h"
#include "gtk/gtkintl.h"
#include "gtk/gtkimmodule.h"
#include "gtk/gtkimmoduleprivate.h"
#include "gdk/wayland/gdkwayland.h"
#include "gtk-text-input-client-protocol.h"
@ -71,6 +71,7 @@ struct _GtkIMContextWayland
};
G_DEFINE_TYPE_WITH_CODE (GtkIMContextWayland, gtk_im_context_wayland, GTK_TYPE_IM_CONTEXT_SIMPLE,
gtk_im_module_ensure_extension_point ();
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
g_define_type_id,
"wayland",

View File

@ -21,7 +21,7 @@
#include <stdlib.h>
#include "gtkimcontextxim.h"
#include "gtkimmodule.h"
#include "gtkimmoduleprivate.h"
#include "gtk/gtkintl.h"
@ -145,6 +145,7 @@ static void xim_info_display_closed (GdkDisplay *display,
GtkXIMInfo *info);
G_DEFINE_TYPE_WITH_CODE (GtkIMContextXIM, gtk_im_context_xim, GTK_TYPE_IM_CONTEXT,
gtk_im_module_ensure_extension_point ();
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
g_define_type_id,
"xim",

View File

@ -237,12 +237,13 @@ _gtk_im_module_get_default_context_id (void)
}
void
gtk_im_modules_init (void)
gtk_im_module_ensure_extension_point (void)
{
GIOExtensionPoint *ep;
GIOModuleScope *scope;
char **paths;
int i;
static gboolean registered = FALSE;
if (registered)
return;
GTK_NOTE (MODULES,
g_print ("Registering extension point %s\n", GTK_IM_MODULE_EXTENSION_POINT_NAME));
@ -250,6 +251,18 @@ gtk_im_modules_init (void)
ep = g_io_extension_point_register (GTK_IM_MODULE_EXTENSION_POINT_NAME);
g_io_extension_point_set_required_type (ep, GTK_TYPE_IM_CONTEXT);
registered = TRUE;
}
void
gtk_im_modules_init (void)
{
GIOModuleScope *scope;
char **paths;
int i;
gtk_im_module_ensure_extension_point ();
g_type_ensure (gtk_im_context_simple_get_type ());
#ifdef GDK_WINDOWING_X11
g_type_ensure (gtk_im_context_xim_get_type ());
@ -282,8 +295,10 @@ gtk_im_modules_init (void)
if (GTK_DEBUG_CHECK (MODULES))
{
GIOExtensionPoint *ep;
GList *list, *l;
ep = g_io_extension_point_lookup (GTK_IM_MODULE_EXTENSION_POINT_NAME);
list = g_io_extension_point_get_extensions (ep);
for (l = list; l; l = l->next)
{

View File

@ -20,10 +20,12 @@
#include <gdk/gdk.h>
#include "gtkimcontext.h"
#include "gtkimmodule.h"
G_BEGIN_DECLS
GtkIMContext * _gtk_im_module_create (const gchar *context_id);
void gtk_im_module_ensure_extension_point (void);
GtkIMContext * _gtk_im_module_create (const char *context_id);
const gchar * _gtk_im_module_get_default_context_id (void);
G_END_DECLS