~mterry/ubuntu/maverick/gnome-settings-daemon/2.32.0

« back to all changes in this revision

Viewing changes to debian/patches/06_use_application_indicator.patch

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-08-20 11:12:10 UTC
  • Revision ID: james.westby@ubuntu.com-20100820111210-csuha5nry24fkt0x
Tags: 2.30.2-0ubuntu4
* 06_use_application_indicator.patch: update by Karl Lattimer to fix those
  - keyboard indicator does not react to layout changes (lp: #531290)
  - indicator variants in a same layout displayed the same way (lp: #620334)
  - move keyboard layouts out of the submenu (lp: #620571)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -uNr gnome-settings-daemon-2.30.2.orig//configure.ac gnome-settings-daemon-2.30.2/configure.ac
2
 
--- gnome-settings-daemon-2.30.2.orig//configure.ac     2010-06-22 09:56:46.000000000 +0100
3
 
+++ gnome-settings-daemon-2.30.2/configure.ac   2010-08-10 09:22:13.192546010 +0100
4
 
@@ -51,6 +51,7 @@
 
1
diff -uNr -x .pc gnome-settings-daemon-2.30.2.orig/configure.ac gnome-settings-daemon-2.30.2/configure.ac
 
2
--- gnome-settings-daemon-2.30.2.orig/configure.ac      2010-08-19 11:17:16.679361002 +0100
 
3
+++ gnome-settings-daemon-2.30.2/configure.ac   2010-08-19 11:17:58.279361002 +0100
 
4
@@ -52,6 +52,7 @@
5
5
 GIO_REQUIRED_VERSION=2.17.3
6
6
 GNOME_DESKTOP_REQUIRED_VERSION=2.29.92
7
7
 LIBNOTIFY_REQUIRED_VERSION=0.4.3
9
9
 
10
10
 EXTRA_COMPILE_WARNINGS(yes)
11
11
 
12
 
@@ -105,6 +106,32 @@
 
12
@@ -108,6 +109,32 @@
13
13
 AC_SUBST(LIBNOTIFY_CFLAGS)
14
14
 AC_SUBST(LIBNOTIFY_LIBS)
15
15
 
42
42
 dnl ---------------------------------------------------------------------------
43
43
 dnl - Check for D-Bus
44
44
 dnl ---------------------------------------------------------------------------
45
 
@@ -389,6 +416,7 @@
 
45
@@ -392,6 +419,7 @@
46
46
         dbus-1 system.d dir:      ${DBUS_SYS_DIR}
47
47
 
48
48
         Libnotify support:        ${have_libnotify}
50
50
         PulseAudio support:       ${have_pulse}
51
51
         Profiling support:        ${enable_profiling}
52
52
 "
53
 
diff -uNr gnome-settings-daemon-2.30.2.orig//plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c gnome-settings-daemon-2.30.2/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
54
 
--- gnome-settings-daemon-2.30.2.orig//plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c        2009-05-03 19:15:30.000000000 +0100
55
 
+++ gnome-settings-daemon-2.30.2/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c      2010-08-10 09:22:13.192546010 +0100
 
53
diff -uNr -x .pc gnome-settings-daemon-2.30.2.orig/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c gnome-settings-daemon-2.30.2/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
 
54
--- gnome-settings-daemon-2.30.2.orig/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c 2010-08-19 11:17:16.679361002 +0100
 
55
+++ gnome-settings-daemon-2.30.2/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c      2010-08-19 11:17:58.289361002 +0100
56
56
@@ -45,6 +45,10 @@
57
57
 #include <libnotify/notify.h>
58
58
 #endif /* HAVE_LIBNOTIFY */
209
209
 
210
210
         gnome_settings_profile_end (NULL);
211
211
 }
212
 
diff -uNr gnome-settings-daemon-2.30.2.orig//plugins/a11y-keyboard/Makefile.am gnome-settings-daemon-2.30.2/plugins/a11y-keyboard/Makefile.am
213
 
--- gnome-settings-daemon-2.30.2.orig//plugins/a11y-keyboard/Makefile.am        2009-07-27 22:37:28.000000000 +0100
214
 
+++ gnome-settings-daemon-2.30.2/plugins/a11y-keyboard/Makefile.am      2010-08-10 09:22:13.192546010 +0100
 
212
diff -uNr -x .pc gnome-settings-daemon-2.30.2.orig/plugins/a11y-keyboard/Makefile.am gnome-settings-daemon-2.30.2/plugins/a11y-keyboard/Makefile.am
 
213
--- gnome-settings-daemon-2.30.2.orig/plugins/a11y-keyboard/Makefile.am 2010-08-19 11:17:16.689361002 +0100
 
214
+++ gnome-settings-daemon-2.30.2/plugins/a11y-keyboard/Makefile.am      2010-08-19 11:17:58.289361002 +0100
215
215
@@ -53,6 +53,7 @@
216
216
 liba11y_keyboard_la_CFLAGS = \
217
217
        $(SETTINGS_PLUGIN_CFLAGS)       \
228
228
        $(NULL)
229
229
 
230
230
 plugin_in_files =              \
231
 
diff -uNr gnome-settings-daemon-2.30.2.orig//plugins/keyboard/gkbd-configuration.c gnome-settings-daemon-2.30.2/plugins/keyboard/gkbd-configuration.c
232
 
--- gnome-settings-daemon-2.30.2.orig//plugins/keyboard/gkbd-configuration.c    1970-01-01 01:00:00.000000000 +0100
233
 
+++ gnome-settings-daemon-2.30.2/plugins/keyboard/gkbd-configuration.c  2010-08-10 09:22:13.192546010 +0100
 
231
diff -uNr -x .pc gnome-settings-daemon-2.30.2.orig/plugins/keyboard/gkbd-configuration.c gnome-settings-daemon-2.30.2/plugins/keyboard/gkbd-configuration.c
 
232
--- gnome-settings-daemon-2.30.2.orig/plugins/keyboard/gkbd-configuration.c     1970-01-01 01:00:00.000000000 +0100
 
233
+++ gnome-settings-daemon-2.30.2/plugins/keyboard/gkbd-configuration.c  2010-08-19 11:17:58.289361002 +0100
234
234
@@ -0,0 +1,359 @@
235
235
+/*
236
236
+ * Copyright (C) 2010 Canonical Ltd.
591
591
+{
592
592
+       return configuration->priv->short_group_names;
593
593
+}
594
 
diff -uNr gnome-settings-daemon-2.30.2.orig//plugins/keyboard/gkbd-configuration.h gnome-settings-daemon-2.30.2/plugins/keyboard/gkbd-configuration.h
595
 
--- gnome-settings-daemon-2.30.2.orig//plugins/keyboard/gkbd-configuration.h    1970-01-01 01:00:00.000000000 +0100
596
 
+++ gnome-settings-daemon-2.30.2/plugins/keyboard/gkbd-configuration.h  2010-08-10 09:22:13.192546010 +0100
 
594
diff -uNr -x .pc gnome-settings-daemon-2.30.2.orig/plugins/keyboard/gkbd-configuration.h gnome-settings-daemon-2.30.2/plugins/keyboard/gkbd-configuration.h
 
595
--- gnome-settings-daemon-2.30.2.orig/plugins/keyboard/gkbd-configuration.h     1970-01-01 01:00:00.000000000 +0100
 
596
+++ gnome-settings-daemon-2.30.2/plugins/keyboard/gkbd-configuration.h  2010-08-19 11:17:58.289361002 +0100
597
597
@@ -0,0 +1,65 @@
598
598
+/*
599
599
+ * Copyright (C) 2010 Canonical Ltd.
660
660
+G_END_DECLS
661
661
+
662
662
+#endif
663
 
diff -uNr gnome-settings-daemon-2.30.2.orig//plugins/keyboard/gsd-keyboard-xkb.c gnome-settings-daemon-2.30.2/plugins/keyboard/gsd-keyboard-xkb.c
664
 
--- gnome-settings-daemon-2.30.2.orig//plugins/keyboard/gsd-keyboard-xkb.c      2010-06-22 09:47:47.000000000 +0100
665
 
+++ gnome-settings-daemon-2.30.2/plugins/keyboard/gsd-keyboard-xkb.c    2010-08-11 12:39:37.278805166 +0100
 
663
diff -uNr -x .pc gnome-settings-daemon-2.30.2.orig/plugins/keyboard/gsd-keyboard-xkb.c gnome-settings-daemon-2.30.2/plugins/keyboard/gsd-keyboard-xkb.c
 
664
--- gnome-settings-daemon-2.30.2.orig/plugins/keyboard/gsd-keyboard-xkb.c       2010-08-19 11:17:16.719361002 +0100
 
665
+++ gnome-settings-daemon-2.30.2/plugins/keyboard/gsd-keyboard-xkb.c    2010-08-20 09:33:11.573645651 +0100
666
666
@@ -31,12 +31,20 @@
667
667
 #include <gtk/gtk.h>
668
668
 #include <gconf/gconf-client.h>
684
684
 #include "gsd-xmodmap.h"
685
685
 #include "gsd-keyboard-xkb.h"
686
686
 #include "delayed-dialog.h"
687
 
@@ -71,7 +79,28 @@
 
687
@@ -71,7 +79,12 @@
688
688
 
689
689
 static const char *gdm_keyboard_layout = NULL;
690
690
 
691
691
+#ifdef HAVE_APPINDICATOR
692
692
+static AppIndicator *app_indicator = NULL;
693
693
+static GkbdConfiguration *gkbd_configuration = NULL;
694
 
+
695
 
+/* hackish xref - taken from gkbd-status.c in libgnomekbd */
696
 
+extern gchar *gkbd_indicator_extract_layout_name (int group,
697
 
+                                                 XklEngine * engine,
698
 
+                                                 GkbdKeyboardConfig *
699
 
+                                                 kbd_cfg,
700
 
+                                                 gchar **
701
 
+                                                 short_group_names,
702
 
+                                                 gchar **
703
 
+                                                 full_group_names);
704
 
+
705
 
+extern gchar *gkbd_indicator_create_label_title (int group,
706
 
+                                                GHashTable **
707
 
+                                                ln2cnt_map,
708
 
+                                                gchar * layout_name);
709
 
+
710
694
+#else
711
695
 static GtkStatusIcon *icon = NULL;
712
696
+#endif
713
697
 
714
698
 static GHashTable *preview_dialogs = NULL;
715
699
 
716
 
@@ -239,7 +268,11 @@
 
700
@@ -239,7 +252,11 @@
717
701
 
718
702
        XklEngine *engine = xkl_engine_get_instance (GDK_DISPLAY ());
719
703
        XklState *xkl_state = xkl_engine_get_current_state (engine);
725
709
        gpointer p = g_hash_table_lookup (preview_dialogs,
726
710
                                          GINT_TO_POINTER
727
711
                                          (xkl_state->group));
728
 
@@ -361,10 +394,19 @@
 
712
@@ -361,37 +378,154 @@
729
713
 popup_menu_set_group (GtkMenuItem * item, gpointer param)
730
714
 {
731
715
        gint group_number = GPOINTER_TO_INT (param);
733
717
+       XklEngine *engine = gkbd_configuration_get_xkl_engine (gkbd_configuration);
734
718
+#else
735
719
        XklEngine *engine = gkbd_status_get_xkl_engine ();
 
720
-       XklState st;
736
721
+#endif
737
 
        XklState st;
 
722
+       XklState *st = xkl_engine_get_current_state(engine);
738
723
        Window cur;
739
724
 
 
725
-       st.group = group_number;
740
726
+#ifdef HAVE_APPINDICATOR
741
 
+       if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))
 
727
+       if ((item != NULL) && (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))))
742
728
+               return;
743
729
+#endif
744
 
+
745
 
        st.group = group_number;
 
730
+       st->group = group_number;
746
731
        xkl_engine_allow_one_switch_to_secondary_group (engine);
747
732
        cur = xkl_engine_get_current_window (engine);
748
 
@@ -382,15 +424,61 @@
 
733
        if (cur != (Window) NULL) {
 
734
                xkl_debug (150, "Enforcing the state %d for window %lx\n",
 
735
-                          st.group, cur);
 
736
+                          st->group, cur);
 
737
                xkl_engine_save_state (engine,
 
738
                                       xkl_engine_get_current_window
 
739
-                                      (engine), &st);
 
740
+                                      (engine), st);
 
741
 /*    XSetInputFocus( GDK_DISPLAY(), cur, RevertToNone, CurrentTime );*/
 
742
        } else {
 
743
                xkl_debug (150,
 
744
                           "??? Enforcing the state %d for unknown window\n",
 
745
-                          st.group);
 
746
+                          st->group);
749
747
                /* strange situation - bad things can happen */
750
748
        }
751
 
        xkl_engine_lock_group (engine, st.group);
 
749
-       xkl_engine_lock_group (engine, st.group);
 
750
+       xkl_engine_lock_group (engine, st->group);
752
751
+#ifdef HAVE_APPINDICATOR
753
 
+        // Most of this comes directly from libgnomekbd it's not great, but it should work
754
 
+        // -- Karl Lattimer <karl@qdh.org.uk>
755
 
+        XklConfigRec * xklrec = xkl_config_rec_new();
756
 
+        xkl_config_rec_get_from_server (xklrec, engine);
757
 
+        gkbd_keyboard_config_load_from_x_current (&current_kbd_config, xklrec);
758
 
+
759
 
+        XklConfigRegistry *registry = xkl_config_registry_get_instance(engine);
760
 
+        xkl_config_registry_load (registry, current_config.load_extra_items);
761
 
+
762
 
+        gchar * layout_name;
763
 
+        gchar * lbl_title;
764
 
+        gchar ** shortnames;
765
 
+        gchar ** longnames;
766
 
+        static GHashTable *ln2cnt_map;
767
 
+
768
 
+        gkbd_desktop_config_load_group_descriptions(&current_config, registry, 
769
 
+                (const gchar **) xklrec->layouts, 
770
 
+                (const gchar **) xklrec->variants,
771
 
+                &shortnames,
772
 
+                &longnames); 
773
 
+
774
 
+        layout_name = gkbd_indicator_extract_layout_name(st.group, engine, &current_kbd_config, shortnames, longnames);
775
 
+        lbl_title = gkbd_indicator_create_label_title (st.group, &ln2cnt_map, layout_name);
776
 
+        if (st.group + 1 == xkl_engine_get_num_groups(engine)) {
777
 
+                g_hash_table_destroy(ln2cnt_map);
778
 
+                ln2cnt_map = NULL;
779
 
+        }
780
 
+        // Guide of 3 wide-ish and one thin
781
 
+        app_indicator_set_label(app_indicator, lbl_title, "XXX1"); 
782
 
+
783
 
+        // Deallocate memory so we don't leak wildly
784
 
+       /*g_object_unref (G_OBJECT (xklrec));
785
 
+        g_object_unref (G_OBJECT (registry));
786
 
+        g_strfreev(longnames);
787
 
+        g_strfreev(shortnames);
788
 
+        g_free(layout_name);
789
 
+        g_free(lbl_title);*/
 
752
+       XklConfigRec * xklrec = xkl_config_rec_new();
 
753
+       xkl_config_rec_get_from_server (xklrec, engine);
 
754
+       XklConfigRegistry *registry = xkl_config_registry_get_instance(engine);
 
755
+
 
756
+       gkbd_keyboard_config_load_from_x_current (&current_kbd_config, xklrec);
 
757
+       xkl_config_registry_load (registry, current_config.load_extra_items);
 
758
+
 
759
+       int g;
 
760
+       gchar ** shortnames;
 
761
+       gchar ** longnames;
 
762
+       gchar * layout_name;
 
763
+       gchar * lname = NULL;
 
764
+       GHashTable *ln2cnt_map = g_hash_table_new (g_str_hash, g_str_equal);
 
765
+
 
766
+       gkbd_desktop_config_load_group_descriptions(&current_config, registry, 
 
767
+               (const gchar **) xklrec->layouts, 
 
768
+               (const gchar **) xklrec->variants,
 
769
+               &shortnames,
 
770
+               &longnames); 
 
771
+
 
772
+       for (g = 0; g < g_strv_length (shortnames);g++) {
 
773
+               gpointer pcounter = NULL;
 
774
+               gchar *prev_layout_name = NULL;
 
775
+               int counter = 0;
 
776
+
 
777
+               if (g < g_strv_length (shortnames)) {
 
778
+                       if (xkl_engine_get_features (engine) &
 
779
+                           XKLF_MULTIPLE_LAYOUTS_SUPPORTED) {
 
780
+                               gchar *longname = (gchar *) g_slist_nth_data (current_kbd_config.layouts_variants, g);
 
781
+                               gchar *variant_name;
 
782
+                               if (!gkbd_keyboard_config_split_items (longname, &lname, &variant_name))
 
783
+                                       /* just in case */
 
784
+                                       lname = longname;
 
785
+
 
786
+                               /* make it freeable */
 
787
+                               lname = g_strdup (lname);
 
788
+
 
789
+                               if (shortnames != NULL) {
 
790
+                                       gchar *shortname = shortnames[g];
 
791
+                                       if (shortname != NULL && *shortname != '\0') {
 
792
+                                               /* drop the long name */
 
793
+                                               g_free (lname);
 
794
+                                               lname = g_strdup (shortname);
 
795
+                                       }
 
796
+                               }
 
797
+                       } else {
 
798
+                               lname = g_strdup (longnames[g]);
 
799
+                       }
 
800
+               }
 
801
+               if (lname == NULL)
 
802
+                       lname = g_strdup ("");
 
803
+
 
804
+               /* Process layouts with repeating description */
 
805
+               if (g_hash_table_lookup_extended (ln2cnt_map, lname, (gpointer *) & prev_layout_name, &pcounter)) {
 
806
+                       /* "next" same description */
 
807
+                       counter = GPOINTER_TO_INT (pcounter);
 
808
+               }
 
809
+               g_hash_table_insert (ln2cnt_map, lname, GINT_TO_POINTER (counter+1));
 
810
+
 
811
+               if (st->group == g) {
 
812
+                       if (counter > 0) {
 
813
+                               gchar appendix[10] = "";
 
814
+                               gint utf8length;
 
815
+                               gunichar cidx;
 
816
+                               /* Unicode subscript 2, 3, 4 */
 
817
+                               cidx = 0x2081 + counter;
 
818
+                               utf8length = g_unichar_to_utf8 (cidx, appendix);
 
819
+                               appendix[utf8length] = '\0';
 
820
+                               layout_name = g_strconcat (lname, appendix, NULL);
 
821
+                       } else {
 
822
+                               layout_name = g_strdup(lname);
 
823
+                       }
 
824
+               }
 
825
+               g_free(lname);
 
826
+       }
 
827
+
 
828
+       // Guide of 3 wide-ish and one thin
 
829
+       app_indicator_set_label(app_indicator, layout_name, "XXX1");
 
830
+       g_hash_table_destroy(ln2cnt_map);
 
831
+
 
832
+       // Deallocate memory so we don't leak wildly
 
833
+       g_free(layout_name);
 
834
+       g_object_unref (G_OBJECT (xklrec));
 
835
+       g_object_unref (G_OBJECT (registry));
 
836
+       g_strfreev(longnames);
 
837
+       g_strfreev(shortnames);
790
838
+#endif
791
839
 }
792
840
 
793
 
-static void
 
841
+#ifdef HAVE_APPINDICATOR
 
842
 static void
794
843
-status_icon_popup_menu_cb (GtkStatusIcon * icon, guint button, guint time)
 
844
+state_callback (XklEngine * engine,
 
845
+               XklEngineStateChange changeType,
 
846
+               gint group, gboolean restore)
 
847
+{
 
848
+       if (changeType == GROUP_CHANGED)
 
849
+               popup_menu_set_group(NULL, GINT_TO_POINTER(group));
 
850
+}
 
851
+#endif
 
852
+
795
853
+static GtkMenu *
796
854
+create_status_menu (void)
797
855
 {
798
856
        GtkMenu *popup_menu = GTK_MENU (gtk_menu_new ());
 
857
+#ifndef HAVE_APPINDICATOR
799
858
        GtkMenu *groups_menu = GTK_MENU (gtk_menu_new ());
 
859
+#endif
800
860
        int i = 0;
801
861
+#ifdef HAVE_APPINDICATOR
802
862
+       const char * const *current_name = gkbd_configuration_get_group_names (gkbd_configuration);
807
867
        gchar **current_name = gkbd_status_get_group_names ();
808
868
+#endif
809
869
 
 
870
+#ifndef HAVE_APPINDICATOR
810
871
        GtkWidget *item = gtk_menu_item_new_with_mnemonic (_("_Groups"));
811
872
        gtk_widget_show (item);
812
 
@@ -410,7 +498,14 @@
 
873
        gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);
 
874
@@ -409,8 +543,23 @@
 
875
        gtk_widget_show (item);
813
876
        g_signal_connect (item, "activate", popup_menu_show_layout, NULL);
814
877
        gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);
815
 
 
816
 
-       for (i = 0; *current_name; i++, current_name++) {
 
878
+#else
 
879
+        GtkWidget *item;
 
880
+#endif
 
881
+
817
882
+       for (i = 0; current_name && *current_name; i++, current_name++) {
818
883
+#ifdef HAVE_APPINDICATOR
819
884
+               item = gtk_radio_menu_item_new_with_label (groups_items_group, *current_name);
820
885
+               groups_items_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
821
 
+
 
886
 
 
887
-       for (i = 0; *current_name; i++, current_name++) {
822
888
+               gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
823
889
+                                               i == group);
 
890
+               gtk_widget_show (item);
 
891
+               gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);
 
892
+               g_signal_connect (item, "activate",
 
893
+                                 G_CALLBACK (popup_menu_set_group),
 
894
+                                 GINT_TO_POINTER (i));
824
895
+#else
825
896
                gchar *image_file = gkbd_status_get_image_filename (i);
826
897
 
827
898
                if (image_file == NULL) {
828
 
@@ -433,6 +528,7 @@
829
 
                            (GTK_IMAGE_MENU_ITEM (item), TRUE);
830
 
                        g_free (image_file);
831
 
                }
832
 
+#endif
833
 
                gtk_widget_show (item);
834
 
                gtk_menu_shell_append (GTK_MENU_SHELL (groups_menu), item);
 
899
@@ -438,17 +587,62 @@
835
900
                g_signal_connect (item, "activate",
836
 
@@ -440,15 +536,78 @@
 
901
                                  G_CALLBACK (popup_menu_set_group),
837
902
                                  GINT_TO_POINTER (i));
 
903
+#endif
838
904
        }
839
905
 
 
906
+#ifdef HAVE_APPINDICATOR
 
907
+        item = gtk_separator_menu_item_new();
 
908
+        gtk_widget_show(item);
 
909
+        gtk_menu_shell_append(GTK_MENU_SHELL (popup_menu), item);
 
910
+
 
911
+       item =
 
912
+           gtk_menu_item_new_with_mnemonic (_("Keyboard _Preferences"));
 
913
+       gtk_widget_show (item);
 
914
+       g_signal_connect (item, "activate", popup_menu_launch_capplet,
 
915
+                         NULL);
 
916
+       gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);
 
917
+
 
918
+       item = gtk_menu_item_new_with_mnemonic (_("Show Current _Layout"));
 
919
+       gtk_widget_show (item);
 
920
+       g_signal_connect (item, "activate", popup_menu_show_layout, NULL);
 
921
+       gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);
 
922
+#endif
 
923
+
840
924
+       return popup_menu;
841
925
+}
842
926
+
863
947
+                       app_indicator = app_indicator_new ("gst-keyboard-xkb",
864
948
+                                                          "keyboard",
865
949
+                                                          APP_INDICATOR_CATEGORY_HARDWARE);
866
 
+                        // Most of this comes directly from libgnomekbd it's not great, but it should work
867
 
+                        // -- Karl Lattimer <karl@qdh.org.uk>
868
 
+                       XklEngine *engine = gkbd_configuration_get_xkl_engine (gkbd_configuration);
 
950
+                       XklEngine *engine = gkbd_configuration_get_xkl_engine (gkbd_configuration);
869
951
+                       XklState *st = xkl_engine_get_current_state(engine);
870
 
+                        XklConfigRec * xklrec = xkl_config_rec_new();
871
 
+                        xkl_config_rec_get_from_server (xklrec, engine);
872
 
+                        gkbd_keyboard_config_load_from_x_current (&current_kbd_config, xklrec);
873
 
+
874
 
+                        XklConfigRegistry *registry = xkl_config_registry_get_instance(engine);
875
 
+                        xkl_config_registry_load (registry, current_config.load_extra_items);
876
 
+
877
 
+                        gchar * layout_name;
878
 
+                        gchar * lbl_title;
879
 
+                        gchar ** shortnames;
880
 
+                        gchar ** longnames;
881
 
+                        static GHashTable *ln2cnt_map;
882
 
+
883
 
+                        gkbd_desktop_config_load_group_descriptions(&current_config, registry, 
884
 
+                                (const gchar **) xklrec->layouts, 
885
 
+                                (const gchar **) xklrec->variants,
886
 
+                                &shortnames,
887
 
+                                &longnames); 
888
 
+
889
 
+                        layout_name = gkbd_indicator_extract_layout_name(st->group, engine, &current_kbd_config, shortnames, longnames);
890
 
+                        lbl_title = gkbd_indicator_create_label_title (st->group, &ln2cnt_map, layout_name);
891
 
+                        if (st->group + 1 == xkl_engine_get_num_groups(engine)) {
892
 
+                                g_hash_table_destroy(ln2cnt_map);
893
 
+                                ln2cnt_map = NULL;
894
 
+                        }
895
 
+                        // Guide of 3 wide-ish and one thin
896
 
+                        app_indicator_set_label(app_indicator, lbl_title, "XXX1"); 
897
 
+
898
 
+                        // Deallocate memory so we don't leak wildly
899
 
+                       /*g_object_unref (G_OBJECT (xklrec));
900
 
+                        g_object_unref (G_OBJECT (registry));
901
 
+                        g_strfreev(longnames);
902
 
+                        g_strfreev(shortnames);
903
 
+                        g_free(layout_name);
904
 
+                        g_free(lbl_title);*/
905
 
+
 
952
+                       popup_menu_set_group(NULL, GINT_TO_POINTER(st->group));
906
953
+                       app_indicator_set_status (app_indicator,
907
954
+                                                 APP_INDICATOR_STATUS_ACTIVE);
908
955
+                       app_indicator_set_menu (app_indicator,
912
959
                if (icon == NULL) {
913
960
                        GConfClient *conf_client =
914
961
                            gconf_client_get_default ();
915
 
@@ -468,12 +627,20 @@
 
962
@@ -468,12 +662,20 @@
916
963
                                          NULL);
917
964
 
918
965
                }
933
980
        }
934
981
 }
935
982
 
936
 
@@ -814,6 +981,22 @@
 
983
@@ -814,6 +1016,22 @@
937
984
        gsd_load_modmap_files ();
938
985
 }
939
986
 
956
1003
 void
957
1004
 gsd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun,
958
1005
                                               void *user_data)
959
 
@@ -858,6 +1041,13 @@
 
1006
@@ -858,6 +1076,13 @@
960
1007
        logfile = fopen ("/tmp/gsdkx.log", "a");
961
1008
        xkl_set_log_appender (gsd_keyboard_log_appender);
962
1009
 #endif
970
1017
        manager = kbd_manager;
971
1018
        gnome_settings_profile_start ("xkl_engine_get_instance");
972
1019
        xkl_engine = xkl_engine_get_instance (GDK_DISPLAY ());
973
 
@@ -962,5 +1152,13 @@
 
1020
@@ -891,6 +1116,9 @@
 
1021
                                              (GConfClientNotifyFunc)
 
1022
                                              apply_xkb_settings);
 
1023
 
 
1024
+#ifdef HAVE_APPINDICATOR
 
1025
+               g_signal_connect (xkl_engine, "X-state-changed", G_CALLBACK (state_callback), NULL);
 
1026
+#endif
 
1027
                gdk_window_add_filter (NULL, (GdkFilterFunc)
 
1028
                                       gsd_keyboard_xkb_evt_filter, NULL);
 
1029
 
 
1030
@@ -962,5 +1190,13 @@
974
1031
        g_object_unref (xkl_engine);
975
1032
 
976
1033
        xkl_engine = NULL;
984
1041
+
985
1042
        inited_ok = FALSE;
986
1043
 }
987
 
diff -uNr gnome-settings-daemon-2.30.2.orig//plugins/keyboard/Makefile.am gnome-settings-daemon-2.30.2/plugins/keyboard/Makefile.am
988
 
--- gnome-settings-daemon-2.30.2.orig//plugins/keyboard/Makefile.am     2010-06-22 09:47:47.000000000 +0100
989
 
+++ gnome-settings-daemon-2.30.2/plugins/keyboard/Makefile.am   2010-08-10 09:22:13.204539994 +0100
 
1044
diff -uNr -x .pc gnome-settings-daemon-2.30.2.orig/plugins/keyboard/Makefile.am gnome-settings-daemon-2.30.2/plugins/keyboard/Makefile.am
 
1045
--- gnome-settings-daemon-2.30.2.orig/plugins/keyboard/Makefile.am      2010-08-19 11:17:16.709361002 +0100
 
1046
+++ gnome-settings-daemon-2.30.2/plugins/keyboard/Makefile.am   2010-08-19 11:17:58.289361002 +0100
990
1047
@@ -18,6 +18,8 @@
991
1048
        gsd-xmodmap.c           \
992
1049
        delayed-dialog.h        \
1012
1069
        $(NULL)
1013
1070
 
1014
1071
 plugin_in_files =              \
1015
 
diff -uNr gnome-settings-daemon-2.30.2.orig//plugins/xrandr/gsd-xrandr-manager.c gnome-settings-daemon-2.30.2/plugins/xrandr/gsd-xrandr-manager.c
1016
 
--- gnome-settings-daemon-2.30.2.orig//plugins/xrandr/gsd-xrandr-manager.c      2010-06-22 09:47:55.000000000 +0100
1017
 
+++ gnome-settings-daemon-2.30.2/plugins/xrandr/gsd-xrandr-manager.c    2010-08-10 09:22:13.208538000 +0100
 
1072
diff -uNr -x .pc gnome-settings-daemon-2.30.2.orig/plugins/xrandr/gsd-xrandr-manager.c gnome-settings-daemon-2.30.2/plugins/xrandr/gsd-xrandr-manager.c
 
1073
--- gnome-settings-daemon-2.30.2.orig/plugins/xrandr/gsd-xrandr-manager.c       2010-08-19 11:17:16.729361002 +0100
 
1074
+++ gnome-settings-daemon-2.30.2/plugins/xrandr/gsd-xrandr-manager.c    2010-08-19 11:17:58.289361002 +0100
1018
1075
@@ -49,6 +49,10 @@
1019
1076
 #include <libnotify/notify.h>
1020
1077
 #endif
1217
1274
 }
1218
1275
 
1219
1276
 static void
1220
 
diff -uNr gnome-settings-daemon-2.30.2.orig//plugins/xrandr/Makefile.am gnome-settings-daemon-2.30.2/plugins/xrandr/Makefile.am
1221
 
--- gnome-settings-daemon-2.30.2.orig//plugins/xrandr/Makefile.am       2010-06-22 09:47:47.000000000 +0100
1222
 
+++ gnome-settings-daemon-2.30.2/plugins/xrandr/Makefile.am     2010-08-10 09:22:13.208538000 +0100
 
1277
diff -uNr -x .pc gnome-settings-daemon-2.30.2.orig/plugins/xrandr/Makefile.am gnome-settings-daemon-2.30.2/plugins/xrandr/Makefile.am
 
1278
--- gnome-settings-daemon-2.30.2.orig/plugins/xrandr/Makefile.am        2010-08-19 11:17:16.739361002 +0100
 
1279
+++ gnome-settings-daemon-2.30.2/plugins/xrandr/Makefile.am     2010-08-19 11:17:58.289361002 +0100
1223
1280
@@ -54,6 +54,7 @@
1224
1281
 libxrandr_la_CFLAGS =                  \
1225
1282
        $(SETTINGS_PLUGIN_CFLAGS)       \