fix so that default icons are created if you call gtk_stock_list_ids()

2001-05-25  Havoc Pennington  <hp@redhat.com>

	* gtk/gtkiconfactory.c: fix so that default icons are created if
	you call gtk_stock_list_ids()

	* demos/gtk-demo/stock_browser.c (create_model): sort stock items
	in list
This commit is contained in:
Havoc Pennington 2001-05-25 22:08:53 +00:00 committed by Havoc Pennington
parent fe14698f7f
commit e05472202d
10 changed files with 84 additions and 17 deletions

View File

@ -1,5 +1,13 @@
2001-05-25 Havoc Pennington <hp@redhat.com> 2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c: fix so that default icons are created if
you call gtk_stock_list_ids()
* demos/gtk-demo/stock_browser.c (create_model): sort stock items
in list
2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon
set can render without falling back to missing image icon set can render without falling back to missing image icon

View File

@ -1,5 +1,13 @@
2001-05-25 Havoc Pennington <hp@redhat.com> 2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c: fix so that default icons are created if
you call gtk_stock_list_ids()
* demos/gtk-demo/stock_browser.c (create_model): sort stock items
in list
2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon
set can render without falling back to missing image icon set can render without falling back to missing image icon

View File

@ -1,5 +1,13 @@
2001-05-25 Havoc Pennington <hp@redhat.com> 2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c: fix so that default icons are created if
you call gtk_stock_list_ids()
* demos/gtk-demo/stock_browser.c (create_model): sort stock items
in list
2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon
set can render without falling back to missing image icon set can render without falling back to missing image icon

View File

@ -1,5 +1,13 @@
2001-05-25 Havoc Pennington <hp@redhat.com> 2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c: fix so that default icons are created if
you call gtk_stock_list_ids()
* demos/gtk-demo/stock_browser.c (create_model): sort stock items
in list
2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon
set can render without falling back to missing image icon set can render without falling back to missing image icon

View File

@ -1,5 +1,13 @@
2001-05-25 Havoc Pennington <hp@redhat.com> 2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c: fix so that default icons are created if
you call gtk_stock_list_ids()
* demos/gtk-demo/stock_browser.c (create_model): sort stock items
in list
2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon
set can render without falling back to missing image icon set can render without falling back to missing image icon

View File

@ -1,5 +1,13 @@
2001-05-25 Havoc Pennington <hp@redhat.com> 2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c: fix so that default icons are created if
you call gtk_stock_list_ids()
* demos/gtk-demo/stock_browser.c (create_model): sort stock items
in list
2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon
set can render without falling back to missing image icon set can render without falling back to missing image icon

View File

@ -1,5 +1,13 @@
2001-05-25 Havoc Pennington <hp@redhat.com> 2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c: fix so that default icons are created if
you call gtk_stock_list_ids()
* demos/gtk-demo/stock_browser.c (create_model): sort stock items
in list
2001-05-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): get sizes an icon
set can render without falling back to missing image icon set can render without falling back to missing image icon

View File

@ -1,10 +1,13 @@
/* Stock Item/Icon Browser /* Stock Item/Icon Browser
* *
* This source code for this demo doesn't demonstrate anything * This source code for this demo doesn't demonstrate anything
* particularly useful in applications, it just lets you scan the * particularly useful in applications. The purpose of the "demo" is
* available stock icons and stock items. * just to provide a handy place to browse the available stock icons
* and stock items.
*/ */
#include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
static GtkWidget *window = NULL; static GtkWidget *window = NULL;
@ -134,6 +137,7 @@ create_model (void)
store = gtk_list_store_new_with_types (1, STOCK_ITEM_INFO_TYPE); store = gtk_list_store_new_with_types (1, STOCK_ITEM_INFO_TYPE);
ids = gtk_stock_list_ids (); ids = gtk_stock_list_ids ();
ids = g_slist_sort (ids, (GCompareFunc) strcmp);
tmp_list = ids; tmp_list = ids;
while (tmp_list != NULL) while (tmp_list != NULL)
{ {

View File

@ -273,6 +273,17 @@ gtk_icon_factory_remove_default (GtkIconFactory *factory)
g_object_unref (G_OBJECT (factory)); g_object_unref (G_OBJECT (factory));
} }
static void
ensure_default_icons (void)
{
if (gtk_default_icons == NULL)
{
gtk_default_icons = gtk_icon_factory_new ();
get_default_icons (gtk_default_icons);
}
}
/** /**
* gtk_icon_factory_lookup_default: * gtk_icon_factory_lookup_default:
* @stock_id: an icon name * @stock_id: an icon name
@ -306,12 +317,7 @@ gtk_icon_factory_lookup_default (const gchar *stock_id)
tmp_list = g_slist_next (tmp_list); tmp_list = g_slist_next (tmp_list);
} }
if (gtk_default_icons == NULL) ensure_default_icons ();
{
gtk_default_icons = gtk_icon_factory_new ();
get_default_icons (gtk_default_icons);
}
return gtk_icon_factory_lookup (gtk_default_icons, stock_id); return gtk_icon_factory_lookup (gtk_default_icons, stock_id);
} }
@ -2056,6 +2062,8 @@ _gtk_icon_factory_list_ids (void)
GSList *ids; GSList *ids;
ids = NULL; ids = NULL;
ensure_default_icons ();
tmp_list = all_icon_factories; tmp_list = all_icon_factories;
while (tmp_list != NULL) while (tmp_list != NULL)

View File

@ -62,8 +62,6 @@ void gtk_stock_item_free (GtkStockItem *item);
/* Stock IDs (not all are stock items; some are images only) */ /* Stock IDs (not all are stock items; some are images only) */
#define GTK_STOCK_MISSING_IMAGE "gtk-missing-image"
#define GTK_STOCK_DIALOG_INFO "gtk-dialog-info" #define GTK_STOCK_DIALOG_INFO "gtk-dialog-info"
#define GTK_STOCK_DIALOG_WARNING "gtk-dialog-warning" #define GTK_STOCK_DIALOG_WARNING "gtk-dialog-warning"
#define GTK_STOCK_DIALOG_ERROR "gtk-dialog-error" #define GTK_STOCK_DIALOG_ERROR "gtk-dialog-error"
@ -101,6 +99,7 @@ void gtk_stock_item_free (GtkStockItem *item);
#define GTK_STOCK_JUSTIFY_FILL "gtk-justify-fill" #define GTK_STOCK_JUSTIFY_FILL "gtk-justify-fill"
#define GTK_STOCK_JUSTIFY_LEFT "gtk-justify-left" #define GTK_STOCK_JUSTIFY_LEFT "gtk-justify-left"
#define GTK_STOCK_JUSTIFY_RIGHT "gtk-justify-right" #define GTK_STOCK_JUSTIFY_RIGHT "gtk-justify-right"
#define GTK_STOCK_MISSING_IMAGE "gtk-missing-image"
#define GTK_STOCK_NEW "gtk-new" #define GTK_STOCK_NEW "gtk-new"
#define GTK_STOCK_NO "gtk-no" #define GTK_STOCK_NO "gtk-no"
#define GTK_STOCK_OK "gtk-ok" #define GTK_STOCK_OK "gtk-ok"