]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkinputdialog.c
traverse all nodes, not just the leafs (pointed out by Josh Parsons)
[~andy/gtk] / gtk / gtkinputdialog.c
index 5eac29bbda3624023b78324f0a7b380e3fee327d..7d9a3af7a1cff7af652d774c257d515f33edf8f0 100644 (file)
@@ -2,16 +2,16 @@
  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  *
  */
 
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+
 #include <stdio.h>
 #include <stdlib.h>
-#include <ctype.h>
 #include "gdk/gdkkeysyms.h"
 #include "gtkbutton.h"
 #include "gtkentry.h"
 #include "gtklabel.h"
 #include "gtklistitem.h"
 #include "gtkmain.h"
+#include "gtkmarshalers.h"
 #include "gtkmenu.h"
 #include "gtkmenuitem.h"
 #include "gtknotebook.h"
 #include "gtkoptionmenu.h"
 #include "gtkscrolledwindow.h"
 #include "gtksignal.h"
+#include "gtkstock.h"
 #include "gtktable.h"
 #include "gtkvbox.h"
 
+#include "gtkintl.h"
+
 typedef struct {
   gint       index;
   GtkWidget *entry;
@@ -67,46 +78,32 @@ enum
 
 /* Forward declarations */
 
-static void gtk_input_dialog_class_init (GtkInputDialogClass *klass);
-static void gtk_input_dialog_init (GtkInputDialog *inputd);
-static GdkDeviceInfo *gtk_input_dialog_get_device_info(guint32 deviceid);
-static void gtk_input_dialog_set_device(GtkWidget *widget, gpointer data);
-static void gtk_input_dialog_finalize (GtkObject *object);
-static void gtk_input_dialog_set_mapping_mode(GtkWidget *w,
-                                             gpointer data);
-static void gtk_input_dialog_set_axis(GtkWidget *widget, gpointer data);
-static void gtk_input_dialog_fill_axes (GtkInputDialog *inputd,
-                                       GdkDeviceInfo *info);
-static void gtk_input_dialog_set_key (GtkInputKeyInfo *key,
-                                     guint keyval, 
-                                     GdkModifierType modifiers);
-static gint gtk_input_dialog_key_press (GtkWidget *widget, 
-                                       GdkEventKey *event,
-                                       GtkInputKeyInfo *key);
-static void gtk_input_dialog_clear_key (GtkWidget *widget, 
-                                       GtkInputKeyInfo *key);
-static void gtk_input_dialog_destroy_key (GtkWidget *widget, 
-                                         GtkInputKeyInfo *key);
-static void gtk_input_dialog_fill_keys (GtkInputDialog *inputd,
-                                       GdkDeviceInfo *info);
+static void gtk_input_dialog_class_init       (GtkInputDialogClass *klass);
+static void gtk_input_dialog_init             (GtkInputDialog      *inputd);
+static void gtk_input_dialog_set_device       (GtkWidget           *widget,
+                                              gpointer             data);
+static void gtk_input_dialog_set_mapping_mode (GtkWidget           *w,
+                                              gpointer             data);
+static void gtk_input_dialog_set_axis         (GtkWidget           *widget,
+                                              gpointer             data);
+static void gtk_input_dialog_fill_axes        (GtkInputDialog      *inputd,
+                                              GdkDevice           *info);
+static void gtk_input_dialog_set_key          (GtkInputKeyInfo     *key,
+                                              guint                keyval,
+                                              GdkModifierType      modifiers);
+static gint gtk_input_dialog_key_press        (GtkWidget           *widget,
+                                              GdkEventKey         *event,
+                                              GtkInputKeyInfo     *key);
+static void gtk_input_dialog_clear_key        (GtkWidget           *widget,
+                                              GtkInputKeyInfo     *key);
+static void gtk_input_dialog_destroy_key      (GtkWidget           *widget,
+                                              GtkInputKeyInfo     *key);
+static void gtk_input_dialog_fill_keys        (GtkInputDialog      *inputd,
+                                              GdkDevice           *info);
 
 static GtkObjectClass *parent_class = NULL;
 static guint input_dialog_signals[LAST_SIGNAL] = { 0 };
 
-static GdkDeviceInfo *
-gtk_input_dialog_get_device_info(guint32 deviceid)
-{
-  GList *tmp_list = gdk_input_list_devices();
-  while (tmp_list)
-    {
-      if (((GdkDeviceInfo *)tmp_list->data)->deviceid == deviceid)
-       return (GdkDeviceInfo *)tmp_list->data;
-      tmp_list = tmp_list->next;
-    }
-
-  return NULL;
-}
-
 GtkType
 gtk_input_dialog_get_type (void)
 {
@@ -142,29 +139,24 @@ gtk_input_dialog_class_init (GtkInputDialogClass *klass)
 
   parent_class = gtk_type_class (GTK_TYPE_DIALOG);
 
+  klass->enable_device = NULL;
+  klass->disable_device = NULL;
+
   input_dialog_signals[ENABLE_DEVICE] =
     gtk_signal_new ("enable_device",
                    GTK_RUN_LAST,
-                   object_class->type,
+                   GTK_CLASS_TYPE (object_class),
                    GTK_SIGNAL_OFFSET (GtkInputDialogClass, enable_device),
-                   gtk_marshal_NONE__INT,
-                   GTK_TYPE_NONE, 1, GTK_TYPE_INT);
+                   _gtk_marshal_VOID__OBJECT,
+                   GTK_TYPE_NONE, 1, GDK_TYPE_DEVICE);
 
   input_dialog_signals[DISABLE_DEVICE] =
     gtk_signal_new ("disable_device",
                    GTK_RUN_LAST,
-                   object_class->type,
+                   GTK_CLASS_TYPE (object_class),
                    GTK_SIGNAL_OFFSET (GtkInputDialogClass, disable_device),
-                   gtk_marshal_NONE__INT,
-                   GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
-  gtk_object_class_add_signals (object_class, input_dialog_signals,
-                               LAST_SIGNAL);
-
-
-  object_class->finalize = gtk_input_dialog_finalize;
-  klass->enable_device = NULL;
-  klass->disable_device = NULL;
+                   _gtk_marshal_VOID__OBJECT,
+                   GTK_TYPE_NONE, 1, GDK_TYPE_DEVICE);
 }
 
 static void
@@ -183,11 +175,13 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
   GList *tmp_list;
   GList *device_info;
 
-  device_info = gdk_input_list_devices();
+  gtk_widget_push_composite_child ();
+
+  device_info = gdk_devices_list ();
 
   /* shell and main vbox */
 
-  gtk_window_set_title (GTK_WINDOW (inputd), "Input");
+  gtk_window_set_title (GTK_WINDOW (inputd), _("Input"));
 
   vbox = gtk_vbox_new (FALSE, 4);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
@@ -195,7 +189,7 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
 
   if (g_list_length(device_info) <= 1) /* only core device */
     {
-      label = gtk_label_new ("No input devices");
+      label = gtk_label_new (_("No input devices"));
       gtk_container_add (GTK_CONTAINER (vbox), label);
 
       gtk_widget_show (label);
@@ -207,27 +201,28 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
       device_menu = gtk_menu_new ();
 
       for (tmp_list = device_info; tmp_list; tmp_list = tmp_list->next) {
-       GdkDeviceInfo *info = (GdkDeviceInfo *)(tmp_list->data);
-       if (info->deviceid != GDK_CORE_POINTER)
+       GdkDevice *info = (GdkDevice *)(tmp_list->data);
+       if (info != gdk_device_get_core_pointer ())
          {
            menuitem = gtk_menu_item_new_with_label(info->name);
 
-           gtk_menu_append(GTK_MENU(device_menu),menuitem);
-           gtk_widget_show(menuitem);
+           gtk_menu_shell_append (GTK_MENU_SHELL (device_menu), menuitem);
+           gtk_widget_show (menuitem);
            gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
            gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
                                (GtkSignalFunc) gtk_input_dialog_set_device,
-                               GUINT_TO_POINTER(info->deviceid));
+                               info);
          }
       }
 
       util_box = gtk_hbox_new (FALSE, 2);
       gtk_box_pack_start (GTK_BOX (vbox), util_box, FALSE, FALSE, 0);
 
-      label = gtk_label_new("Device:");
+      label = gtk_label_new_with_mnemonic (_("_Device:"));
       gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
 
       optionmenu = gtk_option_menu_new ();
+      gtk_label_set_mnemonic_widget (GTK_LABEL (label), optionmenu);
       gtk_box_pack_start (GTK_BOX (util_box), optionmenu, TRUE, TRUE, 2);
       gtk_widget_show (optionmenu);
       gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), device_menu);
@@ -240,34 +235,35 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
 
       mapping_menu = gtk_menu_new ();
 
-      menuitem = gtk_menu_item_new_with_label("Disabled");
-      gtk_menu_append(GTK_MENU(mapping_menu),menuitem);
+      menuitem = gtk_menu_item_new_with_label(_("Disabled"));
+      gtk_menu_shell_append (GTK_MENU_SHELL (mapping_menu), menuitem);
       gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
-      gtk_widget_show(menuitem);
+      gtk_widget_show (menuitem);
       gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
                          (GtkSignalFunc) gtk_input_dialog_set_mapping_mode,
                          GINT_TO_POINTER (GDK_MODE_DISABLED));
 
-      menuitem = gtk_menu_item_new_with_label("Screen");
-      gtk_menu_append(GTK_MENU(mapping_menu),menuitem);
+      menuitem = gtk_menu_item_new_with_label(_("Screen"));
+      gtk_menu_shell_append (GTK_MENU_SHELL (mapping_menu), menuitem);
       gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
-      gtk_widget_show(menuitem);
+      gtk_widget_show (menuitem);
       gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
                          (GtkSignalFunc) gtk_input_dialog_set_mapping_mode,
                          GINT_TO_POINTER (GDK_MODE_SCREEN));
 
-      menuitem = gtk_menu_item_new_with_label("Window");
-      gtk_menu_append(GTK_MENU(mapping_menu),menuitem);
+      menuitem = gtk_menu_item_new_with_label(_("Window"));
+      gtk_menu_shell_append (GTK_MENU_SHELL (mapping_menu), menuitem);
       gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
-      gtk_widget_show(menuitem);
+      gtk_widget_show (menuitem);
       gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
                          (GtkSignalFunc) gtk_input_dialog_set_mapping_mode,
                          GINT_TO_POINTER (GDK_MODE_WINDOW));
 
-      label = gtk_label_new("Mode: ");
+      label = gtk_label_new_with_mnemonic (_("_Mode: "));
       gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
 
       inputd->mode_optionmenu = gtk_option_menu_new ();
+      gtk_label_set_mnemonic_widget (GTK_LABEL (label), inputd->mode_optionmenu);
       gtk_box_pack_start (GTK_BOX (util_box), inputd->mode_optionmenu, FALSE, FALSE, 2);
       gtk_widget_show (inputd->mode_optionmenu);
       gtk_option_menu_set_menu (GTK_OPTION_MENU (inputd->mode_optionmenu), mapping_menu);
@@ -294,7 +290,7 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
       
       /*  The axis listbox  */
 
-      label = gtk_label_new ("Axes");
+      label = gtk_label_new_with_mnemonic (_("_Axes"));
 
       inputd->axis_listbox = gtk_scrolled_window_new (NULL, NULL);
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(inputd->axis_listbox),
@@ -310,7 +306,7 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
 
       /* Keys listbox */
 
-      label = gtk_label_new ("Keys");
+      label = gtk_label_new_with_mnemonic (_("_Keys"));
 
       inputd->keys_listbox = gtk_scrolled_window_new (NULL, NULL);
       gtk_widget_set_usize (inputd->keys_listbox, KEYS_LIST_WIDTH, KEYS_LIST_HEIGHT);
@@ -325,14 +321,13 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
 
       /* ...set_device expects to get input dialog from widget user data */
       gtk_object_set_user_data (GTK_OBJECT (inputd), inputd);
-      gtk_input_dialog_set_device(GTK_WIDGET(inputd), 
-          GUINT_TO_POINTER (((GdkDeviceInfo *)device_info->data)->deviceid));
+      gtk_input_dialog_set_device (GTK_WIDGET(inputd), device_info->data);
 
     }
 
   /* We create the save button in any case, so that clients can 
      connect to it, without paying attention to whether it exits */
-  inputd->save_button = gtk_button_new_with_label ("Save");
+  inputd->save_button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
   GTK_WIDGET_SET_FLAGS (inputd->save_button, GTK_CAN_DEFAULT);
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG(inputd)->action_area),
                      inputd->save_button, TRUE, TRUE, 0);
@@ -341,7 +336,7 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
   if (g_list_length(device_info) <= 1) /* only core device */
     gtk_widget_set_sensitive(inputd->save_button, FALSE);
 
-  inputd->close_button = gtk_button_new_with_label ("Close");
+  inputd->close_button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
   GTK_WIDGET_SET_FLAGS (inputd->close_button, GTK_CAN_DEFAULT);
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG(inputd)->action_area),
                      inputd->close_button, TRUE, TRUE, 0);
@@ -350,6 +345,8 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
   gtk_widget_grab_default (inputd->close_button);
 
   gtk_widget_show (vbox);
+
+  gtk_widget_pop_composite_child ();
 }
 
 
@@ -366,54 +363,42 @@ gtk_input_dialog_new (void)
 static void
 gtk_input_dialog_set_device(GtkWidget *widget, gpointer data)
 {
-  guint32 deviceid = GPOINTER_TO_UINT(data);
-  GdkDeviceInfo *info;
+  GdkDevice *device = data;
 
   GtkInputDialog *inputd = GTK_INPUT_DIALOG(
                 gtk_object_get_user_data(GTK_OBJECT(widget)));
 
-  inputd->current_device = deviceid;
-  info = gtk_input_dialog_get_device_info (deviceid);
+  inputd->current_device = device;
 
-  gtk_input_dialog_fill_axes(inputd, info);
-  gtk_input_dialog_fill_keys(inputd, info);
+  gtk_input_dialog_fill_axes(inputd, device);
+  gtk_input_dialog_fill_keys(inputd, device);
 
   gtk_option_menu_set_history(GTK_OPTION_MENU(inputd->mode_optionmenu),
-                             info->mode);
-}
-
-static void
-gtk_input_dialog_finalize (GtkObject *object)
-{
-  /*  GtkInputDialog *inputd = GTK_INPUT_DIALOG (object); */
-
-  /* Clean up ? */
-
-  (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
+                             device->mode);
 }
 
 static void
-gtk_input_dialog_set_mapping_mode(GtkWidget *w,
-                                 gpointer data)
+gtk_input_dialog_set_mapping_mode (GtkWidget *w,
+                                  gpointer   data)
 {
   GtkInputDialog *inputd = GTK_INPUT_DIALOG(
                 gtk_object_get_user_data(GTK_OBJECT(w)));
-  GdkDeviceInfo *info = gtk_input_dialog_get_device_info (inputd->current_device);
+  GdkDevice *info = inputd->current_device;
   GdkInputMode old_mode = info->mode;
   GdkInputMode mode = GPOINTER_TO_INT (data);
 
   if (mode != old_mode)
     {
-      if (gdk_input_set_mode(inputd->current_device, mode))
+      if (gdk_device_set_mode (inputd->current_device, mode))
        {
          if (mode == GDK_MODE_DISABLED)
            gtk_signal_emit (GTK_OBJECT (inputd),
                             input_dialog_signals[DISABLE_DEVICE],
-                            info->deviceid);
+                            info);
          else
            gtk_signal_emit (GTK_OBJECT (inputd),
                             input_dialog_signals[ENABLE_DEVICE],
-                            info->deviceid);
+                            info);
        }
       else
        gtk_option_menu_set_history (GTK_OPTION_MENU (inputd->mode_optionmenu),
@@ -430,7 +415,7 @@ gtk_input_dialog_set_axis(GtkWidget *widget, gpointer data)
   GdkAxisUse old_use;
   GdkAxisUse *new_axes;
   GtkInputDialog *inputd = GTK_INPUT_DIALOG (gtk_object_get_user_data (GTK_OBJECT (widget)));
-  GdkDeviceInfo *info = gtk_input_dialog_get_device_info (inputd->current_device);
+  GdkDevice *info = inputd->current_device;
 
   gint axis = (GPOINTER_TO_INT(data) >> 16) - 1;
   gint old_axis;
@@ -440,13 +425,13 @@ gtk_input_dialog_set_axis(GtkWidget *widget, gpointer data)
   old_axis = -1;
   for (i=0;i<info->num_axes;i++)
     {
-      new_axes[i] = info->axes[i];
-      if (info->axes[i] == use)
+      new_axes[i] = info->axes[i].use;
+      if (info->axes[i].use == use)
        old_axis = i;
     }
 
   if (axis != -1)
-    old_use = info->axes[axis];
+    old_use = info->axes[axis].use;
   else
     old_use = GDK_AXIS_IGNORE;
 
@@ -464,10 +449,10 @@ gtk_input_dialog_set_axis(GtkWidget *widget, gpointer data)
   else
     {
       if (axis != -1)
-       new_axes[axis] = use;
+       gdk_device_set_axis_use (info, axis, use);
 
       if (old_axis != -1)
-       new_axes[old_axis] = old_use;
+       gdk_device_set_axis_use (info, old_axis, old_use);
 
       if (old_use != GDK_AXIS_IGNORE)
        {
@@ -475,23 +460,23 @@ gtk_input_dialog_set_axis(GtkWidget *widget, gpointer data)
                GTK_OPTION_MENU (inputd->axis_items[old_use]),
                old_axis + 1);
        }
-      gdk_input_set_axes (info->deviceid, new_axes);
     }
 
   g_free (new_axes);
 }
 
 static void
-gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
+gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDevice *info)
 {
   static const char *axis_use_strings[GDK_AXIS_LAST] =
   {
     "",
-    "X",
-    "Y",
-    "Pressure",
-    "X Tilt",
-    "Y Tilt"
+    N_("X"),
+    N_("Y"),
+    N_("Pressure"),
+    N_("X Tilt"),
+    N_("Y Tilt"),
+    N_("Wheel")
   };
 
   int i,j;
@@ -518,7 +503,7 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
     {
       /* create the label */
 
-      label = gtk_label_new(axis_use_strings[i]);
+      label = gtk_label_new (_(axis_use_strings[i]));
       gtk_table_attach (GTK_TABLE (inputd->axis_list), label, 0, 1, i, i+1, 
                        0, 0, 2, 2);
 
@@ -531,7 +516,7 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
          GtkWidget *menu_item;
 
          if (j == -1)
-           menu_item = gtk_menu_item_new_with_label ("none");
+           menu_item = gtk_menu_item_new_with_label (_("none"));
          else
            {
              sprintf (buffer,"%d",j+1);
@@ -542,7 +527,7 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
                              (GtkSignalFunc) gtk_input_dialog_set_axis,
                              GINT_TO_POINTER (0x10000 * (j + 1) + i));
          gtk_widget_show (menu_item);
-         gtk_menu_append (GTK_MENU (menu), menu_item);
+         gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
        }
 
       inputd->axis_items[i] = option_menu = gtk_option_menu_new ();
@@ -552,7 +537,7 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
       gtk_widget_show (option_menu);
       gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
       for (j = 0; j < info->num_axes; j++)
-       if (info->axes[j] == (GdkAxisUse) i)
+       if (info->axes[j].use == (GdkAxisUse) i)
          {
            gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), j+1);
            break;
@@ -565,8 +550,8 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
 static void 
 gtk_input_dialog_clear_key (GtkWidget *widget, GtkInputKeyInfo *key)
 {
-  gtk_entry_set_text (GTK_ENTRY(key->entry), "(disabled)");
-  gdk_input_set_key (key->inputd->current_device, key->index, 0, 0);
+  gtk_entry_set_text (GTK_ENTRY(key->entry), _("(disabled)"));
+  gdk_device_set_key (key->inputd->current_device, key->index, 0, 0);
 }
 
 static void 
@@ -581,9 +566,9 @@ gtk_input_dialog_set_key (GtkInputKeyInfo *key,
       str = g_string_new("");
       
       if (modifiers & GDK_SHIFT_MASK)
-       g_string_append (str, "Shft+");
+       g_string_append (str, "Shift+");
       if (modifiers & GDK_CONTROL_MASK)
-       g_string_append (str, "Ctl+");
+       g_string_append (str, "Ctrl+");
       if (modifiers & GDK_MOD1_MASK)
        g_string_append (str, "Alt+");
       
@@ -594,14 +579,14 @@ gtk_input_dialog_set_key (GtkInputKeyInfo *key,
          g_string_append (str, chars);
        }
       else
-       g_string_append (str, "(unknown)");
+       g_string_append (str, _("(unknown)"));
       gtk_entry_set_text (GTK_ENTRY(key->entry), str->str);
 
       g_string_free (str, TRUE);
     }
   else
     {
-      gtk_entry_set_text (GTK_ENTRY(key->entry), "(disabled)");
+      gtk_entry_set_text (GTK_ENTRY(key->entry), _("(disabled)"));
     }
 }
 
@@ -611,8 +596,8 @@ gtk_input_dialog_key_press (GtkWidget *widget,
                            GtkInputKeyInfo *key)
 {
   gtk_input_dialog_set_key (key, event->keyval, event->state & 0xFF);
-  gdk_input_set_key (key->inputd->current_device, key->index, 
-                    event->keyval, event->state & 0xFF);
+  gdk_device_set_key (key->inputd->current_device, key->index, 
+                     event->keyval, event->state & 0xFF);
 
   gtk_signal_emit_stop_by_name (GTK_OBJECT(widget), "key_press_event");
   
@@ -626,7 +611,7 @@ gtk_input_dialog_destroy_key (GtkWidget *widget, GtkInputKeyInfo *key)
 }
 
 static void
-gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDeviceInfo *info)
+gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDevice *info)
 {
   int i;
   GtkWidget *label;
@@ -658,8 +643,8 @@ gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDeviceInfo *info)
 
       /* create the label */
 
-      sprintf(buffer, "%d", i+1);
-      label = gtk_label_new(buffer);
+      sprintf (buffer, "%d", i+1);
+      label = gtk_label_new (buffer);
       gtk_table_attach (GTK_TABLE (inputd->keys_list), label, 0, 1, i, i+1, 
                        0, 0, 2, 2);
       gtk_widget_show (label);
@@ -679,7 +664,7 @@ gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDeviceInfo *info)
       
       /* and clear button */
 
-      button = gtk_button_new_with_label ("clear");
+      button = gtk_button_new_with_label (_("clear"));
       gtk_table_attach (GTK_TABLE (inputd->keys_list), button, 2, 3, i, i+1, 
                        0, 0, 2, 2);
       gtk_widget_show (button);