annotate src/gtkprefs.c @ 5440:7e8524b5ff98

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