]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkiconfactory.c
Apply a cleanup patch by Kjartan Maraas (#341812)
[~andy/gtk] / gtk / gtkiconfactory.c
index b38d82c423b09c65c1aee67743729477041d4a50..0cc2cb1132d6252341ddb34f733ebd786af9af06 100644 (file)
@@ -82,10 +82,7 @@ struct _GtkIconSource
 #endif
 };
 
-static gpointer parent_class = NULL;
 
-static void gtk_icon_factory_init       (GtkIconFactory      *icon_factory);
-static void gtk_icon_factory_class_init (GtkIconFactoryClass *klass);
 static void gtk_icon_factory_finalize   (GObject             *object);
 static void get_default_icons           (GtkIconFactory      *icon_factory);
 static void icon_source_clear           (GtkIconSource       *source);
@@ -99,33 +96,7 @@ static GtkIconSize icon_size_register_intern (const gchar *name,
    0, 0, 0,                                                            \
    any_direction, any_state, any_size }
 
-GType
-gtk_icon_factory_get_type (void)
-{
-  static GType icon_factory_type = 0;
-
-  if (!icon_factory_type)
-    {
-      static const GTypeInfo icon_factory_info =
-      {
-        sizeof (GtkIconFactoryClass),
-        NULL,          /* base_init */
-        NULL,          /* base_finalize */
-        (GClassInitFunc) gtk_icon_factory_class_init,
-        NULL,           /* class_finalize */
-        NULL,           /* class_data */
-        sizeof (GtkIconFactory),
-        0,              /* n_preallocs */
-        (GInstanceInitFunc) gtk_icon_factory_init,
-      };
-      
-      icon_factory_type =
-       g_type_register_static (G_TYPE_OBJECT, I_("GtkIconFactory"),
-                               &icon_factory_info, 0);
-    }
-  
-  return icon_factory_type;
-}
+G_DEFINE_TYPE (GtkIconFactory, gtk_icon_factory, G_TYPE_OBJECT)
 
 static void
 gtk_icon_factory_init (GtkIconFactory *factory)
@@ -139,8 +110,6 @@ gtk_icon_factory_class_init (GtkIconFactoryClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   
-  parent_class = g_type_class_peek_parent (klass);
-
   object_class->finalize = gtk_icon_factory_finalize;
 }
 
@@ -162,7 +131,7 @@ gtk_icon_factory_finalize (GObject *object)
   
   g_hash_table_destroy (factory->icons);
   
-  G_OBJECT_CLASS (parent_class)->finalize (object);
+  G_OBJECT_CLASS (gtk_icon_factory_parent_class)->finalize (object);
 }
 
 /**
@@ -450,6 +419,10 @@ get_default_icons (GtkIconFactory *factory)
   register_stock_icon (factory, GTK_STOCK_NETWORK);
   register_stock_icon (factory, GTK_STOCK_NEW);
   register_stock_icon (factory, GTK_STOCK_OPEN);
+  register_stock_icon (factory, GTK_STOCK_ORIENTATION_PORTRAIT);
+  register_stock_icon (factory, GTK_STOCK_ORIENTATION_LANDSCAPE);
+  register_stock_icon (factory, GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT);
+  register_stock_icon (factory, GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE);
   register_stock_icon (factory, GTK_STOCK_PASTE);
   register_stock_icon (factory, GTK_STOCK_PREFERENCES);
   register_stock_icon (factory, GTK_STOCK_PRINT);
@@ -482,8 +455,14 @@ get_default_icons (GtkIconFactory *factory)
   register_stock_icon (factory, GTK_STOCK_ITALIC);
   register_stock_icon (factory, GTK_STOCK_STRIKETHROUGH);
   register_stock_icon (factory, GTK_STOCK_UNDERLINE);
-  register_stock_icon (factory, GTK_STOCK_INDENT);
-  register_stock_icon (factory, GTK_STOCK_UNINDENT);
+  register_bidi_stock_icon (factory, 
+                           GTK_STOCK_INDENT,
+                           GTK_STOCK_INDENT "-ltr",
+                           GTK_STOCK_INDENT "-rtl");
+  register_bidi_stock_icon (factory, 
+                           GTK_STOCK_UNINDENT,
+                           GTK_STOCK_UNINDENT "-ltr",
+                           GTK_STOCK_UNINDENT "-rtl");
   register_stock_icon (factory, GTK_STOCK_GOTO_TOP);
   register_stock_icon (factory, GTK_STOCK_DELETE);
   register_bidi_stock_icon (factory, 
@@ -1041,7 +1020,7 @@ gtk_icon_size_register_alias (const gchar *alias,
   init_icon_sizes ();
 
   if (!icon_size_lookup_intern (NULL, target, NULL, NULL))
-    g_warning ("gtk_icon_size_register_alias: Icon size %d does not exist", target);
+    g_warning ("gtk_icon_size_register_alias: Icon size %u does not exist", target);
 
   ia = g_hash_table_lookup (icon_aliases, alias);
   if (ia)
@@ -1474,7 +1453,7 @@ render_icon_name_pixbuf (GtkIconSource    *icon_source,
        }
       else
        {
-         g_warning ("Invalid icon size %d\n", size);
+         g_warning ("Invalid icon size %u\n", size);
          width = height = 24;
        }
     }
@@ -1587,9 +1566,13 @@ render_fallback_image (GtkStyle          *style,
 
   if (fallback_source.type == GTK_ICON_SOURCE_EMPTY)
     {
-      GdkPixbuf *pixbuf = _gtk_icon_cache_get_icon (_builtin_cache,
-                                                   GTK_STOCK_MISSING_IMAGE,
-                                                   "24");
+      GdkPixbuf *pixbuf;
+
+      _gtk_icon_theme_ensure_builtin_cache ();
+
+      pixbuf = _gtk_icon_cache_get_icon (_builtin_cache,
+                                        GTK_STOCK_MISSING_IMAGE,
+                                        "24");
       gtk_icon_source_set_pixbuf (&fallback_source, pixbuf);
       g_object_unref (pixbuf);
     }