forked from AuroraMiddleware/gtk
Merge branch 'wip/chergert/inspector-im-module' into 'main'
inspector: add im-module Closes #4512 See merge request GNOME/gtk!4214
This commit is contained in:
commit
02579a1333
@ -33,6 +33,7 @@
|
||||
#include "gtkbox.h"
|
||||
#include "gtkbinlayout.h"
|
||||
#include "gtkmediafileprivate.h"
|
||||
#include "gtkimmoduleprivate.h"
|
||||
|
||||
#include "gdk/gdkdebug.h"
|
||||
|
||||
@ -87,6 +88,7 @@ struct _GtkInspectorGeneral
|
||||
GtkWidget *gsk_renderer;
|
||||
GtkWidget *pango_fontmap;
|
||||
GtkWidget *media_backend;
|
||||
GtkWidget *im_module;
|
||||
GtkWidget *gl_version;
|
||||
GtkWidget *gl_error;
|
||||
GtkWidget *gl_error_row;
|
||||
@ -742,6 +744,42 @@ init_media (GtkInspectorGeneral *gen)
|
||||
gtk_label_set_label (GTK_LABEL (gen->media_backend), name);
|
||||
}
|
||||
|
||||
static void
|
||||
im_module_changed (GtkSettings *settings,
|
||||
GParamSpec *pspec,
|
||||
GtkInspectorGeneral *gen)
|
||||
{
|
||||
if (!gen->display)
|
||||
return;
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (gen->im_module),
|
||||
_gtk_im_module_get_default_context_id (gen->display));
|
||||
}
|
||||
|
||||
static void
|
||||
init_im_module (GtkInspectorGeneral *gen)
|
||||
{
|
||||
GtkSettings *settings = gtk_settings_get_for_display (gen->display);
|
||||
const char *default_context_id = _gtk_im_module_get_default_context_id (gen->display);
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (gen->im_module), default_context_id);
|
||||
|
||||
if (g_getenv ("GTK_IM_MODULE") != NULL)
|
||||
{
|
||||
/* This can't update if GTK_IM_MODULE envvar is set */
|
||||
gtk_widget_set_tooltip_text (gen->im_module,
|
||||
_("IM Context is hardcoded by GTK_IM_MODULE"));
|
||||
gtk_widget_set_sensitive (gen->im_module, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
g_signal_connect_object (settings,
|
||||
"notify::gtk-im-module",
|
||||
G_CALLBACK (im_module_changed),
|
||||
gen, 0);
|
||||
}
|
||||
|
||||
|
||||
static void populate_seats (GtkInspectorGeneral *gen);
|
||||
|
||||
static void
|
||||
@ -1065,6 +1103,7 @@ gtk_inspector_general_class_init (GtkInspectorGeneralClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gsk_renderer);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, pango_fontmap);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, media_backend);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, im_module);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gl_version);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gl_error);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gl_error_row);
|
||||
@ -1103,6 +1142,7 @@ gtk_inspector_general_set_display (GtkInspectorGeneral *gen,
|
||||
init_gl (gen);
|
||||
init_vulkan (gen);
|
||||
init_device (gen);
|
||||
init_im_module (gen);
|
||||
}
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -151,6 +151,32 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="input_method_label">
|
||||
<property name="label" translatable="yes">Input Method</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="im_module">
|
||||
<property name="selectable">1</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user