1
1
/* GIMP - The GNU Image Manipulation Program
2
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
4
* This program is free software: you can redistribute it and/or modify
5
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
6
* the Free Software Foundation; either version 3 of the License, or
7
7
* (at your option) any later version.
9
9
* This program is distributed in the hope that it will be useful,
12
12
* GNU General Public License for more details.
14
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
18
#include "config.h"
25
24
#include "actions-types.h"
27
#include "widgets/gimpmenudock.h"
26
#include "widgets/gimpdockwindow.h"
27
#include "widgets/gimpdockwindow.h"
29
29
#include "actions.h"
30
30
#include "dock-commands.h"
33
static GimpDockWindow *
34
dock_commands_get_dock_window_from_widget (GtkWidget *widget)
36
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
37
GimpDockWindow *dock_window = NULL;
39
if (GIMP_IS_DOCK_WINDOW (toplevel))
40
dock_window = GIMP_DOCK_WINDOW (toplevel);
33
46
/* public functions */
36
49
dock_toggle_image_menu_cmd_callback (GtkAction *action,
52
GtkWidget *widget = NULL;
53
GimpDockWindow *dock_window = NULL;
41
54
return_if_no_widget (widget, data);
43
if (! GTK_WIDGET_TOPLEVEL (widget))
44
widget = gtk_widget_get_toplevel (widget);
46
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
48
if (GIMP_IS_MENU_DOCK (widget))
49
gimp_menu_dock_set_show_image_menu (GIMP_MENU_DOCK (widget), active);
56
dock_window = dock_commands_get_dock_window_from_widget (widget);
60
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
61
gimp_dock_window_set_show_image_menu (dock_window, active);
53
66
dock_toggle_auto_cmd_callback (GtkAction *action,
69
GtkWidget *widget = NULL;
70
GimpDockWindow *dock_window = NULL;
58
71
return_if_no_widget (widget, data);
60
if (! GTK_WIDGET_TOPLEVEL (widget))
61
widget = gtk_widget_get_toplevel (widget);
63
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
65
if (GIMP_IS_MENU_DOCK (widget))
66
gimp_menu_dock_set_auto_follow_active (GIMP_MENU_DOCK (widget), active);
73
dock_window = dock_commands_get_dock_window_from_widget (widget);
77
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
78
gimp_dock_window_set_auto_follow_active (dock_window, active);