diff --git a/ChangeLog b/ChangeLog index c18e5c887e..74ede7ad50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-07-21 Michael Natterer + + * app/core/gimpmarshal.list + * app/widgets/gimpcellrendereraccel.[ch]: added "gboolean delete" + parameter to the GimpCellRendererAccel::accel_edited() signal. + + * app/widgets/gimpactionview.c: distinguish between deletion of an + accelerator and the user entering an invalid accelerator. + 2004-07-21 Shlomi Fish * plug-ins/gimpressionist/: normalized the identifiers in diff --git a/app/core/gimpmarshal.list b/app/core/gimpmarshal.list index 4d5c481ecb..2680f51e2f 100644 --- a/app/core/gimpmarshal.list +++ b/app/core/gimpmarshal.list @@ -44,6 +44,6 @@ VOID: OBJECT, INT VOID: OBJECT, POINTER VOID: POINTER VOID: STRING +VOID: STRING, BOOLEAN, UINT, FLAGS VOID: STRING, FLAGS -VOID: STRING, UINT, FLAGS VOID: VOID diff --git a/app/widgets/gimpactionview.c b/app/widgets/gimpactionview.c index f89f32ac2e..2596c607c2 100644 --- a/app/widgets/gimpactionview.c +++ b/app/widgets/gimpactionview.c @@ -68,6 +68,7 @@ static void gimp_action_view_accel_changed (GtkAccelGroup *accel_group, GimpActionView *view); static void gimp_action_view_accel_edited (GimpCellRendererAccel *accel, const char *path_string, + gboolean delete, guint accel_key, GdkModifierType accel_mask, GimpActionView *view); @@ -424,6 +425,7 @@ gimp_action_view_accel_confirm (GtkWidget *query_box, static void gimp_action_view_accel_edited (GimpCellRendererAccel *accel, const char *path_string, + gboolean delete, guint accel_key, GdkModifierType accel_mask, GimpActionView *view) @@ -471,7 +473,18 @@ gimp_action_view_accel_edited (GimpCellRendererAccel *accel, gtk_action_group_get_name (group), gtk_action_get_name (action)); - if (accel_key) + if (delete) + { + if (! gtk_accel_map_change_entry (accel_path, 0, 0, FALSE)) + { + g_message (_("Removing shortcut failed.")); + } + } + else if (! accel_key) + { + g_message (_("Invalid shortcut.")); + } + else { if (! gtk_accel_map_change_entry (accel_path, accel_key, accel_mask, FALSE)) @@ -519,9 +532,9 @@ gimp_action_view_accel_edited (GimpCellRendererAccel *accel, if (conflict_action) { GimpActionGroup *conflict_group; - gchar *accel_string; gchar *label; gchar *stripped; + gchar *accel_string; gchar *message; ConfirmData *confirm_data; GtkWidget *query_box; @@ -573,12 +586,12 @@ gimp_action_view_accel_edited (GimpCellRendererAccel *accel, (GWeakNotify) g_free, confirm_data->accel_path); - g_free (message); - g_free (accel_string); g_free (label); g_free (stripped); - g_object_unref (conflict_group); + g_free (accel_string); + g_free (message); g_object_unref (conflict_action); + g_object_unref (conflict_group); gtk_widget_show (query_box); } @@ -588,16 +601,6 @@ gimp_action_view_accel_edited (GimpCellRendererAccel *accel, } } } - else - { - accel_mask = 0; - - if (! gtk_accel_map_change_entry (accel_path, - accel_key, accel_mask, FALSE)) - { - g_message (_("Removing shortcut failed.")); - } - } g_free (accel_path); g_object_unref (group); diff --git a/app/widgets/gimpcellrendereraccel.c b/app/widgets/gimpcellrendereraccel.c index fd225cd240..90a8373c39 100644 --- a/app/widgets/gimpcellrendereraccel.c +++ b/app/widgets/gimpcellrendereraccel.c @@ -136,9 +136,10 @@ gimp_cell_renderer_accel_class_init (GimpCellRendererAccelClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GimpCellRendererAccelClass, accel_edited), NULL, NULL, - gimp_marshal_VOID__STRING_UINT_FLAGS, - G_TYPE_NONE, 3, + gimp_marshal_VOID__STRING_BOOLEAN_UINT_FLAGS, + G_TYPE_NONE, 4, G_TYPE_STRING, + G_TYPE_BOOLEAN, G_TYPE_UINT, GDK_TYPE_MODIFIER_TYPE); @@ -329,7 +330,7 @@ grab_key_callback (GtkWidget *widget, if (edited) g_signal_emit (accel, accel_cell_signals[ACCEL_EDITED], 0, - path, accel_key, accel_mods); + path, delete, accel_key, accel_mods); g_free (path); @@ -380,7 +381,7 @@ pointless_eventbox_subclass_get_type (void) NULL, /* class_data */ sizeof (GtkEventBox), 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, + NULL /* instance init */ }; static const GInterfaceInfo editable_info = diff --git a/app/widgets/gimpcellrendereraccel.h b/app/widgets/gimpcellrendereraccel.h index ada8dc1f1f..548203d0d2 100644 --- a/app/widgets/gimpcellrendereraccel.h +++ b/app/widgets/gimpcellrendereraccel.h @@ -59,6 +59,7 @@ struct _GimpCellRendererAccelClass void (* accel_edited) (GimpCellRendererAccel *accel, const char *path_string, + gboolean delete, guint accel_key, GdkModifierType accel_mask); };