5
5
* Copyright (C) 2008 Michael Natterer <mitch@gimp.org>
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.
12
12
* This program is distributed in the hope that it will be useful,
15
15
* GNU General Public License for more details.
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/>.
22
21
#include "config.h"
37
36
/* local function prototypes */
39
static void gimp_action_editor_filter_clear (GtkButton *button,
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);
45
G_DEFINE_TYPE (GimpActionEditor, gimp_action_editor, GTK_TYPE_VBOX)
43
G_DEFINE_TYPE (GimpActionEditor, gimp_action_editor, GTK_TYPE_BOX)
47
45
#define parent_class gimp_action_editor_parent_class
56
54
gimp_action_editor_init (GimpActionEditor *editor)
60
gtk_orientable_set_orientation (GTK_ORIENTABLE (editor),
61
GTK_ORIENTATION_VERTICAL);
65
63
gtk_box_set_spacing (GTK_BOX (editor), 12);
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);
72
70
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
73
71
gtk_widget_show (label);
75
entrybox = gtk_hbox_new (FALSE, 2);
76
gtk_box_pack_start (GTK_BOX (hbox), entrybox, TRUE, TRUE, 0);
77
gtk_widget_show (entrybox);
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);
83
77
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
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);
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);
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);
86
g_signal_connect (entry, "icon-press",
96
87
G_CALLBACK (gimp_action_editor_filter_clear),
99
89
g_signal_connect (entry, "changed",
100
90
G_CALLBACK (gimp_action_editor_filter_changed),
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);