]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkaccellabel.c
Fix typos
[~andy/gtk] / gtk / gtkaccellabel.c
index cafd022018eea8d2e33b6f1cfa68278f6aa6dbf8..9d3ca419b7d4efda74ddf108f90575109f6a64ed 100644 (file)
@@ -43,8 +43,6 @@ 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,
@@ -62,35 +60,7 @@ static gboolean     gtk_accel_label_expose_event (GtkWidget          *widget,
 static const gchar *gtk_accel_label_get_string   (GtkAccelLabel      *accel_label);
 
 
-static GtkLabelClass *parent_class = NULL;
-
-GType
-gtk_accel_label_get_type (void)
-{
-  static GType accel_label_type = 0;
-  
-  if (!accel_label_type)
-    {
-      static const GTypeInfo accel_label_info =
-      {
-       sizeof (GtkAccelLabelClass),
-       NULL,           /* base_init */
-       NULL,           /* base_finalize */
-       (GClassInitFunc) gtk_accel_label_class_init,
-       NULL,           /* class_finalize */
-       NULL,           /* class_data */
-       sizeof (GtkAccelLabel),
-       0,              /* n_preallocs */
-       (GInstanceInitFunc) gtk_accel_label_init,
-      };
-      
-      accel_label_type =
-       g_type_register_static (GTK_TYPE_LABEL, "GtkAccelLabel",
-                               &accel_label_info, 0);
-    }
-  
-  return accel_label_type;
-}
+G_DEFINE_TYPE (GtkAccelLabel, gtk_accel_label, GTK_TYPE_LABEL)
 
 static void
 gtk_accel_label_class_init (GtkAccelLabelClass *class)
@@ -99,8 +69,6 @@ gtk_accel_label_class_init (GtkAccelLabelClass *class)
   GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
   
-  parent_class = g_type_class_peek_parent (class);
-  
   gobject_class->finalize = gtk_accel_label_finalize;
   gobject_class->set_property = gtk_accel_label_set_property;
   gobject_class->get_property = gtk_accel_label_get_property;
@@ -233,7 +201,7 @@ gtk_accel_label_destroy (GtkObject *object)
   gtk_accel_label_set_accel_widget (accel_label, NULL);
   gtk_accel_label_set_accel_closure (accel_label, NULL);
   
-  GTK_OBJECT_CLASS (parent_class)->destroy (object);
+  GTK_OBJECT_CLASS (gtk_accel_label_parent_class)->destroy (object);
 }
 
 static void
@@ -243,7 +211,7 @@ gtk_accel_label_finalize (GObject *object)
 
   g_free (accel_label->accel_string);
   
-  G_OBJECT_CLASS (parent_class)->finalize (object);
+  G_OBJECT_CLASS (gtk_accel_label_parent_class)->finalize (object);
 }
 
 /**
@@ -281,8 +249,8 @@ gtk_accel_label_size_request (GtkWidget          *widget,
   PangoLayout *layout;
   gint width;
   
-  if (GTK_WIDGET_CLASS (parent_class)->size_request)
-    GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
+  if (GTK_WIDGET_CLASS (gtk_accel_label_parent_class)->size_request)
+    GTK_WIDGET_CLASS (gtk_accel_label_parent_class)->size_request (widget, requisition);
 
   layout = gtk_widget_create_pango_layout (widget, gtk_accel_label_get_string (accel_label));
   pango_layout_get_pixel_size (layout, &width, NULL);
@@ -339,8 +307,8 @@ gtk_accel_label_expose_event (GtkWidget      *widget,
                                    pango_layout_get_width (label_layout) 
                                    - ac_width * PANGO_SCALE);
          
-         if (GTK_WIDGET_CLASS (parent_class)->expose_event)
-           GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
+         if (GTK_WIDGET_CLASS (gtk_accel_label_parent_class)->expose_event)
+           GTK_WIDGET_CLASS (gtk_accel_label_parent_class)->expose_event (widget, event);
          if (direction == GTK_TEXT_DIR_RTL)
            widget->allocation.x -= ac_width;
          widget->allocation.width += ac_width;
@@ -374,8 +342,8 @@ gtk_accel_label_expose_event (GtkWidget      *widget,
        }
       else
        {
-         if (GTK_WIDGET_CLASS (parent_class)->expose_event)
-           GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
+         if (GTK_WIDGET_CLASS (gtk_accel_label_parent_class)->expose_event)
+           GTK_WIDGET_CLASS (gtk_accel_label_parent_class)->expose_event (widget, event);
        }
     }
   
@@ -563,6 +531,80 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
       g_string_append (gstring, klass->mod_name_alt);
       seen_mod = TRUE;
     }
+  if (accelerator_mods & GDK_MOD2_MASK)
+    {
+      if (seen_mod)
+       g_string_append (gstring, klass->mod_separator);
+
+      g_string_append (gstring, "Mod2");
+      seen_mod = TRUE;
+    }
+  if (accelerator_mods & GDK_MOD3_MASK)
+    {
+      if (seen_mod)
+       g_string_append (gstring, klass->mod_separator);
+
+      g_string_append (gstring, "Mod3");
+      seen_mod = TRUE;
+    }
+  if (accelerator_mods & GDK_MOD4_MASK)
+    {
+      if (seen_mod)
+       g_string_append (gstring, klass->mod_separator);
+
+      g_string_append (gstring, "Mod4");
+      seen_mod = TRUE;
+    }
+  if (accelerator_mods & GDK_MOD5_MASK)
+    {
+      if (seen_mod)
+       g_string_append (gstring, klass->mod_separator);
+
+      g_string_append (gstring, "Mod5");
+      seen_mod = TRUE;
+    }
+  if (accelerator_mods & GDK_SUPER_MASK)
+    {
+      if (seen_mod)
+       g_string_append (gstring, klass->mod_separator);
+
+      /* This is the text that should appear next to menu accelerators
+       * that use the super key. If the text on this key isn't typically
+       * translated on keyboards used for your language, don't translate
+       * this.
+       * And do not translate the part before the |.
+       */
+      g_string_append (gstring, Q_("keyboard label|Super"));
+      seen_mod = TRUE;
+    }
+  if (accelerator_mods & GDK_HYPER_MASK)
+    {
+      if (seen_mod)
+       g_string_append (gstring, klass->mod_separator);
+
+      /* This is the text that should appear next to menu accelerators
+       * that use the hyper key. If the text on this key isn't typically
+       * translated on keyboards used for your language, don't translate
+       * this.
+       * And do not translate the part before the |.
+       */
+      g_string_append (gstring, Q_("keyboard label|Hyper"));
+      seen_mod = TRUE;
+    }
+  if (accelerator_mods & GDK_META_MASK)
+    {
+      if (seen_mod)
+       g_string_append (gstring, klass->mod_separator);
+
+      /* This is the text that should appear next to menu accelerators
+       * that use the meta key. If the text on this key isn't typically
+       * translated on keyboards used for your language, don't translate
+       * this.
+       * And do not translate the part before the |.
+       */
+      g_string_append (gstring, Q_("keyboard label|Meta"));
+      seen_mod = TRUE;
+    }
   if (seen_mod)
     g_string_append (gstring, klass->mod_separator);
   
@@ -619,12 +661,8 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
 gboolean
 gtk_accel_label_refetch (GtkAccelLabel *accel_label)
 {
-  GtkAccelLabelClass *class;
-
   g_return_val_if_fail (GTK_IS_ACCEL_LABEL (accel_label), FALSE);
 
-  class = GTK_ACCEL_LABEL_GET_CLASS (accel_label);
-
   if (accel_label->accel_string)
     {
       g_free (accel_label->accel_string);