2008-05-11 00:21:37 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2008-05-11 00:21:37 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2008-05-11 00:21:37 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-05-11 00:21:37 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2010-03-07 14:51:53 +08:00
|
|
|
#include <string.h>
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2008-05-11 00:21:37 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpthumb/gimpthumb.h"
|
|
|
|
|
|
|
|
#include "menus-types.h"
|
|
|
|
|
|
|
|
#include "config/gimpguiconfig.h"
|
|
|
|
|
|
|
|
#include "core/gimp.h"
|
2008-09-22 02:53:14 +08:00
|
|
|
#include "core/gimpimage.h"
|
2008-05-11 00:21:37 +08:00
|
|
|
#include "core/gimplist.h"
|
|
|
|
#include "core/gimpviewable.h"
|
|
|
|
|
|
|
|
#include "widgets/gimpaction.h"
|
2008-05-11 16:15:00 +08:00
|
|
|
#include "widgets/gimpdialogfactory.h"
|
|
|
|
#include "widgets/gimpdock.h"
|
2009-09-13 17:23:02 +08:00
|
|
|
#include "widgets/gimpdockwindow.h"
|
2010-03-07 14:51:53 +08:00
|
|
|
#include "widgets/gimpsessioninfo.h"
|
2008-05-11 00:21:37 +08:00
|
|
|
#include "widgets/gimpuimanager.h"
|
|
|
|
|
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
2008-05-11 16:15:00 +08:00
|
|
|
#include "dialogs/dialogs.h"
|
|
|
|
|
2009-09-15 05:36:03 +08:00
|
|
|
#include "actions/windows-actions.h"
|
|
|
|
|
2008-05-11 00:21:37 +08:00
|
|
|
#include "windows-menu.h"
|
|
|
|
|
|
|
|
|
2010-03-07 14:51:53 +08:00
|
|
|
static void windows_menu_display_add (GimpContainer *container,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GimpUIManager *manager);
|
|
|
|
static void windows_menu_display_remove (GimpContainer *container,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GimpUIManager *manager);
|
2013-05-27 23:52:13 +08:00
|
|
|
static void windows_menu_display_reorder (GimpContainer *container,
|
|
|
|
GimpDisplay *display,
|
|
|
|
gint new_index,
|
|
|
|
GimpUIManager *manager);
|
2010-03-07 14:51:53 +08:00
|
|
|
static void windows_menu_image_notify (GimpDisplay *display,
|
|
|
|
const GParamSpec *unused,
|
|
|
|
GimpUIManager *manager);
|
|
|
|
static void windows_menu_dock_window_added (GimpDialogFactory *factory,
|
|
|
|
GimpDockWindow *dock_window,
|
|
|
|
GimpUIManager *manager);
|
|
|
|
static void windows_menu_dock_window_removed (GimpDialogFactory *factory,
|
|
|
|
GimpDockWindow *dock_window,
|
|
|
|
GimpUIManager *manager);
|
|
|
|
static gchar * windows_menu_dock_window_to_merge_id (GimpDockWindow *dock_window);
|
|
|
|
static void windows_menu_recent_add (GimpContainer *container,
|
|
|
|
GimpSessionInfo *info,
|
|
|
|
GimpUIManager *manager);
|
|
|
|
static void windows_menu_recent_remove (GimpContainer *container,
|
|
|
|
GimpSessionInfo *info,
|
|
|
|
GimpUIManager *manager);
|
|
|
|
static gboolean windows_menu_display_query_tooltip (GtkWidget *widget,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gboolean keyboard_mode,
|
|
|
|
GtkTooltip *tooltip,
|
|
|
|
GimpAction *action);
|
2008-09-22 02:53:14 +08:00
|
|
|
|
2008-05-11 00:21:37 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
windows_menu_setup (GimpUIManager *manager,
|
|
|
|
const gchar *ui_path)
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
|
|
|
|
g_return_if_fail (ui_path != NULL);
|
|
|
|
|
2008-05-11 16:15:00 +08:00
|
|
|
g_object_set_data (G_OBJECT (manager), "image-menu-ui-path",
|
|
|
|
(gpointer) ui_path);
|
|
|
|
|
2008-05-11 00:21:37 +08:00
|
|
|
g_signal_connect_object (manager->gimp->displays, "add",
|
|
|
|
G_CALLBACK (windows_menu_display_add),
|
|
|
|
manager, 0);
|
|
|
|
g_signal_connect_object (manager->gimp->displays, "remove",
|
|
|
|
G_CALLBACK (windows_menu_display_remove),
|
|
|
|
manager, 0);
|
2013-05-27 23:52:13 +08:00
|
|
|
g_signal_connect_object (manager->gimp->displays, "reorder",
|
|
|
|
G_CALLBACK (windows_menu_display_reorder),
|
|
|
|
manager, 0);
|
2008-05-11 00:21:37 +08:00
|
|
|
|
2008-11-03 05:34:14 +08:00
|
|
|
for (list = gimp_get_display_iter (manager->gimp);
|
2008-05-11 00:21:37 +08:00
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpDisplay *display = list->data;
|
|
|
|
|
|
|
|
windows_menu_display_add (manager->gimp->displays, display, manager);
|
|
|
|
}
|
2008-05-11 16:15:00 +08:00
|
|
|
|
2010-03-01 06:20:57 +08:00
|
|
|
g_signal_connect_object (gimp_dialog_factory_get_singleton (), "dock-window-added",
|
2009-09-26 19:11:42 +08:00
|
|
|
G_CALLBACK (windows_menu_dock_window_added),
|
2008-05-11 16:15:00 +08:00
|
|
|
manager, 0);
|
2010-03-01 06:20:57 +08:00
|
|
|
g_signal_connect_object (gimp_dialog_factory_get_singleton (), "dock-window-removed",
|
2009-09-26 19:11:42 +08:00
|
|
|
G_CALLBACK (windows_menu_dock_window_removed),
|
2008-05-11 16:15:00 +08:00
|
|
|
manager, 0);
|
|
|
|
|
2010-03-01 06:20:57 +08:00
|
|
|
for (list = gimp_dialog_factory_get_open_dialogs (gimp_dialog_factory_get_singleton ());
|
2008-05-11 16:15:00 +08:00
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
2009-09-26 19:11:42 +08:00
|
|
|
GimpDockWindow *dock_window = list->data;
|
2008-05-11 16:15:00 +08:00
|
|
|
|
2009-09-26 19:11:42 +08:00
|
|
|
if (GIMP_IS_DOCK_WINDOW (dock_window))
|
2010-03-01 06:20:57 +08:00
|
|
|
windows_menu_dock_window_added (gimp_dialog_factory_get_singleton (),
|
2009-12-20 21:41:02 +08:00
|
|
|
dock_window,
|
|
|
|
manager);
|
2008-05-11 16:15:00 +08:00
|
|
|
}
|
2008-05-17 00:06:42 +08:00
|
|
|
|
|
|
|
g_signal_connect_object (global_recent_docks, "add",
|
|
|
|
G_CALLBACK (windows_menu_recent_add),
|
|
|
|
manager, 0);
|
|
|
|
g_signal_connect_object (global_recent_docks, "remove",
|
|
|
|
G_CALLBACK (windows_menu_recent_remove),
|
|
|
|
manager, 0);
|
|
|
|
|
2008-05-17 00:24:24 +08:00
|
|
|
for (list = g_list_last (GIMP_LIST (global_recent_docks)->list);
|
2008-05-17 00:06:42 +08:00
|
|
|
list;
|
2008-05-17 00:24:24 +08:00
|
|
|
list = g_list_previous (list))
|
2008-05-17 00:06:42 +08:00
|
|
|
{
|
|
|
|
GimpSessionInfo *info = list->data;
|
|
|
|
|
|
|
|
windows_menu_recent_add (global_recent_docks, info, manager);
|
|
|
|
}
|
2008-05-11 00:21:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
windows_menu_display_add (GimpContainer *container,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GimpUIManager *manager)
|
|
|
|
{
|
|
|
|
g_signal_connect_object (display, "notify::image",
|
|
|
|
G_CALLBACK (windows_menu_image_notify),
|
|
|
|
manager, 0);
|
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
if (gimp_display_get_image (display))
|
2008-05-11 00:21:37 +08:00
|
|
|
windows_menu_image_notify (display, NULL, manager);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
windows_menu_display_remove (GimpContainer *container,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GimpUIManager *manager)
|
|
|
|
{
|
|
|
|
gchar *merge_key = g_strdup_printf ("windows-display-%04d-merge-id",
|
|
|
|
gimp_display_get_ID (display));
|
|
|
|
guint merge_id;
|
|
|
|
|
|
|
|
merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager),
|
|
|
|
merge_key));
|
|
|
|
|
|
|
|
if (merge_id)
|
|
|
|
gtk_ui_manager_remove_ui (GTK_UI_MANAGER (manager), merge_id);
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (manager), merge_key, NULL);
|
|
|
|
|
|
|
|
g_free (merge_key);
|
|
|
|
}
|
|
|
|
|
2013-05-27 23:52:13 +08:00
|
|
|
static void
|
|
|
|
windows_menu_display_reorder (GimpContainer *container,
|
2013-09-17 18:20:39 +08:00
|
|
|
GimpDisplay *display,
|
|
|
|
gint new_index,
|
|
|
|
GimpUIManager *manager)
|
2013-05-27 23:52:13 +08:00
|
|
|
{
|
2013-09-17 18:20:39 +08:00
|
|
|
gint n_display = gimp_container_get_n_children (container);
|
|
|
|
gint i;
|
2013-05-27 23:52:13 +08:00
|
|
|
|
2013-09-17 18:20:39 +08:00
|
|
|
for (i = new_index; i < n_display; i++)
|
|
|
|
{
|
|
|
|
GimpObject *d = gimp_container_get_child_by_index (container, i);
|
2013-05-27 23:52:13 +08:00
|
|
|
|
2013-09-17 18:20:39 +08:00
|
|
|
windows_menu_display_remove (container, GIMP_DISPLAY (d), manager);
|
|
|
|
}
|
2013-05-27 23:52:13 +08:00
|
|
|
|
2013-09-17 18:20:39 +08:00
|
|
|
/* If I don't ensure the menu items are effectively removed, adding
|
|
|
|
* the same ones may simply cancel the effect of the removal, hence
|
|
|
|
* losing the menu reordering.
|
|
|
|
*/
|
|
|
|
gtk_ui_manager_ensure_update (GTK_UI_MANAGER (manager));
|
2013-05-27 23:52:13 +08:00
|
|
|
|
2013-09-17 18:20:39 +08:00
|
|
|
for (i = new_index; i < n_display; i++)
|
|
|
|
{
|
|
|
|
GimpObject *d = gimp_container_get_child_by_index (container, i);
|
2013-05-27 23:52:13 +08:00
|
|
|
|
2013-09-17 18:20:39 +08:00
|
|
|
windows_menu_display_add (container, GIMP_DISPLAY (d), manager);
|
|
|
|
}
|
2013-05-27 23:52:13 +08:00
|
|
|
}
|
|
|
|
|
2008-05-11 00:21:37 +08:00
|
|
|
static void
|
|
|
|
windows_menu_image_notify (GimpDisplay *display,
|
|
|
|
const GParamSpec *unused,
|
|
|
|
GimpUIManager *manager)
|
|
|
|
{
|
2009-10-07 01:20:44 +08:00
|
|
|
if (gimp_display_get_image (display))
|
2008-05-11 00:21:37 +08:00
|
|
|
{
|
|
|
|
gchar *merge_key = g_strdup_printf ("windows-display-%04d-merge-id",
|
|
|
|
gimp_display_get_ID (display));
|
|
|
|
guint merge_id;
|
|
|
|
|
|
|
|
merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager),
|
|
|
|
merge_key));
|
|
|
|
|
|
|
|
if (! merge_id)
|
|
|
|
{
|
2008-09-22 02:53:14 +08:00
|
|
|
GtkWidget *widget;
|
2008-05-11 00:21:37 +08:00
|
|
|
const gchar *ui_path;
|
|
|
|
gchar *action_name;
|
|
|
|
gchar *action_path;
|
2008-09-22 02:53:14 +08:00
|
|
|
gchar *full_path;
|
2008-05-11 00:21:37 +08:00
|
|
|
|
2008-09-22 02:53:14 +08:00
|
|
|
ui_path = g_object_get_data (G_OBJECT (manager),
|
|
|
|
"image-menu-ui-path");
|
2008-05-11 00:21:37 +08:00
|
|
|
|
2011-03-15 15:18:48 +08:00
|
|
|
action_name = gimp_display_get_action_name (display);
|
2008-05-11 00:21:37 +08:00
|
|
|
action_path = g_strdup_printf ("%s/Windows/Images", ui_path);
|
|
|
|
|
|
|
|
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (manager), merge_key,
|
|
|
|
GUINT_TO_POINTER (merge_id));
|
|
|
|
|
|
|
|
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
|
|
|
|
action_path, action_name, action_name,
|
|
|
|
GTK_UI_MANAGER_MENUITEM,
|
|
|
|
FALSE);
|
|
|
|
|
2008-09-22 02:53:14 +08:00
|
|
|
full_path = g_strconcat (action_path, "/", action_name, NULL);
|
|
|
|
|
|
|
|
widget = gtk_ui_manager_get_widget (GTK_UI_MANAGER (manager),
|
|
|
|
full_path);
|
|
|
|
|
|
|
|
if (widget)
|
|
|
|
{
|
|
|
|
GtkAction *action;
|
|
|
|
|
|
|
|
action = gimp_ui_manager_find_action (manager,
|
|
|
|
"windows", action_name);
|
|
|
|
|
|
|
|
g_signal_connect_object (widget, "query-tooltip",
|
|
|
|
G_CALLBACK (windows_menu_display_query_tooltip),
|
|
|
|
action, 0);
|
|
|
|
}
|
|
|
|
|
2008-05-11 00:21:37 +08:00
|
|
|
g_free (action_name);
|
2008-09-22 02:53:14 +08:00
|
|
|
g_free (action_path);
|
|
|
|
g_free (full_path);
|
2008-05-11 00:21:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (merge_key);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
windows_menu_display_remove (manager->gimp->displays, display, manager);
|
|
|
|
}
|
|
|
|
}
|
2008-05-11 16:15:00 +08:00
|
|
|
|
|
|
|
static void
|
2009-09-26 19:11:42 +08:00
|
|
|
windows_menu_dock_window_added (GimpDialogFactory *factory,
|
|
|
|
GimpDockWindow *dock_window,
|
|
|
|
GimpUIManager *manager)
|
2008-05-11 16:15:00 +08:00
|
|
|
{
|
|
|
|
const gchar *ui_path;
|
|
|
|
gchar *action_name;
|
|
|
|
gchar *action_path;
|
|
|
|
gchar *merge_key;
|
|
|
|
guint merge_id;
|
|
|
|
|
|
|
|
ui_path = g_object_get_data (G_OBJECT (manager), "image-menu-ui-path");
|
|
|
|
|
2009-09-26 19:11:42 +08:00
|
|
|
action_name = windows_actions_dock_window_to_action_name (dock_window);
|
2009-09-13 17:23:02 +08:00
|
|
|
action_path = g_strdup_printf ("%s/Windows/Docks",
|
|
|
|
ui_path);
|
2008-05-11 16:15:00 +08:00
|
|
|
|
2009-09-26 19:11:42 +08:00
|
|
|
merge_key = windows_menu_dock_window_to_merge_id (dock_window);
|
2009-09-15 13:17:00 +08:00
|
|
|
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
|
2008-05-11 16:15:00 +08:00
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (manager), merge_key,
|
|
|
|
GUINT_TO_POINTER (merge_id));
|
|
|
|
|
|
|
|
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
|
|
|
|
action_path, action_name, action_name,
|
|
|
|
GTK_UI_MANAGER_MENUITEM,
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
g_free (merge_key);
|
|
|
|
g_free (action_path);
|
|
|
|
g_free (action_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-09-26 19:11:42 +08:00
|
|
|
windows_menu_dock_window_removed (GimpDialogFactory *factory,
|
|
|
|
GimpDockWindow *dock_window,
|
|
|
|
GimpUIManager *manager)
|
2008-05-11 16:15:00 +08:00
|
|
|
{
|
2009-09-26 19:11:42 +08:00
|
|
|
gchar *merge_key = windows_menu_dock_window_to_merge_id (dock_window);
|
2009-09-15 13:17:00 +08:00
|
|
|
guint merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager),
|
|
|
|
merge_key));
|
2008-05-11 16:15:00 +08:00
|
|
|
if (merge_id)
|
|
|
|
gtk_ui_manager_remove_ui (GTK_UI_MANAGER (manager), merge_id);
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (manager), merge_key, NULL);
|
|
|
|
|
|
|
|
g_free (merge_key);
|
|
|
|
}
|
2008-05-17 00:06:42 +08:00
|
|
|
|
2009-09-15 13:17:00 +08:00
|
|
|
static gchar *
|
2009-09-26 19:11:42 +08:00
|
|
|
windows_menu_dock_window_to_merge_id (GimpDockWindow *dock_window)
|
2009-09-15 13:17:00 +08:00
|
|
|
{
|
|
|
|
return g_strdup_printf ("windows-dock-%04d-merge-id",
|
2009-09-15 13:58:14 +08:00
|
|
|
gimp_dock_window_get_id (dock_window));
|
2009-09-15 13:17:00 +08:00
|
|
|
}
|
|
|
|
|
2008-05-17 00:06:42 +08:00
|
|
|
static void
|
|
|
|
windows_menu_recent_add (GimpContainer *container,
|
|
|
|
GimpSessionInfo *info,
|
|
|
|
GimpUIManager *manager)
|
|
|
|
{
|
|
|
|
const gchar *ui_path;
|
|
|
|
gchar *action_name;
|
|
|
|
gchar *action_path;
|
|
|
|
gint info_id;
|
|
|
|
gchar *merge_key;
|
|
|
|
guint merge_id;
|
|
|
|
|
|
|
|
ui_path = g_object_get_data (G_OBJECT (manager), "image-menu-ui-path");
|
|
|
|
|
|
|
|
info_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info),
|
|
|
|
"recent-action-id"));
|
|
|
|
|
|
|
|
action_name = g_strdup_printf ("windows-recent-%04d", info_id);
|
|
|
|
action_path = g_strdup_printf ("%s/Windows/Recently Closed Docks", ui_path);
|
|
|
|
|
|
|
|
merge_key = g_strdup_printf ("windows-recent-%04d-merge-id", info_id);
|
|
|
|
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (manager), merge_key,
|
|
|
|
GUINT_TO_POINTER (merge_id));
|
|
|
|
|
|
|
|
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
|
|
|
|
action_path, action_name, action_name,
|
|
|
|
GTK_UI_MANAGER_MENUITEM,
|
2008-05-17 00:24:24 +08:00
|
|
|
TRUE);
|
2008-05-17 00:06:42 +08:00
|
|
|
|
|
|
|
g_free (merge_key);
|
|
|
|
g_free (action_path);
|
|
|
|
g_free (action_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
windows_menu_recent_remove (GimpContainer *container,
|
|
|
|
GimpSessionInfo *info,
|
|
|
|
GimpUIManager *manager)
|
|
|
|
{
|
|
|
|
gint info_id;
|
|
|
|
gchar *merge_key;
|
|
|
|
guint merge_id;
|
|
|
|
|
|
|
|
info_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info),
|
|
|
|
"recent-action-id"));
|
|
|
|
|
|
|
|
merge_key = g_strdup_printf ("windows-recent-%04d-merge-id", info_id);
|
|
|
|
|
|
|
|
merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager),
|
|
|
|
merge_key));
|
|
|
|
|
|
|
|
if (merge_id)
|
|
|
|
gtk_ui_manager_remove_ui (GTK_UI_MANAGER (manager), merge_id);
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (manager), merge_key, NULL);
|
|
|
|
|
|
|
|
g_free (merge_key);
|
|
|
|
}
|
2008-09-22 02:53:14 +08:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
windows_menu_display_query_tooltip (GtkWidget *widget,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gboolean keyboard_mode,
|
|
|
|
GtkTooltip *tooltip,
|
|
|
|
GimpAction *action)
|
|
|
|
{
|
|
|
|
GimpImage *image = GIMP_IMAGE (action->viewable);
|
|
|
|
gchar *text;
|
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
|
|
|
|
text = gtk_widget_get_tooltip_text (widget);
|
|
|
|
gtk_tooltip_set_text (tooltip, text);
|
|
|
|
g_free (text);
|
|
|
|
|
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
|
|
|
|
|
|
|
gimp_viewable_calc_preview_size (gimp_image_get_width (image),
|
|
|
|
gimp_image_get_height (image),
|
|
|
|
GIMP_VIEW_SIZE_HUGE, GIMP_VIEW_SIZE_HUGE,
|
|
|
|
FALSE, xres, yres,
|
|
|
|
&width, &height, NULL);
|
|
|
|
|
|
|
|
gtk_tooltip_set_icon (tooltip,
|
|
|
|
gimp_viewable_get_pixbuf (action->viewable,
|
|
|
|
action->context,
|
|
|
|
width, height));
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|