Commit 1029d0c6 authored by Rui Matos's avatar Rui Matos
Browse files

region: Don't show IBus sources in the system-wide input chooser

Since we can't export IBus sources through the localed API we
shouldn't even allow users to choose them.

This allows us to stop having to show an apologising dialog which
makes us look a bit bad and was using deprecated gtk+ API that we're
trying to get rid of. Instead, we show the same information up front,
in the input chooser.

https://bugzilla.gnome.org/show_bug.cgi?id=740986
parent 52c27cd6
......@@ -67,6 +67,8 @@ typedef struct {
gboolean showing_extra;
guint filter_timeout_id;
gchar **filter_words;
gboolean is_login;
} CcInputChooserPrivate;
#define GET_PRIVATE(chooser) ((CcInputChooserPrivate *) g_object_get_data (G_OBJECT (chooser), "private"))
......@@ -882,7 +884,7 @@ get_ibus_locale_infos (GtkWidget *chooser)
const gchar *engine_id;
IBusEngineDesc *engine;
if (!priv->ibus_engines)
if (!priv->ibus_engines || priv->is_login)
return;
g_hash_table_iter_init (&iter, priv->ibus_engines);
......@@ -1116,6 +1118,7 @@ cc_input_chooser_private_free (gpointer data)
GtkWidget *
cc_input_chooser_new (GtkWindow *main_window,
gboolean is_login,
GnomeXkbInfo *xkb_info,
GHashTable *ibus_engines)
{
......@@ -1138,6 +1141,7 @@ cc_input_chooser_new (GtkWindow *main_window,
g_object_set_data_full (G_OBJECT (chooser), "private", priv, cc_input_chooser_private_free);
g_object_set_data_full (G_OBJECT (chooser), "builder", builder, g_object_unref);
priv->is_login = is_login;
priv->xkb_info = xkb_info;
priv->ibus_engines = ibus_engines;
......@@ -1159,6 +1163,9 @@ cc_input_chooser_new (GtkWindow *main_window,
g_signal_connect_swapped (priv->filter_entry, "search-changed", G_CALLBACK (filter_changed), chooser);
if (priv->is_login)
gtk_widget_show (WID ("login-label"));
get_locale_infos (chooser);
#ifdef HAVE_IBUS
get_ibus_locale_infos (chooser);
......
......@@ -27,6 +27,7 @@
G_BEGIN_DECLS
GtkWidget *cc_input_chooser_new (GtkWindow *parent,
gboolean is_login,
GnomeXkbInfo *xkb_info,
GHashTable *ibus_engines);
void cc_input_chooser_set_ibus_engines (GtkWidget *chooser,
......
......@@ -1076,31 +1076,6 @@ update_input (CcRegionPanel *self)
}
}
static void
apologize_for_no_ibus_login (CcRegionPanel *self)
{
GtkWidget *dialog;
GtkWidget *toplevel;
GtkWidget *image;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel),
GTK_DIALOG_MODAL | GTK_DIALOG_USE_HEADER_BAR,
GTK_MESSAGE_OTHER,
GTK_BUTTONS_OK,
_("Sorry"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", _("Input methods can't be used on the login screen"));
image = gtk_image_new_from_icon_name ("face-sad-symbolic",
GTK_ICON_SIZE_DIALOG);
gtk_widget_show (image);
gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), image);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
static gboolean
input_source_already_added (CcRegionPanel *self,
const gchar *id)
......@@ -1124,7 +1099,6 @@ static void
input_response (GtkWidget *chooser, gint response_id, gpointer data)
{
CcRegionPanel *self = data;
CcRegionPanelPrivate *priv = self->priv;
gchar *type;
gchar *id;
gchar *name;
......@@ -1144,13 +1118,10 @@ input_response (GtkWidget *chooser, gint response_id, gpointer data)
type = INPUT_SOURCE_TYPE_XKB;
}
if (priv->login && g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) {
apologize_for_no_ibus_login (self);
} else {
add_input_row (self, type, id, name, app_info);
update_buttons (self);
update_input (self);
}
add_input_row (self, type, id, name, app_info);
update_buttons (self);
update_input (self);
g_free (id);
g_free (name);
g_clear_object (&app_info);
......@@ -1169,6 +1140,7 @@ show_input_chooser (CcRegionPanel *self)
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
chooser = cc_input_chooser_new (GTK_WINDOW (toplevel),
priv->login,
priv->xkb_info,
#ifdef HAVE_IBUS
priv->ibus_engines
......
......@@ -69,6 +69,19 @@
<property name="margin-bottom">6</property>
</object>
</child>
<child>
<object class="GtkLabel" id="login-label">
<property name="visible">False</property>
<property name="wrap">True</property>
<property name="label" translatable="yes">Input methods can't be used on the login screen</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-bottom">6</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
</object>
</child>
<action-widgets>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment