X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkbindings.c;h=4cbbeaf6aadbb67cd9e0c9981f00b256363ef54a;hb=1247a842a228980a06893e6167ae8c73a4bb6eed;hp=69598e9c5a405ba96242b502d18e2da487ecc208;hpb=b448bb81cea589e6da9b6b61eb8dace7b6509598;p=~andy%2Fgtk
diff --git a/gtk/gtkbindings.c b/gtk/gtkbindings.c
index 69598e9c5..4cbbeaf6a 100644
--- a/gtk/gtkbindings.c
+++ b/gtk/gtkbindings.c
@@ -15,9 +15,7 @@
* Lesser General Public License for more details.
*
* 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.
+ * License along with this library. If not, see .
*/
/*
@@ -33,17 +31,17 @@
#include "gtkbindingsprivate.h"
#include "gtkkeyhash.h"
+#include "gtkstylecontext.h"
#include "gtkwidget.h"
-#include "gtkrc.h"
#include "gtkintl.h"
/**
* SECTION:gtkbindings
- * @Title: GtkBindings
+ * @Title: Bindings
* @Short_description: Key bindings for individual widgets
- * @See_also: Keyboard Accelerators, #GtkCssProvider
+ * @See_also: Keyboard Accelerators, Mnemonics, #GtkCssProvider
*
- * GtkBinding provides a mechanism for configuring GTK+ key bindings
+ * #GtkBindingSet provides a mechanism for configuring GTK+ key bindings
* through CSS files. This eases key binding adjustments for application
* developers as well as users and provides GTK+ users or administrators
* with high key binding configurability which requires no application
@@ -56,7 +54,7 @@
* statement to apply the binding set to specific widget types. Details
* on the matching mechanism are described under
* Selectors
- * in the #GtkCssProvider documentation. Inside the binding-set definition,
+ * in the #GtkCssProvider documentation. Inside the binding set definition,
* key combinations are bound to one or more specific signal emissions on
* the target widget. Key combinations are strings consisting of an optional
* #GdkModifierType name and key names
@@ -71,7 +69,7 @@
* of a #GtkEntry widget to the #GtkEntry::move-cursor signal (so movement
* occurs in 3-character steps), the following binding can be used:
*
- * @binding-set "MoveCursor3"
+ * @binding-set MoveCursor3
* {
* bind "<Control>Right" { "move-cursor" (visual-positions, 3, 0) };
* bind "<Control>Left" { "move-cursor" (visual-positions, -3, 0) };
@@ -94,7 +92,7 @@
* works as expected. The same mechanism can not be used to "unbind"
* existing bindings, however.
*
- * @binding-set "MoveCursor3"
+ * @binding-set MoveCursor3
* {
* bind "<Control>Right" { };
* bind "<Control>Left" { };
@@ -115,7 +113,7 @@
* implement word movement. To keep GTK+ from activating its default
* bindings, the "unbind" keyword can be used like this:
*
- * @binding-set "MoveCursor3"
+ * @binding-set MoveCursor3
* {
* unbind "<Control>Right";
* unbind "<Control>Left";
@@ -134,6 +132,7 @@
*
*
*/
+
/* --- defines --- */
#define BINDING_MOD_MASK() (gtk_accelerator_get_default_mod_mask () | GDK_RELEASE_MASK)
@@ -479,7 +478,7 @@ binding_compose_params (GObject *object,
valid = TRUE;
for (i = 1; i < query->n_params + 1 && valid; i++)
{
- GValue tmp_value = { 0, };
+ GValue tmp_value = G_VALUE_INIT;
g_value_init (params, *types);
@@ -602,7 +601,7 @@ gtk_binding_entry_activate (GtkBindingEntry *entry,
GSignalQuery query;
guint signal_id;
GValue *params = NULL;
- GValue return_val = { 0, };
+ GValue return_val = G_VALUE_INIT;
gchar *accelerator = NULL;
signal_id = g_signal_lookup (sig->signal_name, G_OBJECT_TYPE (object));
@@ -735,15 +734,28 @@ gtk_binding_set_by_class (gpointer object_class)
return binding_set;
binding_set = gtk_binding_set_new (g_type_name (G_OBJECT_CLASS_TYPE (class)));
- gtk_binding_set_add_path (binding_set,
- GTK_PATH_CLASS,
- g_type_name (G_OBJECT_CLASS_TYPE (class)),
- GTK_PATH_PRIO_GTK);
g_dataset_id_set_data (class, key_id_class_binding_set, binding_set);
return binding_set;
}
+static GtkBindingSet*
+gtk_binding_set_find_interned (const gchar *set_name)
+{
+ GSList *slist;
+
+ for (slist = binding_set_list; slist; slist = slist->next)
+ {
+ GtkBindingSet *binding_set;
+
+ binding_set = slist->data;
+ if (binding_set->set_name == set_name)
+ return binding_set;
+ }
+
+ return NULL;
+}
+
/**
* gtk_binding_set_find:
* @set_name: unique binding set name
@@ -758,19 +770,9 @@ gtk_binding_set_by_class (gpointer object_class)
GtkBindingSet*
gtk_binding_set_find (const gchar *set_name)
{
- GSList *slist;
-
g_return_val_if_fail (set_name != NULL, NULL);
- for (slist = binding_set_list; slist; slist = slist->next)
- {
- GtkBindingSet *binding_set;
-
- binding_set = slist->data;
- if (g_str_equal (binding_set->set_name, (gpointer) set_name))
- return binding_set;
- }
- return NULL;
+ return gtk_binding_set_find_interned (g_intern_string (set_name));
}
/**
@@ -990,7 +992,7 @@ _gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
* @modifiers: key modifier of binding to install
* @signal_name: signal to execute upon activation
* @n_args: number of arguments to @signal_name
- * @Varargs: arguments to @signal_name
+ * @...: arguments to @signal_name
*
* Override or install a new key binding for @keyval with @modifiers on
* @binding_set. When the binding is activated, @signal_name will be
@@ -1352,18 +1354,18 @@ create_signal_scanner (void)
* Parses a signal description from @signal_desc and incorporates
* it into @binding_set.
*
- * signal descriptions may either bind a key combination to
+ * Signal descriptions may either bind a key combination to
* one or more signals:
*
- * bind key {
- * signalname (param, ...)
+ * bind "key" {
+ * "signalname" (param, ...)
* ...
* }
*
*
* Or they may also unbind a key combination:
*
- * unbind key
+ * unbind "key"
*
*
* Key combinations must be in a format that can be parsed by
@@ -1405,8 +1407,10 @@ gtk_binding_entry_add_signal_from_string (GtkBindingSet *binding_set,
* @path_pattern: the actual match pattern
* @priority: binding priority
*
- * This function is used internally by the GtkRC parsing mechanism to
- * assign match patterns to #GtkBindingSet structures.
+ * This function was used internally by the GtkRC parsing mechanism
+ * to assign match patterns to #GtkBindingSet structures.
+ *
+ * In GTK+ 3, these match patterns are unused.
*
* Deprecated: 3.0
*/
@@ -1571,7 +1575,7 @@ gtk_bindings_activate_list (GObject *object,
while (class_type && !handled)
{
- binding_set = gtk_binding_set_find (g_type_name (class_type));
+ binding_set = gtk_binding_set_find_interned (g_type_name (class_type));
class_type = g_type_parent (class_type);
if (!binding_set)