]> Pileus Git - ~andy/gtk/commitdiff
Test set_markup_with_accel()
authorHavoc Pennington <hp@redhat.com>
Wed, 1 Nov 2000 23:56:18 +0000 (23:56 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Wed, 1 Nov 2000 23:56:18 +0000 (23:56 +0000)
2000-11-01  Havoc Pennington  <hp@redhat.com>

* gtk/testgtk.c (create_labels): Test set_markup_with_accel()

* gtk/gtklabel.c (set_markup): Convert the unichar to a GDK keyval
before returning it.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtklabel.c
gtk/testgtk.c
tests/testgtk.c

index 9ae227850d765878013e50f17edaac47aa2476c4..99952b29ad7a7c3e714c019c7ff71bddc7ddf5d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,15 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/testgtk.c (create_labels): Test set_markup_with_accel()
+
+       * gtk/gtklabel.c (set_markup): Convert the unichar to a GDK keyval
+       before returning it. 
+       
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
        Clip the rectangle to be rendered to the drawable, since
-       get_from_drawable() requires a region within the drawable       
+       get_from_drawable() requires a region within the drawable
 
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
index 9ae227850d765878013e50f17edaac47aa2476c4..99952b29ad7a7c3e714c019c7ff71bddc7ddf5d0 100644 (file)
@@ -1,8 +1,15 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/testgtk.c (create_labels): Test set_markup_with_accel()
+
+       * gtk/gtklabel.c (set_markup): Convert the unichar to a GDK keyval
+       before returning it. 
+       
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
        Clip the rectangle to be rendered to the drawable, since
-       get_from_drawable() requires a region within the drawable       
+       get_from_drawable() requires a region within the drawable
 
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
index 9ae227850d765878013e50f17edaac47aa2476c4..99952b29ad7a7c3e714c019c7ff71bddc7ddf5d0 100644 (file)
@@ -1,8 +1,15 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/testgtk.c (create_labels): Test set_markup_with_accel()
+
+       * gtk/gtklabel.c (set_markup): Convert the unichar to a GDK keyval
+       before returning it. 
+       
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
        Clip the rectangle to be rendered to the drawable, since
-       get_from_drawable() requires a region within the drawable       
+       get_from_drawable() requires a region within the drawable
 
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
index 9ae227850d765878013e50f17edaac47aa2476c4..99952b29ad7a7c3e714c019c7ff71bddc7ddf5d0 100644 (file)
@@ -1,8 +1,15 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/testgtk.c (create_labels): Test set_markup_with_accel()
+
+       * gtk/gtklabel.c (set_markup): Convert the unichar to a GDK keyval
+       before returning it. 
+       
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
        Clip the rectangle to be rendered to the drawable, since
-       get_from_drawable() requires a region within the drawable       
+       get_from_drawable() requires a region within the drawable
 
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
index 9ae227850d765878013e50f17edaac47aa2476c4..99952b29ad7a7c3e714c019c7ff71bddc7ddf5d0 100644 (file)
@@ -1,8 +1,15 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/testgtk.c (create_labels): Test set_markup_with_accel()
+
+       * gtk/gtklabel.c (set_markup): Convert the unichar to a GDK keyval
+       before returning it. 
+       
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
        Clip the rectangle to be rendered to the drawable, since
-       get_from_drawable() requires a region within the drawable       
+       get_from_drawable() requires a region within the drawable
 
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
index 9ae227850d765878013e50f17edaac47aa2476c4..99952b29ad7a7c3e714c019c7ff71bddc7ddf5d0 100644 (file)
@@ -1,8 +1,15 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/testgtk.c (create_labels): Test set_markup_with_accel()
+
+       * gtk/gtklabel.c (set_markup): Convert the unichar to a GDK keyval
+       before returning it. 
+       
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
        Clip the rectangle to be rendered to the drawable, since
-       get_from_drawable() requires a region within the drawable       
+       get_from_drawable() requires a region within the drawable
 
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
index 9ae227850d765878013e50f17edaac47aa2476c4..99952b29ad7a7c3e714c019c7ff71bddc7ddf5d0 100644 (file)
@@ -1,8 +1,15 @@
+2000-11-01  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/testgtk.c (create_labels): Test set_markup_with_accel()
+
+       * gtk/gtklabel.c (set_markup): Convert the unichar to a GDK keyval
+       before returning it. 
+       
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
        * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
        Clip the rectangle to be rendered to the drawable, since
-       get_from_drawable() requires a region within the drawable       
+       get_from_drawable() requires a region within the drawable
 
 2000-11-01  Havoc Pennington  <hp@redhat.com>
 
index 9030d9a6002b9c649ce23be4756a4b75edd42cf5..40f416ce7ebcea255f2d035f3d40560d01123444 100644 (file)
@@ -285,7 +285,7 @@ set_markup (GtkLabel    *label,
     }
 
   if (accel_char != 0)
-    return gdk_keyval_to_lower (accel_char);
+    return gdk_keyval_to_lower (gdk_unicode_to_keyval (accel_char));
   else
     return GDK_VoidSymbol;
 }
index 6f8542535a584fa86d1af154e88ef6178f8cd2a5..2f71a75a13ae36031001d75979ea76f8b3b05809 100644 (file)
@@ -2002,6 +2002,8 @@ void create_labels (void)
 
   if (!window)
     {
+      guint keyval;
+      
       window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
       gtk_signal_connect (GTK_OBJECT (window), "destroy",
                          GTK_SIGNAL_FUNC(gtk_widget_destroyed),
@@ -2091,21 +2093,28 @@ void create_labels (void)
       frame = gtk_frame_new ("Markup label");
       label = gtk_label_new (NULL);
 
-      gtk_label_set_markup (GTK_LABEL (label),
-                            "This <span foreground=\"blue\" background=\"orange\">label</span> has "
-                            "<b>markup</b> such as "
-                            "<big><i>Big Italics</i></big>\n"
-                            "<tt>Monospace font</tt>\n"
-                            "<u>Underline!</u>\n"
-                            "foo\n"
-                            "<span foreground=\"green\" background=\"red\">Ugly colors</span>\n"
-                            "and nothing on this line,\n"
-                            "or this.\n"
-                            "or this either\n"
-                            "or even on this one\n"
-                            "la <big>la <big>la <big>la <big>la</big></big></big></big>\n"
-                            "but this word is <span foreground=\"purple\"><big>purple</big></span>\n"
-                            "We like <sup>superscript</sup> and <sub>subscript</sub> too");
+      /* There's also a gtk_label_set_markup() without accel if you
+       * don't have an accelerator key
+       */
+      keyval =
+        gtk_label_set_markup_with_accel (GTK_LABEL (label),
+                                         "This <span foreground=\"blue\" background=\"orange\">label</span> has "
+                                         "<b>markup</b> _such as "
+                                         "<big><i>Big Italics</i></big>\n"
+                                         "<tt>Monospace font</tt>\n"
+                                         "<u>Underline!</u>\n"
+                                         "foo\n"
+                                         "<span foreground=\"green\" background=\"red\">Ugly colors</span>\n"
+                                         "and nothing on this line,\n"
+                                         "or this.\n"
+                                         "or this either\n"
+                                         "or even on this one\n"
+                                         "la <big>la <big>la <big>la <big>la</big></big></big></big>\n"
+                                         "but this _word is <span foreground=\"purple\"><big>purple</big></span>\n"
+                                         "We like <sup>superscript</sup> and <sub>subscript</sub> too");
+
+      g_return_if_fail (keyval != GDK_s);
+      
       gtk_container_add (GTK_CONTAINER (frame), label);
       gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
       
index 6f8542535a584fa86d1af154e88ef6178f8cd2a5..2f71a75a13ae36031001d75979ea76f8b3b05809 100644 (file)
@@ -2002,6 +2002,8 @@ void create_labels (void)
 
   if (!window)
     {
+      guint keyval;
+      
       window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
       gtk_signal_connect (GTK_OBJECT (window), "destroy",
                          GTK_SIGNAL_FUNC(gtk_widget_destroyed),
@@ -2091,21 +2093,28 @@ void create_labels (void)
       frame = gtk_frame_new ("Markup label");
       label = gtk_label_new (NULL);
 
-      gtk_label_set_markup (GTK_LABEL (label),
-                            "This <span foreground=\"blue\" background=\"orange\">label</span> has "
-                            "<b>markup</b> such as "
-                            "<big><i>Big Italics</i></big>\n"
-                            "<tt>Monospace font</tt>\n"
-                            "<u>Underline!</u>\n"
-                            "foo\n"
-                            "<span foreground=\"green\" background=\"red\">Ugly colors</span>\n"
-                            "and nothing on this line,\n"
-                            "or this.\n"
-                            "or this either\n"
-                            "or even on this one\n"
-                            "la <big>la <big>la <big>la <big>la</big></big></big></big>\n"
-                            "but this word is <span foreground=\"purple\"><big>purple</big></span>\n"
-                            "We like <sup>superscript</sup> and <sub>subscript</sub> too");
+      /* There's also a gtk_label_set_markup() without accel if you
+       * don't have an accelerator key
+       */
+      keyval =
+        gtk_label_set_markup_with_accel (GTK_LABEL (label),
+                                         "This <span foreground=\"blue\" background=\"orange\">label</span> has "
+                                         "<b>markup</b> _such as "
+                                         "<big><i>Big Italics</i></big>\n"
+                                         "<tt>Monospace font</tt>\n"
+                                         "<u>Underline!</u>\n"
+                                         "foo\n"
+                                         "<span foreground=\"green\" background=\"red\">Ugly colors</span>\n"
+                                         "and nothing on this line,\n"
+                                         "or this.\n"
+                                         "or this either\n"
+                                         "or even on this one\n"
+                                         "la <big>la <big>la <big>la <big>la</big></big></big></big>\n"
+                                         "but this _word is <span foreground=\"purple\"><big>purple</big></span>\n"
+                                         "We like <sup>superscript</sup> and <sub>subscript</sub> too");
+
+      g_return_if_fail (keyval != GDK_s);
+      
       gtk_container_add (GTK_CONTAINER (frame), label);
       gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);