removed gimp_get_accel_string() and use gtk_accelerator_get_label()

2007-10-01  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpwidgets-utils.[ch]: removed
	gimp_get_accel_string() and use gtk_accelerator_get_label()
	instead.

	* app/widgets/gimpactionview.c: ditto.


svn path=/trunk/; revision=23704
This commit is contained in:
Michael Natterer 2007-10-01 13:10:40 +00:00 committed by Michael Natterer
parent d16a7ffb2a
commit 6435c669b8
4 changed files with 19 additions and 78 deletions

View File

@ -1,3 +1,11 @@
2007-10-01 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpwidgets-utils.[ch]: removed
gimp_get_accel_string() and use gtk_accelerator_get_label()
instead.
* app/widgets/gimpactionview.c: ditto.
2007-10-01 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/scripts/camo.scm

View File

@ -38,7 +38,6 @@
#include "gimpmessagebox.h"
#include "gimpmessagedialog.h"
#include "gimpuimanager.h"
#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
@ -527,7 +526,7 @@ gimp_action_view_conflict_confirm (GimpActionView *view,
label = gimp_strip_uline (tmp);
g_free (tmp);
accel_string = gimp_get_accel_string (accel_key, accel_mask);
accel_string = gtk_accelerator_get_label (accel_key, accel_mask);
confirm_data = g_slice_new (ConfirmData);

View File

@ -482,7 +482,7 @@ gimp_get_mod_string (GdkModifierType modifiers)
{
if (! modifier_strings[i].name)
{
GString *str = g_string_new ("");
GString *str = g_string_new (NULL);
if (modifiers & GDK_SHIFT_MASK)
{
@ -515,70 +515,6 @@ gimp_get_mod_string (GdkModifierType modifiers)
return NULL;
}
static void
gimp_substitute_underscores (gchar *str)
{
gchar *p;
for (p = str; *p; p++)
if (*p == '_')
*p = ' ';
}
/* pretty much straight copy of _gtk_accel_label_class_get_accelerator_label */
gchar *
gimp_get_accel_string (guint key,
GdkModifierType modifiers)
{
GtkAccelLabelClass *accel_label_class;
GString *gstring;
gunichar ch;
accel_label_class = g_type_class_peek (GTK_TYPE_ACCEL_LABEL);
gstring = g_string_new (gimp_get_mod_string (modifiers));
if (gstring->len > 0)
g_string_append (gstring, gimp_get_mod_separator ());
ch = gdk_keyval_to_unicode (key);
if (ch && (g_unichar_isgraph (ch) || ch == ' ') &&
(ch < 0x80 || accel_label_class->latin1_to_char))
{
switch (ch)
{
case ' ':
/* do not translate the part before the | */
g_string_append (gstring, Q_("keyboard label|Space"));
break;
case '\\':
/* do not translate the part before the | */
g_string_append (gstring, Q_("keyboard label|Backslash"));
break;
default:
g_string_append_unichar (gstring, g_unichar_toupper (ch));
break;
}
}
else
{
gchar *tmp;
tmp = gtk_accelerator_name (key, 0);
if (tmp[0] != 0 && tmp[1] == 0)
tmp[0] = g_ascii_toupper (tmp[0]);
gimp_substitute_underscores (tmp);
g_string_append (gstring, tmp);
g_free (tmp);
}
return g_string_free (gstring, FALSE);
}
#define BUF_SIZE 100
/**
* gimp_suggest_modifiers:
@ -1058,7 +994,7 @@ gimp_widget_accel_changed (GtkAccelGroup *accel_group,
accel_key->accel_key &&
accel_key->accel_flags & GTK_ACCEL_VISIBLE)
{
gchar *accel = gimp_get_accel_string (accel_key->accel_key,
gchar *accel = gtk_accelerator_get_label (accel_key->accel_key,
accel_key->accel_mods);
tooltip = g_strdup_printf ("%s (%s)", orig_tooltip, accel);

View File

@ -53,8 +53,6 @@ const gchar * gimp_get_mod_name_control (void);
const gchar * gimp_get_mod_name_alt (void);
const gchar * gimp_get_mod_separator (void);
const gchar * gimp_get_mod_string (GdkModifierType modifiers);
gchar * gimp_get_accel_string (guint key,
GdkModifierType modifiers);
gchar * gimp_suggest_modifiers (const gchar *message,
GdkModifierType modifiers,
const gchar *shift_format,