[gnome-control-center] region: build IBus setup app filename only from the engine prefix



commit fb6c89f45a3c73d34de4cf0c8d381bce301176f1
Author: Daiki Ueno <ueno unixuser org>
Date:   Thu Sep 27 17:46:40 2012 +0900

    region: build IBus setup app filename only from the engine prefix
    
    There are 84 m17n engines in the whitelist and they all use
    ibus-setup-m17n.  To reduce the number of .desktop files, this
    patch uses the prefix before the first ":" to construct the .desktop
    filename and set IBUS_ENGINE_NAME envvar to let the setup app know
    the actual engine ID.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684935

 panels/region/gnome-region-panel-input.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/panels/region/gnome-region-panel-input.c b/panels/region/gnome-region-panel-input.c
index 94d73d6..4820014 100644
--- a/panels/region/gnome-region-panel-input.c
+++ b/panels/region/gnome-region-panel-input.c
@@ -309,8 +309,12 @@ setup_app_info_for_id (const gchar *id)
 {
   GDesktopAppInfo *app_info;
   gchar *desktop_file_name;
+  gchar **strv;
+
+  strv = g_strsplit (id, ":", 2);
+  desktop_file_name = g_strdup_printf ("ibus-setup-%s.desktop", strv[0]);
+  g_strfreev (strv);
 
-  desktop_file_name = g_strdup_printf ("ibus-setup-%s.desktop", id);
   app_info = g_desktop_app_info_new (desktop_file_name);
   g_free (desktop_file_name);
 
@@ -1060,6 +1064,7 @@ show_selected_settings (GtkButton *button, gpointer data)
   GtkTreeIter iter;
   GdkAppLaunchContext *ctx;
   GDesktopAppInfo *app_info;
+  gchar *id;
   GError *error = NULL;
 
   g_debug ("show selected layout");
@@ -1075,6 +1080,12 @@ show_selected_settings (GtkButton *button, gpointer data)
   ctx = gdk_display_get_app_launch_context (gdk_display_get_default ());
   gdk_app_launch_context_set_timestamp (ctx, gtk_get_current_event_time ());
 
+  gtk_tree_model_get (model, &iter, ID_COLUMN, &id, -1);
+  g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (ctx),
+                               "IBUS_ENGINE_NAME",
+                               id);
+  g_free (id);
+
   if (!g_app_info_launch (G_APP_INFO (app_info), NULL, G_APP_LAUNCH_CONTEXT (ctx), &error))
     {
       g_warning ("Failed to launch input source setup: %s", error->message);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]