remove key bindings. i hate gtk. i saved a diff.
authorDana Jansens <danakj@orodu.net>
Fri, 1 Jun 2007 00:03:32 +0000 (00:03 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 1 Jun 2007 00:03:32 +0000 (00:03 +0000)
Makefile.am
src/keybindings.c [deleted file]
src/keybindings.h [deleted file]
src/main.c
src/obconf.glade
src/strings.c

index b87eb38..f66313d 100644 (file)
@@ -51,8 +51,6 @@ src_obconf_SOURCES = \
        src/main.h \
        src/appearance.c \
        src/appearance.h \
-       src/keybindings.c \
-       src/keybindings.h \
        src/preview.c \
        src/preview.h \
        src/preview_update.c \
diff --git a/src/keybindings.c b/src/keybindings.c
deleted file mode 100644 (file)
index fcf0bcc..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
-
-   keybindings.c for ObConf, the configuration tool for Openbox
-   Copyright (c) 2007        Dana Jansens
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program 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 General Public License for more details.
-
-   See the COPYING file for a copy of the GNU General Public License.
-*/
-
-#include "main.h"
-#include "tree.h"
-
-static gboolean      mapping = FALSE;
-static gchar        *saved_text = NULL;
-static GtkListStore *binding_store;
-
-static gboolean validate_key(const gchar *s);
-static void on_key_cell_edited(GtkCellRendererText *cell,
-                               const gchar *path_string,
-                               const gchar *new_text,
-                               gpointer data);
-
-void keybindings_setup_tab()
-{
-    GtkWidget *w;
-    GtkCellRenderer *render;
-    GtkTreeViewColumn *column;
-    GtkTreeSelection *select;
-    gchar *s;
-
-    mapping = TRUE;
-
-    w = get_widget("chain_quit_key");
-    s = tree_get_string("keyboard/chainQuitKey", "C-g");
-    gtk_entry_set_text(GTK_ENTRY(w), s);
-    g_free(s);
-
-    /* widget setup */
-    w = get_widget("key_bindings");
-    binding_store = gtk_list_store_new(2, G_TYPE_STRING, GTK_TYPE_COMBO_BOX);
-    gtk_tree_view_set_model(GTK_TREE_VIEW(w), GTK_TREE_MODEL(binding_store));
-    g_object_unref (binding_store);
-
-    gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(w)),
-                                GTK_SELECTION_SINGLE);
-
-    /* text column for the keys */
-    render = gtk_cell_renderer_text_new();
-    g_signal_connect(render, "edited",
-                     G_CALLBACK(on_key_cell_edited), NULL);
-    column = gtk_tree_view_column_new_with_attributes
-        ("Key", render, "text", 0, NULL);
-    gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
-
-    /* combo box column, for the actions */
-    render = gtk_cell_renderer_combo_new();
-    column = gtk_tree_view_column_new_with_attributes
-        ("Action", render, "text", 0, NULL);
-    gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
-
-    mapping = FALSE;
-}
-
-static void on_key_cell_edited(GtkCellRendererText *cell,
-                               const gchar *path_string,
-                               const gchar *new_text,
-                               gpointer data)
-{
-    if (mapping) return;
-
-    if (!validate_key(new_text)) {
-        g_print("bad key binding: %s\n", new_text);
-    } else {
-        GtkTreePath *path;
-        GtkTreeIter it;
-        gchar *old_text;
-
-        path = gtk_tree_path_new_from_string (path_string);
-        gtk_tree_model_get_iter(GTK_TREE_MODEL(binding_store), &it, path);
-
-        gtk_tree_model_get(GTK_TREE_MODEL(binding_store), &it, 0,
-                           &old_text, -1);
-        g_free(old_text);
-
-        gtk_list_store_set(binding_store, &it, 0, new_text, -1);
-
-        //tree_set_string("keyboard/keybind:key=%s", s);
-    }
-}
-
-void on_chain_quit_key_focus_in(GtkEntry *w, gpointer data)
-{
-    g_assert(saved_text == NULL);
-    saved_text = g_strdup(gtk_entry_get_text(w));
-}
-
-void on_chain_quit_key_focus_out(GtkEntry *w, gpointer data)
-{
-    const gchar *s;
-
-    if (mapping) return;
-
-    s = gtk_entry_get_text(w);
-    if (!validate_key(s)) {
-        g_print("bad key binding: %s\n", s);
-        gtk_entry_set_text(w, saved_text);
-    } else
-        tree_set_string("keyboard/chainQuitKey", s);
-
-    g_free(saved_text);
-    saved_text = NULL;
-}
-
-static gboolean validate_key(const gchar *s)
-{
-    const gchar *next;
-    const gchar *valid[] = { "Mod1", "Mod2", "Mod3", "Mod4", "Mod5",
-                             "Control", "C", "Alt", "A", "Meta", "M",
-                             "Super", "W", "Shift", "S", "Hyper", "H",
-                             NULL };
-
-    while ((next = strchr(s, '-'))) {
-        /* it's a modifier, validate it */
-        const gchar **it;
-        gboolean found = FALSE;
-
-        for (it = valid; *it && !found; ++it)
-            if (!g_ascii_strncasecmp(*it, s, strlen(*it)))
-                found = TRUE;
-
-        if (!found) {
-            g_print("Invalid modifier\n");
-            return FALSE;
-        }
-
-        s = next + 1; /* skip past the '-' */
-    }
-    /* we're at the real key part */
-    if (!gdk_keyval_from_name(s)) {
-        g_print("Invalid key: %s\n", s);
-        return FALSE;
-    }
-
-    return TRUE;
-}
diff --git a/src/keybindings.h b/src/keybindings.h
deleted file mode 100644 (file)
index 4521270..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
-
-   keybindings.h for ObConf, the configuration tool for Openbox
-   Copyright (c) 2003-2007   Dana Jansens
-   Copyright (c) 2003        Tim Riley
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program 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 General Public License for more details.
-
-   See the COPYING file for a copy of the GNU General Public License.
-*/
-
-#ifndef obconf__keybindings_h
-#define obconf__keybindings_h
-
-void keybindings_setup_tab();
-
-#endif
index db30665..c8008a2 100644 (file)
@@ -159,7 +159,6 @@ int main(int argc, char **argv)
     behavior_setup_tab();
     desktops_setup_tab();
     dock_setup_tab();
-    keybindings_setup_tab();
 
     mainwin = get_widget("main_window");
 
index ac876eb..2753748 100644 (file)
@@ -3254,316 +3254,6 @@ C - The close button</property>
              <property name="type">tab</property>
            </packing>
          </child>
-
-         <child>
-           <widget class="GtkVBox" id="vbox45">
-             <property name="border_width">12</property>
-             <property name="visible">True</property>
-             <property name="homogeneous">False</property>
-             <property name="spacing">18</property>
-
-             <child>
-               <widget class="GtkVBox" id="vbox46">
-                 <property name="visible">True</property>
-                 <property name="homogeneous">False</property>
-                 <property name="spacing">6</property>
-
-                 <child>
-                   <widget class="GtkLabel" id="label112">
-                     <property name="visible">True</property>
-                     <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Key Bindings&lt;/span&gt;</property>
-                     <property name="use_underline">False</property>
-                     <property name="use_markup">True</property>
-                     <property name="justify">GTK_JUSTIFY_LEFT</property>
-                     <property name="wrap">False</property>
-                     <property name="selectable">False</property>
-                     <property name="xalign">0</property>
-                     <property name="yalign">0.5</property>
-                     <property name="xpad">0</property>
-                     <property name="ypad">0</property>
-                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                     <property name="width_chars">-1</property>
-                     <property name="single_line_mode">False</property>
-                     <property name="angle">0</property>
-                   </widget>
-                   <packing>
-                     <property name="padding">0</property>
-                     <property name="expand">False</property>
-                     <property name="fill">False</property>
-                   </packing>
-                 </child>
-
-                 <child>
-                   <widget class="GtkHBox" id="hbox62">
-                     <property name="visible">True</property>
-                     <property name="homogeneous">False</property>
-                     <property name="spacing">0</property>
-
-                     <child>
-                       <widget class="GtkLabel" id="label113">
-                         <property name="visible">True</property>
-                         <property name="label" translatable="yes">    </property>
-                         <property name="use_underline">False</property>
-                         <property name="use_markup">False</property>
-                         <property name="justify">GTK_JUSTIFY_LEFT</property>
-                         <property name="wrap">False</property>
-                         <property name="selectable">False</property>
-                         <property name="xalign">0.5</property>
-                         <property name="yalign">0.5</property>
-                         <property name="xpad">0</property>
-                         <property name="ypad">0</property>
-                         <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                         <property name="width_chars">-1</property>
-                         <property name="single_line_mode">False</property>
-                         <property name="angle">0</property>
-                       </widget>
-                       <packing>
-                         <property name="padding">0</property>
-                         <property name="expand">False</property>
-                         <property name="fill">False</property>
-                       </packing>
-                     </child>
-
-                     <child>
-                       <widget class="GtkScrolledWindow" id="scrolledwindow4">
-                         <property name="visible">True</property>
-                         <property name="can_focus">True</property>
-                         <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                         <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                         <property name="shadow_type">GTK_SHADOW_IN</property>
-                         <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
-                         <child>
-                           <widget class="GtkViewport" id="viewport1">
-                             <property name="visible">True</property>
-                             <property name="shadow_type">GTK_SHADOW_IN</property>
-
-                             <child>
-                               <widget class="GtkVBox" id="vbox47">
-                                 <property name="visible">True</property>
-                                 <property name="homogeneous">False</property>
-                                 <property name="spacing">0</property>
-
-                                 <child>
-                                   <widget class="GtkHBox" id="hbox63">
-                                     <property name="visible">True</property>
-                                     <property name="homogeneous">False</property>
-                                     <property name="spacing">0</property>
-
-                                     <child>
-                                       <widget class="GtkTreeView" id="key_bindings">
-                                         <property name="visible">True</property>
-                                         <property name="can_focus">True</property>
-                                         <property name="headers_visible">True</property>
-                                         <property name="rules_hint">False</property>
-                                         <property name="reorderable">False</property>
-                                         <property name="enable_search">True</property>
-                                         <property name="fixed_height_mode">False</property>
-                                         <property name="hover_selection">False</property>
-                                         <property name="hover_expand">False</property>
-                                       </widget>
-                                       <packing>
-                                         <property name="padding">0</property>
-                                         <property name="expand">True</property>
-                                         <property name="fill">True</property>
-                                       </packing>
-                                     </child>
-                                   </widget>
-                                   <packing>
-                                     <property name="padding">0</property>
-                                     <property name="expand">True</property>
-                                     <property name="fill">True</property>
-                                   </packing>
-                                 </child>
-                               </widget>
-                             </child>
-                           </widget>
-                         </child>
-                       </widget>
-                       <packing>
-                         <property name="padding">0</property>
-                         <property name="expand">True</property>
-                         <property name="fill">True</property>
-                       </packing>
-                     </child>
-                   </widget>
-                   <packing>
-                     <property name="padding">0</property>
-                     <property name="expand">True</property>
-                     <property name="fill">True</property>
-                   </packing>
-                 </child>
-               </widget>
-               <packing>
-                 <property name="padding">0</property>
-                 <property name="expand">True</property>
-                 <property name="fill">True</property>
-               </packing>
-             </child>
-
-             <child>
-               <widget class="GtkVBox" id="vbox48">
-                 <property name="visible">True</property>
-                 <property name="homogeneous">False</property>
-                 <property name="spacing">6</property>
-
-                 <child>
-                   <widget class="GtkLabel" id="label114">
-                     <property name="visible">True</property>
-                     <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Key Chains&lt;/span&gt;</property>
-                     <property name="use_underline">False</property>
-                     <property name="use_markup">True</property>
-                     <property name="justify">GTK_JUSTIFY_LEFT</property>
-                     <property name="wrap">False</property>
-                     <property name="selectable">False</property>
-                     <property name="xalign">0</property>
-                     <property name="yalign">0.5</property>
-                     <property name="xpad">0</property>
-                     <property name="ypad">0</property>
-                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                     <property name="width_chars">-1</property>
-                     <property name="single_line_mode">False</property>
-                     <property name="angle">0</property>
-                   </widget>
-                   <packing>
-                     <property name="padding">0</property>
-                     <property name="expand">False</property>
-                     <property name="fill">False</property>
-                   </packing>
-                 </child>
-
-                 <child>
-                   <widget class="GtkHBox" id="hbox64">
-                     <property name="visible">True</property>
-                     <property name="homogeneous">False</property>
-                     <property name="spacing">0</property>
-
-                     <child>
-                       <widget class="GtkLabel" id="label115">
-                         <property name="visible">True</property>
-                         <property name="label" translatable="yes">    </property>
-                         <property name="use_underline">False</property>
-                         <property name="use_markup">False</property>
-                         <property name="justify">GTK_JUSTIFY_LEFT</property>
-                         <property name="wrap">False</property>
-                         <property name="selectable">False</property>
-                         <property name="xalign">0.5</property>
-                         <property name="yalign">0.5</property>
-                         <property name="xpad">0</property>
-                         <property name="ypad">0</property>
-                         <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                         <property name="width_chars">-1</property>
-                         <property name="single_line_mode">False</property>
-                         <property name="angle">0</property>
-                       </widget>
-                       <packing>
-                         <property name="padding">0</property>
-                         <property name="expand">False</property>
-                         <property name="fill">False</property>
-                       </packing>
-                     </child>
-
-                     <child>
-                       <widget class="GtkHBox" id="hbox65">
-                         <property name="visible">True</property>
-                         <property name="homogeneous">False</property>
-                         <property name="spacing">3</property>
-
-                         <child>
-                           <widget class="GtkLabel" id="label116">
-                             <property name="visible">True</property>
-                             <property name="label" translatable="yes">Escape key chains:</property>
-                             <property name="use_underline">False</property>
-                             <property name="use_markup">False</property>
-                             <property name="justify">GTK_JUSTIFY_LEFT</property>
-                             <property name="wrap">False</property>
-                             <property name="selectable">False</property>
-                             <property name="xalign">0.5</property>
-                             <property name="yalign">0.5</property>
-                             <property name="xpad">0</property>
-                             <property name="ypad">0</property>
-                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                             <property name="width_chars">-1</property>
-                             <property name="single_line_mode">False</property>
-                             <property name="angle">0</property>
-                           </widget>
-                           <packing>
-                             <property name="padding">0</property>
-                             <property name="expand">False</property>
-                             <property name="fill">False</property>
-                           </packing>
-                         </child>
-
-                         <child>
-                           <widget class="GtkEntry" id="chain_quit_key">
-                             <property name="visible">True</property>
-                             <property name="can_focus">True</property>
-                             <property name="editable">True</property>
-                             <property name="visibility">True</property>
-                             <property name="max_length">0</property>
-                             <property name="text" translatable="yes"></property>
-                             <property name="has_frame">True</property>
-                             <property name="invisible_char">‚óŹ</property>
-                             <property name="activates_default">False</property>
-                             <signal name="focus_out_event" handler="on_chain_quit_key_focus_out" after="yes" last_modification_time="Thu, 31 May 2007 22:14:24 GMT"/>
-                             <signal name="focus_in_event" handler="on_chain_quit_key_focus_in" after="yes" last_modification_time="Thu, 31 May 2007 22:15:25 GMT"/>
-                           </widget>
-                           <packing>
-                             <property name="padding">0</property>
-                             <property name="expand">True</property>
-                             <property name="fill">True</property>
-                           </packing>
-                         </child>
-                       </widget>
-                       <packing>
-                         <property name="padding">0</property>
-                         <property name="expand">True</property>
-                         <property name="fill">True</property>
-                       </packing>
-                     </child>
-                   </widget>
-                   <packing>
-                     <property name="padding">0</property>
-                     <property name="expand">True</property>
-                     <property name="fill">True</property>
-                   </packing>
-                 </child>
-               </widget>
-               <packing>
-                 <property name="padding">0</property>
-                 <property name="expand">False</property>
-                 <property name="fill">True</property>
-               </packing>
-             </child>
-           </widget>
-           <packing>
-             <property name="tab_expand">False</property>
-             <property name="tab_fill">True</property>
-           </packing>
-         </child>
-
-         <child>
-           <widget class="GtkLabel" id="label111">
-             <property name="visible">True</property>
-             <property name="label" translatable="yes">Key Bindings</property>
-             <property name="use_underline">False</property>
-             <property name="use_markup">False</property>
-             <property name="justify">GTK_JUSTIFY_LEFT</property>
-             <property name="wrap">False</property>
-             <property name="selectable">False</property>
-             <property name="xalign">0.5</property>
-             <property name="yalign">0.5</property>
-             <property name="xpad">0</property>
-             <property name="ypad">0</property>
-             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-             <property name="width_chars">-1</property>
-             <property name="single_line_mode">False</property>
-             <property name="angle">0</property>
-           </widget>
-           <packing>
-             <property name="type">tab</property>
-           </packing>
-         </child>
        </widget>
        <packing>
          <property name="padding">0</property>
index f9153f6..eed4123 100644 (file)
@@ -97,12 +97,6 @@ gchar *s = N_("    ");
 gchar *s = N_("Delay before _showing:");
 gchar *s = N_("ms");
 gchar *s = N_("Dock");
-gchar *s = N_("<span weight=\"bold\">Key Bindings</span>");
-gchar *s = N_("    ");
-gchar *s = N_("<span weight=\"bold\">Key Chains</span>");
-gchar *s = N_("    ");
-gchar *s = N_("Escape key chains:");
-gchar *s = N_("Key Bindings");
 gchar *s = N_("Abo_ut");
 gchar *s = N_("About ObConf");
 gchar *s = N_("<span weight=\"bold\" size=\"xx-large\">ObConf VERSION</span>");