metacity r3966 - in trunk: . src/core



Author: tthurman
Date: Sat Oct 18 04:33:14 2008
New Revision: 3966
URL: http://svn.gnome.org/viewvc/metacity?rev=3966&view=rev

Log:
2008-10-18  Thomas Thurman  <tthurman gnome org>

        During a discussion with Rodney Dawes about making life easier
        for the translators, he pointed out that the short and long
        forms of almost all the keybindings say much the same thing
        in different words.  I believe this is an unconscionable burden
        to place on translators, and have therefore merged the short
        and long descriptions into the short description.  The long
        is now a general explanation of the format, plus possibly a
        notice about reversibility.  Closes #469361, and should solve
        the l10n issue previously mentioned.

        * src/core/keybindings.c: reflect changes in *-bindings.h
        * src/core/schema-bindings.c: reflect changes in *-bindings.h
        * src/core/prefs.c: reflect changes in *-bindings.h
        * src/core/window-bindings.h: Add flags field, always the same
          currently, so that it's the same as screen-bindings.h.
          Also, lose ONLY_BOUND_BY_DEFAULT, since we already had a
          rather more elegant way to perform the same effect.
          And merge the long and short descriptions.
        * src/core/screen-bindings.h (, item): Merge the long and
          short descriptions.



Modified:
   trunk/ChangeLog
   trunk/src/core/keybindings.c
   trunk/src/core/prefs.c
   trunk/src/core/schema-bindings.c
   trunk/src/core/screen-bindings.h
   trunk/src/core/window-bindings.h

Modified: trunk/src/core/keybindings.c
==============================================================================
--- trunk/src/core/keybindings.c	(original)
+++ trunk/src/core/keybindings.c	Sat Oct 18 04:33:14 2008
@@ -55,7 +55,7 @@
                                      MetaKeyBinding *binding);
 
 /* Prototypes for handlers */
-#define item(name, suffix, param, short, long, stroke) \
+#define item(name, suffix, param, flags, description, stroke) \
 static void \
 handle_##name (MetaDisplay    *display,\
                MetaScreen     *screen,\
@@ -65,7 +65,7 @@
 #include "window-bindings.h"
 #undef item
 
-#define item(name, suffix, param, can_reverse, short, long, stroke) \
+#define item(name, suffix, param, flags, description, stroke) \
 static void \
 handle_##name (MetaDisplay    *display,\
                MetaScreen     *screen,\
@@ -135,7 +135,7 @@
 };
 
 static const MetaKeyHandler screen_handlers[] = {
-#define item(name, suffix, param, flags, short, long, stroke) \
+#define item(name, suffix, param, flags, description, stroke) \
    { #name suffix, handle_##name, param, flags },
 #include "screen-bindings.h"
 #undef item
@@ -143,14 +143,11 @@
 };
   
 static const MetaKeyHandler window_handlers[] = {
-/* FIXME: The flags=1 thing is pretty ugly here, but it'll really have
- * to wait until and if we merge the window and screen binding files.
- *
- * TODO: Are window bindings only ever called on non-null windows?
+/* TODO: Are window bindings only ever called on non-null windows?
  * If so, we can remove the check from all of them.
  */
-#define item(name, suffix, param, short, long, stroke) \
-  { #name suffix, handle_##name, param, 1 },
+#define item(name, suffix, param, flags, description, stroke) \
+  { #name suffix, handle_##name, param, flags },
 #include "window-bindings.h"
 #undef item
    { NULL, NULL, 0, 0 }

Modified: trunk/src/core/prefs.c
==============================================================================
--- trunk/src/core/prefs.c	(original)
+++ trunk/src/core/prefs.c	Sat Oct 18 04:33:14 2008
@@ -1815,21 +1815,18 @@
 #endif /* HAVE_GCONF */
 }
 
+#define item(name, suffix, param, flags, description, stroke) \
+  { #name suffix, NULL, flags & BINDING_REVERSES },
 static MetaKeyPref screen_bindings[] = {
-#define item(name, suffix, param, has_inverse, short, long, stroke) \
-  { #name suffix, NULL, has_inverse },
 #include "screen-bindings.h"
-#undef item
   { NULL, NULL, FALSE}
 };
 
 static MetaKeyPref window_bindings[] = {
-#define item(name, suffix, param, short, long, stroke) \
-  { #name suffix, NULL, FALSE },
 #include "window-bindings.h"
-#undef item
   { NULL, NULL, FALSE }
 };
+#undef item
 
 #ifndef HAVE_GCONF
 typedef struct
@@ -1839,14 +1836,14 @@
 } MetaSimpleKeyMapping;
 
 /* FIXME: This would be neater if the array only contained entries whose
- * default keystroke was non-null.  You can do this by defining
+ * default keystroke was non-null.  You COULD do this by defining
  * ONLY_BOUND_BY_DEFAULT around various blocks at the cost of making
  * the bindings file way more complicated.  However, we could stop this being
  * data and move it into code.  Then the compiler would optimise away
  * the problem lines.
  */
 static MetaSimpleKeyMapping screen_string_bindings[] = {
-#define item(name, suffix, param, is_reverse, short, long, keystroke) \
+#define item(name, suffix, param, flags, description, keystroke) \
   { #name suffix,                           keystroke                    },
 #include "screen-bindings.h"
 #undef item
@@ -1854,12 +1851,10 @@
 };
 
 static MetaSimpleKeyMapping window_string_bindings[] = {
-#define ONLY_BOUND_BY_DEFAULT
-#define item(name, suffix, param, short, long, keystroke) \
+#define item(name, suffix, param, flags, description, keystroke) \
   { #name suffix,                           keystroke                    },
 #include "window-bindings.h"
 #undef item
-#undef ONLY_BOUND_BY_DEFAULT
   { NULL,                                   NULL                         }
 };
 

Modified: trunk/src/core/schema-bindings.c
==============================================================================
--- trunk/src/core/schema-bindings.c	(original)
+++ trunk/src/core/schema-bindings.c	Sat Oct 18 04:33:14 2008
@@ -35,15 +35,18 @@
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
+
 #include <glib.h>
+#include "config.h"
 
 #define _(x) x
 
-static void single_stanza (gboolean is_window, char *name, char *default_value,
-               gboolean can_reverse, gboolean going_backwards,
-               char *short_description, char *long_description);
+static void single_stanza (gboolean is_window, const char *name,
+               const char *default_value,
+               gboolean can_reverse,
+               const char *description);
 
-char *liberal, *could_go_backwards, *could_go_forwards;
+char *about_keybindings, *about_reversible_keybindings;
 
 const char* window_string = \
 	"    <schema>\n" \
@@ -61,26 +64,20 @@
 	"    </schema>\n\n\n";
 
 static void
-single_stanza (gboolean is_window, char *name, char *default_value,
-               gboolean can_reverse, gboolean going_backwards,
-               char *short_description, char *long_description)
+single_stanza (gboolean is_window, const char *name,
+               const char *default_value,
+               gboolean can_reverse,
+               const char *description)
 {
   char *keybinding_type = is_window? "window": "global";
-  char *escaped_default_value;
+  char *escaped_default_value, *escaped_description;
 
-  if (short_description == NULL || long_description == NULL)
-    /* it must be undocumented, so it can't be in this table */
-    return;
+  if (description==NULL)
+    return; /* it must be undocumented, so it can't go in this table */
 
-  /* Escape the text.  The old values point at constants (literals, actually)
-   * so it doesn't matter that we lose the reference.
-   */
-  short_description = g_markup_escape_text (short_description, -1);
-  long_description = g_markup_escape_text (long_description, -1);
-  
-  escaped_default_value = g_markup_escape_text (
-        default_value? default_value: "disabled",
-        -1);
+  escaped_description = g_markup_escape_text (description, -1);
+  escaped_default_value = default_value==NULL? "disabled":
+        g_markup_escape_text (description, -1);
   
   printf ("    <schema>\n");
   printf ("      <key>/schemas/apps/metacity/%s_keybindings/%s</key>\n",
@@ -90,34 +87,19 @@
   printf ("      <owner>metacity</owner>\n");
   printf ("      <type>string</type>\n");
   printf ("      <default>%s</default>\n", escaped_default_value);
+  
   printf ("      <locale name=\"C\">\n");
-  printf ("        <short>%s</short>\n", short_description);
-  printf ("        <long>\n");
-  printf ("          %s\n", long_description);
+  printf ("        <short>%s</short>\n", description);
+  printf ("        <long>%s</long>\n",
+                   can_reverse? about_reversible_keybindings:
+                   about_keybindings);
+  printf ("      </locale>\n");
+  printf ("    </schema>\n\n");
 
-  if (can_reverse)
-    {
-      /* I don't think this is very useful, tbh: */
-      if (default_value != NULL)
-        {
-          printf (" (Traditionally %s)\n", escaped_default_value);
-        }
-
-      if (going_backwards)
-        printf ("%s\n", could_go_forwards);
-      else
-        printf ("%s\n", could_go_backwards);
-    }
+  g_free (escaped_description);
 
-  printf ("          %s\n", liberal);
-  
-  printf ("        </long>\n");
-  printf ("      </locale>\n");
-  printf ("    </schema>\n\n\n");
-  
-  g_free (escaped_default_value);
-  g_free (short_description);
-  g_free (long_description);
+  if (default_value!=NULL)
+    g_free (escaped_default_value);
 }
 
 static void produce_bindings ();
@@ -150,20 +132,14 @@
 
   if (!feof (metacity_schemas_in_in))
     {
-#define item(name, suffix, param, short, long, keystroke) \
-  single_stanza (TRUE, #name suffix, \
-              keystroke, \
-              FALSE, FALSE, \
-              short, long);
-#include "window-bindings.h"
-#undef item
-
-#define item(name, suffix, param, flags, short, long, keystroke) \
-  single_stanza (FALSE, #name suffix,  \
+#define item(name, suffix, param, flags, description, keystroke) \
+  single_stanza ( \
+               flags & BINDING_PER_WINDOW, \
+               #name suffix, \
                keystroke, \
                flags & BINDING_REVERSES, \
-               flags & BINDING_IS_REVERSED, \
-               short, long);
+               description);
+#include "window-bindings.h"
 #include "screen-bindings.h"
 #undef item
     }
@@ -187,27 +163,28 @@
    * are hardcoded (in gtk/gtkaccelgroup.c; it's not metacity's fault).
    * "disabled" must also stay as it is.
    */
-  liberal = g_markup_escape_text(_("The format looks like \"<Control>a\" or "
-        "<Shift><Alt>F1\". \n"\
+  about_keybindings = g_markup_escape_text(_( \
+        "The format looks like \"<Control>a\" or <Shift><Alt>F1\".\n\n"\
         "The parser is fairly liberal and allows "\
   	"lower or upper case, and also abbreviations such as \"<Ctl>\" and " \
 	"\"<Ctrl>\". If you set the option to the special string " \
-	"\"disabled\", then there will be no keybinding for this action."), -1);
-
-  /* These were more dissimilar at some point but have been regularised
-   * for the translators' benefit.
-   */
-  could_go_backwards = g_markup_escape_text (_("Holding the \"shift\" key "
-        "while using this binding reverses the direction of movement."), -1);
+	"\"disabled\", then there will be no keybinding for this action."),
+        -1);
 
-  could_go_forwards = g_markup_escape_text (_("Holding the \"shift\" key "
-        "while using this binding makes the direction go forward again."), -1);
+  about_reversible_keybindings = g_markup_escape_text(_( \
+        "The format looks like \"<Control>a\" or <Shift><Alt>F1\".\n\n"\
+        "The parser is fairly liberal and allows "\
+  	"lower or upper case, and also abbreviations such as \"<Ctl>\" and " \
+	"\"<Ctrl>\". If you set the option to the special string " \
+	"\"disabled\", then there will be no keybinding for this action.\n\n"\
+	"This keybinding may be reversed by holding down the \"shift\" key; "
+	"therefore, \"shift\" cannot be one of the keys it uses."),
+	-1);
 
   produce_bindings ();
-  
-  g_free (could_go_forwards);
-  g_free (could_go_backwards);
-  g_free (liberal);
+
+  g_free (about_keybindings);
+  g_free (about_reversible_keybindings);
   
   return 0;
 }

Modified: trunk/src/core/screen-bindings.h
==============================================================================
--- trunk/src/core/screen-bindings.h	(original)
+++ trunk/src/core/screen-bindings.h	Sat Oct 18 04:33:14 2008
@@ -59,12 +59,10 @@
  *       BINDING_IS_REVERSED - the same, but the senses are reversed from the
  *                             handler's point of view (let me know if I should
  *                             explain this better)
- *       
+ *
  *   5) a short description.  Mostly, you won't use this.
  *          It must be marked translatable (i.e. inside "_(...)").
- *   6) like short, except long.  Don't include all the stuff about
- *          the parser being fairly liberal.
- *   7) a string representing the default binding.
+ *   6) a string representing the default binding.
  *          If this is NULL, the action is unbound by default.
  *
  * Don't try to do XML entity escaping anywhere in the strings.
@@ -96,51 +94,39 @@
 
 item (switch_to_workspace, "_1", 1, 0,
         _("Switch to workspace 1"),
-        _("The keybinding that switches to workspace 1."),
         NULL)
 item (switch_to_workspace, "_2", 2, 0,
         _("Switch to workspace 2"),
-        _("The keybinding that switches to workspace 2."),
         NULL)
 item (switch_to_workspace, "_3", 3, 0,
         _("Switch to workspace 3"),
-        _("The keybinding that switches to workspace 3."),
         NULL)
 item (switch_to_workspace, "_4", 4, 0,
         _("Switch to workspace 4"),
-        _("The keybinding that switches to workspace 4."),
         NULL)
 item (switch_to_workspace, "_5", 5, 0,
         _("Switch to workspace 5"),
-        _("The keybinding that switches to workspace 5."),
         NULL)
 item (switch_to_workspace, "_6", 6, 0,
         _("Switch to workspace 6"),
-        _("The keybinding that switches to workspace 6."),
         NULL)
 item (switch_to_workspace, "_7", 7, 0,
         _("Switch to workspace 7"),
-        _("The keybinding that switches to workspace 7."),
         NULL)
 item (switch_to_workspace, "_8", 8, 0,
         _("Switch to workspace 8"),
-        _("The keybinding that switches to workspace 8."),
         NULL)
 item (switch_to_workspace, "_9", 9, 0,
         _("Switch to workspace 9"),
-        _("The keybinding that switches to workspace 9."),
         NULL)
 item (switch_to_workspace, "_10", 10, 0,
         _("Switch to workspace 10"),
-        _("The keybinding that switches to workspace 10."),
         NULL)
 item (switch_to_workspace, "_11", 11, 0,
         _("Switch to workspace 11"),
-        _("The keybinding that switches to workspace 11."),
         NULL)
 item (switch_to_workspace, "_12", 12, 0,
         _("Switch to workspace 12"),
-        _("The keybinding that switches to workspace 12."),
         NULL)
 
 /* META_MOTION_* are negative, and so distinct from workspace numbers,
@@ -152,27 +138,19 @@
  */
 
 item (switch_to_workspace, "_left",  META_MOTION_LEFT,  0,
-        _("Switch to workspace on the left"),
-        _("The keybinding that switches to the workspace on the left "
-          "of the current workspace."),
+        _("Switch to workspace on the left of the current workspace"),
         "<Control><Alt>Left")
 
 item (switch_to_workspace, "_right", META_MOTION_RIGHT, 0,
-        _("Switch to workspace on the right"),
-        _("The keybinding that switches to the workspace on the right "
-          "of the current workspace."),
+        _("Switch to workspace on the right of the current workspace"),
         "<Control><Alt>Right")
 
 item (switch_to_workspace, "_up",    META_MOTION_UP,    0,
-        _("Switch to workspace above this one"),
-        _("The keybinding that switches to the workspace above "
-          "the current workspace."),
+        _("Switch to workspace above the current workspace"),
         "<Control><Alt>Up")
 
 item (switch_to_workspace, "_down",  META_MOTION_DOWN,  0,
-        _("Switch to workspace below this one"),
-        _("The keybinding that switches to the workspace below "
-          "the current workspace."),
+        _("Switch to workspace below the current workspace"),
         "<Control><Alt>Down")
 
 /***********************************/
@@ -185,126 +163,107 @@
  */
 
 item (switch, "_group",            META_TAB_LIST_GROUP,    BINDING_REVERSES,
-        _("Move between windows of an application with popup"),
-        _("The keybinding used to move focus between windows of an"
-          "application, using a popup window."),           NULL)
+        _("Move between windows of an application, using a popup window"),
+        NULL)
 item (switch, "_group_backwards",  META_TAB_LIST_GROUP,    REVERSES_AND_REVERSED,
-        _("Move backwards between windows of an application with popup"),
-        _("The keybinding used to move focus backwards between windows"
-          "of an application, using a popup window."),     NULL)
+        _("Move backwards between windows of an application, "
+          "using a popup window"),
+        NULL)
 item (switch, "_windows",          META_TAB_LIST_NORMAL,   BINDING_REVERSES,
-        _("Move between windows with popup"),
-        _("The keybinding used to move focus between windows, "
-          "using a popup window."),                        "<Alt>Tab")
+        _("Move between windows, using a popup window"),
+        "<Alt>Tab")
 item (switch, "_windows_backwards",META_TAB_LIST_NORMAL,   REVERSES_AND_REVERSED,
-        _("Move focus backwards between windows using popup display"),
-        _("The keybinding used to move focus backwards between windows, "
-          "using a popup window."),                        NULL)
+        _("Move backwards between windows, using a popup window"),
+        NULL)
 item (switch, "_panels",           META_TAB_LIST_DOCKS,    BINDING_REVERSES,
-        _("Move between panels and the desktop with popup"),
-        _("The keybinding used to move focus between panels and the desktop, "
-          "using a popup window."),                        "<Control><Alt>Tab")
+        _("Move between panels and the desktop, using a popup window"),
+        "<Control><Alt>Tab")
 item (switch, "_panels_backwards", META_TAB_LIST_DOCKS,    REVERSES_AND_REVERSED,
-        _("Move backwards between panels and the desktop with popup"),
-        _("The keybinding used to move focus backwards between panels "
-          "and the desktop, using a popup window."),       NULL)
+        _("Move backwards between panels and the desktop, "
+          "using a popup window"),
+        NULL)
 item (cycle,  "_group",            META_TAB_LIST_GROUP,    BINDING_REVERSES,
         _("Move between windows of an application immediately"),
-        _("The keybinding used to move focus between windows of an "
-          "application without a popup window."),          "<Alt>F6")
+        "<Alt>F6")
 item (cycle,  "_group_backwards",  META_TAB_LIST_GROUP,    REVERSES_AND_REVERSED,
         _("Move backwards between windows of an application immediately"),
-        _("The keybinding used to move focus backwards between windows "
-          "of an application without a popup window."),    NULL)
+        NULL)
 item (cycle,  "_windows",          META_TAB_LIST_NORMAL,   BINDING_REVERSES,
         _("Move between windows immediately"),
-        _("The keybinding used to move focus between windows without "
-          "a popup window."),                              "<Alt>Escape")
+        "<Alt>Escape")
 item (cycle,  "_windows_backwards",META_TAB_LIST_NORMAL,   REVERSES_AND_REVERSED,
         _("Move backwards between windows immediately"),
-        _("The keybinding used to move focus backwards between windows "
-          "without a popup window."),                       NULL)
+        NULL)
 item (cycle,  "_panels",           META_TAB_LIST_DOCKS,    BINDING_REVERSES,
         _("Move between panels and the desktop immediately"),
-        _("The keybinding used to move focus between panels and "
-          "the desktop, without a popup window."),      "<Control><Alt>Escape")
+        "<Control><Alt>Escape")
 item (cycle,  "_panels_backwards", META_TAB_LIST_DOCKS,    REVERSES_AND_REVERSED,
-        _("Move backward between panels and the desktop immediately"),
-        _("The keybinding used to move focus backwards between panels and "
-          "the desktop, without a popup window."),         NULL)
+        _("Move backwards between panels and the desktop immediately"),
+        NULL)
 
 /***********************************/
      
 item (show_desktop, "", 0, 0,
-      _("Hide all windows and focus desktop"),
-      _("The keybinding used to hide all normal windows and set the "
-        "focus to the desktop background."),
+      _("Hide all normal windows and set focus to the desktop background"),
       "<Control><Alt>d")
 item (panel, "_main_menu", META_KEYBINDING_ACTION_PANEL_MAIN_MENU, 0,
-      _("Show the panel menu"),
-      _("The keybinding which shows the panel's main menu."),
+      _("Show the panel's main menu"),
       "<Alt>F1")
 item (panel, "_run_dialog", META_KEYBINDING_ACTION_PANEL_RUN_DIALOG, 0,
-      _("Show the panel run application dialog"),
-      _("The keybinding which display's the panel's \"Run Application\" "
-        "dialog box."),
+      _("Show the panel's \"Run Application\" dialog box"),
       "<Alt>F2")
 
 /* Yes, the param is offset by one.  Historical reasons.  (Maybe worth fixing
- * at some point.)  The short and long are NULL here because the stanza is
+ * at some point.)  The description is NULL here because the stanza is
  * irregularly shaped in metacity.schemas.in.  This will probably be fixed
  * as well.
  */
-item (run_command, "_1",   0, 0, NULL, NULL, NULL)
-item (run_command, "_2",   1, 0, NULL, NULL, NULL)
-item (run_command, "_3",   2, 0, NULL, NULL, NULL)
-item (run_command, "_4",   3, 0, NULL, NULL, NULL)
-item (run_command, "_5",   4, 0, NULL, NULL, NULL)
-item (run_command, "_6",   5, 0, NULL, NULL, NULL)
-item (run_command, "_7",   6, 0, NULL, NULL, NULL)
-item (run_command, "_8",   7, 0, NULL, NULL, NULL)
-item (run_command, "_9",   8, 0, NULL, NULL, NULL)
-item (run_command, "_10",  9, 0, NULL, NULL, NULL)
-item (run_command, "_11", 10, 0, NULL, NULL, NULL)
-item (run_command, "_12", 11, 0, NULL, NULL, NULL)
-item (run_command, "_13", 12, 0, NULL, NULL, NULL)
-item (run_command, "_14", 13, 0, NULL, NULL, NULL)
-item (run_command, "_15", 14, 0, NULL, NULL, NULL)
-item (run_command, "_16", 15, 0, NULL, NULL, NULL)
-item (run_command, "_17", 16, 0, NULL, NULL, NULL)
-item (run_command, "_18", 17, 0, NULL, NULL, NULL)
-item (run_command, "_19", 18, 0, NULL, NULL, NULL)
-item (run_command, "_20", 19, 0, NULL, NULL, NULL)
-item (run_command, "_21", 20, 0, NULL, NULL, NULL)
-item (run_command, "_22", 21, 0, NULL, NULL, NULL)
-item (run_command, "_23", 22, 0, NULL, NULL, NULL)
-item (run_command, "_24", 23, 0, NULL, NULL, NULL)
-item (run_command, "_25", 24, 0, NULL, NULL, NULL)
-item (run_command, "_26", 25, 0, NULL, NULL, NULL)
-item (run_command, "_27", 26, 0, NULL, NULL, NULL)
-item (run_command, "_28", 27, 0, NULL, NULL, NULL)
-item (run_command, "_29", 28, 0, NULL, NULL, NULL)
-item (run_command, "_30", 29, 0, NULL, NULL, NULL)
-item (run_command, "_31", 30, 0, NULL, NULL, NULL)
-item (run_command, "_32", 31, 0, NULL, NULL, NULL)
+item (run_command, "_1",   0, 0, NULL, NULL)
+item (run_command, "_2",   1, 0, NULL, NULL)
+item (run_command, "_3",   2, 0, NULL, NULL)
+item (run_command, "_4",   3, 0, NULL, NULL)
+item (run_command, "_5",   4, 0, NULL, NULL)
+item (run_command, "_6",   5, 0, NULL, NULL)
+item (run_command, "_7",   6, 0, NULL, NULL)
+item (run_command, "_8",   7, 0, NULL, NULL)
+item (run_command, "_9",   8, 0, NULL, NULL)
+item (run_command, "_10",  9, 0, NULL, NULL)
+item (run_command, "_11", 10, 0, NULL, NULL)
+item (run_command, "_12", 11, 0, NULL, NULL)
+item (run_command, "_13", 12, 0, NULL, NULL)
+item (run_command, "_14", 13, 0, NULL, NULL)
+item (run_command, "_15", 14, 0, NULL, NULL)
+item (run_command, "_16", 15, 0, NULL, NULL)
+item (run_command, "_17", 16, 0, NULL, NULL)
+item (run_command, "_18", 17, 0, NULL, NULL)
+item (run_command, "_19", 18, 0, NULL, NULL)
+item (run_command, "_20", 19, 0, NULL, NULL)
+item (run_command, "_21", 20, 0, NULL, NULL)
+item (run_command, "_22", 21, 0, NULL, NULL)
+item (run_command, "_23", 22, 0, NULL, NULL)
+item (run_command, "_24", 23, 0, NULL, NULL)
+item (run_command, "_25", 24, 0, NULL, NULL)
+item (run_command, "_26", 25, 0, NULL, NULL)
+item (run_command, "_27", 26, 0, NULL, NULL)
+item (run_command, "_28", 27, 0, NULL, NULL)
+item (run_command, "_29", 28, 0, NULL, NULL)
+item (run_command, "_30", 29, 0, NULL, NULL)
+item (run_command, "_31", 30, 0, NULL, NULL)
+item (run_command, "_32", 31, 0, NULL, NULL)
 
 item (run_command, "_screenshot", 32, 0,
       _("Take a screenshot"),
-      _("The keybinding which invokes the panel's screenshot utility."),
       "Print")
 item (run_command, "_window_screenshot", 33, 0,
       _("Take a screenshot of a window"),
-      _("The keybinding which invokes the panel's screenshot utility "
-        "to take a screenshot of a window."),
       "<Alt>Print")
 
 item (run_terminal, "", 0, 0,
       _("Run a terminal"),
-      _("The keybinding which invokes a terminal."),
       NULL)
 
-/* No descriptions because this is undocumented */
-item (set_spew_mark, "", 0, 0, NULL, NULL, NULL)
+/* No description because this is undocumented */
+item (set_spew_mark, "", 0, 0, NULL, NULL)
 
 #undef REVERSES_AND_REVERSED
 

Modified: trunk/src/core/window-bindings.h
==============================================================================
--- trunk/src/core/window-bindings.h	(original)
+++ trunk/src/core/window-bindings.h	Sat Oct 18 04:33:14 2008
@@ -43,26 +43,23 @@
  * process.
  *
  * The arguments to item() are:
- *   1) name: the name of the binding; a bareword identifier
- *   2) suffix: a string to add to the binding name to make the handler name
+ *   1) the name of the binding; a bareword identifier
+ *   2) a suffix to add to the binding name to make the handler name
  *              (usually the empty string)
- *   3) param: an integer parameter to pass to the handler
- *   4) short: a short description.  Mostly, you won't use this.
- *             It must be marked translatable (i.e. inside "_(...)").
- *   5) long: like short, except long.  Don't include all the stuff about
- *            the parser being fairly liberal.
- *   6) keystroke: a string representing the default binding.
- *            If this is NULL, the action is unbound by default.
+ *   3) an integer parameter to pass to the handler
+ *   4) a set of boolean flags, ORed together.
+ *         This is used in *this* file for completeness, but at present
+ *         is not checked anywhere.  We use the flag BINDING_PER_WINDOW
+ *         on all window-based bindings (i.e. every binding in this file).
+ *   5) a short description.  Mostly, you won't use this.
+ *         It must be marked translatable (i.e. inside "_(...)").
+ *   6) a string representing the default binding.
+ *         If this is NULL, the action is unbound by default.
  *
  * Don't try to do XML entity escaping anywhere in the strings.
  *
- * Some code out there wants only the entries which have a default
- * binding (i.e. whose sixth parameter is not NULL).  You can get only these
- * by defining ONLY_BOUND_BY_DEFAULT before you include this file.
- * 
  * Possible future work:
  *  - merge with screen-bindings.h somehow
- *  - ONLY_BOUND_BY_DEFAULT is crack, get rid of it
  *  - "suffix" is confusing; write it out in full
  */
 
@@ -70,126 +67,103 @@
 #error "item () must be defined when you include window-bindings.h"
 #endif
 
-item (activate_window_menu, "", 0,
-        _("Activate window menu"),
-        _("The keybinding used to activate the window menu."),
-        "<Alt>Space")
+/***********************************/
+/* FIXME: this is duplicated from screen-bindings.h; find a better
+ * solution, which may involve merging the two files */
+
+#ifndef _BINDINGS_DEFINED_CONSTANTS
+#define _BINDINGS_DEFINED_CONSTANTS 1
+
+#define BINDING_PER_WINDOW    0x01
+#define BINDING_REVERSES      0x02
+#define BINDING_IS_REVERSED   0x04
+
+/* FIXME: There is somewhere better for these; remove them */
+#define PANEL_MAIN_MENU            -1
+#define PANEL_RUN_DIALOG           -2
 
-#ifndef ONLY_BOUND_BY_DEFAULT
+#endif /* _BINDINGS_DEFINED_CONSTANTS */
 
-item (toggle_fullscreen, "", 0,
+
+item (activate_window_menu, "", 0, BINDING_PER_WINDOW,
+        _("Activate the window menu"),
+        "<Alt>Space")
+
+item (toggle_fullscreen, "", 0, BINDING_PER_WINDOW,
         _("Toggle fullscreen mode"),
-        _("The keybinding used to toggle fullscreen mode."),
         NULL)
-item (toggle_maximized, "", 0,
+item (toggle_maximized, "", 0, BINDING_PER_WINDOW,
         _("Toggle maximization state"),
-        _("The keybinding used to toggle maximization."),
         NULL)
-item (toggle_above, "", 0,
-        _("Toggle always on top state"),
-        _("The keybinding used to toggle always on top.  A window that is "
-          "always on top will always be visible over other overlapping "
-          "windows."),
+item (toggle_above, "", 0, BINDING_PER_WINDOW,
+        _("Toggle whether a window will always be visible over other windows"),
           NULL)
-#endif /* ONLY_BOUND_BY_DEFAULT */
 
-item (maximize, "", 0,
+item (maximize, "", 0, BINDING_PER_WINDOW,
         _("Maximize window"),
-        _("The keybinding used to maximize a window."),
         "<Alt>F10")
-item (unmaximize, "", 0,
+item (unmaximize, "", 0, BINDING_PER_WINDOW,
         _("Unmaximize window"),
-        _("The keybinding used to unmaximize a window."),
         "<Alt>F5")
 
-#ifndef ONLY_BOUND_BY_DEFAULT
-
-item (toggle_shaded, "", 0,
+item (toggle_shaded, "", 0, BINDING_PER_WINDOW,
         _("Toggle shaded state"),
-        _("The keybinding used to toggle shaded/unshaded state."),
         NULL)
         
-#endif /* ONLY_BOUND_BY_DEFAULT */
-
-item (minimize, "", 0,
+item (minimize, "", 0, BINDING_PER_WINDOW,
         _("Minimize window"),
-        _("The keybinding used to minimize a window."),
         "<Alt>F9")
-item (close, "", 0,
+item (close, "", 0, BINDING_PER_WINDOW,
         _("Close window"),
-        _("The keybinding used to close a window."),
         "<Alt>F4")
-item (begin_move, "", 0,
+item (begin_move, "", 0, BINDING_PER_WINDOW,
         _("Move window"),
-        _("The keybinding used to enter \"move mode\" "
-        "and begin moving a window using the keyboard."),
         "<Alt>F7")
-item (begin_resize, "", 0,
+item (begin_resize, "", 0, BINDING_PER_WINDOW,
         _("Resize window"),
-        ("The keybinding used to enter \"resize mode\" "
-        "and begin resizing a window using the keyboard."),
         "<Alt>F8")
 
-#ifndef ONLY_BOUND_BY_DEFAULT
-
-item (toggle_on_all_workspaces, "", 0,
-        _("Toggle window on all workspaces"),
-        _("The keybinding used to toggle whether the window is on all "
-          "workspaces or just one."),
+item (toggle_on_all_workspaces, "", 0, BINDING_PER_WINDOW,
+        _("Toggle whether window is on all workspaces or just one"),
           NULL)
 
-
-item (move_to_workspace, "_1", 1,
+item (move_to_workspace, "_1", 1, BINDING_PER_WINDOW,
         _("Move window to workspace 1"),
-        _("The keybinding used to move a window to workspace 1."),
         NULL)
-item (move_to_workspace, "_2", 2,
+item (move_to_workspace, "_2", 2, BINDING_PER_WINDOW,
         _("Move window to workspace 2"),
-        _("The keybinding used to move a window to workspace 2."),
         NULL)
-item (move_to_workspace, "_3", 3,
+item (move_to_workspace, "_3", 3, BINDING_PER_WINDOW,
         _("Move window to workspace 3"),
-        _("The keybinding used to move a window to workspace 3."),
         NULL)
-item (move_to_workspace, "_4", 4,
+item (move_to_workspace, "_4", 4, BINDING_PER_WINDOW,
         _("Move window to workspace 4"),
-        _("The keybinding used to move a window to workspace 4."),
         NULL)
-item (move_to_workspace, "_5", 5,
+item (move_to_workspace, "_5", 5, BINDING_PER_WINDOW,
         _("Move window to workspace 5"),
-        _("The keybinding used to move a window to workspace 5."),
         NULL)
-item (move_to_workspace, "_6", 6,
+item (move_to_workspace, "_6", 6, BINDING_PER_WINDOW,
         _("Move window to workspace 6"),
-        _("The keybinding used to move a window to workspace 6."),
         NULL)
-item (move_to_workspace, "_7", 7,
+item (move_to_workspace, "_7", 7, BINDING_PER_WINDOW,
         _("Move window to workspace 7"),
-        _("The keybinding used to move a window to workspace 7."),
         NULL)
-item (move_to_workspace, "_8", 8,
+item (move_to_workspace, "_8", 8, BINDING_PER_WINDOW,
         _("Move window to workspace 8"),
-        _("The keybinding used to move a window to workspace 8."),
         NULL)
-item (move_to_workspace, "_9", 9,
+item (move_to_workspace, "_9", 9, BINDING_PER_WINDOW,
         _("Move window to workspace 9"),
-        _("The keybinding used to move a window to workspace 9."),
         NULL)
-item (move_to_workspace, "_10", 10,
+item (move_to_workspace, "_10", 10, BINDING_PER_WINDOW,
         _("Move window to workspace 10"),
-        _("The keybinding used to move a window to workspace 10."),
         NULL)
-item (move_to_workspace, "_11", 11,
+item (move_to_workspace, "_11", 11, BINDING_PER_WINDOW,
         _("Move window to workspace 11"),
-        _("The keybinding used to move a window to workspace 11."),
         NULL)
-item (move_to_workspace, "_12", 12,
+item (move_to_workspace, "_12", 12, BINDING_PER_WINDOW,
         _("Move window to workspace 12"),
-        _("The keybinding used to move a window to workspace 12."),
         NULL)
 
-#endif /* ONLY_BOUND_BY_DEFAULT */
-
 /* META_MOTION_* are negative, and so distinct from workspace numbers,
  * which are always zero or positive.
  * If you make use of these constants, you will need to include workspace.h
@@ -198,101 +172,64 @@
  * workspace.h, of course.
  */
 
-item (move_to_workspace, "_left", META_MOTION_LEFT,
+item (move_to_workspace, "_left", META_MOTION_LEFT, BINDING_PER_WINDOW,
         _("Move window one workspace to the left"),
-        _("The keybinding used to move a window one workspace to the left."),
         "<Control><Shift><Alt>Left")
-item (move_to_workspace, "_right", META_MOTION_RIGHT,
+item (move_to_workspace, "_right", META_MOTION_RIGHT, BINDING_PER_WINDOW,
         _("Move window one workspace to the right"),
-        _("The keybinding used to move a window one workspace to the right."),
         "<Control><Shift><Alt>Right")
-item (move_to_workspace, "_up", META_MOTION_UP,
+item (move_to_workspace, "_up", META_MOTION_UP, BINDING_PER_WINDOW,
         _("Move window one workspace up"),
-        _("The keybinding used to move a window one workspace up."),
         "<Control><Shift><Alt>Up")
-item (move_to_workspace, "_down", META_MOTION_DOWN,
+item (move_to_workspace, "_down", META_MOTION_DOWN, BINDING_PER_WINDOW,
         _("Move window one workspace down"),
-        _("The keybinding used to move a window one workspace down."),
         "<Control><Shift><Alt>Down")
 
-#ifndef ONLY_BOUND_BY_DEFAULT
-
-item (raise_or_lower, "", 0,
-        _("Raise obscured window, otherwise lower"),
-        _("This keybinding changes whether a window is above or below "
-           "other windows.  If the window is covered by another one, it "
-           "raises the window above all others, and if the window is "
-           "already fully visible, it lowers it below all others."),
+item (raise_or_lower, "", 0, BINDING_PER_WINDOW,
+        _("Raise window if it's covered by another window, otherwise lower it"),
            NULL)
-item (raise, "", 0,
+item (raise, "", 0, BINDING_PER_WINDOW,
         _("Raise window above other windows"),
-        _("This keybinding raises the window above other windows."),
         NULL)
-item (lower, "", 0,
+item (lower, "", 0, BINDING_PER_WINDOW,
         _("Lower window below other windows"),
-        _("This keybinding lowers a window below other windows."),
         NULL)
 
-item (maximize_vertically, "", 0,
+item (maximize_vertically, "", 0, BINDING_PER_WINDOW,
         _("Maximize window vertically"),
-        _("This keybinding resizes a window to fill available "
-          "vertical space."),
           NULL)
-item (maximize_horizontally, "", 0,
+item (maximize_horizontally, "", 0, BINDING_PER_WINDOW,
         _("Maximize window horizontally"),
-        _("This keybinding resizes a window to fill available "
-          "horizontal space."),
           NULL)
 
-item (move_to_corner_nw, "", 0,
-        _("Move window to north-west corner"),
-        _("This keybinding moves a window into the north-west (top left) "
-          "corner of the screen."),
+item (move_to_corner_nw, "", 0, BINDING_PER_WINDOW,
+        _("Move window to north-west (top left) corner"),
           NULL)
-item (move_to_corner_ne, "", 0,
-        _("Move window to north-east corner"),
-        _("This keybinding moves a window into the north-east (top right) "
-          "corner of the screen."),
+item (move_to_corner_ne, "", 0, BINDING_PER_WINDOW,
+        _("Move window to north-east (top right) corner"),
           NULL)
-item (move_to_corner_sw, "", 0,
-        _("Move window to south-west corner"),
-        _("This keybinding moves a window into the north-east (bottom left) "
-          "corner of the screen."),
+item (move_to_corner_sw, "", 0, BINDING_PER_WINDOW,
+        _("Move window to south-west (bottom left) corner"),
           NULL)
-item (move_to_corner_se, "", 0,
-        _("Move window to south-east corner"),
-        _("This keybinding moves a window into the north-east (bottom right) "
-          "corner of the screen."),
+item (move_to_corner_se, "", 0, BINDING_PER_WINDOW,
+        _("Move window to south-east (bottom right) corner"),
           NULL)
 
-item (move_to_side_n, "", 0,
-        _("Move window to north side of screen"),
-        _("This keybinding moves a window against the north (top) "
-          "side of the screen."),
+item (move_to_side_n, "", 0, BINDING_PER_WINDOW,
+        _("Move window to north (top) side of screen"),
           NULL)
-item (move_to_side_s, "", 0,
-        _("Move window to south side of screen"),
-        _("This keybinding moves a window against the south (bottom) "
-          "side of the screen."),
+item (move_to_side_s, "", 0, BINDING_PER_WINDOW,
+        _("Move window to south (bottom) side of screen"),
           NULL)
-item (move_to_side_e, "", 0,
-        _("Move window to east side of screen"),
-        _("This keybinding moves a window against the east (right) "
-          "side of the screen."),
+item (move_to_side_e, "", 0, BINDING_PER_WINDOW,
+        _("Move window to east (right) side of screen"),
           NULL)
-item (move_to_side_w, "", 0,
-        _("Move window to west side of screen"),
-        _("This keybinding moves a window against the west (left) "
-          "side of the screen."),
+item (move_to_side_w, "", 0, BINDING_PER_WINDOW,
+        _("Move window to west (left) side of screen"),
           NULL)
-
-item (move_to_center, "", 0,
+item (move_to_center, "", 0, BINDING_PER_WINDOW,
         _("Move window to center of screen"),
-        _("This keybinding moves a window into the center "
-          "of the screen."),
           NULL)
 
-#endif /* ONLY_BOUND_BY_DEFAULT */
-
 /* eof window-bindings.h */
 



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