~ubuntu-branches/ubuntu/saucy/gimp/saucy

« back to all changes in this revision

Viewing changes to app/actions/dock-commands.c

  • Committer: Package Import Robot
  • Author(s): Micah Gersten
  • Date: 2012-05-20 19:21:01 UTC
  • mfrom: (1.1.26) (0.4.16 sid)
  • Revision ID: package-import@ubuntu.com-20120520192101-bs7zetx8ffoq2nfv
Tags: 2.8.0-2ubuntu1
* Merge from Debian unstable (LP: #908472). Remaining Changes:
  - debian/patches/02_help-message.patch,
    debian/patches/03_gimp.desktop.in.in.patch:
    + Update some strings for Ubuntu
  - debian/control:
    + Update description
  - debian/rules:
    + Set gettext domain and update translation templates
* Drop the following patches that were applied upstream:
  - debian/patches/ghost-cursor.patch: fix Wacom tablet cursor events
  - debian/patches/embed-page-setup-dialog.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
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.
8
8
 *
9
9
 * This program is distributed in the hope that it will be useful,
12
12
 * GNU General Public License for more details.
13
13
 *
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/>.
17
16
 */
18
17
 
19
18
#include "config.h"
24
23
 
25
24
#include "actions-types.h"
26
25
 
27
 
#include "widgets/gimpmenudock.h"
 
26
#include "widgets/gimpdockwindow.h"
 
27
#include "widgets/gimpdockwindow.h"
28
28
 
29
29
#include "actions.h"
30
30
#include "dock-commands.h"
31
31
 
32
32
 
 
33
static GimpDockWindow *
 
34
dock_commands_get_dock_window_from_widget (GtkWidget *widget)
 
35
{
 
36
  GtkWidget      *toplevel    = gtk_widget_get_toplevel (widget);
 
37
  GimpDockWindow *dock_window = NULL;
 
38
 
 
39
  if (GIMP_IS_DOCK_WINDOW (toplevel))
 
40
    dock_window = GIMP_DOCK_WINDOW (toplevel);
 
41
 
 
42
  return dock_window;
 
43
}
 
44
 
 
45
 
33
46
/*  public functions  */
34
47
 
35
48
void
36
49
dock_toggle_image_menu_cmd_callback (GtkAction *action,
37
50
                                     gpointer   data)
38
51
{
39
 
  GtkWidget *widget;
40
 
  gboolean   active;
 
52
  GtkWidget      *widget      = NULL;
 
53
  GimpDockWindow *dock_window = NULL;
41
54
  return_if_no_widget (widget, data);
42
55
 
43
 
  if (! GTK_WIDGET_TOPLEVEL (widget))
44
 
    widget = gtk_widget_get_toplevel (widget);
45
 
 
46
 
  active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
47
 
 
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);
 
57
 
 
58
  if (dock_window)
 
59
    {
 
60
      gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
 
61
      gimp_dock_window_set_show_image_menu (dock_window, active);
 
62
    }
50
63
}
51
64
 
52
65
void
53
66
dock_toggle_auto_cmd_callback (GtkAction *action,
54
67
                               gpointer   data)
55
68
{
56
 
  GtkWidget *widget;
57
 
  gboolean   active;
 
69
  GtkWidget      *widget      = NULL;
 
70
  GimpDockWindow *dock_window = NULL;
58
71
  return_if_no_widget (widget, data);
59
72
 
60
 
  if (! GTK_WIDGET_TOPLEVEL (widget))
61
 
    widget = gtk_widget_get_toplevel (widget);
62
 
 
63
 
  active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
64
 
 
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);
 
74
 
 
75
  if (dock_window)
 
76
    {
 
77
      gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
 
78
      gimp_dock_window_set_auto_follow_active (dock_window, active);
 
79
    }
67
80
}