2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2005-01-24 07:00:21 +08:00
|
|
|
* 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
|
2005-01-24 07:00:21 +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
|
2005-01-24 07:00:21 +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/>.
|
2005-01-24 07:00:21 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2005-01-26 21:34:41 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2005-01-24 07:00:21 +08:00
|
|
|
#include "actions-types.h"
|
|
|
|
|
2009-09-27 23:12:18 +08:00
|
|
|
#include "widgets/gimpdockwindow.h"
|
2005-05-12 04:26:12 +08:00
|
|
|
#include "widgets/gimpmenudock.h"
|
2005-01-26 21:34:41 +08:00
|
|
|
|
2005-01-24 07:00:21 +08:00
|
|
|
#include "actions.h"
|
|
|
|
#include "dock-commands.h"
|
|
|
|
|
|
|
|
|
2009-09-27 23:12:18 +08:00
|
|
|
static GimpMenuDock *
|
|
|
|
dock_commands_get_menudock_from_widget (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
|
|
|
|
GimpMenuDock *menu_dock = NULL;
|
|
|
|
|
|
|
|
if (GIMP_IS_DOCK_WINDOW (toplevel))
|
|
|
|
{
|
|
|
|
GimpDock *dock = gimp_dock_window_get_dock (GIMP_DOCK_WINDOW (toplevel));
|
|
|
|
|
|
|
|
if (GIMP_IS_MENU_DOCK (dock))
|
|
|
|
menu_dock = GIMP_MENU_DOCK (dock);
|
|
|
|
}
|
|
|
|
|
|
|
|
return menu_dock;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-24 07:00:21 +08:00
|
|
|
/* public functions */
|
|
|
|
|
2005-01-26 21:34:41 +08:00
|
|
|
void
|
|
|
|
dock_toggle_image_menu_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2009-09-27 23:12:18 +08:00
|
|
|
GtkWidget *widget = NULL;
|
|
|
|
GimpMenuDock *menu_dock = NULL;
|
2005-01-26 21:34:41 +08:00
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2009-09-27 23:12:18 +08:00
|
|
|
menu_dock = dock_commands_get_menudock_from_widget (widget);
|
2005-01-26 21:34:41 +08:00
|
|
|
|
2009-09-27 23:12:18 +08:00
|
|
|
if (menu_dock)
|
|
|
|
{
|
|
|
|
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
gimp_menu_dock_set_show_image_menu (menu_dock, active);
|
|
|
|
}
|
2005-01-26 21:34:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
dock_toggle_auto_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2009-09-27 23:12:18 +08:00
|
|
|
GtkWidget *widget = NULL;
|
|
|
|
GimpMenuDock *menu_dock = NULL;
|
2005-01-26 21:34:41 +08:00
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2009-09-27 23:12:18 +08:00
|
|
|
menu_dock = dock_commands_get_menudock_from_widget (widget);
|
2005-01-26 21:34:41 +08:00
|
|
|
|
2009-09-27 23:12:18 +08:00
|
|
|
if (menu_dock)
|
|
|
|
{
|
|
|
|
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
gimp_menu_dock_set_auto_follow_active (menu_dock, active);
|
|
|
|
}
|
2005-01-26 21:34:41 +08:00
|
|
|
}
|