[gtk] Avoid warnings
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] Avoid warnings
- Date: Fri, 9 Mar 2018 07:15:01 +0000 (UTC)
commit e0771a54a2102c80750beba2e643310118e98963
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Mar 9 02:13:13 2018 -0500
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.
gtk/gtkimcontextbroadway.c | 3 ++-
gtk/gtkimcontextime.c | 2 ++
gtk/gtkimcontextquartz.c | 3 ++-
gtk/gtkimcontextsimple.c | 3 ++-
gtk/gtkimcontextwayland.c | 3 ++-
gtk/gtkimcontextxim.c | 3 ++-
gtk/gtkimmodule.c | 23 +++++++++++++++++++----
gtk/gtkimmoduleprivate.h | 4 +++-
8 files changed, 34 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkimcontextbroadway.c b/gtk/gtkimcontextbroadway.c
index e8e459ada2..5ad2010125 100644
--- a/gtk/gtkimcontextbroadway.c
+++ b/gtk/gtkimcontextbroadway.c
@@ -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",
diff --git a/gtk/gtkimcontextime.c b/gtk/gtkimcontextime.c
index 7ba1483c29..146cc129db 100644
--- a/gtk/gtkimcontextime.c
+++ b/gtk/gtkimcontextime.c
@@ -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",
diff --git a/gtk/gtkimcontextquartz.c b/gtk/gtkimcontextquartz.c
index 2c950fc860..14637de186 100644
--- a/gtk/gtkimcontextquartz.c
+++ b/gtk/gtkimcontextquartz.c
@@ -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",
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 38ec5f24c2..fe11e7c332 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -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",
diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c
index be1159b094..af195581c8 100644
--- a/gtk/gtkimcontextwayland.c
+++ b/gtk/gtkimcontextwayland.c
@@ -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",
diff --git a/gtk/gtkimcontextxim.c b/gtk/gtkimcontextxim.c
index caaaf03280..23c4f0f7b3 100644
--- a/gtk/gtkimcontextxim.c
+++ b/gtk/gtkimcontextxim.c
@@ -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",
diff --git a/gtk/gtkimmodule.c b/gtk/gtkimmodule.c
index 5e45bd8cfb..0c99553423 100644
--- a/gtk/gtkimmodule.c
+++ b/gtk/gtkimmodule.c
@@ -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)
{
diff --git a/gtk/gtkimmoduleprivate.h b/gtk/gtkimmoduleprivate.h
index 8fcc013dc0..ed469891d0 100644
--- a/gtk/gtkimmoduleprivate.h
+++ b/gtk/gtkimmoduleprivate.h
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]