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

« back to all changes in this revision

Viewing changes to app/widgets/gimpactioneditor.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:
4
4
 * gimpactioneditor.c
5
5
 * Copyright (C) 2008  Michael Natterer <mitch@gimp.org>
6
6
 *
7
 
 * This program is free software; you can redistribute it and/or modify
 
7
 * This program is free software: you can redistribute it and/or modify
8
8
 * it under the terms of the GNU General Public License as published by
9
 
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * the Free Software Foundation; either version 3 of the License, or
10
10
 * (at your option) any later version.
11
11
 *
12
12
 * This program is distributed in the hope that it will be useful,
15
15
 * GNU General Public License for more details.
16
16
 *
17
17
 * You should have received a copy of the GNU General Public License
18
 
 * along with this program; if not, write to the Free Software
19
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
19
 */
21
20
 
22
21
#include "config.h"
36
35
 
37
36
/*  local function prototypes  */
38
37
 
39
 
static void   gimp_action_editor_filter_clear   (GtkButton        *button,
40
 
                                                 GtkEntry         *entry);
 
38
static void   gimp_action_editor_filter_clear   (GtkEntry         *entry);
41
39
static void   gimp_action_editor_filter_changed (GtkEntry         *entry,
42
40
                                                 GimpActionEditor *editor);
43
41
 
44
42
 
45
 
G_DEFINE_TYPE (GimpActionEditor, gimp_action_editor, GTK_TYPE_VBOX)
 
43
G_DEFINE_TYPE (GimpActionEditor, gimp_action_editor, GTK_TYPE_BOX)
46
44
 
47
45
#define parent_class gimp_action_editor_parent_class
48
46
 
56
54
gimp_action_editor_init (GimpActionEditor *editor)
57
55
{
58
56
  GtkWidget *hbox;
59
 
  GtkWidget *entrybox;
60
57
  GtkWidget *label;
61
58
  GtkWidget *entry;
62
 
  GtkWidget *button;
63
 
  GtkWidget *image;
 
59
 
 
60
  gtk_orientable_set_orientation (GTK_ORIENTABLE (editor),
 
61
                                  GTK_ORIENTATION_VERTICAL);
64
62
 
65
63
  gtk_box_set_spacing (GTK_BOX (editor), 12);
66
64
 
67
 
  hbox = gtk_hbox_new (FALSE, 6);
 
65
  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
68
66
  gtk_box_pack_start (GTK_BOX (editor), hbox, FALSE, FALSE, 0);
69
67
  gtk_widget_show (hbox);
70
68
 
72
70
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
73
71
  gtk_widget_show (label);
74
72
 
75
 
  entrybox = gtk_hbox_new (FALSE, 2);
76
 
  gtk_box_pack_start (GTK_BOX (hbox), entrybox, TRUE, TRUE, 0);
77
 
  gtk_widget_show (entrybox);
78
 
 
79
73
  entry = gtk_entry_new ();
80
 
  gtk_box_pack_start (GTK_BOX (entrybox), entry, TRUE, TRUE, 0);
 
74
  gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
81
75
  gtk_widget_show (entry);
82
76
 
83
77
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
84
78
 
85
 
  button = gtk_button_new ();
86
 
  GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
87
 
  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
88
 
  gtk_box_pack_start (GTK_BOX (entrybox), button, FALSE, FALSE, 0);
89
 
  gtk_widget_show (button);
90
 
 
91
 
  image = gtk_image_new_from_stock (GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU);
92
 
  gtk_container_add (GTK_CONTAINER (button), image);
93
 
  gtk_widget_show (image);
94
 
 
95
 
  g_signal_connect (button, "clicked",
 
79
  gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
 
80
                                 GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
 
81
  gtk_entry_set_icon_activatable (GTK_ENTRY (entry),
 
82
                                  GTK_ENTRY_ICON_SECONDARY, TRUE);
 
83
  gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
 
84
                                GTK_ENTRY_ICON_SECONDARY, FALSE);
 
85
 
 
86
  g_signal_connect (entry, "icon-press",
96
87
                    G_CALLBACK (gimp_action_editor_filter_clear),
97
 
                    entry);
98
 
 
 
88
                    NULL);
99
89
  g_signal_connect (entry, "changed",
100
90
                    G_CALLBACK (gimp_action_editor_filter_changed),
101
91
                    editor);
133
123
/*  private functions  */
134
124
 
135
125
static void
136
 
gimp_action_editor_filter_clear (GtkButton *button,
137
 
                                 GtkEntry  *entry)
 
126
gimp_action_editor_filter_clear (GtkEntry *entry)
138
127
{
139
128
  gtk_entry_set_text (entry, "");
140
129
}
145
134
{
146
135
  gimp_action_view_set_filter (GIMP_ACTION_VIEW (editor->view),
147
136
                               gtk_entry_get_text (entry));
 
137
  gtk_entry_set_icon_sensitive (entry,
 
138
                                GTK_ENTRY_ICON_SECONDARY,
 
139
                                gtk_entry_get_text_length (entry) > 0);
148
140
}
149
141