forked from AuroraMiddleware/gtk
Don't insert mnemonics for stock items (#72918, reported by Mikael
Fri Oct 25 17:32:44 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtktoolbar.c: Don't insert mnemonics for stock items (#72918, reported by Mikael Hallendal)
This commit is contained in:
parent
547b0bd938
commit
a9fd75f871
@ -1,3 +1,8 @@
|
|||||||
|
Fri Oct 25 17:32:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktoolbar.c: Don't insert mnemonics for stock
|
||||||
|
items (#72918, reported by Mikael Hallendal)
|
||||||
|
|
||||||
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Fri Oct 25 17:32:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktoolbar.c: Don't insert mnemonics for stock
|
||||||
|
items (#72918, reported by Mikael Hallendal)
|
||||||
|
|
||||||
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Fri Oct 25 17:32:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktoolbar.c: Don't insert mnemonics for stock
|
||||||
|
items (#72918, reported by Mikael Hallendal)
|
||||||
|
|
||||||
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Fri Oct 25 17:32:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktoolbar.c: Don't insert mnemonics for stock
|
||||||
|
items (#72918, reported by Mikael Hallendal)
|
||||||
|
|
||||||
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Fri Oct 25 17:32:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktoolbar.c: Don't insert mnemonics for stock
|
||||||
|
items (#72918, reported by Mikael Hallendal)
|
||||||
|
|
||||||
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Fri Oct 25 17:32:44 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktoolbar.c: Don't insert mnemonics for stock
|
||||||
|
items (#72918, reported by Mikael Hallendal)
|
||||||
|
|
||||||
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
Fri Oct 25 14:51:34 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
* gtk/gtkfilesel.c: Fix sensitivity of file operation
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "gtkbutton.h"
|
#include "gtkbutton.h"
|
||||||
#include "gtktogglebutton.h"
|
#include "gtktogglebutton.h"
|
||||||
#include "gtkradiobutton.h"
|
#include "gtkradiobutton.h"
|
||||||
@ -118,8 +120,7 @@ static GtkWidget * gtk_toolbar_internal_insert_element (GtkToolbar *too
|
|||||||
GtkWidget *icon,
|
GtkWidget *icon,
|
||||||
GtkSignalFunc callback,
|
GtkSignalFunc callback,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
gint position,
|
gint position);
|
||||||
gboolean has_mnemonic);
|
|
||||||
|
|
||||||
static GtkWidget * gtk_toolbar_internal_insert_item (GtkToolbar *toolbar,
|
static GtkWidget * gtk_toolbar_internal_insert_item (GtkToolbar *toolbar,
|
||||||
const char *text,
|
const char *text,
|
||||||
@ -128,8 +129,7 @@ static GtkWidget * gtk_toolbar_internal_insert_item (GtkToolbar *toolbar,
|
|||||||
GtkWidget *icon,
|
GtkWidget *icon,
|
||||||
GtkSignalFunc callback,
|
GtkSignalFunc callback,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
gint position,
|
gint position);
|
||||||
gboolean has_mnemonic);
|
|
||||||
|
|
||||||
static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar);
|
static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar);
|
||||||
|
|
||||||
@ -959,14 +959,13 @@ gtk_toolbar_internal_insert_item (GtkToolbar *toolbar,
|
|||||||
GtkWidget *icon,
|
GtkWidget *icon,
|
||||||
GtkSignalFunc callback,
|
GtkSignalFunc callback,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
gint position,
|
gint position)
|
||||||
gboolean has_mnemonic)
|
|
||||||
{
|
{
|
||||||
return gtk_toolbar_internal_insert_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON,
|
return gtk_toolbar_internal_insert_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON,
|
||||||
NULL, text,
|
NULL, text,
|
||||||
tooltip_text, tooltip_private_text,
|
tooltip_text, tooltip_private_text,
|
||||||
icon, callback, user_data,
|
icon, callback, user_data,
|
||||||
position, has_mnemonic);
|
position);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
@ -982,7 +981,7 @@ gtk_toolbar_insert_item (GtkToolbar *toolbar,
|
|||||||
return gtk_toolbar_internal_insert_item (toolbar,
|
return gtk_toolbar_internal_insert_item (toolbar,
|
||||||
text, tooltip_text, tooltip_private_text,
|
text, tooltip_text, tooltip_private_text,
|
||||||
icon, callback, user_data,
|
icon, callback, user_data,
|
||||||
position, FALSE);
|
position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1083,6 +1082,32 @@ gtk_toolbar_unset_icon_size (GtkToolbar *toolbar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gchar *
|
||||||
|
elide_underscores (const gchar *original)
|
||||||
|
{
|
||||||
|
gchar *q, *result;
|
||||||
|
const gchar *p;
|
||||||
|
gboolean last_underscore;
|
||||||
|
|
||||||
|
q = result = g_malloc (strlen (original + 1));
|
||||||
|
last_underscore = FALSE;
|
||||||
|
|
||||||
|
for (p = original; *p; p++)
|
||||||
|
{
|
||||||
|
if (!last_underscore && *p == '_')
|
||||||
|
last_underscore = TRUE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
last_underscore = FALSE;
|
||||||
|
*q++ = *p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*q = '\0';
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_toolbar_insert_stock:
|
* gtk_toolbar_insert_stock:
|
||||||
* @toolbar: A #GtkToolbar
|
* @toolbar: A #GtkToolbar
|
||||||
@ -1096,8 +1121,7 @@ gtk_toolbar_unset_icon_size (GtkToolbar *toolbar)
|
|||||||
*
|
*
|
||||||
* Inserts a stock item at the specified position of the toolbar. If
|
* Inserts a stock item at the specified position of the toolbar. If
|
||||||
* @stock_id is not a known stock item ID, it's inserted verbatim,
|
* @stock_id is not a known stock item ID, it's inserted verbatim,
|
||||||
* except that underscores are used to mark mnemonics (see
|
* except that underscores used to mark mnemonics are removed.
|
||||||
* gtk_label_new_with_mnemonic()).
|
|
||||||
*
|
*
|
||||||
* Returns: the inserted widget
|
* Returns: the inserted widget
|
||||||
*/
|
*/
|
||||||
@ -1111,32 +1135,30 @@ gtk_toolbar_insert_stock (GtkToolbar *toolbar,
|
|||||||
gint position)
|
gint position)
|
||||||
{
|
{
|
||||||
GtkStockItem item;
|
GtkStockItem item;
|
||||||
GtkWidget *image;
|
GtkWidget *image = NULL;
|
||||||
|
const gchar *label;
|
||||||
|
gchar *label_no_mnemonic;
|
||||||
|
|
||||||
if (gtk_stock_lookup (stock_id, &item))
|
if (gtk_stock_lookup (stock_id, &item))
|
||||||
{
|
{
|
||||||
image = gtk_image_new_from_stock (stock_id, toolbar->icon_size);
|
image = gtk_image_new_from_stock (stock_id, toolbar->icon_size);
|
||||||
|
label = item.label;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
label = stock_id;
|
||||||
|
|
||||||
|
label_no_mnemonic = elide_underscores (label);
|
||||||
|
|
||||||
return gtk_toolbar_internal_insert_item (toolbar,
|
return gtk_toolbar_internal_insert_item (toolbar,
|
||||||
item.label,
|
label_no_mnemonic,
|
||||||
tooltip_text,
|
tooltip_text,
|
||||||
tooltip_private_text,
|
tooltip_private_text,
|
||||||
image,
|
image,
|
||||||
callback,
|
callback,
|
||||||
user_data,
|
user_data,
|
||||||
position,
|
position);
|
||||||
TRUE);
|
|
||||||
}
|
g_free (label_no_mnemonic);
|
||||||
else
|
|
||||||
return gtk_toolbar_internal_insert_item (toolbar,
|
|
||||||
stock_id,
|
|
||||||
tooltip_text,
|
|
||||||
tooltip_private_text,
|
|
||||||
NULL,
|
|
||||||
callback,
|
|
||||||
user_data,
|
|
||||||
position,
|
|
||||||
TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1366,7 +1388,7 @@ gtk_toolbar_insert_element (GtkToolbar *toolbar,
|
|||||||
return gtk_toolbar_internal_insert_element (toolbar, type, widget, text,
|
return gtk_toolbar_internal_insert_element (toolbar, type, widget, text,
|
||||||
tooltip_text, tooltip_private_text,
|
tooltip_text, tooltip_private_text,
|
||||||
icon, callback, user_data,
|
icon, callback, user_data,
|
||||||
position, FALSE);
|
position);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
@ -1379,8 +1401,7 @@ gtk_toolbar_internal_insert_element (GtkToolbar *toolbar,
|
|||||||
GtkWidget *icon,
|
GtkWidget *icon,
|
||||||
GtkSignalFunc callback,
|
GtkSignalFunc callback,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
gint position,
|
gint position)
|
||||||
gboolean has_mnemonic)
|
|
||||||
{
|
{
|
||||||
GtkToolbarChild *child;
|
GtkToolbarChild *child;
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
@ -1453,9 +1474,6 @@ gtk_toolbar_internal_insert_element (GtkToolbar *toolbar,
|
|||||||
|
|
||||||
if (text)
|
if (text)
|
||||||
{
|
{
|
||||||
if (has_mnemonic)
|
|
||||||
child->label = gtk_label_new_with_mnemonic (text);
|
|
||||||
else
|
|
||||||
child->label = gtk_label_new (text);
|
child->label = gtk_label_new (text);
|
||||||
gtk_box_pack_end (GTK_BOX (box), child->label, FALSE, FALSE, 0);
|
gtk_box_pack_end (GTK_BOX (box), child->label, FALSE, FALSE, 0);
|
||||||
if (toolbar->style != GTK_TOOLBAR_ICONS)
|
if (toolbar->style != GTK_TOOLBAR_ICONS)
|
||||||
|
Loading…
Reference in New Issue
Block a user