2005-10-30  Michael Natterer  <mitch@gimp.org>

	Fixed bug #316395:

	* app/actions/dialogs-actions.c (dialogs_dockable_actions)
	* app/actions/quick-mask-actions.c (quick_mask_toggle_actions):
	added tooltips to action entries.

	* app/display/gimpdisplayshell.c (gimp_display_shell_new): use
	gimp_widget_set_accel_help() to set the tooltip so it contains
	the accelerator.

	* app/dialogs/dialogs-constructors.c (dialogs_dockable_constructor):
	attach the dialog's identifier to the dockable widget (hack).

	* app/widgets/gimpdockbook.c (gimp_dockbook_get_tab_widget): use
	the attached identifier to find the action for this dockable in
	the dock's UI manager (HACK HACK). Use the found action to set
	a tooltip with accelerator.

	* app/widgets/gimpwidgets-utils.c (gimp_widget_set_accel_help):
	fixed bug in fallback code what should never be used.
This commit is contained in:
Michael Natterer 2005-10-30 18:41:18 +00:00 committed by Michael Natterer
parent 86888a6a76
commit e3e53dca27
7 changed files with 113 additions and 34 deletions

View File

@ -1,3 +1,26 @@
2005-10-30 Michael Natterer <mitch@gimp.org>
Fixed bug #316395:
* app/actions/dialogs-actions.c (dialogs_dockable_actions)
* app/actions/quick-mask-actions.c (quick_mask_toggle_actions):
added tooltips to action entries.
* app/display/gimpdisplayshell.c (gimp_display_shell_new): use
gimp_widget_set_accel_help() to set the tooltip so it contains
the accelerator.
* app/dialogs/dialogs-constructors.c (dialogs_dockable_constructor):
attach the dialog's identifier to the dockable widget (hack).
* app/widgets/gimpdockbook.c (gimp_dockbook_get_tab_widget): use
the attached identifier to find the action for this dockable in
the dock's UI manager (HACK HACK). Use the found action to set
a tooltip with accelerator.
* app/widgets/gimpwidgets-utils.c (gimp_widget_set_accel_help):
fixed bug in fallback code what should never be used.
2005-10-30 Michael Natterer <mitch@gimp.org>
* app/actions/dialogs-actions.c (dialogs_dockable_actions): removed

View File

@ -62,122 +62,122 @@ static GimpActionEntry dialogs_actions[] =
GimpStringActionEntry dialogs_dockable_actions[] =
{
{ "dialogs-tool-options", GIMP_STOCK_TOOL_OPTIONS,
N_("Tool _Options"), NULL, NULL,
N_("Tool _Options"), NULL, N_("Tool Options"),
"gimp-tool-options",
GIMP_HELP_TOOL_OPTIONS_DIALOG },
{ "dialogs-device-status", GIMP_STOCK_DEVICE_STATUS,
N_("_Device Status"), NULL, NULL,
N_("_Device Status"), NULL, N_("Device Status"),
"gimp-device-status",
GIMP_HELP_DEVICE_STATUS_DIALOG },
{ "dialogs-layers", GIMP_STOCK_LAYERS,
N_("_Layers"), "<control>L", NULL,
N_("_Layers"), "<control>L", N_("Layers"),
"gimp-layer-list",
GIMP_HELP_LAYER_DIALOG },
{ "dialogs-channels", GIMP_STOCK_CHANNELS,
N_("_Channels"), NULL, NULL,
N_("_Channels"), NULL, N_("Channels"),
"gimp-channel-list",
GIMP_HELP_CHANNEL_DIALOG },
{ "dialogs-vectors", GIMP_STOCK_PATHS,
N_("_Paths"), NULL, NULL,
N_("_Paths"), NULL, N_("Paths"),
"gimp-vectors-list",
GIMP_HELP_PATH_DIALOG },
{ "dialogs-indexed-palette", GIMP_STOCK_INDEXED_PALETTE,
N_("Color_map"), NULL, NULL,
N_("Color_map"), NULL, N_("Colormap"),
"gimp-indexed-palette",
GIMP_HELP_INDEXED_PALETTE_DIALOG },
{ "dialogs-histogram", GIMP_STOCK_HISTOGRAM,
N_("Histogra_m"), NULL, NULL,
N_("Histogra_m"), NULL, N_("Histogram"),
"gimp-histogram-editor",
GIMP_HELP_HISTOGRAM_DIALOG },
{ "dialogs-selection-editor", GIMP_STOCK_TOOL_RECT_SELECT,
N_("_Selection Editor"), NULL, NULL,
N_("_Selection Editor"), NULL, N_("Selection Editor"),
"gimp-selection-editor",
GIMP_HELP_SELECTION_DIALOG },
{ "dialogs-navigation", GIMP_STOCK_NAVIGATION,
N_("Na_vigation"), NULL, NULL,
N_("Na_vigation"), NULL, N_("Display Navigation"),
"gimp-navigation-view",
GIMP_HELP_NAVIGATION_DIALOG },
{ "dialogs-undo-history", GIMP_STOCK_UNDO_HISTORY,
N_("Undo _History"), NULL, NULL,
N_("Undo _History"), NULL, N_("Undo History"),
"gimp-undo-history",
GIMP_HELP_UNDO_DIALOG },
{ "dialogs-cursor", GIMP_STOCK_CURSOR,
N_("_Cursor"), NULL, NULL,
N_("_Cursor"), NULL, N_("Cursor Info"),
"gimp-cursor-view",
GIMP_HELP_CURSOR_INFO_DIALOG },
{ "dialogs-sample-points", GIMP_STOCK_SAMPLE_POINT,
N_("_Sample Points"), NULL, NULL,
N_("_Sample Points"), NULL, N_("Sample Points"),
"gimp-sample-point-editor",
GIMP_HELP_SAMPLE_POINT_DIALOG },
{ "dialogs-colors", GIMP_STOCK_DEFAULT_COLORS,
N_("Colo_rs"), NULL, NULL,
N_("Colo_rs"), NULL, N_("FG/BG Color"),
"gimp-color-editor",
GIMP_HELP_COLOR_DIALOG },
{ "dialogs-brushes", GIMP_STOCK_BRUSH,
N_("_Brushes"), "<control><shift>B", NULL,
N_("_Brushes"), "<control><shift>B", N_("Brushes"),
"gimp-brush-grid|gimp-brush-list",
GIMP_HELP_BRUSH_DIALOG },
{ "dialogs-patterns", GIMP_STOCK_PATTERN,
N_("P_atterns"), "<control><shift>P", NULL,
N_("P_atterns"), "<control><shift>P", N_("Patterns"),
"gimp-pattern-grid|gimp-pattern-list",
GIMP_HELP_PATTERN_DIALOG },
{ "dialogs-gradients", GIMP_STOCK_GRADIENT,
N_("_Gradients"), "<control>G", NULL,
N_("_Gradients"), "<control>G", N_("Gradients"),
"gimp-gradient-list|gimp-gradient-grid",
GIMP_HELP_GRADIENT_DIALOG },
{ "dialogs-palettes", GIMP_STOCK_PALETTE,
N_("Pal_ettes"), "<control>P", NULL,
N_("Pal_ettes"), "<control>P", N_("Palettes"),
"gimp-palette-list|gimp-palette-grid",
GIMP_HELP_PALETTE_DIALOG },
{ "dialogs-fonts", GIMP_STOCK_FONT,
N_("_Fonts"), NULL, NULL,
N_("_Fonts"), NULL, N_("Fonts"),
"gimp-font-list|gimp-font-grid",
GIMP_HELP_FONT_DIALOG },
{ "dialogs-buffers", GIMP_STOCK_BUFFER,
N_("B_uffers"), "", NULL,
N_("B_uffers"), "", N_("Buffers"),
"gimp-buffer-list|gimp-buffer-grid",
GIMP_HELP_BUFFER_DIALOG },
{ "dialogs-images", GIMP_STOCK_IMAGES,
N_("_Images"), NULL, NULL,
N_("_Images"), NULL, N_("Images"),
"gimp-image-list|gimp-image-grid",
GIMP_HELP_IMAGE_DIALOG },
{ "dialogs-document-history", GTK_STOCK_OPEN,
N_("Document Histor_y"), "", NULL,
N_("Document Histor_y"), "", N_("Document History"),
"gimp-document-list|gimp-document-grid",
GIMP_HELP_DOCUMENT_DIALOG },
{ "dialogs-templates", GIMP_STOCK_TEMPLATE,
N_("_Templates"), "", NULL,
N_("_Templates"), "", N_("Image Templates"),
"gimp-template-list|gimp-template-grid",
GIMP_HELP_TEMPLATE_DIALOG },
{ "dialogs-tools", GIMP_STOCK_TOOLS,
N_("T_ools"), NULL, NULL,
N_("T_ools"), NULL, N_("Tools"),
"gimp-tool-list|gimp-tool-grid",
GIMP_HELP_TOOLS_DIALOG },
{ "dialogs-error-console", GIMP_STOCK_WARNING,
N_("Error Co_nsole"), NULL, NULL,
N_("Error Co_nsole"), NULL, N_("Error Console"),
"gimp-error-console",
GIMP_HELP_ERRORS_DIALOG }
};

View File

@ -51,7 +51,7 @@ static GimpActionEntry quick_mask_actions[] =
static GimpToggleActionEntry quick_mask_toggle_actions[] =
{
{ "quick-mask-toggle", GIMP_STOCK_QUICK_MASK_ON,
N_("Toggle _Quick Mask"), "<shift>Q", NULL,
N_("Toggle _Quick Mask"), "<shift>Q", N_("Toggle Quick Mask"),
G_CALLBACK (quick_mask_toggle_cmd_callback),
FALSE,
GIMP_HELP_QUICK_MASK_TOGGLE }

View File

@ -242,6 +242,10 @@ dialogs_dockable_constructor (GimpDialogFactory *factory,
entry->stock_id, entry->help_id);
gtk_container_add (GTK_CONTAINER (dockable), widget);
gtk_widget_show (widget);
/* EEK */
g_object_set_data (G_OBJECT (dockable), "gimp-dialog-identifier",
entry->identifier);
}
return dockable;

View File

@ -577,6 +577,7 @@ gimp_display_shell_new (GimpDisplay *gdisp,
GtkWidget *inner_table;
GtkWidget *image;
GdkScreen *screen;
GtkAction *action;
gint image_width, image_height;
gint n_width, n_height;
gint s_width, s_height;
@ -846,11 +847,12 @@ gimp_display_shell_new (GimpDisplay *gdisp,
gimp_help_set_help_data (shell->vrule, NULL, GIMP_HELP_IMAGE_WINDOW_RULER);
/* Workaround for GTK+ Wintab bug on Windows when creating guides by
* dragging from the rulers. See bug #168516. */
/* Workaround for GTK+ Wintab bug on Windows when creating guides by
* dragging from the rulers. See bug #168516.
*/
gtk_widget_set_extension_events (shell->hrule, GDK_EXTENSION_EVENTS_ALL);
gtk_widget_set_extension_events (shell->vrule, GDK_EXTENSION_EVENTS_ALL);
/* the canvas */
gtk_widget_set_size_request (shell->canvas, n_width, n_height);
gtk_widget_set_events (shell->canvas, GIMP_DISPLAY_SHELL_CANVAS_EVENT_MASK);
@ -937,9 +939,14 @@ gimp_display_shell_new (GimpDisplay *gdisp,
gtk_container_add (GTK_CONTAINER (shell->quick_mask_button), image);
gtk_widget_show (image);
gimp_help_set_help_data (shell->quick_mask_button,
_("Toggle Quick Mask"),
GIMP_HELP_IMAGE_WINDOW_QUICK_MASK_BUTTON);
action = gimp_ui_manager_find_action (shell->menubar_manager,
"quick-mask", "quick-mask-toggle");
if (action)
gimp_widget_set_accel_help (shell->quick_mask_button, action);
else
gimp_help_set_help_data (shell->quick_mask_button,
_("Toggle Quick Mask"),
GIMP_HELP_IMAGE_WINDOW_QUICK_MASK_BUTTON);
g_signal_connect (shell->quick_mask_button, "toggled",
G_CALLBACK (gimp_display_shell_quick_mask_toggled),

View File

@ -33,12 +33,15 @@
#include "core/gimpmarshal.h"
#include "gimpdnd.h"
#include "gimpdock.h"
#include "gimpdockable.h"
#include "gimpdockbook.h"
#include "gimphelp-ids.h"
#include "gimpimagedock.h"
#include "gimpmenufactory.h"
#include "gimpstringaction.h"
#include "gimpuimanager.h"
#include "gimpview.h"
#include "gimpwidgets-utils.h"
#define DEFAULT_TAB_BORDER 0
@ -407,6 +410,7 @@ gimp_dockbook_get_tab_widget (GimpDockbook *dockbook,
{
GtkWidget *tab_widget;
GtkIconSize tab_size = DEFAULT_TAB_ICON_SIZE;
GtkAction *action = NULL;
gtk_widget_style_get (GTK_WIDGET (dockbook),
"tab-icon-size", &tab_size,
@ -428,7 +432,48 @@ gimp_dockbook_get_tab_widget (GimpDockbook *dockbook,
tab_widget = event_box;
}
gimp_help_set_help_data (tab_widget, dockable->blurb, dockable->help_id);
/* EEK */
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
const gchar *dialog_id;
dialog_id = g_object_get_data (G_OBJECT (dockable),
"gimp-dialog-identifier");
if (dialog_id)
{
GimpActionGroup *group;
group = gimp_ui_manager_get_action_group
(GIMP_IMAGE_DOCK (dockbook->dock)->ui_manager, "dialogs");
if (group)
{
GList *actions;
GList *list;
actions = gtk_action_group_list_actions (GTK_ACTION_GROUP (group));
for (list = actions; list; list = g_list_next (list))
{
if (GIMP_IS_STRING_ACTION (list->data) &&
strstr (GIMP_STRING_ACTION (list->data)->value,
dialog_id))
{
action = list->data;
break;
}
}
g_list_free (actions);
}
}
}
if (action)
gimp_widget_set_accel_help (tab_widget, action);
else
gimp_help_set_help_data (tab_widget, dockable->blurb, dockable->help_id);
g_object_set_data (G_OBJECT (tab_widget), "gimp-dockable", dockable);

View File

@ -1018,7 +1018,7 @@ gimp_widget_set_accel_help (GtkWidget *widget,
gchar *help_id;
g_object_get (action, "tooltip", &tooltip, NULL);
help_id = g_object_get_qdata (G_OBJECT (tooltip), GIMP_HELP_ID);
help_id = g_object_get_qdata (G_OBJECT (action), GIMP_HELP_ID);
gimp_help_set_help_data (widget, tooltip, help_id);