forked from AuroraMiddleware/gtk
Insert cast to fix warning. Assign something to old_value to quiet gcc
Thu Jul 3 03:13:20 2003 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtkpaned.c (gtk_paned_set_child_property): Insert cast to fix warning. Assign something to old_value to quiet gcc * gtk/gtkcalendar.c (start_spinning): gtk_timeout_add->g_timeout_add * gtk/gtkicontheme.c (theme_lookup_icon): Make it compile (remove double semicolon) * gtk/gtktoolbutton.c (gtk_tool_button_class_init): Long comment about properties. (gtk_tool_button_class_init): Improve text for "use_underline" property (gtk_tool_button_create_menu_proxy): Fix up to use_mnemonic based on whether the passed-in label has use_mnemonic set (gtk_tool_button_create_menu_proxy): Split image cloning out in new function. Make that function also handle image with pixbuf storage. (gtk_tool_button_construct_contents): Use gtk_widget_destroy() instead of gtk_container_remove(). (gtk_tool_button_construct_contents): Fix eliding bug * gtk/gtktoolbar.c (gtk_toolbar_finalize): New function. Unref tooltips, pointed out by Morten Welinder (gtk_toolbar_button_press): Make popup_context_menu signal provide coordinates and button number * tests/testtoolbar.c (main): Add new pixbuf toolbutton * tests/apple-red.png: new file
This commit is contained in:
parent
9e3f0c6f5f
commit
1f8942769b
34
ChangeLog
34
ChangeLog
@ -1,3 +1,37 @@
|
||||
Thu Jul 3 03:13:20 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkpaned.c (gtk_paned_set_child_property): Insert cast to
|
||||
fix warning. Assign something to old_value to quiet gcc
|
||||
|
||||
* gtk/gtkcalendar.c
|
||||
(start_spinning): gtk_timeout_add->g_timeout_add
|
||||
|
||||
* gtk/gtkicontheme.c
|
||||
(theme_lookup_icon): Make it compile (remove double semicolon)
|
||||
|
||||
* gtk/gtktoolbutton.c
|
||||
(gtk_tool_button_class_init): Long comment about properties.
|
||||
(gtk_tool_button_class_init): Improve text for "use_underline"
|
||||
property
|
||||
(gtk_tool_button_create_menu_proxy): Fix up to use_mnemonic based
|
||||
on whether the passed-in label has use_mnemonic set
|
||||
(gtk_tool_button_create_menu_proxy): Split image cloning out in
|
||||
new function. Make that function also handle image with pixbuf
|
||||
storage.
|
||||
(gtk_tool_button_construct_contents): Use gtk_widget_destroy()
|
||||
instead of gtk_container_remove().
|
||||
(gtk_tool_button_construct_contents): Fix eliding bug
|
||||
|
||||
* gtk/gtktoolbar.c
|
||||
(gtk_toolbar_finalize): New function. Unref tooltips, pointed out
|
||||
by Morten Welinder
|
||||
(gtk_toolbar_button_press): Make popup_context_menu signal provide
|
||||
coordinates and button number
|
||||
|
||||
* tests/testtoolbar.c (main): Add new pixbuf toolbutton
|
||||
|
||||
* tests/apple-red.png: new file
|
||||
|
||||
Wed Jul 2 18:00:56 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkicontheme.[ch]: Implement a loader for
|
||||
|
@ -1,3 +1,37 @@
|
||||
Thu Jul 3 03:13:20 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkpaned.c (gtk_paned_set_child_property): Insert cast to
|
||||
fix warning. Assign something to old_value to quiet gcc
|
||||
|
||||
* gtk/gtkcalendar.c
|
||||
(start_spinning): gtk_timeout_add->g_timeout_add
|
||||
|
||||
* gtk/gtkicontheme.c
|
||||
(theme_lookup_icon): Make it compile (remove double semicolon)
|
||||
|
||||
* gtk/gtktoolbutton.c
|
||||
(gtk_tool_button_class_init): Long comment about properties.
|
||||
(gtk_tool_button_class_init): Improve text for "use_underline"
|
||||
property
|
||||
(gtk_tool_button_create_menu_proxy): Fix up to use_mnemonic based
|
||||
on whether the passed-in label has use_mnemonic set
|
||||
(gtk_tool_button_create_menu_proxy): Split image cloning out in
|
||||
new function. Make that function also handle image with pixbuf
|
||||
storage.
|
||||
(gtk_tool_button_construct_contents): Use gtk_widget_destroy()
|
||||
instead of gtk_container_remove().
|
||||
(gtk_tool_button_construct_contents): Fix eliding bug
|
||||
|
||||
* gtk/gtktoolbar.c
|
||||
(gtk_toolbar_finalize): New function. Unref tooltips, pointed out
|
||||
by Morten Welinder
|
||||
(gtk_toolbar_button_press): Make popup_context_menu signal provide
|
||||
coordinates and button number
|
||||
|
||||
* tests/testtoolbar.c (main): Add new pixbuf toolbutton
|
||||
|
||||
* tests/apple-red.png: new file
|
||||
|
||||
Wed Jul 2 18:00:56 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkicontheme.[ch]: Implement a loader for
|
||||
|
@ -1,3 +1,37 @@
|
||||
Thu Jul 3 03:13:20 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkpaned.c (gtk_paned_set_child_property): Insert cast to
|
||||
fix warning. Assign something to old_value to quiet gcc
|
||||
|
||||
* gtk/gtkcalendar.c
|
||||
(start_spinning): gtk_timeout_add->g_timeout_add
|
||||
|
||||
* gtk/gtkicontheme.c
|
||||
(theme_lookup_icon): Make it compile (remove double semicolon)
|
||||
|
||||
* gtk/gtktoolbutton.c
|
||||
(gtk_tool_button_class_init): Long comment about properties.
|
||||
(gtk_tool_button_class_init): Improve text for "use_underline"
|
||||
property
|
||||
(gtk_tool_button_create_menu_proxy): Fix up to use_mnemonic based
|
||||
on whether the passed-in label has use_mnemonic set
|
||||
(gtk_tool_button_create_menu_proxy): Split image cloning out in
|
||||
new function. Make that function also handle image with pixbuf
|
||||
storage.
|
||||
(gtk_tool_button_construct_contents): Use gtk_widget_destroy()
|
||||
instead of gtk_container_remove().
|
||||
(gtk_tool_button_construct_contents): Fix eliding bug
|
||||
|
||||
* gtk/gtktoolbar.c
|
||||
(gtk_toolbar_finalize): New function. Unref tooltips, pointed out
|
||||
by Morten Welinder
|
||||
(gtk_toolbar_button_press): Make popup_context_menu signal provide
|
||||
coordinates and button number
|
||||
|
||||
* tests/testtoolbar.c (main): Add new pixbuf toolbutton
|
||||
|
||||
* tests/apple-red.png: new file
|
||||
|
||||
Wed Jul 2 18:00:56 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkicontheme.[ch]: Implement a loader for
|
||||
|
@ -1,3 +1,37 @@
|
||||
Thu Jul 3 03:13:20 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkpaned.c (gtk_paned_set_child_property): Insert cast to
|
||||
fix warning. Assign something to old_value to quiet gcc
|
||||
|
||||
* gtk/gtkcalendar.c
|
||||
(start_spinning): gtk_timeout_add->g_timeout_add
|
||||
|
||||
* gtk/gtkicontheme.c
|
||||
(theme_lookup_icon): Make it compile (remove double semicolon)
|
||||
|
||||
* gtk/gtktoolbutton.c
|
||||
(gtk_tool_button_class_init): Long comment about properties.
|
||||
(gtk_tool_button_class_init): Improve text for "use_underline"
|
||||
property
|
||||
(gtk_tool_button_create_menu_proxy): Fix up to use_mnemonic based
|
||||
on whether the passed-in label has use_mnemonic set
|
||||
(gtk_tool_button_create_menu_proxy): Split image cloning out in
|
||||
new function. Make that function also handle image with pixbuf
|
||||
storage.
|
||||
(gtk_tool_button_construct_contents): Use gtk_widget_destroy()
|
||||
instead of gtk_container_remove().
|
||||
(gtk_tool_button_construct_contents): Fix eliding bug
|
||||
|
||||
* gtk/gtktoolbar.c
|
||||
(gtk_toolbar_finalize): New function. Unref tooltips, pointed out
|
||||
by Morten Welinder
|
||||
(gtk_toolbar_button_press): Make popup_context_menu signal provide
|
||||
coordinates and button number
|
||||
|
||||
* tests/testtoolbar.c (main): Add new pixbuf toolbutton
|
||||
|
||||
* tests/apple-red.png: new file
|
||||
|
||||
Wed Jul 2 18:00:56 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkicontheme.[ch]: Implement a loader for
|
||||
|
@ -1,3 +1,37 @@
|
||||
Thu Jul 3 03:13:20 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkpaned.c (gtk_paned_set_child_property): Insert cast to
|
||||
fix warning. Assign something to old_value to quiet gcc
|
||||
|
||||
* gtk/gtkcalendar.c
|
||||
(start_spinning): gtk_timeout_add->g_timeout_add
|
||||
|
||||
* gtk/gtkicontheme.c
|
||||
(theme_lookup_icon): Make it compile (remove double semicolon)
|
||||
|
||||
* gtk/gtktoolbutton.c
|
||||
(gtk_tool_button_class_init): Long comment about properties.
|
||||
(gtk_tool_button_class_init): Improve text for "use_underline"
|
||||
property
|
||||
(gtk_tool_button_create_menu_proxy): Fix up to use_mnemonic based
|
||||
on whether the passed-in label has use_mnemonic set
|
||||
(gtk_tool_button_create_menu_proxy): Split image cloning out in
|
||||
new function. Make that function also handle image with pixbuf
|
||||
storage.
|
||||
(gtk_tool_button_construct_contents): Use gtk_widget_destroy()
|
||||
instead of gtk_container_remove().
|
||||
(gtk_tool_button_construct_contents): Fix eliding bug
|
||||
|
||||
* gtk/gtktoolbar.c
|
||||
(gtk_toolbar_finalize): New function. Unref tooltips, pointed out
|
||||
by Morten Welinder
|
||||
(gtk_toolbar_button_press): Make popup_context_menu signal provide
|
||||
coordinates and button number
|
||||
|
||||
* tests/testtoolbar.c (main): Add new pixbuf toolbutton
|
||||
|
||||
* tests/apple-red.png: new file
|
||||
|
||||
Wed Jul 2 18:00:56 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkicontheme.[ch]: Implement a loader for
|
||||
|
@ -2496,9 +2496,10 @@ arrow_action (GtkCalendar *calendar,
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
calendar_timer (GtkCalendar *calendar)
|
||||
static gboolean
|
||||
calendar_timer (gpointer data)
|
||||
{
|
||||
GtkCalendar *calendar = data;
|
||||
GtkCalendarPrivateData *private_data = GTK_CALENDAR_PRIVATE_DATA (calendar);
|
||||
gboolean retval = FALSE;
|
||||
|
||||
@ -2535,9 +2536,9 @@ start_spinning (GtkWidget *widget,
|
||||
if (!private_data->timer)
|
||||
{
|
||||
private_data->need_timer = TRUE;
|
||||
private_data->timer = gtk_timeout_add (CALENDAR_INITIAL_TIMER_DELAY,
|
||||
(GtkFunction) calendar_timer,
|
||||
(gpointer) widget);
|
||||
private_data->timer = g_timeout_add (CALENDAR_INITIAL_TIMER_DELAY,
|
||||
calendar_timer,
|
||||
(gpointer) widget);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1517,7 +1517,7 @@ theme_lookup_icon (IconTheme *theme,
|
||||
IconThemeDir *dir, *min_dir;
|
||||
char *file;
|
||||
int min_difference, difference;
|
||||
BuiltinIcon *closest_builtin = NULL;;
|
||||
BuiltinIcon *closest_builtin = NULL;
|
||||
gboolean smaller, has_larger;
|
||||
IconSuffix suffix;
|
||||
|
||||
|
@ -547,10 +547,11 @@ gtk_paned_set_child_property (GtkContainer *container,
|
||||
break;
|
||||
default:
|
||||
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
|
||||
old_value = -1; /* quiet gcc */
|
||||
break;
|
||||
}
|
||||
if (old_value != new_value)
|
||||
gtk_widget_queue_resize (container);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (container));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -131,6 +131,8 @@ static void gtk_toolbar_get_child_property (GtkContainer *container,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_toolbar_finalize (GObject *object);
|
||||
|
||||
|
||||
static void gtk_toolbar_add (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
@ -281,6 +283,7 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
|
||||
|
||||
gobject_class->set_property = gtk_toolbar_set_property;
|
||||
gobject_class->get_property = gtk_toolbar_get_property;
|
||||
gobject_class->finalize = gtk_toolbar_finalize;
|
||||
|
||||
widget_class->button_press_event = gtk_toolbar_button_press;
|
||||
widget_class->expose_event = gtk_toolbar_expose;
|
||||
@ -332,7 +335,7 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GtkToolbarClass, popup_context_menu),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
_gtk_marshal_VOID__INT_INT_INT,
|
||||
G_TYPE_NONE, 0);
|
||||
toolbar_signals[MOVE_FOCUS] =
|
||||
_gtk_binding_signal_new ("move_focus",
|
||||
@ -1983,7 +1986,10 @@ gtk_toolbar_button_press (GtkWidget *toolbar,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
if (event->button == 3)
|
||||
g_signal_emit (toolbar, toolbar_signals[POPUP_CONTEXT_MENU], 0, NULL);
|
||||
{
|
||||
g_signal_emit (toolbar, toolbar_signals[POPUP_CONTEXT_MENU], 0,
|
||||
(int)event->x_root, (int)event->y_root, event->button, NULL);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -2762,3 +2768,14 @@ gtk_toolbar_internal_insert_element (GtkToolbar *toolbar,
|
||||
|
||||
return child->widget;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_toolbar_finalize (GObject *object)
|
||||
{
|
||||
GtkToolbar *toolbar = GTK_TOOLBAR (object);
|
||||
|
||||
if (toolbar->tooltips)
|
||||
g_object_unref (toolbar->tooltips);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -121,7 +121,10 @@ struct _GtkToolbarClass
|
||||
GtkOrientation orientation);
|
||||
void (* style_changed) (GtkToolbar *toolbar,
|
||||
GtkToolbarStyle style);
|
||||
void (* popup_context_menu) (GtkToolbar *toolbar);
|
||||
void (* popup_context_menu) (GtkToolbar *toolbar,
|
||||
gint x,
|
||||
gint y,
|
||||
gint button_number);
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gtk_reserved1) (void);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "gtkvbox.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtktoolbar.h"
|
||||
#include "gtkiconfactory.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -129,6 +130,37 @@ gtk_tool_button_class_init (GtkToolButtonClass *klass)
|
||||
|
||||
klass->button_type = GTK_TYPE_BUTTON;
|
||||
|
||||
/* Properties are interpreted like this:
|
||||
*
|
||||
* - if the tool button has an icon_widget, then that widget
|
||||
* will be used as the icon. Otherwise, if the tool button
|
||||
* has a stock id, the corresponding stock icon will be
|
||||
* used. Otherwise, the tool button will not have an icon.
|
||||
*
|
||||
* - if the tool button has a label_widget then that widget
|
||||
* will be used as the label. Otherwise, if the tool button
|
||||
* has a label text, that text will be used as label. Otherwise,
|
||||
* if the toolbutton has a stock id, the corresponding text
|
||||
* will be used as label. Otherwise, the toolbutton will
|
||||
* have an empty label.
|
||||
*
|
||||
* - The use_underline property only has an effect when the label
|
||||
* on the toolbutton comes from the label property (ie. not from
|
||||
* label_widget or from stock_id).
|
||||
*
|
||||
* In that case, if use_underline is set,
|
||||
*
|
||||
* - underscores are removed from the label text before
|
||||
* the label is shown on the toolbutton unless the
|
||||
* underscore is followed by another underscore
|
||||
*
|
||||
* - an underscore indicates that the next character when
|
||||
* used in the overflow menu should be used as a mnemonic.
|
||||
*
|
||||
* In short: use_underline = TRUE means that the label text has
|
||||
* the form "_Open" and the toolbar should take appropriate action.
|
||||
*/
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_LABEL,
|
||||
g_param_spec_string ("label",
|
||||
@ -140,7 +172,7 @@ gtk_tool_button_class_init (GtkToolButtonClass *klass)
|
||||
PROP_USE_UNDERLINE,
|
||||
g_param_spec_boolean ("use_underline",
|
||||
_("Use underline"),
|
||||
_("Interpret underlines in the item label"),
|
||||
_("If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (object_class,
|
||||
@ -277,8 +309,10 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
|
||||
if (GTK_BIN (button->button)->child)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (button->button),
|
||||
GTK_BIN (button->button)->child);
|
||||
/* Note: we are not destroying the label_widget or icon_widget
|
||||
* here because they were removed from their containers above
|
||||
*/
|
||||
gtk_widget_destroy (GTK_BIN (button->button)->child);
|
||||
}
|
||||
|
||||
style = gtk_tool_item_get_toolbar_style (GTK_TOOL_ITEM (button));
|
||||
@ -298,7 +332,7 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
else
|
||||
{
|
||||
GtkStockItem stock_item;
|
||||
gboolean elide = TRUE;
|
||||
gboolean elide;
|
||||
gchar *label_text;
|
||||
|
||||
if (button->label_text)
|
||||
@ -307,9 +341,15 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
elide = button->use_underline;
|
||||
}
|
||||
else if (button->stock_id && gtk_stock_lookup (button->stock_id, &stock_item))
|
||||
label_text = stock_item.label;
|
||||
{
|
||||
label_text = stock_item.label;
|
||||
elide = TRUE;
|
||||
}
|
||||
else
|
||||
label_text = "";
|
||||
{
|
||||
label_text = "";
|
||||
elide = FALSE;
|
||||
}
|
||||
|
||||
if (elide)
|
||||
label_text = _gtk_toolbar_elide_underscores (label_text);
|
||||
@ -333,25 +373,9 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
|
||||
if (GTK_IS_IMAGE (icon))
|
||||
{
|
||||
GtkImage *image = GTK_IMAGE (icon);
|
||||
GtkImageType storage_type = gtk_image_get_storage_type (image);
|
||||
|
||||
if (storage_type == GTK_IMAGE_STOCK)
|
||||
{
|
||||
gchar *stock_id;
|
||||
gtk_image_get_stock (image, &stock_id, NULL);
|
||||
|
||||
icon = gtk_image_new_from_stock (stock_id, icon_size);
|
||||
gtk_widget_show (icon);
|
||||
}
|
||||
else if (storage_type == GTK_IMAGE_ICON_SET)
|
||||
{
|
||||
GtkIconSet *icon_set;
|
||||
gtk_image_get_icon_set (image, &icon_set, NULL);
|
||||
|
||||
icon = gtk_image_new_from_icon_set (icon_set, icon_size);
|
||||
gtk_widget_show (icon);
|
||||
}
|
||||
g_object_set (G_OBJECT (button->icon_widget),
|
||||
"icon-size", icon_size,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
else if (button->stock_id)
|
||||
@ -467,6 +491,44 @@ gtk_tool_button_finalize (GObject *object)
|
||||
parent_class->finalize (object);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
clone_image_menu_size (GtkImage *image, GtkSettings *settings)
|
||||
{
|
||||
GtkImageType storage_type = gtk_image_get_storage_type (image);
|
||||
|
||||
if (storage_type == GTK_IMAGE_STOCK)
|
||||
{
|
||||
gchar *stock_id;
|
||||
gtk_image_get_stock (image, &stock_id, NULL);
|
||||
return gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
else if (storage_type == GTK_IMAGE_ICON_SET)
|
||||
{
|
||||
GtkIconSet *icon_set;
|
||||
gtk_image_get_icon_set (image, &icon_set, NULL);
|
||||
return gtk_image_new_from_icon_set (icon_set, GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
else if (storage_type == GTK_IMAGE_PIXBUF)
|
||||
{
|
||||
gint width, height;
|
||||
|
||||
if (settings &&
|
||||
gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
|
||||
&width, &height))
|
||||
{
|
||||
GdkPixbuf *src_pixbuf, *dest_pixbuf;
|
||||
|
||||
src_pixbuf = gtk_image_get_pixbuf (image);
|
||||
dest_pixbuf = gdk_pixbuf_scale_simple (src_pixbuf, width, height,
|
||||
GDK_INTERP_BILINEAR);
|
||||
|
||||
return gtk_image_new_from_pixbuf (dest_pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tool_button_create_menu_proxy (GtkToolItem *item)
|
||||
{
|
||||
@ -475,17 +537,28 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item)
|
||||
GtkWidget *menu_image = NULL;
|
||||
GtkStockItem stock_item;
|
||||
gboolean use_mnemonic = TRUE;
|
||||
const char *label = "";
|
||||
const char *label;
|
||||
|
||||
if (button->label_widget && GTK_IS_LABEL (button->label_widget))
|
||||
label = gtk_label_get_label (GTK_LABEL (button->label_widget));
|
||||
{
|
||||
label = gtk_label_get_label (GTK_LABEL (button->label_widget));
|
||||
use_mnemonic = gtk_label_get_use_underline (GTK_LABEL (button->label_widget));
|
||||
}
|
||||
else if (button->label_text)
|
||||
{
|
||||
label = button->label_text;
|
||||
use_mnemonic = button->use_underline;
|
||||
}
|
||||
else if (button->stock_id && gtk_stock_lookup (button->stock_id, &stock_item))
|
||||
label = stock_item.label;
|
||||
{
|
||||
label = stock_item.label;
|
||||
use_mnemonic = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
label = "";
|
||||
use_mnemonic = FALSE;
|
||||
}
|
||||
|
||||
if (use_mnemonic)
|
||||
menu_item = gtk_image_menu_item_new_with_mnemonic (label);
|
||||
@ -494,21 +567,8 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item)
|
||||
|
||||
if (button->icon_widget && GTK_IS_IMAGE (button->icon_widget))
|
||||
{
|
||||
GtkImage *image = GTK_IMAGE (button->icon_widget);
|
||||
GtkImageType storage_type = gtk_image_get_storage_type (image);
|
||||
|
||||
if (storage_type == GTK_IMAGE_STOCK)
|
||||
{
|
||||
gchar *stock_id;
|
||||
gtk_image_get_stock (image, &stock_id, NULL);
|
||||
menu_image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
else if (storage_type == GTK_IMAGE_ICON_SET)
|
||||
{
|
||||
GtkIconSet *icon_set;
|
||||
gtk_image_get_icon_set (image, &icon_set, NULL);
|
||||
menu_image = gtk_image_new_from_icon_set (icon_set, GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
menu_image = clone_image_menu_size (GTK_IMAGE (button->icon_widget),
|
||||
gtk_widget_get_settings (GTK_WIDGET (button)));
|
||||
}
|
||||
else if (button->stock_id)
|
||||
{
|
||||
|
BIN
tests/apple-red.png
Normal file
BIN
tests/apple-red.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
@ -532,15 +532,19 @@ main (gint argc, gchar **argv)
|
||||
|
||||
item = gtk_radio_tool_button_new_from_stock (group, GTK_STOCK_JUSTIFY_CENTER); make_prop_editor (G_OBJECT (item));
|
||||
|
||||
group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
|
||||
group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
|
||||
add_item_to_list (store, item, "Center");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
item = gtk_radio_tool_button_new_from_stock (group, GTK_STOCK_JUSTIFY_RIGHT);
|
||||
|
||||
add_item_to_list (store, item, "Right");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
|
||||
item = gtk_tool_button_new ("_Apple", gtk_image_new_from_file ("apple-red.png"));
|
||||
add_item_to_list (store, item, "Apple");
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
|
||||
gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (item), TRUE);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_table_attach (GTK_TABLE (table), hbox,
|
||||
|
Loading…
Reference in New Issue
Block a user