Mercurial > pidgin
annotate src/gtkprefs.c @ 5530:2c4c975620f0
[gaim-migrate @ 5930]
Okay, several changes in this commit.
- We now have gtkprefs.h.
- We have a place where we can add UI prefs.
- show_prefs() -> gaim_gtk_prefs_show().
- make_frame() -> gaim_gtk_make_frame().
- The debug window is the first thing to have prefs. You can even
turn off the toolbar if you edit ~/.gaim/prefs.xml.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 26 May 2003 08:30:48 +0000 |
parents | 7e8524b5ff98 |
children | 933739f789f9 |
rev | line source |
---|---|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1 /** |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2 * @file gtkprefs.c GTK+ Preferences |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
3 * @ingroup gtkui |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
4 * |
5440 | 5 * gaim |
6 * | |
7 * Copyright (C) 1998-2002, Mark Spencer <markster@marko.net> | |
8 * | |
9 * This program is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 * | |
23 */ | |
24 | |
25 #ifdef HAVE_CONFIG_H | |
26 #include <config.h> | |
27 #endif | |
28 #include <string.h> | |
29 #include <sys/time.h> | |
30 | |
31 #include <sys/types.h> | |
32 #include <sys/stat.h> | |
33 | |
34 #include <unistd.h> | |
35 #include <stdio.h> | |
36 #include <stdlib.h> | |
37 #include <stdarg.h> | |
38 #include <ctype.h> | |
39 #include <gtk/gtk.h> | |
40 #include "gtkimhtml.h" | |
41 #include "gaim.h" | |
42 #include "gtkblist.h" | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
43 #include "gtkdebug.h" |
5440 | 44 #include "gtkplugin.h" |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
45 #include "gtkprefs.h" |
5440 | 46 #include "prpl.h" |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
47 #include "prefs.h" |
5440 | 48 #include "proxy.h" |
49 #include "sound.h" | |
50 #include "notify.h" | |
51 | |
52 #ifdef _WIN32 | |
53 #include "win32dep.h" | |
54 #endif | |
55 | |
56 GtkWidget *tree_v = NULL; | |
57 GtkWidget *prefs_away_menu = NULL; | |
58 GtkWidget *fontseld = NULL; | |
59 | |
60 GtkListStore *prefs_away_store = NULL; | |
61 | |
62 static int sound_row_sel = 0; | |
63 static char *last_sound_dir = NULL; | |
64 | |
65 static GtkWidget *sounddialog = NULL; | |
66 static GtkWidget *browser_entry = NULL; | |
67 static GtkWidget *sound_entry = NULL; | |
68 static GtkWidget *away_text = NULL; | |
69 static GtkListStore *smiley_theme_store = NULL; | |
70 GtkWidget *prefs_proxy_frame = NULL; | |
71 GtkWidget *gaim_button(const char *, guint *, int, GtkWidget *); | |
72 GtkWidget *gaim_labeled_spin_button(GtkWidget *, const gchar *, int*, int, int, GtkSizeGroup *); | |
73 static GtkWidget *gaim_dropdown(GtkWidget *, const gchar *, int *, int, ...); | |
74 static GtkWidget *gaim_dropdown_from_list(GtkWidget *, const gchar *, int *, int, GList *); | |
75 static GtkWidget *show_color_pref(GtkWidget *, gboolean); | |
76 static void delete_prefs(GtkWidget *, void *); | |
77 void set_default_away(GtkWidget *, gpointer); | |
78 #ifndef _WIN32 | |
79 static gboolean program_is_valid(const char *); | |
80 #endif | |
81 | |
82 static GtkWidget *prefs = NULL; | |
83 GtkWidget *debugbutton = NULL; | |
84 static int notebook_page = 0; | |
85 static GtkTreeIter plugin_iter; | |
86 | |
87 /* | |
88 * PROTOTYPES | |
89 */ | |
90 GtkTreeIter *prefs_notebook_add_page(const char*, GdkPixbuf*, GtkWidget*, GtkTreeIter*, GtkTreeIter*, int); | |
91 | |
92 static void update_plugin_list(void *data); | |
93 | |
94 void delete_prefs(GtkWidget *asdf, void *gdsa) { | |
95 GList *l; | |
96 GaimPlugin *plug; | |
97 | |
98 gaim_plugins_unregister_probe_notify_cb(update_plugin_list); | |
99 | |
100 save_prefs(); | |
101 prefs = NULL; | |
102 tree_v = NULL; | |
103 sound_entry = NULL; | |
104 browser_entry = NULL; | |
105 debugbutton = NULL; | |
106 prefs_away_menu = NULL; | |
107 notebook_page = 0; | |
108 smiley_theme_store = NULL; | |
109 if(sounddialog) | |
110 gtk_widget_destroy(sounddialog); | |
111 g_object_unref(G_OBJECT(prefs_away_store)); | |
112 prefs_away_store = NULL; | |
113 | |
114 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | |
115 plug = l->data; | |
116 | |
117 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
118 GaimGtkPluginUiInfo *ui_info; | |
119 | |
120 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
121 | |
122 if (ui_info->iter != NULL) { | |
123 g_free(ui_info->iter); | |
124 ui_info->iter = NULL; | |
125 } | |
126 } | |
127 } | |
128 } | |
129 | |
130 GtkWidget *preflabel; | |
131 GtkWidget *prefsnotebook; | |
132 GtkTreeStore *prefstree; | |
133 | |
134 static void set_misc_option(); | |
135 static void set_logging_option(); | |
136 static void set_blist_option(); | |
137 static void set_convo_option(); | |
138 static void set_im_option(); | |
139 static void set_chat_option(); | |
140 static void set_font_option(); | |
141 static void set_sound_option(); | |
142 static void set_away_option(); | |
143 | |
144 #define PROXYHOST 0 | |
145 #define PROXYPORT 1 | |
146 #define PROXYTYPE 2 | |
147 #define PROXYUSER 3 | |
148 #define PROXYPASS 4 | |
149 static void proxy_print_option(GtkEntry *entry, int entrynum) | |
150 { | |
151 if (entrynum == PROXYHOST) | |
152 g_snprintf(global_proxy_info.proxyhost, sizeof(global_proxy_info.proxyhost), "%s", gtk_entry_get_text(entry)); | |
153 else if (entrynum == PROXYPORT) | |
154 global_proxy_info.proxyport = atoi(gtk_entry_get_text(entry)); | |
155 else if (entrynum == PROXYUSER) | |
156 g_snprintf(global_proxy_info.proxyuser, sizeof(global_proxy_info.proxyuser), "%s", gtk_entry_get_text(entry)); | |
157 else if (entrynum == PROXYPASS) | |
158 g_snprintf(global_proxy_info.proxypass, sizeof(global_proxy_info.proxypass), "%s", gtk_entry_get_text(entry)); | |
159 proxy_info_is_from_gaimrc = 1; /* If the user specifies it, we want | |
160 to save it */ | |
161 } | |
162 | |
163 /* OK, Apply and Cancel */ | |
164 | |
165 static void pref_nb_select(GtkTreeSelection *sel, GtkNotebook *nb) { | |
166 GtkTreeIter iter; | |
167 char text[128]; | |
168 GValue val = { 0, }; | |
169 GtkTreeModel *model = GTK_TREE_MODEL(prefstree); | |
170 | |
171 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
172 return; | |
173 gtk_tree_model_get_value (model, &iter, 1, &val); | |
174 g_snprintf(text, sizeof(text), "<span weight=\"bold\" size=\"larger\">%s</span>", | |
175 g_value_get_string(&val)); | |
176 gtk_label_set_markup (GTK_LABEL(preflabel), text); | |
177 g_value_unset (&val); | |
178 gtk_tree_model_get_value (model, &iter, 2, &val); | |
179 gtk_notebook_set_current_page (GTK_NOTEBOOK (prefsnotebook), g_value_get_int (&val)); | |
180 | |
181 } | |
182 | |
183 /* These are the pages in the preferences notebook */ | |
184 GtkWidget *interface_page() { | |
185 GtkWidget *ret; | |
186 GtkWidget *vbox; | |
187 ret = gtk_vbox_new(FALSE, 18); | |
188 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
189 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
190 vbox = gaim_gtk_make_frame(ret, _("Interface Options")); |
5440 | 191 |
192 gaim_button(_("D_isplay remote nicknames if no alias is set"), &misc_options, OPT_MISC_USE_SERVER_ALIAS, vbox); | |
193 | |
194 | |
195 gtk_widget_show_all(ret); | |
196 return ret; | |
197 } | |
198 | |
199 static void smiley_sel (GtkTreeSelection *sel, GtkTreeModel *model) { | |
200 GtkTreeIter iter; | |
201 const char *filename; | |
202 GValue val = { 0, }; | |
203 | |
204 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
205 return; | |
206 gtk_tree_model_get_value (model, &iter, 2, &val); | |
207 filename = g_value_get_string(&val); | |
208 load_smiley_theme(filename, TRUE); | |
209 g_value_unset (&val); | |
210 save_prefs(); | |
211 } | |
212 | |
213 GtkTreePath *theme_refresh_theme_list() | |
214 { | |
215 GdkPixbuf *pixbuf; | |
216 GSList *themes; | |
217 GtkTreeIter iter; | |
218 GtkTreePath *path = NULL; | |
219 int ind = 0; | |
220 | |
221 | |
222 smiley_theme_probe(); | |
223 | |
224 if (!smiley_themes) | |
225 return NULL; | |
226 | |
227 themes = smiley_themes; | |
228 | |
229 gtk_list_store_clear(smiley_theme_store); | |
230 | |
231 while (themes) { | |
232 struct smiley_theme *theme = themes->data; | |
233 char *description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n" | |
234 "<span size='smaller' foreground='dim grey'>%s</span>", | |
235 theme->name, theme->author, theme->desc); | |
236 gtk_list_store_append (smiley_theme_store, &iter); | |
237 pixbuf = gdk_pixbuf_new_from_file(theme->icon, NULL); | |
238 | |
239 gtk_list_store_set(smiley_theme_store, &iter, | |
240 0, pixbuf, | |
241 1, description, | |
242 2, theme->path, | |
243 -1); | |
244 g_object_unref(G_OBJECT(pixbuf)); | |
245 g_free(description); | |
246 themes = themes->next; | |
247 if (current_smiley_theme && !strcmp(theme->path, current_smiley_theme->path)) { | |
248 /* path = gtk_tree_path_new_from_indices(ind); */ | |
249 char *iwishihadgtk2_2 = g_strdup_printf("%d", ind); | |
250 path = gtk_tree_path_new_from_string(iwishihadgtk2_2); | |
251 g_free(iwishihadgtk2_2); | |
252 } | |
253 ind++; | |
254 } | |
255 | |
256 return path; | |
257 } | |
258 | |
259 void theme_install_theme(char *path, char *extn) { | |
260 #ifndef _WIN32 | |
261 gchar *command; | |
262 #endif | |
263 gchar *destdir; | |
264 gchar *tail; | |
265 | |
266 /* Just to be safe */ | |
267 g_strchomp(path); | |
268 | |
269 /* I dont know what you are, get out of here */ | |
270 if (extn != NULL) | |
271 tail = extn; | |
272 else if ((tail = strrchr(path, '.')) == NULL) | |
273 return; | |
274 | |
275 destdir = g_strconcat(gaim_user_dir(), G_DIR_SEPARATOR_S "smileys", NULL); | |
276 | |
277 /* We'll check this just to make sure. This also lets us do something different on | |
278 * other platforms, if need be */ | |
279 if (!g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz")) { | |
280 #ifndef _WIN32 | |
281 command = g_strdup_printf("tar > /dev/null xzf \"%s\" -C %s", path, destdir); | |
282 #else | |
283 if(!wgaim_gz_untar(path, destdir)) { | |
284 g_free(destdir); | |
285 return; | |
286 } | |
287 #endif | |
288 } | |
289 else { | |
290 g_free(destdir); | |
291 return; | |
292 } | |
293 | |
294 #ifndef _WIN32 | |
295 /* Fire! */ | |
296 system(command); | |
297 | |
298 g_free(command); | |
299 #endif | |
300 g_free(destdir); | |
301 | |
302 theme_refresh_theme_list(); | |
303 } | |
304 | |
305 static void theme_got_url(gpointer data, char *themedata, unsigned long len) { | |
306 FILE *f; | |
307 gchar *path; | |
308 | |
309 f = gaim_mkstemp(&path); | |
310 fwrite(themedata, len, 1, f); | |
311 fclose(f); | |
312 | |
313 theme_install_theme(path, data); | |
314 | |
315 unlink(path); | |
316 g_free(path); | |
317 } | |
318 | |
319 void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, | |
320 guint info, guint t, gpointer data) { | |
321 gchar *name = sd->data; | |
322 | |
323 if ((sd->length >= 0) && (sd->format == 8)) { | |
324 /* Well, it looks like the drag event was cool. | |
325 * Let's do something with it */ | |
326 | |
327 if (!g_ascii_strncasecmp(name, "file://", 7)) { | |
328 GError *converr = NULL; | |
329 gchar *tmp; | |
330 /* It looks like we're dealing with a local file. Let's | |
331 * just untar it in the right place */ | |
332 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) { | |
333 gaim_debug(GAIM_DEBUG_ERROR, "theme dnd", "%s\n", | |
334 (converr ? converr->message : | |
335 "g_filename_from_uri error")); | |
336 return; | |
337 } | |
338 theme_install_theme(tmp, NULL); | |
339 g_free(tmp); | |
340 } else if (!g_ascii_strncasecmp(name, "http://", 7)) { | |
341 /* Oo, a web drag and drop. This is where things | |
342 * will start to get interesting */ | |
343 gchar *tail; | |
344 | |
345 if ((tail = strrchr(name, '.')) == NULL) | |
346 return; | |
347 | |
348 /* We'll check this just to make sure. This also lets us do something different on | |
349 * other platforms, if need be */ | |
350 grab_url(name, TRUE, theme_got_url, ".tgz"); | |
351 } | |
352 | |
353 gtk_drag_finish(dc, TRUE, FALSE, t); | |
354 } | |
355 | |
356 gtk_drag_finish(dc, FALSE, FALSE, t); | |
357 } | |
358 | |
359 GtkWidget *theme_page() { | |
360 GtkWidget *ret; | |
361 GtkWidget *sw; | |
362 GtkWidget *view; | |
363 GtkCellRenderer *rend; | |
364 GtkTreeViewColumn *col; | |
365 GtkTreeSelection *sel; | |
366 GtkTreePath *path = NULL; | |
367 GtkWidget *label; | |
368 GtkTargetEntry te[3] = {{"text/plain", 0, 0},{"text/uri-list", 0, 1},{"STRING", 0, 2}}; | |
369 | |
370 ret = gtk_vbox_new(FALSE, 18); | |
371 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
372 | |
373 label = gtk_label_new(_("Select a smiley theme that you would like to use from the list below. New themes can be installed by dragging and dropping them onto the theme list.")); | |
374 | |
375 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
376 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
377 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); | |
378 | |
379 gtk_box_pack_start(GTK_BOX(ret), label, FALSE, TRUE, 0); | |
380 gtk_widget_show(label); | |
381 | |
382 sw = gtk_scrolled_window_new(NULL,NULL); | |
383 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
384 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
385 | |
386 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
387 smiley_theme_store = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); | |
388 | |
389 path = theme_refresh_theme_list(); | |
390 | |
391 view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(smiley_theme_store)); | |
392 | |
393 gtk_drag_dest_set(view, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, te, | |
394 sizeof(te) / sizeof(GtkTargetEntry) , GDK_ACTION_COPY | GDK_ACTION_MOVE); | |
395 | |
396 g_signal_connect(G_OBJECT(view), "drag_data_received", G_CALLBACK(theme_dnd_recv), smiley_theme_store); | |
397 | |
398 rend = gtk_cell_renderer_pixbuf_new(); | |
399 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); | |
400 | |
401 if(path) { | |
402 gtk_tree_selection_select_path(sel, path); | |
403 gtk_tree_path_free(path); | |
404 } | |
405 | |
406 col = gtk_tree_view_column_new_with_attributes (_("Icon"), | |
407 rend, | |
408 "pixbuf", 0, | |
409 NULL); | |
410 gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); | |
411 | |
412 rend = gtk_cell_renderer_text_new(); | |
413 col = gtk_tree_view_column_new_with_attributes (_("Description"), | |
414 rend, | |
415 "markup", 1, | |
416 NULL); | |
417 gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); | |
418 g_object_unref(G_OBJECT(smiley_theme_store)); | |
419 gtk_container_add(GTK_CONTAINER(sw), view); | |
420 | |
421 g_signal_connect (G_OBJECT (sel), "changed", | |
422 G_CALLBACK (smiley_sel), | |
423 NULL); | |
424 | |
425 | |
426 gtk_widget_show_all(ret); | |
427 return ret; | |
428 } | |
429 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
430 static void update_color(GtkWidget *w, GtkWidget *pic) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
431 { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
432 GdkColor c; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
433 GtkStyle *style; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
434 c.pixel = 0; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
435 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
436 if (pic == pref_fg_picture) { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
437 if (font_options & OPT_FONT_FGCOL) { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
438 c.red = fgcolor.red; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
439 c.blue = fgcolor.blue; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
440 c.green = fgcolor.green; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
441 } else { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
442 c.red = 0; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
443 c.blue = 0; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
444 c.green = 0; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
445 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
446 } else { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
447 if (font_options & OPT_FONT_BGCOL) { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
448 c.red = bgcolor.red; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
449 c.blue = bgcolor.blue; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
450 c.green = bgcolor.green; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
451 } else { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
452 c.red = 0xffff; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
453 c.blue = 0xffff; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
454 c.green = 0xffff; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
455 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
456 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
457 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
458 style = gtk_style_new(); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
459 style->bg[0] = c; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
460 gtk_widget_set_style(pic, style); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
461 g_object_unref(style); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
462 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
463 |
5440 | 464 GtkWidget *font_page() { |
465 GtkWidget *ret; | |
466 GtkWidget *button; | |
467 GtkWidget *vbox, *hbox; | |
468 GtkWidget *select = NULL; | |
469 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
470 | |
471 ret = gtk_vbox_new(FALSE, 18); | |
472 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
473 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
474 vbox = gaim_gtk_make_frame(ret, _("Style")); |
5440 | 475 gaim_button(_("_Bold"), &font_options, OPT_FONT_BOLD, vbox); |
476 gaim_button(_("_Italics"), &font_options, OPT_FONT_ITALIC, vbox); | |
477 gaim_button(_("_Underline"), &font_options, OPT_FONT_UNDERLINE, vbox); | |
478 gaim_button(_("_Strikethrough"), &font_options, OPT_FONT_STRIKE, vbox); | |
479 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
480 vbox = gaim_gtk_make_frame(ret, _("Face")); |
5440 | 481 hbox = gtk_hbox_new(FALSE, 6); |
482 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
483 button = gaim_button(_("Use custo_m face"), &font_options, OPT_FONT_FACE, hbox); | |
484 gtk_size_group_add_widget(sg, button); | |
485 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT); | |
486 | |
487 if (!(font_options & OPT_FONT_FACE)) | |
488 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); | |
489 g_signal_connect(G_OBJECT(button), "clicked", | |
490 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
491 g_signal_connect(G_OBJECT(select), "clicked", | |
492 G_CALLBACK(show_font_dialog), NULL); | |
493 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); | |
494 | |
495 hbox = gtk_hbox_new(FALSE, 5); | |
496 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
497 button = gaim_button(_("Use custom si_ze"), &font_options, OPT_FONT_SIZE, hbox); | |
498 gtk_size_group_add_widget(sg, button); | |
499 select = gaim_labeled_spin_button(hbox, NULL, &fontsize, 1, 7, NULL); | |
500 if (!(font_options & OPT_FONT_SIZE)) | |
501 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); | |
502 g_signal_connect(G_OBJECT(button), "clicked", | |
503 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
504 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
505 vbox = gaim_gtk_make_frame(ret, _("Color")); |
5440 | 506 hbox = gtk_hbox_new(FALSE, 5); |
507 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
508 | |
509 | |
510 button = gaim_button(_("_Text color"), &font_options, OPT_FONT_FGCOL, hbox); | |
511 gtk_size_group_add_widget(sg, button); | |
512 | |
513 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR); | |
514 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); | |
515 pref_fg_picture = show_color_pref(hbox, TRUE); | |
516 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(update_color), | |
517 pref_fg_picture); | |
518 | |
519 if (!(font_options & OPT_FONT_FGCOL)) | |
520 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); | |
521 g_signal_connect(G_OBJECT(button), "clicked", | |
522 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
523 g_signal_connect(G_OBJECT(select), "clicked", G_CALLBACK(show_fgcolor_dialog), NULL); | |
524 hbox = gtk_hbox_new(FALSE, 5); | |
525 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
526 | |
527 button = gaim_button(_("Bac_kground color"), &font_options, OPT_FONT_BGCOL, hbox); | |
528 gtk_size_group_add_widget(sg, button); | |
529 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR); | |
530 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); | |
531 pref_bg_picture = show_color_pref(hbox, FALSE); | |
532 g_signal_connect(G_OBJECT(button), "clicked", | |
533 G_CALLBACK(update_color), pref_bg_picture); | |
534 | |
535 if (!(font_options & OPT_FONT_BGCOL)) | |
536 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); | |
537 g_signal_connect(G_OBJECT(select), "clicked", | |
538 G_CALLBACK(show_bgcolor_dialog), NULL); | |
539 g_signal_connect(G_OBJECT(button), "clicked", | |
540 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
541 | |
542 gtk_widget_show_all(ret); | |
543 return ret; | |
544 } | |
545 | |
546 | |
547 GtkWidget *messages_page() { | |
548 GtkWidget *ret; | |
549 GtkWidget *vbox; | |
550 ret = gtk_vbox_new(FALSE, 18); | |
551 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
552 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
553 vbox = gaim_gtk_make_frame (ret, _("Display")); |
5440 | 554 gaim_button(_("Show graphical _smileys"), &convo_options, OPT_CONVO_SHOW_SMILEY, vbox); |
555 gaim_button(_("Show _timestamp on messages"), &convo_options, OPT_CONVO_SHOW_TIME, vbox); | |
556 gaim_button(_("Show _URLs as links"), &convo_options, OPT_CONVO_SEND_LINKS, vbox); | |
557 #ifdef USE_GTKSPELL | |
558 gaim_button(_("_Highlight misspelled words"), &convo_options, OPT_CONVO_CHECK_SPELLING, vbox); | |
559 #endif | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
560 vbox = gaim_gtk_make_frame (ret, _("Ignore")); |
5440 | 561 gaim_button(_("Ignore c_olors"), &convo_options, OPT_CONVO_IGNORE_COLOUR, vbox); |
562 gaim_button(_("Ignore font _faces"), &convo_options, OPT_CONVO_IGNORE_FONTS, vbox); | |
563 gaim_button(_("Ignore font si_zes"), &convo_options, OPT_CONVO_IGNORE_SIZES, vbox); | |
564 | |
565 gtk_widget_show_all(ret); | |
566 return ret; | |
567 } | |
568 | |
569 GtkWidget *hotkeys_page() { | |
570 GtkWidget *ret; | |
571 GtkWidget *vbox; | |
572 ret = gtk_vbox_new(FALSE, 18); | |
573 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
574 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
575 vbox = gaim_gtk_make_frame(ret, _("Send Message")); |
5440 | 576 gaim_button(_("_Enter sends message"), &convo_options, OPT_CONVO_ENTER_SENDS, vbox); |
577 gaim_button(_("C_ontrol-Enter sends message"), &convo_options, OPT_CONVO_CTL_ENTER, vbox); | |
578 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
579 vbox = gaim_gtk_make_frame (ret, _("Window Closing")); |
5440 | 580 gaim_button(_("E_scape closes window"), &convo_options, OPT_CONVO_ESC_CAN_CLOSE, vbox); |
581 gaim_button(_("Control-_W closes window"), &convo_options, OPT_CONVO_CTL_W_CLOSES, vbox); | |
582 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
583 vbox = gaim_gtk_make_frame(ret, _("Insertions")); |
5440 | 584 gaim_button(_("Control-{B/I/U/S} inserts _HTML tags"), &convo_options, OPT_CONVO_CTL_CHARS, vbox); |
585 gaim_button(_("Control-(number) inserts _smileys"), &convo_options, OPT_CONVO_CTL_SMILEYS, vbox); | |
586 | |
587 gtk_widget_show_all(ret); | |
588 return ret; | |
589 } | |
590 | |
591 GtkWidget *list_page() { | |
592 GtkWidget *ret; | |
593 GtkWidget *vbox; | |
594 GtkWidget *button, *b2; | |
595 int r = 0; | |
596 gboolean fnd = FALSE; | |
597 GList *l= NULL; | |
598 GSList *sl = gaim_gtk_blist_sort_methods; | |
599 ret = gtk_vbox_new(FALSE, 18); | |
600 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
601 | |
602 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
603 vbox = gaim_gtk_make_frame (ret, _("Buddy List Sorting")); |
5440 | 604 while (sl) { |
605 l = g_list_append(l, ((struct gaim_gtk_blist_sort_method*)sl->data)->name); | |
606 l = g_list_append(l, ((struct gaim_gtk_blist_sort_method*)sl->data)->name); | |
607 if (!fnd && !gaim_utf8_strcasecmp(((struct gaim_gtk_blist_sort_method*)sl->data)->name, sort_method)) | |
608 fnd = TRUE; | |
609 sl = sl->next; | |
610 if (!fnd) r++; | |
611 } | |
612 gaim_dropdown_from_list(vbox, _("Sorting:"), | |
613 (int*)&sort_method, r, l); | |
614 | |
615 g_list_free(l); | |
616 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
617 vbox = gaim_gtk_make_frame (ret, _("Buddy List Toolbar")); |
5440 | 618 gaim_dropdown(vbox, _("Show _buttons as:"), &blist_options, OPT_BLIST_SHOW_BUTTON_XPM | OPT_BLIST_NO_BUTTON_TEXT, |
619 _("Pictures"), OPT_BLIST_SHOW_BUTTON_XPM | OPT_BLIST_NO_BUTTON_TEXT, | |
620 _("Text"), 0, | |
621 _("Pictures and text"), OPT_BLIST_SHOW_BUTTON_XPM, | |
622 _("None"), OPT_BLIST_NO_BUTTON_TEXT, NULL); | |
623 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
624 vbox = gaim_gtk_make_frame (ret, _("Buddy List Window")); |
5440 | 625 gaim_button(_("_Raise window on events"), &blist_options, OPT_BLIST_POPUP, vbox); |
626 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
627 vbox = gaim_gtk_make_frame (ret, _("Group Display")); |
5440 | 628 /* gaim_button(_("Hide _groups with no online buddies"), &blist_options, OPT_BLIST_NO_MT_GRP, vbox); */ |
629 gaim_button(_("Show _numbers in groups"), &blist_options, OPT_BLIST_SHOW_GRPNUM, vbox); | |
630 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
631 vbox = gaim_gtk_make_frame (ret, _("Buddy Display")); |
5440 | 632 button = gaim_button(_("Show buddy _icons"), &blist_options, OPT_BLIST_SHOW_ICONS, vbox); |
633 b2 = gaim_button(_("Show _warning levels"), &blist_options, OPT_BLIST_SHOW_WARN, vbox); | |
634 if (blist_options & OPT_BLIST_SHOW_ICONS) | |
635 gtk_widget_set_sensitive(GTK_WIDGET(b2), FALSE); | |
636 g_signal_connect(G_OBJECT(button), "clicked", | |
637 G_CALLBACK(gaim_gtk_toggle_sensitive), b2); | |
638 b2 = gaim_button(_("Show idle _times"), &blist_options, OPT_BLIST_SHOW_IDLETIME, vbox); | |
639 if (blist_options & OPT_BLIST_SHOW_ICONS) | |
640 gtk_widget_set_sensitive(GTK_WIDGET(b2), FALSE); | |
641 g_signal_connect(G_OBJECT(button), "clicked", | |
642 G_CALLBACK(gaim_gtk_toggle_sensitive), b2); | |
643 gaim_button(_("Dim i_dle buddies"), &blist_options, OPT_BLIST_GREY_IDLERS, vbox); | |
644 | |
645 gtk_widget_show_all(ret); | |
646 return ret; | |
647 } | |
648 | |
649 GtkWidget *conv_page() { | |
650 GtkWidget *ret; | |
651 GtkWidget *vbox; | |
652 GtkWidget *label; | |
653 GtkSizeGroup *sg; | |
654 GList *names = NULL; | |
655 int i; | |
656 | |
657 ret = gtk_vbox_new(FALSE, 18); | |
658 gtk_container_set_border_width(GTK_CONTAINER(ret), 12); | |
659 | |
660 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
661 vbox = gaim_gtk_make_frame(ret, _("Conversations")); |
5440 | 662 |
663 /* Build a list of names. */ | |
664 for (i = 0; i < gaim_conv_placement_get_fnc_count(); i++) { | |
665 names = g_list_append(names, (char *)gaim_conv_placement_get_name(i)); | |
666 names = g_list_append(names, GINT_TO_POINTER(i)); | |
667 } | |
668 | |
669 label = gaim_dropdown_from_list(vbox, _("_Placement:"), | |
670 &conv_placement_option, -1, names); | |
671 | |
672 g_list_free(names); | |
673 | |
674 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
675 gtk_size_group_add_widget(sg, label); | |
676 | |
677 gaim_button(_("Show IMs and chats in _same tabbed window."), | |
678 &convo_options, OPT_CONVO_COMBINE, vbox); | |
679 | |
680 gtk_widget_show_all(ret); | |
681 | |
682 return ret; | |
683 } | |
684 | |
685 GtkWidget *im_page() { | |
686 GtkWidget *ret; | |
687 GtkWidget *vbox; | |
688 GtkWidget *typingbutton, *widge; | |
689 GtkSizeGroup *sg; | |
690 | |
691 ret = gtk_vbox_new(FALSE, 18); | |
692 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
693 | |
694 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
695 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
696 vbox = gaim_gtk_make_frame (ret, _("Window")); |
5440 | 697 widge = gaim_dropdown(vbox, _("Show _buttons as:"), &im_options, OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM, |
698 _("Pictures"), OPT_IM_BUTTON_XPM, | |
699 _("Text"), OPT_IM_BUTTON_TEXT, | |
700 _("Pictures and text"), OPT_IM_BUTTON_XPM | OPT_IM_BUTTON_TEXT, NULL); | |
701 gtk_size_group_add_widget(sg, widge); | |
702 gtk_misc_set_alignment(GTK_MISC(widge), 0, 0); | |
703 gaim_labeled_spin_button(vbox, _("New window _width:"), &conv_size.width, 25, 9999, sg); | |
704 gaim_labeled_spin_button(vbox, _("New window _height:"), &conv_size.height, 25, 9999, sg); | |
705 gaim_labeled_spin_button(vbox, _("_Entry field height:"), &conv_size.entry_height, 25, 9999, sg); | |
706 gaim_button(_("_Raise windows on events"), &im_options, OPT_IM_POPUP, vbox); | |
707 gaim_button(_("Hide window on _send"), &im_options, OPT_IM_POPDOWN, vbox); | |
708 gtk_widget_show (vbox); | |
709 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
710 vbox = gaim_gtk_make_frame (ret, _("Buddy Icons")); |
5440 | 711 gaim_button(_("Hide buddy _icons"), &im_options, OPT_IM_HIDE_ICONS, vbox); |
712 gaim_button(_("Disable buddy icon a_nimation"), &im_options, OPT_IM_NO_ANIMATION, vbox); | |
713 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
714 vbox = gaim_gtk_make_frame (ret, _("Display")); |
5440 | 715 gaim_button(_("Show _logins in window"), &im_options, OPT_IM_LOGON, vbox); |
716 gaim_button(_("Show a_liases in tabs/titles"), &im_options, OPT_IM_ALIAS_TAB, vbox); | |
717 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
718 vbox = gaim_gtk_make_frame (ret, _("Typing Notification")); |
5440 | 719 typingbutton = gaim_button(_("Notify buddies that you are _typing to them"), &misc_options, |
720 OPT_MISC_STEALTH_TYPING, vbox); | |
721 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(typingbutton), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(typingbutton))); | |
722 misc_options ^= OPT_MISC_STEALTH_TYPING; | |
723 | |
724 gtk_widget_show_all(ret); | |
725 return ret; | |
726 } | |
727 | |
728 GtkWidget *chat_page() { | |
729 GtkWidget *ret; | |
730 GtkWidget *vbox; | |
731 GtkWidget *dd; | |
732 GtkSizeGroup *sg; | |
733 | |
734 ret = gtk_vbox_new(FALSE, 18); | |
735 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
736 | |
737 sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); | |
738 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
739 vbox = gaim_gtk_make_frame (ret, _("Window")); |
5440 | 740 dd = gaim_dropdown(vbox, _("Show _buttons as:"), &chat_options, OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM, |
741 _("Pictures"), OPT_CHAT_BUTTON_XPM, | |
742 _("Text"), OPT_CHAT_BUTTON_TEXT, | |
743 _("Pictures and text"), OPT_CHAT_BUTTON_XPM | OPT_CHAT_BUTTON_TEXT, NULL); | |
744 gtk_size_group_add_widget(sg, dd); | |
745 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
746 gaim_labeled_spin_button(vbox, _("New window _width:"), &buddy_chat_size.width, 25, 9999, sg); | |
747 gaim_labeled_spin_button(vbox, _("New window _height:"), &buddy_chat_size.height, 25, 9999, sg); | |
748 gaim_labeled_spin_button(vbox, _("_Entry field height:"), &buddy_chat_size.entry_height, 25, 9999, sg); | |
749 gaim_button(_("_Raise windows on events"), &chat_options, OPT_CHAT_POPUP, vbox); | |
750 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
751 vbox = gaim_gtk_make_frame (ret, _("Tab Completion")); |
5440 | 752 gaim_button(_("_Tab-complete nicks"), &chat_options, OPT_CHAT_TAB_COMPLETE, vbox); |
753 gaim_button(_("_Old-style tab completion"), &chat_options, OPT_CHAT_OLD_STYLE_TAB, vbox); | |
754 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
755 vbox = gaim_gtk_make_frame (ret, _("Display")); |
5440 | 756 gaim_button(_("_Show people joining/leaving in window"), &chat_options, OPT_CHAT_LOGON, vbox); |
757 gaim_button(_("Co_lorize screennames"), &chat_options, OPT_CHAT_COLORIZE, vbox); | |
758 | |
759 gtk_widget_show_all(ret); | |
760 return ret; | |
761 } | |
762 | |
763 GtkWidget *tab_page() { | |
764 GtkWidget *ret; | |
765 GtkWidget *vbox; | |
766 GtkWidget *dd; | |
767 GtkWidget *button; | |
768 GtkSizeGroup *sg; | |
769 ret = gtk_vbox_new(FALSE, 18); | |
770 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
771 | |
772 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
773 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
774 vbox = gaim_gtk_make_frame (ret, _("IM Tabs")); |
5440 | 775 dd = gaim_dropdown(vbox, _("Tab _placement:"), &im_options, OPT_IM_SIDE_TAB | OPT_IM_BR_TAB, |
776 _("Top"), 0, | |
777 _("Bottom"), OPT_IM_BR_TAB, | |
778 _("Left"), OPT_IM_SIDE_TAB, | |
779 _("Right"), OPT_IM_BR_TAB | OPT_IM_SIDE_TAB, NULL); | |
780 gtk_size_group_add_widget(sg, dd); | |
781 gaim_button(_("Show all _instant messages in one tabbed\nwindow"), &im_options, OPT_IM_ONE_WINDOW, vbox); | |
782 | |
783 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
784 vbox = gaim_gtk_make_frame (ret, _("Chat Tabs")); |
5440 | 785 dd = gaim_dropdown(vbox, _("Tab _placement:"), &chat_options, OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB, |
786 _("Top"), 0, | |
787 _("Bottom"), OPT_CHAT_BR_TAB, | |
788 _("Left"), OPT_CHAT_SIDE_TAB, | |
789 _("Right"), OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB, NULL); | |
790 gtk_size_group_add_widget(sg, dd); | |
791 gaim_button(_("Show all c_hats in one tabbed window"), &chat_options, OPT_CHAT_ONE_WINDOW, | |
792 vbox); | |
793 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
794 vbox = gaim_gtk_make_frame (ret, _("Tab Options")); |
5440 | 795 button = gaim_button(_("Show _close button on tabs."), &convo_options, OPT_CONVO_NO_X_ON_TAB, vbox); |
796 convo_options ^= OPT_CONVO_NO_X_ON_TAB; | |
797 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))); | |
798 | |
799 | |
800 gtk_widget_show_all(ret); | |
801 return ret; | |
802 } | |
803 | |
804 GtkWidget *proxy_page() { | |
805 GtkWidget *ret; | |
806 GtkWidget *vbox; | |
807 GtkWidget *entry; | |
808 GtkWidget *label; | |
809 GtkWidget *hbox; | |
810 GtkWidget *table; | |
811 | |
812 ret = gtk_vbox_new(FALSE, 18); | |
813 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
814 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
815 vbox = gaim_gtk_make_frame (ret, _("Proxy Type")); |
5440 | 816 gaim_dropdown(vbox, _("Proxy _type:"), (int*)&global_proxy_info.proxytype, -1, |
817 _("No proxy"), PROXY_NONE, | |
818 "SOCKS 4", PROXY_SOCKS4, | |
819 "SOCKS 5", PROXY_SOCKS5, | |
820 "HTTP", PROXY_HTTP, NULL); | |
821 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
822 vbox = gaim_gtk_make_frame(ret, _("Proxy Server")); |
5440 | 823 prefs_proxy_frame = vbox; |
824 | |
825 if (global_proxy_info.proxytype == PROXY_NONE) | |
826 gtk_widget_set_sensitive(GTK_WIDGET(vbox), FALSE); | |
827 | |
828 table = gtk_table_new(2, 4, FALSE); | |
829 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
830 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
831 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
832 gtk_container_add(GTK_CONTAINER(vbox), table); | |
833 | |
834 | |
835 label = gtk_label_new_with_mnemonic(_("_Host")); | |
836 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
837 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
838 | |
839 entry = gtk_entry_new(); | |
840 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
841 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
842 g_signal_connect(G_OBJECT(entry), "changed", | |
843 G_CALLBACK(proxy_print_option), (void *)PROXYHOST); | |
844 gtk_entry_set_text(GTK_ENTRY(entry), global_proxy_info.proxyhost); | |
845 | |
846 hbox = gtk_hbox_new(TRUE, 5); | |
847 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
848 | |
849 label = gtk_label_new_with_mnemonic(_("Port")); | |
850 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
851 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); | |
852 | |
853 entry = gtk_entry_new(); | |
854 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
855 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); | |
856 g_signal_connect(G_OBJECT(entry), "changed", | |
857 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | |
858 | |
859 if (global_proxy_info.proxyport) { | |
860 char buf[128]; | |
861 g_snprintf(buf, sizeof(buf), "%d", global_proxy_info.proxyport); | |
862 gtk_entry_set_text(GTK_ENTRY(entry), buf); | |
863 } | |
864 | |
865 label = gtk_label_new_with_mnemonic(_("_User")); | |
866 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
867 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); | |
868 | |
869 entry = gtk_entry_new(); | |
870 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
871 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); | |
872 g_signal_connect(G_OBJECT(entry), "changed", | |
873 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); | |
874 gtk_entry_set_text(GTK_ENTRY(entry), global_proxy_info.proxyuser); | |
875 | |
876 hbox = gtk_hbox_new(TRUE, 5); | |
877 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
878 | |
879 label = gtk_label_new_with_mnemonic(_("Pa_ssword")); | |
880 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
881 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); | |
882 | |
883 entry = gtk_entry_new(); | |
884 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
885 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 3, 4, GTK_FILL , 0, 0, 0); | |
886 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | |
887 g_signal_connect(G_OBJECT(entry), "changed", | |
888 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); | |
889 gtk_entry_set_text(GTK_ENTRY(entry), global_proxy_info.proxypass); | |
890 | |
891 gtk_widget_show_all(ret); | |
892 return ret; | |
893 } | |
894 | |
895 #ifndef _WIN32 | |
896 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { | |
897 const char *program = gtk_entry_get_text(GTK_ENTRY(entry)); | |
898 | |
899 if (!program_is_valid(program)) { | |
900 char *error = g_strdup_printf(_("The entered manual browser " | |
901 "'%s' is not valid. Hyperlinks will " | |
902 "not work."), program); | |
903 gaim_notify_warning(NULL, NULL, error, NULL); | |
904 } | |
905 | |
906 g_strlcpy(web_command, program, sizeof(web_command)); | |
907 | |
908 /* carry on normally */ | |
909 return FALSE; | |
910 } | |
911 | |
912 static GList *get_available_browsers() | |
913 { | |
914 struct browser { | |
915 char *name; | |
916 char *command; | |
917 int id; | |
918 }; | |
919 | |
920 static struct browser possible_browsers[] = { | |
921 {N_("Konqueror"), "kfmclient", BROWSER_KONQ}, | |
922 {N_("Opera"), "opera", BROWSER_OPERA}, | |
923 {N_("Galeon"), "galeon", BROWSER_GALEON}, | |
924 {N_("Netscape"), "netscape", BROWSER_NETSCAPE}, | |
925 {N_("Mozilla"), "mozilla", BROWSER_MOZILLA}, | |
926 }; | |
927 static const int num_possible_browsers = 5; | |
928 | |
929 GList *browsers = NULL; | |
930 int i = 0; | |
931 | |
932 browsers = g_list_prepend(browsers, GINT_TO_POINTER(BROWSER_MANUAL)); | |
933 browsers = g_list_prepend(browsers, _("Manual")); | |
934 for (i = 0; i < num_possible_browsers; i++) { | |
935 if (program_is_valid(possible_browsers[i].command)) { | |
936 browsers = g_list_prepend(browsers, | |
937 GINT_TO_POINTER(possible_browsers[i].id)); | |
938 browsers = g_list_prepend(browsers, possible_browsers[i].name); | |
939 } | |
940 } | |
941 | |
942 return browsers; | |
943 } | |
944 | |
945 GtkWidget *browser_page() { | |
946 GtkWidget *ret; | |
947 GtkWidget *vbox; | |
948 GtkWidget *hbox; | |
949 GtkWidget *label; | |
950 GtkSizeGroup *sg; | |
951 GList *browsers = NULL; | |
952 | |
953 ret = gtk_vbox_new(FALSE, 18); | |
954 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
955 | |
956 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
957 vbox = gaim_gtk_make_frame (ret, _("Browser Selection")); |
5440 | 958 |
959 browsers = get_available_browsers(); | |
960 if (browsers != NULL) { | |
961 label = gaim_dropdown_from_list(vbox,_("_Browser"), &web_browser, -1, | |
962 browsers); | |
963 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
964 gtk_size_group_add_widget(sg, label); | |
965 } | |
966 | |
967 hbox = gtk_hbox_new(FALSE, 5); | |
968 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
969 label = gtk_label_new_with_mnemonic(_("_Manual: ")); | |
970 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); | |
971 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
972 gtk_size_group_add_widget(sg, label); | |
973 | |
974 browser_entry = gtk_entry_new(); | |
975 gtk_label_set_mnemonic_widget(GTK_LABEL(label), browser_entry); | |
976 if (web_browser != BROWSER_MANUAL) | |
977 gtk_widget_set_sensitive(hbox, FALSE); | |
978 gtk_box_pack_start (GTK_BOX (hbox), browser_entry, FALSE, FALSE, 0); | |
979 | |
980 gtk_entry_set_text(GTK_ENTRY(browser_entry), web_command); | |
981 g_signal_connect(G_OBJECT(browser_entry), "focus-out-event", G_CALLBACK(manual_browser_set), NULL); | |
982 | |
983 if (browsers != NULL) { | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
984 vbox = gaim_gtk_make_frame (ret, _("Browser Options")); |
5440 | 985 label = gaim_button(_("Open new _window by default"), &misc_options, OPT_MISC_BROWSER_POPUP, vbox); |
986 } | |
987 | |
988 gtk_widget_show_all(ret); | |
989 return ret; | |
990 } | |
991 #endif /*_WIN32*/ | |
992 | |
993 GtkWidget *logging_page() { | |
994 GtkWidget *ret; | |
995 GtkWidget *vbox; | |
996 ret = gtk_vbox_new(FALSE, 18); | |
997 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
998 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
999 vbox = gaim_gtk_make_frame (ret, _("Message Logs")); |
5440 | 1000 gaim_button(_("_Log all instant messages"), &logging_options, OPT_LOG_CONVOS, vbox); |
1001 gaim_button(_("Log all c_hats"), &logging_options, OPT_LOG_CHATS, vbox); | |
1002 gaim_button(_("Strip _HTML from logs"), &logging_options, OPT_LOG_STRIP_HTML, vbox); | |
1003 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1004 vbox = gaim_gtk_make_frame (ret, _("System Logs")); |
5440 | 1005 gaim_button(_("Log when buddies _sign on/sign off"), &logging_options, OPT_LOG_BUDDY_SIGNON, |
1006 vbox); | |
1007 gaim_button(_("Log when buddies become _idle/un-idle"), &logging_options, OPT_LOG_BUDDY_IDLE, | |
1008 vbox); | |
1009 gaim_button(_("Log when buddies go away/come _back"), &logging_options, OPT_LOG_BUDDY_AWAY, vbox); | |
1010 gaim_button(_("Log your _own signons/idleness/awayness"), &logging_options, OPT_LOG_MY_SIGNON, | |
1011 vbox); | |
1012 gaim_button(_("I_ndividual log file for each buddy's signons"), &logging_options, | |
1013 OPT_LOG_INDIVIDUAL, vbox); | |
1014 | |
1015 gtk_widget_show_all(ret); | |
1016 return ret; | |
1017 } | |
1018 | |
1019 static GtkWidget *sndcmd = NULL; | |
1020 | |
1021 #ifndef _WIN32 | |
1022 static gint sound_cmd_yeah(GtkEntry *entry, gpointer d) | |
1023 { | |
1024 gaim_sound_set_command(gtk_entry_get_text(GTK_ENTRY(sndcmd))); | |
1025 return TRUE; | |
1026 } | |
1027 #endif | |
1028 | |
1029 GtkWidget *sound_page() { | |
1030 GtkWidget *ret; | |
1031 GtkWidget *vbox; | |
1032 GtkSizeGroup *sg; | |
1033 #ifndef _WIN32 | |
1034 GtkWidget *dd; | |
1035 GtkWidget *hbox; | |
1036 GtkWidget *label; | |
1037 char *cmd; | |
1038 #endif | |
1039 | |
1040 ret = gtk_vbox_new(FALSE, 18); | |
1041 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1042 | |
1043 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1044 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1045 vbox = gaim_gtk_make_frame (ret, _("Sound Options")); |
5440 | 1046 gaim_button(_("_No sounds when you log in"), &sound_options, OPT_SOUND_SILENT_SIGNON, vbox); |
1047 gaim_button(_("_Sounds while away"), &sound_options, OPT_SOUND_WHEN_AWAY, vbox); | |
1048 | |
1049 #ifndef _WIN32 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1050 vbox = gaim_gtk_make_frame (ret, _("Sound Method")); |
5440 | 1051 dd = gaim_dropdown(vbox, _("_Method"), &sound_options, OPT_SOUND_BEEP | |
1052 OPT_SOUND_ESD | OPT_SOUND_ARTS | OPT_SOUND_NAS | | |
1053 OPT_SOUND_NORMAL | OPT_SOUND_CMD, | |
1054 _("Console beep"), OPT_SOUND_BEEP, | |
1055 #ifdef USE_AO | |
1056 _("Automatic"), OPT_SOUND_NORMAL, | |
1057 "ESD", OPT_SOUND_ESD, | |
1058 "Arts", OPT_SOUND_ARTS, | |
1059 #endif | |
1060 #ifdef USE_NAS_AUDIO | |
1061 "NAS", OPT_SOUND_NAS, | |
1062 #endif | |
1063 _("Command"), OPT_SOUND_CMD, NULL); | |
1064 gtk_size_group_add_widget(sg, dd); | |
1065 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1066 | |
1067 hbox = gtk_hbox_new(FALSE, 5); | |
1068 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
1069 | |
1070 hbox = gtk_hbox_new(FALSE, 5); | |
1071 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1072 label = gtk_label_new_with_mnemonic(_("Sound c_ommand\n(%s for filename)")); | |
1073 gtk_size_group_add_widget(sg, label); | |
1074 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1075 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
1076 | |
1077 sndcmd = gtk_entry_new(); | |
1078 gtk_label_set_mnemonic_widget(GTK_LABEL(label), sndcmd); | |
1079 | |
1080 gtk_editable_set_editable(GTK_EDITABLE(sndcmd), TRUE); | |
1081 cmd = gaim_sound_get_command(); | |
1082 if(cmd) | |
1083 gtk_entry_set_text(GTK_ENTRY(sndcmd), cmd); | |
1084 gtk_widget_set_size_request(sndcmd, 75, -1); | |
1085 | |
1086 gtk_widget_set_sensitive(sndcmd, (sound_options & OPT_SOUND_CMD)); | |
1087 gtk_box_pack_start(GTK_BOX(hbox), sndcmd, TRUE, TRUE, 5); | |
1088 g_signal_connect(G_OBJECT(sndcmd), "changed", | |
1089 G_CALLBACK(sound_cmd_yeah), NULL); | |
1090 #endif /* _WIN32 */ | |
1091 gtk_widget_show_all(ret); | |
1092 return ret; | |
1093 } | |
1094 | |
1095 GtkWidget *away_page() { | |
1096 GtkWidget *ret; | |
1097 GtkWidget *vbox; | |
1098 GtkWidget *hbox; | |
1099 GtkWidget *label; | |
1100 GtkWidget *button; | |
1101 GtkWidget *select; | |
1102 GtkWidget *dd; | |
1103 GtkSizeGroup *sg; | |
1104 | |
1105 ret = gtk_vbox_new(FALSE, 18); | |
1106 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1107 | |
1108 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1109 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1110 vbox = gaim_gtk_make_frame (ret, _("Away")); |
5440 | 1111 gaim_button(_("_Sending messages removes away status"), &away_options, OPT_AWAY_BACK_ON_IM, vbox); |
1112 gaim_button(_("_Queue new messages when away"), &away_options, OPT_AWAY_QUEUE, vbox); | |
1113 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1114 vbox = gaim_gtk_make_frame (ret, _("Auto-response")); |
5440 | 1115 hbox = gtk_hbox_new(FALSE, 0); |
1116 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1117 gaim_labeled_spin_button(hbox, _("Seconds before _resending:"), | |
1118 &away_resend, 1, 24 * 60 * 60, sg); | |
1119 gaim_button(_("_Don't send auto-response"), &away_options, OPT_AWAY_NO_AUTO_RESP, vbox); | |
1120 gaim_button(_("_Only send auto-response when idle"), &away_options, OPT_AWAY_IDLE_RESP, vbox); | |
1121 gaim_button(_("Do_n't send auto-response in active conversations"), &away_options, OPT_AWAY_DELAY_IN_USE, vbox); | |
1122 | |
1123 if (away_options & OPT_AWAY_NO_AUTO_RESP) | |
1124 gtk_widget_set_sensitive(hbox, FALSE); | |
1125 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1126 vbox = gaim_gtk_make_frame (ret, _("Idle")); |
5440 | 1127 dd = gaim_dropdown(vbox, _("Idle _time reporting:"), &report_idle, -1, |
1128 _("None"), IDLE_NONE, | |
1129 _("Gaim usage"), IDLE_GAIM, | |
1130 #ifdef USE_SCREENSAVER | |
1131 #ifndef _WIN32 | |
1132 _("X usage"), IDLE_SCREENSAVER, | |
1133 #else | |
1134 _("Windows usage"), IDLE_SCREENSAVER, | |
1135 #endif | |
1136 #endif | |
1137 NULL); | |
1138 gtk_size_group_add_widget(sg, dd); | |
1139 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1140 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1141 vbox = gaim_gtk_make_frame (ret, _("Auto-away")); |
5440 | 1142 button = gaim_button(_("Set away _when idle"), &away_options, OPT_AWAY_AUTO, vbox); |
1143 select = gaim_labeled_spin_button(vbox, _("_Minutes before setting away:"), &auto_away, 1, 24 * 60, sg); | |
1144 if (!(away_options & OPT_AWAY_AUTO)) | |
1145 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); | |
1146 g_signal_connect(G_OBJECT(button), "clicked", | |
1147 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
1148 | |
1149 label = gtk_label_new_with_mnemonic(_("Away m_essage:")); | |
1150 gtk_size_group_add_widget(sg, label); | |
1151 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1152 hbox = gtk_hbox_new(FALSE, 0); | |
1153 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1154 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
1155 prefs_away_menu = gtk_option_menu_new(); | |
1156 gtk_label_set_mnemonic_widget(GTK_LABEL(label), prefs_away_menu); | |
1157 if (!(away_options & OPT_AWAY_AUTO)) | |
1158 gtk_widget_set_sensitive(GTK_WIDGET(prefs_away_menu), FALSE); | |
1159 g_signal_connect(G_OBJECT(button), "clicked", | |
1160 G_CALLBACK(gaim_gtk_toggle_sensitive), prefs_away_menu); | |
1161 default_away_menu_init(prefs_away_menu); | |
1162 gtk_widget_show(prefs_away_menu); | |
1163 gtk_box_pack_start(GTK_BOX(hbox), prefs_away_menu, FALSE, FALSE, 0); | |
1164 | |
1165 gtk_widget_show_all(ret); | |
1166 return ret; | |
1167 } | |
1168 | |
1169 static GtkWidget *plugin_description=NULL, *plugin_details=NULL; | |
1170 | |
1171 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) | |
1172 { | |
1173 gchar *buf, *pname, *perr, *pdesc, *pauth, *pweb; | |
1174 GtkTreeIter iter; | |
1175 GValue val = { 0, }; | |
1176 GaimPlugin *plug; | |
1177 | |
1178 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1179 return; | |
1180 gtk_tree_model_get_value (model, &iter, 2, &val); | |
1181 plug = g_value_get_pointer(&val); | |
1182 | |
1183 pname = g_markup_escape_text(_(plug->info->name), -1); | |
1184 pdesc = g_markup_escape_text(_(plug->info->description), -1); | |
1185 pauth = g_markup_escape_text(_(plug->info->author), -1); | |
1186 pweb = g_markup_escape_text(_(plug->info->homepage), -1); | |
1187 if (plug->error != NULL) { | |
1188 perr = g_markup_escape_text(_(plug->error), -1); | |
1189 buf = g_strdup_printf( | |
1190 "<span size=\"larger\">%s %s</span>\n\n" | |
1191 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1192 "%s", | |
1193 pname, plug->info->version, perr, pdesc); | |
1194 g_free(perr); | |
1195 } | |
1196 else { | |
1197 buf = g_strdup_printf( | |
1198 "<span size=\"larger\">%s %s</span>\n\n%s", | |
1199 pname, plug->info->version, pdesc); | |
1200 } | |
1201 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1202 g_free(buf); | |
1203 | |
1204 buf = g_strdup_printf( | |
1205 #ifndef _WIN32 | |
1206 _("<span size=\"larger\">%s %s</span>\n\n" | |
1207 "<span weight=\"bold\">Written by:</span>\t%s\n" | |
1208 "<span weight=\"bold\">Web site:</span>\t\t%s\n" | |
1209 "<span weight=\"bold\">File name:</span>\t%s"), | |
1210 #else | |
1211 _("<span size=\"larger\">%s %s</span>\n\n" | |
1212 "<span weight=\"bold\">Written by:</span> %s\n" | |
1213 "<span weight=\"bold\">URL:</span> %s\n" | |
1214 "<span weight=\"bold\">File name:</span> %s"), | |
1215 #endif | |
1216 pname, plug->info->version, pauth, pweb, plug->path); | |
1217 | |
1218 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); | |
1219 g_value_unset(&val); | |
1220 g_free(buf); | |
1221 g_free(pname); | |
1222 g_free(pdesc); | |
1223 g_free(pauth); | |
1224 g_free(pweb); | |
1225 } | |
1226 | |
1227 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1228 { | |
1229 GtkTreeModel *model = (GtkTreeModel *)data; | |
1230 GtkTreeIter iter; | |
1231 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1232 GaimPlugin *plug; | |
1233 gchar buf[1024]; | |
1234 | |
1235 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); | |
1236 gdk_window_set_cursor(prefs->window, wait); | |
1237 gdk_cursor_unref(wait); | |
1238 | |
1239 gtk_tree_model_get_iter (model, &iter, path); | |
1240 gtk_tree_model_get (model, &iter, 2, &plug, -1); | |
1241 | |
1242 if (!gaim_plugin_is_loaded(plug)) { | |
1243 gaim_plugin_load(plug); | |
1244 | |
1245 /* | |
1246 * NOTE: This is basically the same check as before | |
1247 * (plug->type == plugin), but now there aren't plugin types. | |
1248 * Not yet, anyway. I want to do a V2 of the plugin API. | |
1249 * The thing is, we should have a flag specifying the UI type, | |
1250 * or just whether it's a general plugin or a UI-specific | |
1251 * plugin. We should only load this if it's UI-specific. | |
1252 * | |
1253 * -- ChipX86 | |
1254 */ | |
1255 if (GAIM_IS_GTK_PLUGIN(plug)) | |
1256 { | |
1257 GtkWidget *config_frame; | |
1258 GaimGtkPluginUiInfo *ui_info; | |
1259 | |
1260 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1261 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
1262 | |
1263 if (config_frame != NULL) { | |
1264 ui_info->iter = g_new0(GtkTreeIter, 1); | |
1265 prefs_notebook_add_page(_(plug->info->name), NULL, | |
1266 config_frame, ui_info->iter, | |
1267 &plugin_iter, notebook_page++); | |
1268 | |
1269 if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(prefstree), | |
1270 &plugin_iter) == 1) { | |
1271 | |
1272 /* Expand the tree for the first plugin added */ | |
1273 GtkTreePath *path2; | |
1274 | |
1275 path2 = gtk_tree_model_get_path(GTK_TREE_MODEL(prefstree), | |
1276 &plugin_iter); | |
1277 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_v), | |
1278 path2, TRUE); | |
1279 gtk_tree_path_free(path2); | |
1280 } | |
1281 } | |
1282 } | |
1283 } | |
1284 else { | |
1285 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
1286 GaimGtkPluginUiInfo *ui_info; | |
1287 | |
1288 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1289 | |
1290 if (ui_info != NULL && ui_info->iter != NULL) { | |
1291 gtk_tree_store_remove(GTK_TREE_STORE(prefstree), ui_info->iter); | |
1292 g_free(ui_info->iter); | |
1293 ui_info->iter = NULL; | |
1294 } | |
1295 } | |
1296 | |
1297 gaim_plugin_unload(plug); | |
1298 } | |
1299 | |
1300 gdk_window_set_cursor(prefs->window, NULL); | |
1301 | |
1302 if (plug->error != NULL) { | |
1303 g_snprintf(buf, sizeof(buf), | |
1304 "<span size=\"larger\">%s %s</span>\n\n" | |
1305 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1306 "%s", | |
1307 g_markup_escape_text(_(plug->info->name), -1), | |
1308 plug->info->version, | |
1309 g_markup_escape_text(plug->error, -1), | |
1310 g_markup_escape_text(_(plug->info->description), -1)); | |
1311 } | |
1312 else { | |
1313 g_snprintf(buf, sizeof(buf), | |
1314 "<span size=\"larger\">%s %s</span>\n\n%s", | |
1315 g_markup_escape_text(_(plug->info->name), -1), | |
1316 plug->info->version, | |
1317 g_markup_escape_text(_(plug->info->description), -1)); | |
1318 } | |
1319 | |
1320 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1321 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, | |
1322 gaim_plugin_is_loaded(plug), -1); | |
1323 | |
1324 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1325 gtk_tree_path_free(path); | |
1326 } | |
1327 | |
1328 static void | |
1329 update_plugin_list(void *data) | |
1330 { | |
1331 GtkListStore *ls = GTK_LIST_STORE(data); | |
1332 GtkTreeIter iter; | |
1333 GList *probes; | |
1334 GaimPlugin *plug; | |
1335 | |
1336 gtk_list_store_clear(ls); | |
1337 | |
1338 for (probes = gaim_plugins_get_all(); | |
1339 probes != NULL; | |
1340 probes = probes->next) { | |
1341 | |
1342 plug = probes->data; | |
1343 | |
1344 if (plug->info->type != GAIM_PLUGIN_STANDARD) | |
1345 continue; | |
1346 | |
1347 gtk_list_store_append (ls, &iter); | |
1348 gtk_list_store_set(ls, &iter, | |
1349 0, gaim_plugin_is_loaded(plug), | |
1350 1, plug->info->name ? _(plug->info->name) : plug->path, | |
1351 2, plug, -1); | |
1352 } | |
1353 } | |
1354 | |
1355 static GtkWidget *plugin_page () | |
1356 { | |
1357 GtkWidget *ret; | |
1358 GtkWidget *sw, *vp; | |
1359 GtkWidget *event_view; | |
1360 GtkListStore *ls; | |
1361 GtkCellRenderer *rend, *rendt; | |
1362 GtkTreeViewColumn *col; | |
1363 GtkTreeSelection *sel; | |
1364 GtkTreePath *path; | |
1365 GtkWidget *nb; | |
1366 | |
1367 ret = gtk_vbox_new(FALSE, 18); | |
1368 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1369 | |
1370 sw = gtk_scrolled_window_new(NULL,NULL); | |
1371 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
1372 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
1373 | |
1374 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
1375 | |
1376 ls = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); | |
1377 | |
1378 update_plugin_list(ls); | |
1379 | |
1380 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls)); | |
1381 | |
1382 rend = gtk_cell_renderer_toggle_new(); | |
1383 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1384 | |
1385 | |
1386 col = gtk_tree_view_column_new_with_attributes (_("Load"), | |
1387 rend, | |
1388 "active", 0, | |
1389 NULL); | |
1390 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1391 | |
1392 rendt = gtk_cell_renderer_text_new(); | |
1393 col = gtk_tree_view_column_new_with_attributes (_("Name"), | |
1394 rendt, | |
1395 "text", 1, | |
1396 NULL); | |
1397 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1398 g_object_unref(G_OBJECT(ls)); | |
1399 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
1400 | |
1401 | |
1402 nb = gtk_notebook_new(); | |
1403 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(nb), GTK_POS_BOTTOM); | |
1404 gtk_notebook_popup_disable(GTK_NOTEBOOK(nb)); | |
1405 | |
1406 /* Description */ | |
1407 sw = gtk_scrolled_window_new(NULL, NULL); | |
1408 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
1409 plugin_description = gtk_label_new(NULL); | |
1410 | |
1411 vp = gtk_viewport_new(NULL, NULL); | |
1412 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
1413 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
1414 | |
1415 gtk_container_add(GTK_CONTAINER(vp), plugin_description); | |
1416 gtk_container_add(GTK_CONTAINER(sw), vp); | |
1417 | |
1418 gtk_label_set_selectable(GTK_LABEL(plugin_description), TRUE); | |
1419 gtk_label_set_line_wrap(GTK_LABEL(plugin_description), TRUE); | |
1420 gtk_misc_set_alignment(GTK_MISC(plugin_description), 0, 0); | |
1421 gtk_misc_set_padding(GTK_MISC(plugin_description), 6, 6); | |
1422 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Description"))); | |
1423 | |
1424 /* Details */ | |
1425 sw = gtk_scrolled_window_new(NULL, NULL); | |
1426 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
1427 plugin_details = gtk_label_new(NULL); | |
1428 | |
1429 vp = gtk_viewport_new(NULL, NULL); | |
1430 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
1431 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
1432 | |
1433 gtk_container_add(GTK_CONTAINER(vp), plugin_details); | |
1434 gtk_container_add(GTK_CONTAINER(sw), vp); | |
1435 | |
1436 gtk_label_set_selectable(GTK_LABEL(plugin_details), TRUE); | |
1437 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); | |
1438 gtk_misc_set_alignment(GTK_MISC(plugin_details), 0, 0); | |
1439 gtk_misc_set_padding(GTK_MISC(plugin_details), 6, 6); | |
1440 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Details"))); | |
1441 gtk_box_pack_start(GTK_BOX(ret), nb, TRUE, TRUE, 0); | |
1442 | |
1443 g_signal_connect (G_OBJECT (sel), "changed", | |
1444 G_CALLBACK (prefs_plugin_sel), | |
1445 NULL); | |
1446 g_signal_connect (G_OBJECT(rend), "toggled", | |
1447 G_CALLBACK(plugin_load), ls); | |
1448 | |
1449 path = gtk_tree_path_new_first(); | |
1450 gtk_tree_selection_select_path(sel, path); | |
1451 gtk_tree_path_free(path); | |
1452 | |
1453 gaim_plugins_register_probe_notify_cb(update_plugin_list, ls); | |
1454 | |
1455 gtk_widget_show_all(ret); | |
1456 return ret; | |
1457 } | |
1458 | |
1459 static void event_toggled (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1460 { | |
1461 GtkTreeModel *model = (GtkTreeModel *)data; | |
1462 GtkTreeIter iter; | |
1463 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1464 gint soundnum; | |
1465 | |
1466 gtk_tree_model_get_iter (model, &iter, path); | |
1467 gtk_tree_model_get (model, &iter, 2, &soundnum, -1); | |
1468 | |
1469 sound_options ^= gaim_sound_get_event_option(soundnum); | |
1470 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, sound_options & gaim_sound_get_event_option(soundnum), -1); | |
1471 | |
1472 gtk_tree_path_free(path); | |
1473 } | |
1474 | |
1475 static void test_sound(GtkWidget *button, gpointer i_am_NULL) | |
1476 { | |
1477 guint32 tmp_sound = sound_options; | |
1478 if (!(sound_options & OPT_SOUND_WHEN_AWAY)) | |
1479 sound_options ^= OPT_SOUND_WHEN_AWAY; | |
1480 if (!(sound_options & gaim_sound_get_event_option(sound_row_sel))) | |
1481 sound_options ^= gaim_sound_get_event_option(sound_row_sel); | |
1482 gaim_sound_play_event(sound_row_sel); | |
1483 | |
1484 sound_options = tmp_sound; | |
1485 } | |
1486 | |
1487 static void reset_sound(GtkWidget *button, gpointer i_am_also_NULL) | |
1488 { | |
1489 /* This just resets a sound file back to default */ | |
1490 gaim_sound_set_event_file(sound_row_sel, NULL); | |
1491 | |
1492 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); | |
1493 } | |
1494 | |
1495 void close_sounddialog(GtkWidget *w, GtkWidget *w2) | |
1496 { | |
1497 | |
1498 GtkWidget *dest; | |
1499 | |
1500 if (!GTK_IS_WIDGET(w2)) | |
1501 dest = w; | |
1502 else | |
1503 dest = w2; | |
1504 | |
1505 sounddialog = NULL; | |
1506 | |
1507 gtk_widget_destroy(dest); | |
1508 } | |
1509 | |
1510 void do_select_sound(GtkWidget *w, int snd) | |
1511 { | |
1512 const char *file; | |
1513 | |
1514 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sounddialog)); | |
1515 | |
1516 /* If they type in a directory, change there */ | |
1517 if (file_is_dir(file, sounddialog)) | |
1518 return; | |
1519 | |
1520 /* Set it -- and forget it */ | |
1521 gaim_sound_set_event_file(snd, file); | |
1522 | |
1523 /* Set our text entry */ | |
1524 gtk_entry_set_text(GTK_ENTRY(sound_entry), file); | |
1525 | |
1526 /* Close the window! It's getting cold in here! */ | |
1527 close_sounddialog(NULL, sounddialog); | |
1528 | |
1529 if (last_sound_dir) | |
1530 g_free(last_sound_dir); | |
1531 last_sound_dir = g_path_get_dirname(file); | |
1532 } | |
1533 | |
1534 static void sel_sound(GtkWidget *button, gpointer being_NULL_is_fun) | |
1535 { | |
1536 char *buf = g_malloc(BUF_LEN); | |
1537 | |
1538 if (!sounddialog) { | |
1539 sounddialog = gtk_file_selection_new(_("Sound Selection")); | |
1540 | |
1541 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(sounddialog)); | |
1542 | |
1543 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S, last_sound_dir ? last_sound_dir : gaim_home_dir()); | |
1544 | |
1545 gtk_file_selection_set_filename(GTK_FILE_SELECTION(sounddialog), buf); | |
1546 | |
1547 g_signal_connect(G_OBJECT(sounddialog), "destroy", | |
1548 G_CALLBACK(close_sounddialog), sounddialog); | |
1549 | |
1550 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->ok_button), | |
1551 "clicked", | |
1552 G_CALLBACK(do_select_sound), (int *)sound_row_sel); | |
1553 | |
1554 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->cancel_button), | |
1555 "clicked", | |
1556 G_CALLBACK(close_sounddialog), sounddialog); | |
1557 } | |
1558 | |
1559 g_free(buf); | |
1560 gtk_widget_show(sounddialog); | |
1561 gdk_window_raise(sounddialog->window); | |
1562 } | |
1563 | |
1564 | |
1565 static void prefs_sound_sel (GtkTreeSelection *sel, GtkTreeModel *model) { | |
1566 GtkTreeIter iter; | |
1567 GValue val = { 0, }; | |
1568 char *file; | |
1569 | |
1570 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1571 return; | |
1572 gtk_tree_model_get_value (model, &iter, 2, &val); | |
1573 sound_row_sel = g_value_get_uint(&val); | |
1574 file = gaim_sound_get_event_file(sound_row_sel); | |
1575 if (sound_entry) | |
1576 gtk_entry_set_text(GTK_ENTRY(sound_entry), file ? file : "(default)"); | |
1577 g_value_unset (&val); | |
1578 if (sounddialog) | |
1579 gtk_widget_destroy(sounddialog); | |
1580 } | |
1581 | |
1582 GtkWidget *sound_events_page() { | |
1583 | |
1584 GtkWidget *ret; | |
1585 GtkWidget *sw; | |
1586 GtkWidget *button, *hbox; | |
1587 GtkTreeIter iter; | |
1588 GtkWidget *event_view; | |
1589 GtkListStore *event_store; | |
1590 GtkCellRenderer *rend; | |
1591 GtkTreeViewColumn *col; | |
1592 GtkTreeSelection *sel; | |
1593 GtkTreePath *path; | |
1594 int j; | |
1595 char *file; | |
1596 | |
1597 ret = gtk_vbox_new(FALSE, 18); | |
1598 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1599 | |
1600 sw = gtk_scrolled_window_new(NULL,NULL); | |
1601 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
1602 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
1603 | |
1604 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
1605 event_store = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_UINT); | |
1606 | |
1607 for (j=0; j < GAIM_NUM_SOUNDS; j++) { | |
1608 guint opt = gaim_sound_get_event_option(j); | |
1609 if (opt == 0) | |
1610 continue; | |
1611 | |
1612 gtk_list_store_append (event_store, &iter); | |
1613 gtk_list_store_set(event_store, &iter, | |
1614 0, sound_options & opt, | |
1615 1, gettext(gaim_sound_get_event_label(j)), | |
1616 2, j, -1); | |
1617 } | |
1618 | |
1619 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); | |
1620 | |
1621 rend = gtk_cell_renderer_toggle_new(); | |
1622 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1623 g_signal_connect (G_OBJECT (sel), "changed", | |
1624 G_CALLBACK (prefs_sound_sel), | |
1625 NULL); | |
1626 g_signal_connect (G_OBJECT(rend), "toggled", | |
1627 G_CALLBACK(event_toggled), event_store); | |
1628 path = gtk_tree_path_new_first(); | |
1629 gtk_tree_selection_select_path(sel, path); | |
1630 gtk_tree_path_free(path); | |
1631 | |
1632 col = gtk_tree_view_column_new_with_attributes (_("Play"), | |
1633 rend, | |
1634 "active", 0, | |
1635 NULL); | |
1636 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1637 | |
1638 rend = gtk_cell_renderer_text_new(); | |
1639 col = gtk_tree_view_column_new_with_attributes (_("Event"), | |
1640 rend, | |
1641 "text", 1, | |
1642 NULL); | |
1643 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1644 g_object_unref(G_OBJECT(event_store)); | |
1645 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
1646 | |
1647 hbox = gtk_hbox_new(FALSE, 6); | |
1648 gtk_box_pack_start(GTK_BOX(ret), hbox, FALSE, FALSE, 0); | |
1649 sound_entry = gtk_entry_new(); | |
1650 file = gaim_sound_get_event_file(0); | |
1651 gtk_entry_set_text(GTK_ENTRY(sound_entry), file ? file : "(default)"); | |
1652 gtk_editable_set_editable(GTK_EDITABLE(sound_entry), FALSE); | |
1653 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); | |
1654 | |
1655 button = gtk_button_new_with_label(_("Test")); | |
1656 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(test_sound), NULL); | |
1657 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1658 | |
1659 button = gtk_button_new_with_label(_("Reset")); | |
1660 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_sound), NULL); | |
1661 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1662 | |
1663 button = gtk_button_new_with_label(_("Choose...")); | |
1664 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(sel_sound), NULL); | |
1665 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1666 | |
1667 gtk_widget_show_all (ret); | |
1668 | |
1669 return ret; | |
1670 } | |
1671 | |
1672 void away_message_sel(GtkTreeSelection *sel, GtkTreeModel *model) | |
1673 { | |
1674 GtkTreeIter iter; | |
1675 GValue val = { 0, }; | |
1676 gchar buffer[BUF_LONG]; | |
1677 char *tmp; | |
1678 struct away_message *am; | |
1679 | |
1680 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1681 return; | |
1682 gtk_tree_model_get_value (model, &iter, 1, &val); | |
1683 am = g_value_get_pointer(&val); | |
1684 gtk_imhtml_clear(GTK_IMHTML(away_text)); | |
1685 strncpy(buffer, am->message, BUF_LONG); | |
1686 tmp = stylize(buffer, BUF_LONG); | |
1687 gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, -1, GTK_IMHTML_NO_TITLE | | |
1688 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); | |
1689 gtk_imhtml_append_text(GTK_IMHTML(away_text), "<BR>", -1, GTK_IMHTML_NO_TITLE | | |
1690 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); | |
1691 g_free(tmp); | |
1692 g_value_unset (&val); | |
1693 | |
1694 } | |
1695 | |
1696 void remove_away_message(GtkWidget *widget, GtkTreeView *tv) { | |
1697 struct away_message *am; | |
1698 GtkTreeIter iter; | |
1699 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv); | |
1700 GtkTreeModel *model = GTK_TREE_MODEL(prefs_away_store); | |
1701 GValue val = { 0, }; | |
1702 | |
1703 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1704 return; | |
1705 gtk_tree_model_get_value (GTK_TREE_MODEL(prefs_away_store), &iter, 1, &val); | |
1706 am = g_value_get_pointer (&val); | |
1707 gtk_imhtml_clear(GTK_IMHTML(away_text)); | |
1708 rem_away_mess(NULL, am); | |
1709 } | |
1710 | |
1711 GtkWidget *away_message_page() { | |
1712 GtkWidget *ret; | |
1713 GtkWidget *hbox; | |
1714 GtkWidget *button; | |
1715 GtkWidget *sw; | |
1716 GtkTreeIter iter; | |
1717 GtkWidget *event_view; | |
1718 GtkCellRenderer *rend; | |
1719 GtkTreeViewColumn *col; | |
1720 GtkTreeSelection *sel; | |
1721 GSList *awy = away_messages; | |
1722 struct away_message *a; | |
1723 GtkWidget *sw2; | |
1724 GtkSizeGroup *sg; | |
1725 | |
1726 ret = gtk_vbox_new(FALSE, 18); | |
1727 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1728 | |
1729 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
1730 | |
1731 sw = gtk_scrolled_window_new(NULL,NULL); | |
1732 away_text = gtk_imhtml_new(NULL, NULL); | |
1733 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
1734 /* | |
1735 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
1736 */ | |
1737 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
1738 | |
1739 prefs_away_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); | |
1740 while (awy) { | |
1741 a = (struct away_message *)awy->data; | |
1742 gtk_list_store_append (prefs_away_store, &iter); | |
1743 gtk_list_store_set(prefs_away_store, &iter, | |
1744 0, a->name, | |
1745 1, a, -1); | |
1746 awy = awy->next; | |
1747 } | |
1748 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(prefs_away_store)); | |
1749 | |
1750 | |
1751 rend = gtk_cell_renderer_text_new(); | |
1752 col = gtk_tree_view_column_new_with_attributes ("NULL", | |
1753 rend, | |
1754 "text", 0, | |
1755 NULL); | |
1756 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1757 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(event_view), FALSE); | |
1758 gtk_widget_show(event_view); | |
1759 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), event_view); | |
1760 | |
1761 sw2 = gtk_scrolled_window_new(NULL, NULL); | |
1762 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | |
1763 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
1764 gtk_box_pack_start(GTK_BOX(ret), sw2, TRUE, TRUE, 0); | |
1765 | |
1766 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), away_text); | |
1767 gaim_setup_imhtml(away_text); | |
1768 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1769 g_signal_connect (G_OBJECT (sel), "changed", | |
1770 G_CALLBACK (away_message_sel), | |
1771 NULL); | |
1772 hbox = gtk_hbox_new(TRUE, 5); | |
1773 gtk_box_pack_start(GTK_BOX(ret), hbox, FALSE, FALSE, 0); | |
1774 button = gtk_button_new_from_stock (GTK_STOCK_ADD); | |
1775 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
1776 gtk_size_group_add_widget(sg, button); | |
1777 g_signal_connect(G_OBJECT(button), "clicked", | |
1778 G_CALLBACK(create_away_mess), NULL); | |
1779 | |
1780 button = gtk_button_new_from_stock (GTK_STOCK_REMOVE); | |
1781 gtk_size_group_add_widget(sg, button); | |
1782 g_signal_connect(G_OBJECT(button), "clicked", | |
1783 G_CALLBACK(remove_away_message), event_view); | |
1784 | |
1785 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
1786 | |
1787 button = gaim_pixbuf_button_from_stock(_("_Edit"), GAIM_STOCK_EDIT, GAIM_BUTTON_HORIZONTAL); | |
1788 gtk_size_group_add_widget(sg, button); | |
1789 g_signal_connect(G_OBJECT(button), "clicked", | |
1790 G_CALLBACK(create_away_mess), event_view); | |
1791 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
1792 | |
1793 gtk_widget_show_all(ret); | |
1794 return ret; | |
1795 } | |
1796 | |
1797 GtkTreeIter *prefs_notebook_add_page(const char *text, | |
1798 GdkPixbuf *pixbuf, | |
1799 GtkWidget *page, | |
1800 GtkTreeIter *iter, | |
1801 GtkTreeIter *parent, | |
1802 int ind) { | |
1803 GdkPixbuf *icon = NULL; | |
1804 | |
1805 if (pixbuf) | |
1806 icon = gdk_pixbuf_scale_simple (pixbuf, 18, 18, GDK_INTERP_BILINEAR); | |
1807 | |
1808 gtk_tree_store_append (prefstree, iter, parent); | |
1809 gtk_tree_store_set (prefstree, iter, 0, icon, 1, text, 2, ind, -1); | |
1810 | |
1811 if (pixbuf) | |
1812 g_object_unref(pixbuf); | |
1813 if (icon) | |
1814 g_object_unref(icon); | |
1815 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); | |
1816 return iter; | |
1817 } | |
1818 | |
1819 void prefs_notebook_init() { | |
1820 GtkTreeIter p, p2, c; | |
1821 GList *l; | |
1822 GaimPlugin *plug; | |
1823 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++); | |
1824 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c, &p, notebook_page++); | |
1825 prefs_notebook_add_page(_("Fonts"), NULL, font_page(), &c, &p, notebook_page++); | |
1826 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, notebook_page++); | |
1827 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++); | |
1828 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); | |
1829 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &p2, NULL, notebook_page++); | |
1830 prefs_notebook_add_page(_("IMs"), NULL, im_page(), &c, &p2, notebook_page++); | |
1831 prefs_notebook_add_page(_("Chats"), NULL, chat_page(), &c, &p2, notebook_page++); | |
1832 prefs_notebook_add_page(_("Tabs"), NULL, tab_page(), &c, &p2, notebook_page++); | |
1833 prefs_notebook_add_page(_("Proxy"), NULL, proxy_page(), &p, NULL, notebook_page++); | |
1834 #ifndef _WIN32 | |
1835 /* We use the registered default browser in windows */ | |
1836 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); | |
1837 #endif | |
1838 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); | |
1839 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &p, NULL, notebook_page++); | |
1840 prefs_notebook_add_page(_("Sound Events"), NULL, sound_events_page(), &c, &p, notebook_page++); | |
1841 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | |
1842 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++); | |
1843 | |
1844 if (gaim_plugins_enabled()) { | |
1845 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); | |
1846 | |
1847 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | |
1848 plug = l->data; | |
1849 | |
1850 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
1851 GtkWidget *config_frame; | |
1852 GaimGtkPluginUiInfo *ui_info; | |
1853 | |
1854 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1855 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
1856 | |
1857 if (config_frame != NULL) { | |
1858 ui_info->iter = g_new0(GtkTreeIter, 1); | |
1859 prefs_notebook_add_page(_(plug->info->name), NULL, | |
1860 config_frame, ui_info->iter, | |
1861 &plugin_iter, notebook_page++); | |
1862 } | |
1863 } | |
1864 } | |
1865 } | |
1866 } | |
1867 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1868 void gaim_gtk_prefs_show(void) |
5440 | 1869 { |
1870 GtkWidget *vbox, *vbox2; | |
1871 GtkWidget *hbox; | |
1872 GtkWidget *frame; | |
1873 GtkTreeViewColumn *column; | |
1874 GtkCellRenderer *cell; | |
1875 GtkTreeSelection *sel; | |
1876 GtkWidget *notebook; | |
1877 GtkWidget *sep; | |
1878 GtkWidget *button; | |
1879 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
1880 | |
1881 if (prefs) { | |
1882 gtk_window_present(GTK_WINDOW(prefs)); | |
1883 return; | |
1884 } | |
1885 | |
1886 /* copy the preferences to tmp values... | |
1887 * I liked "take affect immediately" Oh well :-( */ | |
1888 | |
1889 /* Back to instant-apply! I win! BU-HAHAHA! */ | |
1890 | |
1891 /* Create the window */ | |
1892 prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
1893 gtk_window_set_role(GTK_WINDOW(prefs), "preferences"); | |
1894 gtk_widget_realize(prefs); | |
1895 gtk_window_set_title(GTK_WINDOW(prefs), _("Preferences")); | |
1896 gtk_window_set_resizable (GTK_WINDOW(prefs), FALSE); | |
1897 g_signal_connect(G_OBJECT(prefs), "destroy", | |
1898 G_CALLBACK(delete_prefs), NULL); | |
1899 | |
1900 vbox = gtk_vbox_new(FALSE, 5); | |
1901 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | |
1902 gtk_container_add(GTK_CONTAINER(prefs), vbox); | |
1903 gtk_widget_show(vbox); | |
1904 | |
1905 hbox = gtk_hbox_new (FALSE, 6); | |
1906 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); | |
1907 gtk_container_add (GTK_CONTAINER(vbox), hbox); | |
1908 gtk_widget_show (hbox); | |
1909 | |
1910 frame = gtk_frame_new (NULL); | |
1911 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); | |
1912 gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); | |
1913 gtk_widget_show (frame); | |
1914 | |
1915 /* The tree -- much inspired by the Gimp */ | |
1916 prefstree = gtk_tree_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); | |
1917 tree_v = gtk_tree_view_new_with_model (GTK_TREE_MODEL (prefstree)); | |
1918 gtk_container_add (GTK_CONTAINER (frame), tree_v); | |
1919 | |
1920 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_v), FALSE); | |
1921 gtk_widget_show(tree_v); | |
1922 /* icons */ | |
1923 /* XXX: to be used at a later date | |
1924 cell = gtk_cell_renderer_pixbuf_new (); | |
1925 column = gtk_tree_view_column_new_with_attributes ("icons", cell, "pixbuf", 0, NULL); | |
1926 */ | |
1927 | |
1928 /* text */ | |
1929 cell = gtk_cell_renderer_text_new (); | |
1930 column = gtk_tree_view_column_new_with_attributes ("text", cell, "text", 1, NULL); | |
1931 | |
1932 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_v), column); | |
1933 | |
1934 /* The right side */ | |
1935 frame = gtk_frame_new (NULL); | |
1936 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); | |
1937 gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0); | |
1938 gtk_widget_show (frame); | |
1939 | |
1940 vbox2 = gtk_vbox_new (FALSE, 4); | |
1941 gtk_container_add (GTK_CONTAINER (frame), vbox2); | |
1942 gtk_widget_show (vbox2); | |
1943 | |
1944 frame = gtk_frame_new (NULL); | |
1945 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); | |
1946 gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, TRUE, 0); | |
1947 gtk_widget_show (frame); | |
1948 | |
1949 hbox = gtk_hbox_new (FALSE, 4); | |
1950 gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); | |
1951 gtk_container_add (GTK_CONTAINER (frame), hbox); | |
1952 gtk_widget_show (hbox); | |
1953 | |
1954 preflabel = gtk_label_new(NULL); | |
1955 gtk_box_pack_end (GTK_BOX (hbox), preflabel, FALSE, FALSE, 0); | |
1956 gtk_widget_show (preflabel); | |
1957 | |
1958 /* The notebook */ | |
1959 prefsnotebook = notebook = gtk_notebook_new (); | |
1960 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); | |
1961 gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); | |
1962 gtk_box_pack_start (GTK_BOX (vbox2), notebook, FALSE, FALSE, 0); | |
1963 | |
1964 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_v)); | |
1965 g_signal_connect (G_OBJECT (sel), "changed", | |
1966 G_CALLBACK (pref_nb_select), | |
1967 notebook); | |
1968 gtk_widget_show(notebook); | |
1969 sep = gtk_hseparator_new(); | |
1970 gtk_widget_show(sep); | |
1971 gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0); | |
1972 | |
1973 /* The buttons^H to press! */ | |
1974 hbox = gtk_hbox_new (FALSE, 6); | |
1975 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); | |
1976 gtk_container_add (GTK_CONTAINER(vbox), hbox); | |
1977 gtk_widget_show (hbox); | |
1978 | |
1979 button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); | |
1980 gtk_size_group_add_widget(sg, button); | |
1981 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
1982 G_CALLBACK(gtk_widget_destroy), prefs); | |
1983 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
1984 gtk_widget_show(button); | |
1985 | |
1986 prefs_notebook_init(); | |
1987 | |
1988 gtk_tree_view_expand_all (GTK_TREE_VIEW(tree_v)); | |
1989 gtk_widget_show(prefs); | |
1990 } | |
1991 | |
1992 static void set_misc_option(GtkWidget *w, int option) | |
1993 { | |
1994 misc_options ^= option; | |
1995 | |
1996 if (option == OPT_MISC_DEBUG) { | |
1997 if ((misc_options & OPT_MISC_DEBUG)) | |
1998 gaim_gtk_debug_window_show(); | |
1999 else | |
2000 gaim_gtk_debug_window_hide(); | |
2001 } | |
2002 else if(option == OPT_MISC_USE_SERVER_ALIAS) { | |
2003 /* XXX blist reset the aliases here */ | |
2004 gaim_conversation_foreach(gaim_conversation_autoset_title); | |
2005 } | |
2006 } | |
2007 | |
2008 static void set_logging_option(GtkWidget *w, int option) | |
2009 { | |
2010 logging_options ^= option; | |
2011 | |
2012 if (option == OPT_LOG_CONVOS || option == OPT_LOG_CHATS) | |
2013 update_log_convs(); | |
2014 } | |
2015 | |
2016 static void set_blist_option(GtkWidget *w, int option) | |
2017 { | |
2018 struct gaim_gtk_buddy_list *gtkblist; | |
2019 | |
2020 gtkblist = GAIM_GTK_BLIST(gaim_get_blist()); | |
2021 | |
2022 blist_options ^= option; | |
2023 | |
2024 if (!gtkblist) | |
2025 return; | |
2026 | |
2027 if (option == OPT_BLIST_SHOW_WARN) | |
2028 gaim_gtk_blist_update_columns(); | |
2029 else if (option == OPT_BLIST_SHOW_IDLETIME) { | |
2030 gaim_gtk_blist_update_refresh_timeout(); | |
2031 gaim_gtk_blist_update_columns(); | |
2032 } | |
2033 else if (option == OPT_BLIST_SHOW_ICONS) { | |
2034 gaim_gtk_blist_update_refresh_timeout(); | |
2035 gaim_gtk_blist_refresh(gaim_get_blist()); | |
2036 gaim_gtk_blist_update_columns(); | |
2037 } else | |
2038 gaim_gtk_blist_refresh(gaim_get_blist()); | |
2039 | |
2040 } | |
2041 | |
2042 static void set_convo_option(GtkWidget *w, int option) | |
2043 { | |
2044 convo_options ^= option; | |
2045 | |
2046 if (option == OPT_CONVO_SHOW_SMILEY) | |
2047 gaim_gtkconv_toggle_smileys(); | |
2048 | |
2049 if (option == OPT_CONVO_SHOW_TIME) | |
2050 gaim_gtkconv_toggle_timestamps(); | |
2051 | |
2052 if (option == OPT_CONVO_CHECK_SPELLING) | |
2053 gaim_gtkconv_toggle_spellchk(); | |
2054 | |
2055 if (option == OPT_CONVO_NO_X_ON_TAB) | |
2056 gaim_gtkconv_toggle_close_buttons(); | |
2057 } | |
2058 | |
2059 static void set_im_option(GtkWidget *w, int option) | |
2060 { | |
2061 im_options ^= option; | |
2062 | |
2063 #if 0 | |
2064 if (option == OPT_IM_ONE_WINDOW) | |
2065 im_tabize(); | |
2066 #endif | |
2067 | |
2068 if (option == OPT_IM_HIDE_ICONS) | |
2069 gaim_gtkconv_hide_buddy_icons(); | |
2070 | |
2071 if (option == OPT_IM_ALIAS_TAB) | |
2072 gaim_conversation_foreach(gaim_conversation_autoset_title); | |
2073 | |
2074 if (option == OPT_IM_NO_ANIMATION) | |
2075 gaim_gtkconv_set_anim(); | |
2076 } | |
2077 | |
2078 static void set_chat_option(GtkWidget *w, int option) | |
2079 { | |
2080 chat_options ^= option; | |
2081 | |
2082 #if 0 | |
2083 if (option == OPT_CHAT_ONE_WINDOW) | |
2084 chat_tabize(); | |
2085 #endif | |
2086 } | |
2087 | |
2088 void set_sound_option(GtkWidget *w, int option) | |
2089 { | |
2090 sound_options ^= option; | |
2091 } | |
2092 | |
2093 static void set_font_option(GtkWidget *w, int option) | |
2094 { | |
2095 font_options ^= option; | |
2096 | |
2097 gaim_gtkconv_update_font_buttons(); | |
2098 } | |
2099 | |
2100 static void set_away_option(GtkWidget *w, int option) | |
2101 { | |
2102 away_options ^= option; | |
2103 | |
2104 if (option == OPT_AWAY_QUEUE) | |
2105 toggle_away_queue(); | |
2106 } | |
2107 | |
2108 GtkWidget *gaim_button(const char *text, guint *options, int option, GtkWidget *page) | |
2109 { | |
2110 GtkWidget *button; | |
2111 button = gtk_check_button_new_with_mnemonic(text); | |
2112 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), (*options & option)); | |
2113 gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); | |
2114 g_object_set_data(G_OBJECT(button), "options", options); | |
2115 | |
2116 if (options == &misc_options) { | |
2117 g_signal_connect(G_OBJECT(button), "clicked", | |
2118 G_CALLBACK(set_misc_option), (int *)option); | |
2119 } else if (options == &logging_options) { | |
2120 g_signal_connect(G_OBJECT(button), "clicked", | |
2121 G_CALLBACK(set_logging_option), (int *)option); | |
2122 } else if (options == &blist_options) { | |
2123 g_signal_connect(G_OBJECT(button), "clicked", | |
2124 G_CALLBACK(set_blist_option), (int *)option); | |
2125 } else if (options == &convo_options) { | |
2126 g_signal_connect(G_OBJECT(button), "clicked", | |
2127 G_CALLBACK(set_convo_option), (int *)option); | |
2128 } else if (options == &im_options) { | |
2129 g_signal_connect(G_OBJECT(button), "clicked", | |
2130 G_CALLBACK(set_im_option), (int *)option); | |
2131 } else if (options == &chat_options) { | |
2132 g_signal_connect(G_OBJECT(button), "clicked", | |
2133 G_CALLBACK(set_chat_option), (int *)option); | |
2134 } else if (options == &font_options) { | |
2135 g_signal_connect(G_OBJECT(button), "clicked", | |
2136 G_CALLBACK(set_font_option), (int *)option); | |
2137 } else if (options == &sound_options) { | |
2138 g_signal_connect(G_OBJECT(button), "clicked", | |
2139 G_CALLBACK(set_sound_option), (int *)option); | |
2140 } else if (options == &away_options) { | |
2141 g_signal_connect(G_OBJECT(button), "clicked", | |
2142 G_CALLBACK(set_away_option), (int *)option); | |
2143 } else { | |
2144 gaim_debug(GAIM_DEBUG_WARNING, "gaim_button", | |
2145 "\"%s\" has no signal handler attached to it!\n", text); | |
2146 } | |
2147 gtk_widget_show(button); | |
2148 | |
2149 return button; | |
2150 } | |
2151 | |
2152 void default_away_menu_init(GtkWidget *omenu) | |
2153 { | |
2154 GtkWidget *menu, *opt; | |
2155 int index = 0; | |
2156 GSList *awy = away_messages; | |
2157 struct away_message *a; | |
2158 | |
2159 menu = gtk_menu_new(); | |
2160 | |
2161 while (awy) { | |
2162 a = (struct away_message *)awy->data; | |
2163 opt = gtk_menu_item_new_with_label(a->name); | |
2164 g_signal_connect(G_OBJECT(opt), "activate", | |
2165 G_CALLBACK(set_default_away), (gpointer)index); | |
2166 gtk_widget_show(opt); | |
2167 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
2168 | |
2169 awy = awy->next; | |
2170 index++; | |
2171 } | |
2172 | |
2173 gtk_option_menu_remove_menu(GTK_OPTION_MENU(omenu)); | |
2174 gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu); | |
2175 gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), g_slist_index(away_messages, default_away)); | |
2176 } | |
2177 | |
2178 GtkWidget *pref_fg_picture = NULL; | |
2179 GtkWidget *pref_bg_picture = NULL; | |
2180 | |
2181 void destroy_colorsel(GtkWidget *w, gpointer d) | |
2182 { | |
2183 if (d) { | |
2184 gtk_widget_destroy(fgcseld); | |
2185 fgcseld = NULL; | |
2186 } else { | |
2187 gtk_widget_destroy(bgcseld); | |
2188 bgcseld = NULL; | |
2189 } | |
2190 } | |
2191 | |
2192 void apply_color_dlg(GtkWidget *w, gpointer d) | |
2193 { | |
2194 if ((int)d == 1) { | |
2195 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION | |
2196 (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), | |
2197 &fgcolor); | |
2198 destroy_colorsel(NULL, (void *)1); | |
2199 update_color(NULL, pref_fg_picture); | |
2200 } else { | |
2201 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION | |
2202 (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), | |
2203 &bgcolor); | |
2204 destroy_colorsel(NULL, (void *)0); | |
2205 update_color(NULL, pref_bg_picture); | |
2206 } | |
2207 gaim_conversation_foreach(gaim_gtkconv_update_font_colors); | |
2208 } | |
2209 | |
2210 void set_default_away(GtkWidget *w, gpointer i) | |
2211 { | |
2212 | |
2213 int length = g_slist_length(away_messages); | |
2214 | |
2215 if (away_messages == NULL) | |
2216 default_away = NULL; | |
2217 else if ((int)i >= length) | |
2218 default_away = g_slist_nth_data(away_messages, length - 1); | |
2219 else | |
2220 default_away = g_slist_nth_data(away_messages, (int)i); | |
2221 } | |
2222 | |
2223 #ifndef _WIN32 | |
2224 static gboolean program_is_valid(const char *program) | |
2225 { | |
2226 GError *error = NULL; | |
2227 char **argv; | |
2228 gchar *progname; | |
2229 gboolean is_valid = FALSE; | |
2230 | |
2231 if (program == NULL || *program == '\0') { | |
2232 return FALSE; | |
2233 } | |
2234 | |
2235 if (!g_shell_parse_argv(program, NULL, &argv, &error)) { | |
2236 gaim_debug(GAIM_DEBUG_ERROR, "program_is_valid", | |
2237 "Could not parse program '%s': %s\n", | |
2238 program, error->message); | |
2239 g_error_free(error); | |
2240 return FALSE; | |
2241 } | |
2242 | |
2243 if (argv == NULL) { | |
2244 return FALSE; | |
2245 } | |
2246 | |
2247 progname = g_find_program_in_path(argv[0]); | |
2248 is_valid = (progname != NULL); | |
2249 | |
2250 g_strfreev(argv); | |
2251 g_free(progname); | |
2252 | |
2253 return is_valid; | |
2254 } | |
2255 #endif | |
2256 | |
2257 static void update_spin_value(GtkWidget *w, GtkWidget *spin) | |
2258 { | |
2259 int *value = g_object_get_data(G_OBJECT(spin), "val"); | |
2260 *value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); | |
2261 } | |
2262 | |
2263 GtkWidget *gaim_labeled_spin_button(GtkWidget *box, const gchar *title, int *val, int min, int max, GtkSizeGroup *sg) | |
2264 { | |
2265 GtkWidget *hbox; | |
2266 GtkWidget *label; | |
2267 GtkWidget *spin; | |
2268 GtkObject *adjust; | |
2269 | |
2270 hbox = gtk_hbox_new(FALSE, 5); | |
2271 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); | |
2272 gtk_widget_show(hbox); | |
2273 | |
2274 label = gtk_label_new_with_mnemonic(title); | |
2275 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2276 gtk_widget_show(label); | |
2277 | |
2278 adjust = gtk_adjustment_new(*val, min, max, 1, 1, 1); | |
2279 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); | |
2280 g_object_set_data(G_OBJECT(spin), "val", val); | |
2281 gtk_widget_set_size_request(spin, 50, -1); | |
2282 gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); | |
2283 g_signal_connect(G_OBJECT(adjust), "value-changed", | |
2284 G_CALLBACK(update_spin_value), GTK_WIDGET(spin)); | |
2285 gtk_widget_show(spin); | |
2286 | |
2287 gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin); | |
2288 | |
2289 if (sg) { | |
2290 gtk_size_group_add_widget(sg, label); | |
2291 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
2292 | |
2293 } | |
2294 return label; | |
2295 } | |
2296 | |
2297 void dropdown_set(GObject *w, int *option) | |
2298 { | |
2299 int opt = GPOINTER_TO_INT(g_object_get_data(w, "value")); | |
2300 int clear = GPOINTER_TO_INT(g_object_get_data(w, "clear")); | |
2301 | |
2302 if (option == (int*)&sort_method) { | |
2303 /* Hack city -- Population: Sean Egan */ | |
2304 char *name = (char*)opt; | |
2305 gaim_gtk_blist_sort_method_set(name); | |
2306 return; | |
2307 } | |
2308 if (clear != -1) { | |
2309 *option = *option & ~clear; | |
2310 *option = *option | opt; | |
2311 } else { | |
2312 gaim_debug(GAIM_DEBUG_MISC, "dropdown_set", "HELLO %d\n", opt); | |
2313 *option = opt; | |
2314 } | |
2315 | |
2316 if (option == (int*)&global_proxy_info.proxytype) { | |
2317 if (opt == PROXY_NONE) | |
2318 gtk_widget_set_sensitive(prefs_proxy_frame, FALSE); | |
2319 else | |
2320 gtk_widget_set_sensitive(prefs_proxy_frame, TRUE); | |
2321 } else if (option == &web_browser) { | |
2322 if (opt == BROWSER_MANUAL) | |
2323 gtk_widget_set_sensitive(gtk_widget_get_parent(browser_entry), TRUE); | |
2324 else | |
2325 gtk_widget_set_sensitive(gtk_widget_get_parent(browser_entry), FALSE); | |
2326 } else if (option == (int*)&sound_options) { | |
2327 if (opt == OPT_SOUND_CMD) | |
2328 gtk_widget_set_sensitive(sndcmd, TRUE); | |
2329 else | |
2330 gtk_widget_set_sensitive(sndcmd, FALSE); | |
2331 gaim_sound_change_output_method(); | |
2332 } else if (option == (int*)&blist_options) { | |
2333 gaim_gtk_blist_update_toolbar(); | |
2334 } else if (option == (int*)&im_options) { | |
2335 if (clear == (OPT_IM_SIDE_TAB | OPT_IM_BR_TAB)) | |
2336 gaim_gtkconv_update_tabs(); | |
2337 else if (clear == (OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM)) | |
2338 gaim_gtkconv_update_im_button_style(); | |
2339 } else if (option == (int*)&chat_options) { | |
2340 if (clear == (OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB)) | |
2341 gaim_gtkconv_update_tabs(); | |
2342 else if (clear == (OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM)) | |
2343 gaim_gtkconv_update_chat_button_style(); | |
2344 // } else if (option == (int*)&blist_options) { | |
2345 // set_blist_tab(); | |
2346 } else if (option == (int *)&conv_placement_option) { | |
2347 gaim_conv_placement_set_active(conv_placement_option); | |
2348 } | |
2349 } | |
2350 | |
2351 static GtkWidget *gaim_dropdown(GtkWidget *box, const gchar *title, int *option, int clear, ...) | |
2352 { | |
2353 va_list ap; | |
2354 GList *menuitems = NULL; | |
2355 GtkWidget *dropdown = NULL; | |
2356 char *name; | |
2357 int id; | |
2358 | |
2359 va_start(ap, clear); | |
2360 while ((name = va_arg(ap, char *)) != NULL) { | |
2361 id = va_arg(ap, int); | |
2362 | |
2363 menuitems = g_list_prepend(menuitems, name); | |
2364 menuitems = g_list_prepend(menuitems, GINT_TO_POINTER(id)); | |
2365 } | |
2366 va_end(ap); | |
2367 | |
2368 g_return_val_if_fail(menuitems != NULL, NULL); | |
2369 | |
2370 menuitems = g_list_reverse(menuitems); | |
2371 | |
2372 dropdown = gaim_dropdown_from_list(box, title, option, clear, menuitems); | |
2373 | |
2374 g_list_free(menuitems); | |
2375 | |
2376 return dropdown; | |
2377 } | |
2378 | |
2379 static GtkWidget *gaim_dropdown_from_list(GtkWidget *box, const gchar *title, int *option, int clear, GList *menuitems) | |
2380 { | |
2381 GtkWidget *dropdown, *opt, *menu; | |
2382 GtkWidget *label; | |
2383 gchar *text; | |
2384 int value; | |
2385 int o = 0; | |
2386 GtkWidget *hbox; | |
2387 | |
2388 g_return_val_if_fail(menuitems != NULL, NULL); | |
2389 | |
2390 hbox = gtk_hbox_new(FALSE, 5); | |
2391 gtk_container_add (GTK_CONTAINER (box), hbox); | |
2392 gtk_widget_show(hbox); | |
2393 | |
2394 label = gtk_label_new_with_mnemonic(title); | |
2395 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2396 gtk_widget_show(label); | |
2397 | |
2398 dropdown = gtk_option_menu_new(); | |
2399 menu = gtk_menu_new(); | |
2400 | |
2401 gtk_label_set_mnemonic_widget(GTK_LABEL(label), dropdown); | |
2402 | |
2403 while (menuitems != NULL && (text = (char *) menuitems->data) != NULL) { | |
2404 menuitems = g_list_next(menuitems); | |
2405 g_return_val_if_fail(menuitems != NULL, NULL); | |
2406 value = GPOINTER_TO_INT(menuitems->data); | |
2407 menuitems = g_list_next(menuitems); | |
2408 | |
2409 opt = gtk_menu_item_new_with_label(text); | |
2410 g_object_set_data(G_OBJECT(opt), "value", GINT_TO_POINTER(value)); | |
2411 g_object_set_data(G_OBJECT(opt), "clear", GINT_TO_POINTER(clear)); | |
2412 g_signal_connect(G_OBJECT(opt), "activate", | |
2413 G_CALLBACK(dropdown_set), (void *)option); | |
2414 gtk_widget_show(opt); | |
2415 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
2416 | |
2417 if (option == (int*)sort_method) { | |
2418 /* Now Entering Hacksville, Estd. May 17, 2003 */ | |
2419 gtk_menu_set_active(GTK_MENU(menu), clear); | |
2420 } else if (((clear > -1) && ((*option & clear) == value)) || *option == value) { | |
2421 gtk_menu_set_active(GTK_MENU(menu), o); | |
2422 } | |
2423 o++; | |
2424 | |
2425 } | |
2426 | |
2427 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu); | |
2428 gtk_box_pack_start(GTK_BOX(hbox), dropdown, FALSE, FALSE, 0); | |
2429 gtk_widget_show(dropdown); | |
2430 return label; | |
2431 } | |
2432 | |
2433 static GtkWidget *show_color_pref(GtkWidget *box, gboolean fgc) | |
2434 { | |
2435 /* more stuff stolen from X-Chat */ | |
2436 GtkWidget *swid; | |
2437 GdkColor c; | |
2438 GtkStyle *style; | |
2439 c.pixel = 0; | |
2440 if (fgc) { | |
2441 if (font_options & OPT_FONT_FGCOL) { | |
2442 c.red = fgcolor.red; | |
2443 c.blue = fgcolor.blue; | |
2444 c.green = fgcolor.green; | |
2445 } else { | |
2446 c.red = 0; | |
2447 c.blue = 0; | |
2448 c.green = 0; | |
2449 } | |
2450 } else { | |
2451 if (font_options & OPT_FONT_BGCOL) { | |
2452 c.red = bgcolor.red; | |
2453 c.blue = bgcolor.blue; | |
2454 c.green = bgcolor.green; | |
2455 } else { | |
2456 c.red = 0xffff; | |
2457 c.blue = 0xffff; | |
2458 c.green = 0xffff; | |
2459 } | |
2460 } | |
2461 | |
2462 style = gtk_style_new(); | |
2463 style->bg[0] = c; | |
2464 | |
2465 swid = gtk_event_box_new(); | |
2466 gtk_widget_set_style(GTK_WIDGET(swid), style); | |
2467 g_object_unref(style); | |
2468 gtk_widget_set_size_request(GTK_WIDGET(swid), 40, -1); | |
2469 gtk_box_pack_start(GTK_BOX(box), swid, FALSE, FALSE, 5); | |
2470 gtk_widget_show(swid); | |
2471 return swid; | |
2472 } | |
2473 | |
2474 void apply_font_dlg(GtkWidget *w, GtkWidget *f) | |
2475 { | |
2476 int i = 0; | |
2477 char *fontname; | |
2478 | |
2479 fontname = g_strdup(gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(f))); | |
2480 destroy_fontsel(0, 0); | |
2481 | |
2482 while(fontname[i] && !isdigit(fontname[i]) && i < sizeof(fontface)) { | |
2483 fontface[i] = fontname[i]; | |
2484 i++; | |
2485 } | |
2486 | |
2487 fontface[i] = 0; | |
2488 g_free(fontname); | |
2489 | |
2490 gaim_conversation_foreach(gaim_gtkconv_update_font_face); | |
2491 } | |
2492 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2493 void |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2494 gaim_gtk_prefs_init(void) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2495 { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2496 gaim_prefs_add_none("/gaim"); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2497 gaim_prefs_add_none("/gaim/gtk"); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2498 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2499 /* Debug window preferences. */ |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2500 gaim_prefs_add_none("/gaim/gtk/debug"); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2501 gaim_prefs_add_bool("/gaim/gtk/debug/toolbar", TRUE); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2502 gaim_prefs_add_bool("/gaim/gtk/debug/timestamps", FALSE); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2503 gaim_prefs_add_bool("/gaim/gtk/debug/enabled", FALSE); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2504 gaim_prefs_add_int("/gaim/gtk/debug/width", 400); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2505 gaim_prefs_add_int("/gaim/gtk/debug/height", 150); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2506 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2507 |