[gnome-desktop] gnome-xkb-info: Remove xkbfile dependency



commit 579456e7b66eaf0bccd07e1f6fb2a4f8101336b3
Author: Rui Matos <tiagomatos gmail com>
Date:   Wed Feb 12 22:07:56 2014 +0100

    gnome-xkb-info: Remove xkbfile dependency
    
    This code was originally from gnome-settings-daemon but got moved here
    so that we could be sure that all GnomeXkbInfo users were using the
    same xkb rules file by getting it from the X server.
    
    As we move towards wayland though, we find ourselves in a position to
    specify how and where xkb data resides so we can drop this
    dependency. Instead, for now, we'll just hardcode the path to the xkb
    data from the xkeyboard-config XKB_DATA compile time variable.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719942

 configure.ac                             |    1 -
 libgnome-desktop/Makefile.am             |    3 +-
 libgnome-desktop/gnome-desktop-3.0.pc.in |    1 -
 libgnome-desktop/gnome-xkb-info.c        |   86 +-----------------------------
 libgnome-desktop/gnome-xkb-info.h        |    7 ---
 libgnome-desktop/test-xkb-info.c         |    3 -
 6 files changed, 2 insertions(+), 99 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2cbf82d..e333fcf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,7 +153,6 @@ PKG_CHECK_MODULES(GNOME_DESKTOP, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED
                                  xrandr >= $XRANDR_REQUIRED
                                  xext >= $XEXT_REQUIRED
                                  xkeyboard-config
-                                 xkbfile
                                  iso-codes)
 
 XKB_BASE=$($PKG_CONFIG --variable xkb_base xkeyboard-config)
diff --git a/libgnome-desktop/Makefile.am b/libgnome-desktop/Makefile.am
index 8dc7675..5305584 100644
--- a/libgnome-desktop/Makefile.am
+++ b/libgnome-desktop/Makefile.am
@@ -166,8 +166,7 @@ gnome_rr_debug_LDADD =              \
 noinst_PROGRAMS = test-xkb-info test-pnp-ids test-wall-clock test-desktop-thumbnail test-idle-monitor 
test-languages
 test_xkb_info_LDADD =          \
        $(GNOME_DESKTOP_LIBS)   \
-       $(lib_LTLIBRARIES)      \
-       $(XLIB_LIBS)
+       $(lib_LTLIBRARIES)
 
 test_pnp_ids_LDADD = $(test_xkb_info_LDADD)
 
diff --git a/libgnome-desktop/gnome-desktop-3.0.pc.in b/libgnome-desktop/gnome-desktop-3.0.pc.in
index 1c501c5..a9cef93 100644
--- a/libgnome-desktop/gnome-desktop-3.0.pc.in
+++ b/libgnome-desktop/gnome-desktop-3.0.pc.in
@@ -6,7 +6,6 @@ includedir= includedir@
 Name: gnome-desktop-3.0
 Description: Utility library for loading .desktop files
 Requires: gtk+-3.0 gsettings-desktop-schemas
-Requires.private: xkbfile
 Version: @VERSION@
 Libs: -L${libdir} -lgnome-desktop-3
 Cflags: -I${includedir}/gnome-desktop-3.0
diff --git a/libgnome-desktop/gnome-xkb-info.c b/libgnome-desktop/gnome-xkb-info.c
index eec1224..973d850 100644
--- a/libgnome-desktop/gnome-xkb-info.c
+++ b/libgnome-desktop/gnome-xkb-info.c
@@ -25,9 +25,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <X11/XKBlib.h>
-#include <X11/extensions/XKBrules.h>
-
 #include <gdk/gdkx.h>
 
 #include <glib/gi18n-lib.h>
@@ -40,12 +37,6 @@
 #ifndef XKB_RULES_FILE
 #define XKB_RULES_FILE "evdev"
 #endif
-#ifndef XKB_LAYOUT
-#define XKB_LAYOUT "us"
-#endif
-#ifndef XKB_MODEL
-#define XKB_MODEL "pc105+inet"
-#endif
 
 typedef struct _Layout Layout;
 struct _Layout
@@ -132,88 +123,13 @@ free_option_group (gpointer data)
   g_slice_free (XkbOptionGroup, group);
 }
 
-/**
- * gnome_xkb_info_get_var_defs: (skip)
- * @rules: (out) (transfer full): location to store the rules file
- * path. Use g_free() when it's no longer needed
- * @var_defs: (out) (transfer full): location to store a
- * #XkbRF_VarDefsRec pointer. Use gnome_xkb_info_free_var_defs() to
- * free it
- *
- * Gets both the XKB rules file path and the current XKB parameters in
- * use by the X server.
- *
- * Since: 3.6
- */
-void
-gnome_xkb_info_get_var_defs (gchar            **rules,
-                             XkbRF_VarDefsRec **var_defs)
-{
-  Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
-  char *tmp;
-
-  g_return_if_fail (rules != NULL);
-  g_return_if_fail (var_defs != NULL);
-
-  *rules = NULL;
-  *var_defs = g_new0 (XkbRF_VarDefsRec, 1);
-
-  gdk_error_trap_push ();
-
-  /* Get it from the X property or fallback on defaults */
-  if (!XkbRF_GetNamesProp (display, rules, *var_defs) || !*rules)
-    {
-      *rules = strdup (XKB_RULES_FILE);
-      (*var_defs)->model = strdup (XKB_MODEL);
-      (*var_defs)->layout = strdup (XKB_LAYOUT);
-      (*var_defs)->variant = NULL;
-      (*var_defs)->options = NULL;
-    }
-
-  gdk_error_trap_pop_ignored ();
-
-  tmp = *rules;
-
-  if (*rules[0] == '/')
-    *rules = g_strdup (*rules);
-  else
-    *rules = g_build_filename (XKB_BASE, "rules", *rules, NULL);
-
-  free (tmp);
-}
-
-/**
- * gnome_xkb_info_free_var_defs: (skip)
- * @var_defs: #XkbRF_VarDefsRec instance to free
- *
- * Frees an #XkbRF_VarDefsRec instance allocated by
- * gnome_xkb_info_get_var_defs().
- *
- * Since: 3.6
- */
-void
-gnome_xkb_info_free_var_defs (XkbRF_VarDefsRec *var_defs)
-{
-  g_return_if_fail (var_defs != NULL);
-
-  free (var_defs->model);
-  free (var_defs->layout);
-  free (var_defs->variant);
-  free (var_defs->options);
-
-  g_free (var_defs);
-}
-
 static gchar *
 get_xml_rules_file_path (const gchar *suffix)
 {
-  XkbRF_VarDefsRec *xkb_var_defs;
   gchar *rules_file;
   gchar *xml_rules_file;
 
-  gnome_xkb_info_get_var_defs (&rules_file, &xkb_var_defs);
-  gnome_xkb_info_free_var_defs (xkb_var_defs);
-
+  rules_file = g_build_filename (XKB_BASE, "rules", XKB_RULES_FILE, NULL);
   xml_rules_file = g_strdup_printf ("%s%s", rules_file, suffix);
   g_free (rules_file);
 
diff --git a/libgnome-desktop/gnome-xkb-info.h b/libgnome-desktop/gnome-xkb-info.h
index 4abb6ef..8fc96c7 100644
--- a/libgnome-desktop/gnome-xkb-info.h
+++ b/libgnome-desktop/gnome-xkb-info.h
@@ -30,9 +30,6 @@
 
 #include <glib-object.h>
 
-#include <X11/XKBlib.h>
-#include <X11/extensions/XKBrules.h>
-
 G_BEGIN_DECLS
 
 #define GNOME_TYPE_XKB_INFO            (gnome_xkb_info_get_type ())
@@ -80,10 +77,6 @@ GList          *gnome_xkb_info_get_layouts_for_language         (GnomeXkbInfo *s
 GList          *gnome_xkb_info_get_layouts_for_country          (GnomeXkbInfo *self,
                                                                  const gchar  *country_code);
 
-void            gnome_xkb_info_get_var_defs                     (gchar            **rules,
-                                                                 XkbRF_VarDefsRec **var_defs);
-void            gnome_xkb_info_free_var_defs                    (XkbRF_VarDefsRec  *var_defs);
-
 G_END_DECLS
 
 #endif  /* __GNOME_XKB_INFO_H__ */
diff --git a/libgnome-desktop/test-xkb-info.c b/libgnome-desktop/test-xkb-info.c
index 6a6bb16..433d19d 100644
--- a/libgnome-desktop/test-xkb-info.c
+++ b/libgnome-desktop/test-xkb-info.c
@@ -1,4 +1,3 @@
-#include <gtk/gtk.h>
 #define GNOME_DESKTOP_USE_UNSTABLE_API
 #include <libgnome-desktop/gnome-xkb-info.h>
 int
@@ -9,8 +8,6 @@ main (int argc, char **argv)
        GList *option_groups, *g;
        GList *options, *o;
 
-       gtk_init (&argc, &argv);
-
        info = gnome_xkb_info_new ();
 
        layouts = gnome_xkb_info_get_all_layouts (info);


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