diff --git a/ChangeLog b/ChangeLog index 3ca35f91bc..b8f1628f9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +Thu Nov 1 19:18:34 2001 Owen Taylor + + * demos/gtk-demo/stock_browser.c (do_stock_browser): + Set a reasonable default height for the window. + + * demos/gtk-demo/stock_browser.c (id_to_macro): Fix + bug where subsequent '-' weren't converted to '_'. + (#59550, Matthias Clasen) + + * demos/gtk-demo/appwindow.c (menu_items): Don't right + justify the Help menu - just include a comment on + how to do it. (#63539, Marius Andreiana) + + * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): Don't + list GTK_ICON_SIZE_INVALID. + + * demos/gtk-demo/stock_browser.c: Show the biggest available + size, not a fixed size. (Often reported, including #63539, + Marius Andreiana) + Thu Nov 1 19:11:35 2001 Jonathan Blandford * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 3ca35f91bc..b8f1628f9e 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,23 @@ +Thu Nov 1 19:18:34 2001 Owen Taylor + + * demos/gtk-demo/stock_browser.c (do_stock_browser): + Set a reasonable default height for the window. + + * demos/gtk-demo/stock_browser.c (id_to_macro): Fix + bug where subsequent '-' weren't converted to '_'. + (#59550, Matthias Clasen) + + * demos/gtk-demo/appwindow.c (menu_items): Don't right + justify the Help menu - just include a comment on + how to do it. (#63539, Marius Andreiana) + + * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): Don't + list GTK_ICON_SIZE_INVALID. + + * demos/gtk-demo/stock_browser.c: Show the biggest available + size, not a fixed size. (Often reported, including #63539, + Marius Andreiana) + Thu Nov 1 19:11:35 2001 Jonathan Blandford * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 3ca35f91bc..b8f1628f9e 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,23 @@ +Thu Nov 1 19:18:34 2001 Owen Taylor + + * demos/gtk-demo/stock_browser.c (do_stock_browser): + Set a reasonable default height for the window. + + * demos/gtk-demo/stock_browser.c (id_to_macro): Fix + bug where subsequent '-' weren't converted to '_'. + (#59550, Matthias Clasen) + + * demos/gtk-demo/appwindow.c (menu_items): Don't right + justify the Help menu - just include a comment on + how to do it. (#63539, Marius Andreiana) + + * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): Don't + list GTK_ICON_SIZE_INVALID. + + * demos/gtk-demo/stock_browser.c: Show the biggest available + size, not a fixed size. (Often reported, including #63539, + Marius Andreiana) + Thu Nov 1 19:11:35 2001 Jonathan Blandford * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 3ca35f91bc..b8f1628f9e 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,23 @@ +Thu Nov 1 19:18:34 2001 Owen Taylor + + * demos/gtk-demo/stock_browser.c (do_stock_browser): + Set a reasonable default height for the window. + + * demos/gtk-demo/stock_browser.c (id_to_macro): Fix + bug where subsequent '-' weren't converted to '_'. + (#59550, Matthias Clasen) + + * demos/gtk-demo/appwindow.c (menu_items): Don't right + justify the Help menu - just include a comment on + how to do it. (#63539, Marius Andreiana) + + * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): Don't + list GTK_ICON_SIZE_INVALID. + + * demos/gtk-demo/stock_browser.c: Show the biggest available + size, not a fixed size. (Often reported, including #63539, + Marius Andreiana) + Thu Nov 1 19:11:35 2001 Jonathan Blandford * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 3ca35f91bc..b8f1628f9e 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,23 @@ +Thu Nov 1 19:18:34 2001 Owen Taylor + + * demos/gtk-demo/stock_browser.c (do_stock_browser): + Set a reasonable default height for the window. + + * demos/gtk-demo/stock_browser.c (id_to_macro): Fix + bug where subsequent '-' weren't converted to '_'. + (#59550, Matthias Clasen) + + * demos/gtk-demo/appwindow.c (menu_items): Don't right + justify the Help menu - just include a comment on + how to do it. (#63539, Marius Andreiana) + + * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): Don't + list GTK_ICON_SIZE_INVALID. + + * demos/gtk-demo/stock_browser.c: Show the biggest available + size, not a fixed size. (Often reported, including #63539, + Marius Andreiana) + Thu Nov 1 19:11:35 2001 Jonathan Blandford * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 3ca35f91bc..b8f1628f9e 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,23 @@ +Thu Nov 1 19:18:34 2001 Owen Taylor + + * demos/gtk-demo/stock_browser.c (do_stock_browser): + Set a reasonable default height for the window. + + * demos/gtk-demo/stock_browser.c (id_to_macro): Fix + bug where subsequent '-' weren't converted to '_'. + (#59550, Matthias Clasen) + + * demos/gtk-demo/appwindow.c (menu_items): Don't right + justify the Help menu - just include a comment on + how to do it. (#63539, Marius Andreiana) + + * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): Don't + list GTK_ICON_SIZE_INVALID. + + * demos/gtk-demo/stock_browser.c: Show the biggest available + size, not a fixed size. (Often reported, including #63539, + Marius Andreiana) + Thu Nov 1 19:11:35 2001 Jonathan Blandford * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 3ca35f91bc..b8f1628f9e 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,23 @@ +Thu Nov 1 19:18:34 2001 Owen Taylor + + * demos/gtk-demo/stock_browser.c (do_stock_browser): + Set a reasonable default height for the window. + + * demos/gtk-demo/stock_browser.c (id_to_macro): Fix + bug where subsequent '-' weren't converted to '_'. + (#59550, Matthias Clasen) + + * demos/gtk-demo/appwindow.c (menu_items): Don't right + justify the Help menu - just include a comment on + how to do it. (#63539, Marius Andreiana) + + * gtk/gtkiconfactory.c (gtk_icon_set_get_sizes): Don't + list GTK_ICON_SIZE_INVALID. + + * demos/gtk-demo/stock_browser.c: Show the biggest available + size, not a fixed size. (Often reported, including #63539, + Marius Andreiana) + Thu Nov 1 19:11:35 2001 Jonathan Blandford * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, diff --git a/demos/gtk-demo/appwindow.c b/demos/gtk-demo/appwindow.c index 89b517c07f..c052bcbc60 100644 --- a/demos/gtk-demo/appwindow.c +++ b/demos/gtk-demo/appwindow.c @@ -52,7 +52,10 @@ static GtkItemFactoryEntry menu_items[] = { "/_Preferences/Shape/_Rectangle", NULL, menuitem_cb, 0, "/Preferences/Shape/Square" }, { "/_Preferences/Shape/_Oval", NULL, menuitem_cb, 0, "/Preferences/Shape/Rectangle" }, - { "/_Help", NULL, 0, 0, "" }, + /* If you wanted this to be right justified you would use "", not "". + * Right justified help menu items are generally considered a bad idea now days. + */ + { "/_Help", NULL, 0, 0, "" }, { "/Help/_About", NULL, menuitem_cb, 0 }, }; diff --git a/demos/gtk-demo/stock_browser.c b/demos/gtk-demo/stock_browser.c index 4523d699a7..7457c5f172 100644 --- a/demos/gtk-demo/stock_browser.c +++ b/demos/gtk-demo/stock_browser.c @@ -84,26 +84,32 @@ struct _StockItemDisplay static gchar* id_to_macro (const gchar *id) { - GString *macro; + GString *macro = NULL; const gchar *cp; - /* gtk-foo -> GTK_STOCK_FOO */ - - cp = id; - while (*cp && *cp != '-') - ++cp; - - if (*cp == '\0') - return g_strdup ("??UNKNOWN??"); + /* gtk-foo-bar -> GTK_STOCK_FOO_BAR */ macro = g_string_new (NULL); - g_string_append_len (macro, id, cp - id); + cp = id; - g_string_append (macro, "_STOCK"); - g_string_append (macro, cp); + if (strncmp (cp, "gtk-", 4) == 0) + { + g_string_append (macro, "GTK_STOCK_"); + cp += 4; + } - g_string_ascii_up (macro); + while (*cp) + { + if (*cp == '-') + g_string_append_c (macro, '_'); + else if (g_ascii_islower (*cp)) + g_string_append_c (macro, g_ascii_toupper (*cp)); + else + g_string_append_c (macro, *cp); + + cp++; + } return g_string_free (macro, FALSE); } @@ -220,6 +226,38 @@ create_model (void) return GTK_TREE_MODEL (store); } +/* Finds the largest size at which the given image stock id is + * available. This would not be useful for a normal application + */ +static GtkIconSize +get_largest_size (const char *id) +{ + GtkIconSet *set = gtk_icon_factory_lookup_default (id); + GtkIconSize *sizes; + gint n_sizes, i; + GtkIconSize best_size = GTK_ICON_SIZE_INVALID; + gint best_pixels = 0; + + gtk_icon_set_get_sizes (set, &sizes, &n_sizes); + + for (i = 0; i < n_sizes; i++) + { + gint width, height; + + gtk_icon_size_lookup (sizes[i], &width, &height); + + if (width * height > best_pixels) + { + best_size = sizes[i]; + best_pixels = width * height; + } + } + + g_free (sizes); + + return best_size; +} + static void selection_changed (GtkTreeSelection *selection) { @@ -263,12 +301,9 @@ selection_changed (GtkTreeSelection *selection) gtk_label_set_text (GTK_LABEL (display->label_accel_label), ""); } - /* The problem here is that some icons don't have SIZE_LARGE_TOOLBAR, - * so we get a "missing image" icon... - */ if (info->small_icon) gtk_image_set_from_stock (GTK_IMAGE (display->icon_image), info->id, - GTK_ICON_SIZE_LARGE_TOOLBAR); + get_largest_size (info->id)); else gtk_image_set_from_pixbuf (GTK_IMAGE (display->icon_image), NULL); @@ -403,6 +438,7 @@ do_stock_browser (void) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Stock Icons and Items"); + gtk_window_set_default_size (GTK_WINDOW (window), -1, 500); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); gtk_container_set_border_width (GTK_CONTAINER (window), 8); diff --git a/gtk/gtkiconfactory.c b/gtk/gtkiconfactory.c index 09de30d246..2c62650e8e 100644 --- a/gtk/gtkiconfactory.c +++ b/gtk/gtkiconfactory.c @@ -1305,12 +1305,12 @@ gtk_icon_set_get_sizes (GtkIconSet *icon_set, init_icon_sizes (); *sizes = g_new (GtkIconSize, icon_sizes_used); - *n_sizes = icon_sizes_used; + *n_sizes = icon_sizes_used - 1; - i = 0; + i = 1; while (i < icon_sizes_used) { - (*sizes)[i] = icon_sizes[i].size; + (*sizes)[i - 1] = icon_sizes[i].size; ++i; } }