diff options
author | Soeren Sandmann <sandmann@daimi.au.dk> | 2002-12-16 16:22:11 +0000 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@src.gnome.org> | 2002-12-16 16:22:11 +0000 |
commit | a04d59791a91db115e3588ee2fb8d9feddd6bdff (patch) | |
tree | 4ee46727e1b094a08bb8104e0384868fdf0703c0 | |
parent | 6669d0c581baced1feed0c0df587b96d72c386f1 (diff) | |
download | gdk-pixbuf-a04d59791a91db115e3588ee2fb8d9feddd6bdff.tar.gz |
Implement Owen's susggestion from #80764. Fixes #101314.
Mon Dec 16 17:20:02 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkaccellabel.c: Implement Owen's susggestion from
#80764. Fixes #101314.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 5 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 5 | ||||
-rw-r--r-- | gtk/gtkaccellabel.c | 72 |
7 files changed, 78 insertions, 24 deletions
@@ -1,3 +1,8 @@ +Mon Dec 16 17:20:02 2002 Soeren Sandmann <sandmann@daimi.au.dk> + + * gtk/gtkaccellabel.c: Implement Owen's susggestion from + #80764. Fixes #101314. + Sun Dec 15 18:47:30 2002 Owen Taylor <otaylor@redhat.com> Some fixes for modal hint setting based on a patch diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 96fe3e3d1..a47b03e83 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Mon Dec 16 17:20:02 2002 Soeren Sandmann <sandmann@daimi.au.dk> + + * gtk/gtkaccellabel.c: Implement Owen's susggestion from + #80764. Fixes #101314. + Sun Dec 15 18:47:30 2002 Owen Taylor <otaylor@redhat.com> Some fixes for modal hint setting based on a patch diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 96fe3e3d1..a47b03e83 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Mon Dec 16 17:20:02 2002 Soeren Sandmann <sandmann@daimi.au.dk> + + * gtk/gtkaccellabel.c: Implement Owen's susggestion from + #80764. Fixes #101314. + Sun Dec 15 18:47:30 2002 Owen Taylor <otaylor@redhat.com> Some fixes for modal hint setting based on a patch diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 96fe3e3d1..a47b03e83 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Mon Dec 16 17:20:02 2002 Soeren Sandmann <sandmann@daimi.au.dk> + + * gtk/gtkaccellabel.c: Implement Owen's susggestion from + #80764. Fixes #101314. + Sun Dec 15 18:47:30 2002 Owen Taylor <otaylor@redhat.com> Some fixes for modal hint setting based on a patch diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 96fe3e3d1..a47b03e83 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Mon Dec 16 17:20:02 2002 Soeren Sandmann <sandmann@daimi.au.dk> + + * gtk/gtkaccellabel.c: Implement Owen's susggestion from + #80764. Fixes #101314. + Sun Dec 15 18:47:30 2002 Owen Taylor <otaylor@redhat.com> Some fixes for modal hint setting based on a patch diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 96fe3e3d1..a47b03e83 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Mon Dec 16 17:20:02 2002 Soeren Sandmann <sandmann@daimi.au.dk> + + * gtk/gtkaccellabel.c: Implement Owen's susggestion from + #80764. Fixes #101314. + Sun Dec 15 18:47:30 2002 Owen Taylor <otaylor@redhat.com> Some fixes for modal hint setting based on a patch diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index 7c68f9a94..232a5b471 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -40,26 +40,26 @@ enum { PROP_ACCEL_WIDGET }; -static void gtk_accel_label_class_init (GtkAccelLabelClass *klass); -static void gtk_accel_label_init (GtkAccelLabel *accel_label); -static void gtk_accel_label_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void gtk_accel_label_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void gtk_accel_label_destroy (GtkObject *object); -static void gtk_accel_label_finalize (GObject *object); -static void gtk_accel_label_size_request (GtkWidget *widget, - GtkRequisition *requisition); -static gboolean gtk_accel_label_expose_event (GtkWidget *widget, - GdkEventExpose *event); -static gboolean gtk_accel_label_refetch_idle (GtkAccelLabel *accel_label); +static void gtk_accel_label_class_init (GtkAccelLabelClass *klass); +static void gtk_accel_label_init (GtkAccelLabel *accel_label); +static void gtk_accel_label_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gtk_accel_label_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gtk_accel_label_destroy (GtkObject *object); +static void gtk_accel_label_finalize (GObject *object); +static void gtk_accel_label_size_request (GtkWidget *widget, + GtkRequisition *requisition); +static gboolean gtk_accel_label_expose_event (GtkWidget *widget, + GdkEventExpose *event); +static const gchar *gtk_accel_label_get_string (GtkAccelLabel *accel_label); -static GtkLabelClass *parent_class = NULL; +static GtkLabelClass *parent_class = NULL; GType gtk_accel_label_get_type (void) @@ -278,7 +278,7 @@ gtk_accel_label_size_request (GtkWidget *widget, if (GTK_WIDGET_CLASS (parent_class)->size_request) GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); - layout = gtk_widget_create_pango_layout (widget, accel_label->accel_string); + layout = gtk_widget_create_pango_layout (widget, gtk_accel_label_get_string (accel_label)); pango_layout_get_pixel_size (layout, &width, NULL); accel_label->accel_string_width = width; @@ -339,7 +339,7 @@ gtk_accel_label_expose_event (GtkWidget *widget, label_layout = gtk_label_get_layout (GTK_LABEL (accel_label)); gtk_label_get_layout_offsets (GTK_LABEL (accel_label), NULL, &y); - accel_layout = gtk_widget_create_pango_layout (widget, accel_label->accel_string); + accel_layout = gtk_widget_create_pango_layout (widget, gtk_accel_label_get_string (accel_label)); y += get_first_baseline (label_layout) - get_first_baseline (accel_layout); @@ -424,6 +424,18 @@ gtk_accel_label_set_accel_widget (GtkAccelLabel *accel_label, } static void +gtk_accel_label_reset (GtkAccelLabel *accel_label) +{ + if (accel_label->accel_string) + { + g_free (accel_label->accel_string); + accel_label->accel_string = NULL; + } + + gtk_widget_queue_resize (GTK_WIDGET (accel_label)); +} + +static void check_accel_changed (GtkAccelGroup *accel_group, guint keyval, GdkModifierType modifier, @@ -431,7 +443,7 @@ check_accel_changed (GtkAccelGroup *accel_group, GtkAccelLabel *accel_label) { if (accel_closure == accel_label->accel_closure) - gtk_accel_label_refetch (accel_label); + gtk_accel_label_reset (accel_label); } /** @@ -469,7 +481,7 @@ gtk_accel_label_set_accel_closure (GtkAccelLabel *accel_label, G_CALLBACK (check_accel_changed), accel_label, 0); } - gtk_accel_label_refetch (accel_label); + gtk_accel_label_reset (accel_label); g_object_notify (G_OBJECT (accel_label), "accel_closure"); } } @@ -482,6 +494,15 @@ find_accel (GtkAccelKey *key, return data == (gpointer) closure; } +static const gchar * +gtk_accel_label_get_string (GtkAccelLabel *accel_label) +{ + if (!accel_label->accel_string) + gtk_accel_label_refetch (accel_label); + + return accel_label->accel_string; +} + gboolean gtk_accel_label_refetch (GtkAccelLabel *accel_label) { @@ -491,8 +512,11 @@ gtk_accel_label_refetch (GtkAccelLabel *accel_label) class = GTK_ACCEL_LABEL_GET_CLASS (accel_label); - g_free (accel_label->accel_string); - accel_label->accel_string = NULL; + if (accel_label->accel_string) + { + g_free (accel_label->accel_string); + accel_label->accel_string = NULL; + } if (accel_label->accel_closure) { |