1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
/* $Id$
*
* Copyright (c) 2005-2007 Jasper Huijsmans <jasper@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (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 Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "tasklist.h"
#include "tasklist-dialogs.h"
/* prototypes */
static void tasklist_all_workspaces_toggled (GtkToggleButton *tb,
TasklistPlugin *tasklist);
static void tasklist_grouping_changed (GtkComboBox *cb,
TasklistPlugin *tasklist);
static void tasklist_expand_toggled (GtkToggleButton *tb,
TasklistPlugin *tasklist);
static void tasklist_flat_buttons_toggled (GtkToggleButton *tb,
TasklistPlugin *tasklist);
static void tasklist_show_handle_toggled (GtkToggleButton *tb,
TasklistPlugin *tasklist);
static void tasklist_width_changed (GtkSpinButton *sb,
TasklistPlugin *tasklist);
static void tasklist_dialog_response (GtkWidget *dlg,
gint reponse,
TasklistPlugin *tasklist);
static void
tasklist_all_workspaces_toggled (GtkToggleButton *tb,
TasklistPlugin *tasklist)
{
tasklist->all_workspaces = gtk_toggle_button_get_active (tb);
wnck_tasklist_set_include_all_workspaces (WNCK_TASKLIST (tasklist->list),
tasklist->all_workspaces);
}
static void
tasklist_grouping_changed (GtkComboBox *cb,
TasklistPlugin *tasklist)
{
tasklist->grouping = gtk_combo_box_get_active (cb);
wnck_tasklist_set_grouping (WNCK_TASKLIST (tasklist->list),
tasklist->grouping);
}
static void
tasklist_expand_toggled (GtkToggleButton *tb,
TasklistPlugin *tasklist)
{
tasklist->expand = gtk_toggle_button_get_active (tb);
xfce_panel_plugin_set_expand (tasklist->panel_plugin, tasklist->expand);
}
static void
tasklist_flat_buttons_toggled (GtkToggleButton *tb,
TasklistPlugin *tasklist)
{
tasklist->flat_buttons = gtk_toggle_button_get_active (tb);
wnck_tasklist_set_button_relief (WNCK_TASKLIST (tasklist->list),
tasklist->flat_buttons ?
GTK_RELIEF_NONE : GTK_RELIEF_NORMAL);
}
static void
tasklist_show_handle_toggled (GtkToggleButton *tb,
TasklistPlugin *tasklist)
{
tasklist->show_handles = gtk_toggle_button_get_active (tb);
if (tasklist->show_handles)
gtk_widget_show (tasklist->handle);
else
gtk_widget_hide (tasklist->handle);
}
static void
tasklist_fixed_width_toggled (GtkToggleButton *tb,
TasklistPlugin *tasklist)
{
tasklist->fixed_width = gtk_toggle_button_get_active (tb);
gtk_widget_queue_resize (GTK_WIDGET (tasklist->panel_plugin));
}
static void
tasklist_width_changed (GtkSpinButton *sb,
TasklistPlugin *tasklist)
{
tasklist->width = gtk_spin_button_get_value_as_int (sb);
gtk_widget_queue_resize (GTK_WIDGET (tasklist->panel_plugin));
}
static void
tasklist_width_sensitive (GtkToggleButton *tb,
GtkWidget *sb)
{
gtk_widget_set_sensitive (sb, gtk_toggle_button_get_active (tb));
}
static void
tasklist_dialog_response (GtkWidget *dlg,
gint reponse,
TasklistPlugin *tasklist)
{
g_object_set_data (G_OBJECT (tasklist->panel_plugin), I_("dialog"), NULL);
gtk_widget_destroy (dlg);
xfce_panel_plugin_unblock_menu (tasklist->panel_plugin);
tasklist_plugin_write (tasklist);
}
void
tasklist_dialogs_configure (TasklistPlugin *tasklist)
{
GtkWidget *dlg, *mainvbox, *vbox, *frame, *cb,
*hbox, *spin;
xfce_panel_plugin_block_menu (tasklist->panel_plugin);
dlg = xfce_titled_dialog_new_with_buttons (_("Task List"), NULL,
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
NULL);
gtk_window_set_screen (GTK_WINDOW (dlg), gtk_widget_get_screen (GTK_WIDGET (tasklist->panel_plugin)));
g_object_set_data (G_OBJECT (tasklist->panel_plugin), I_("dialog"), dlg);
gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER);
gtk_window_set_icon_name (GTK_WINDOW (dlg), GTK_STOCK_PROPERTIES);
g_signal_connect (G_OBJECT (dlg), "response",
G_CALLBACK (tasklist_dialog_response), tasklist);
mainvbox = gtk_vbox_new (FALSE, 6);
gtk_container_set_border_width (GTK_CONTAINER (mainvbox), 6);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), mainvbox,
TRUE, TRUE, 0);
/* Size */
vbox = gtk_vbox_new (FALSE, 6);
frame = xfce_create_framebox_with_content (_("Appearance"), vbox);
gtk_box_pack_start (GTK_BOX (mainvbox), frame, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, 12);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
cb = gtk_check_button_new_with_mnemonic (_("Fi_xed length (pixels):"));
gtk_box_pack_start (GTK_BOX (hbox), cb, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->fixed_width);
g_signal_connect (G_OBJECT (cb), "toggled",
G_CALLBACK (tasklist_fixed_width_toggled), tasklist);
/* an arbitrary max of 4000 should be future proof, right? */
spin = gtk_spin_button_new_with_range (100, 4000, 10);
gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), tasklist->width);
g_signal_connect (G_OBJECT (spin), "value-changed",
G_CALLBACK (tasklist_width_changed), tasklist);
gtk_widget_set_sensitive (spin, tasklist->fixed_width);
g_signal_connect (G_OBJECT (cb), "toggled",
G_CALLBACK (tasklist_width_sensitive), spin);
if (tasklist_using_xinerama (tasklist->panel_plugin))
{
cb = gtk_check_button_new_with_mnemonic (_("Use all available _space"));
gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->expand);
g_signal_connect (G_OBJECT (cb), "toggled",
G_CALLBACK (tasklist_expand_toggled), tasklist);
}
cb = gtk_check_button_new_with_mnemonic (_("Use _flat buttons"));
gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->flat_buttons);
g_signal_connect (G_OBJECT (cb), "toggled",
G_CALLBACK (tasklist_flat_buttons_toggled), tasklist);
cb = gtk_check_button_new_with_mnemonic (_("Show _handle"));
gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->show_handles);
g_signal_connect (G_OBJECT (cb), "toggled",
G_CALLBACK (tasklist_show_handle_toggled), tasklist);
/* Tasks */
vbox = gtk_vbox_new (FALSE, 6);
frame = xfce_create_framebox_with_content (_("Task List"), vbox);
gtk_box_pack_start (GTK_BOX (mainvbox), frame, FALSE, FALSE, 0);
cb = gtk_check_button_new_with_mnemonic (_("Show tasks from _all workspaces"));
gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->all_workspaces);
g_signal_connect (G_OBJECT (cb), "toggled",
G_CALLBACK (tasklist_all_workspaces_toggled), tasklist);
cb = gtk_combo_box_new_text ();
gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Never group tasks"));
gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Automatically group tasks"));
gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Always group tasks"));
/* keep order above in sync with WnckTasklistGroupingType */
gtk_combo_box_set_active (GTK_COMBO_BOX (cb), tasklist->grouping);
g_signal_connect (G_OBJECT (cb), "changed",
G_CALLBACK (tasklist_grouping_changed), tasklist);
gtk_widget_show_all (dlg);
}
|