Mercurial > pidgin.yaz
comparison src/prefs.c @ 572:faca21605e1b
[gaim-migrate @ 582]
no no no! :)
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 01 Aug 2000 22:59:00 +0000 |
parents | 93c65fbaa622 |
children | a33616e4e48d |
comparison
equal
deleted
inserted
replaced
571:feccb7afc81d | 572:faca21605e1b |
---|---|
33 #include <stdlib.h> | 33 #include <stdlib.h> |
34 #include <gtk/gtk.h> | 34 #include <gtk/gtk.h> |
35 #include "gaim.h" | 35 #include "gaim.h" |
36 #include "proxy.h" | 36 #include "proxy.h" |
37 #include "gnome_applet_mgr.h" | 37 #include "gnome_applet_mgr.h" |
38 #include "pixmaps/save.xpm" | |
39 #include "pixmaps/cancel.xpm" | |
40 | 38 |
41 struct prefs_data *pd = NULL; | 39 struct prefs_data *pd = NULL; |
42 struct debug_window *dw = NULL; | 40 struct debug_window *dw = NULL; |
43 | 41 |
44 GtkWidget *debugbutton; | 42 GtkWidget *debugbutton; |
95 void away_list_unclicked( GtkWidget *widget, struct away_message *a) | 93 void away_list_unclicked( GtkWidget *widget, struct away_message *a) |
96 { | 94 { |
97 if (pd == NULL) | 95 if (pd == NULL) |
98 return; | 96 return; |
99 strcpy(a->message, pd->edited_message); | 97 strcpy(a->message, pd->edited_message); |
98 save_prefs(); | |
100 } | 99 } |
101 | 100 |
102 void set_option(GtkWidget *w, int *option) | 101 void set_option(GtkWidget *w, int *option) |
103 { | 102 { |
104 *option = !(*option); | 103 *option = !(*option); |
111 if (blist) update_button_pix(); | 110 if (blist) update_button_pix(); |
112 | 111 |
113 #ifdef USE_APPLET | 112 #ifdef USE_APPLET |
114 update_pixmaps(); | 113 update_pixmaps(); |
115 #endif | 114 #endif |
115 | |
116 save_prefs(); | |
116 } | 117 } |
117 | 118 |
118 void set_sound_option(GtkWidget *w, int *option) | 119 void set_sound_option(GtkWidget *w, int *option) |
119 { | 120 { |
120 sound_options = sound_options ^ (int)option; | 121 sound_options = sound_options ^ (int)option; |
122 save_prefs(); | |
121 } | 123 } |
122 | 124 |
123 void set_font_option(GtkWidget *w, int *option) | 125 void set_font_option(GtkWidget *w, int *option) |
124 { | 126 { |
125 font_options = font_options ^ (int)option; | 127 font_options = font_options ^ (int)option; |
126 | 128 |
127 update_font_buttons(); | 129 update_font_buttons(); |
130 | |
131 save_prefs(); | |
128 } | 132 } |
129 | 133 |
130 void set_general_option(GtkWidget *w, int *option) | 134 void set_general_option(GtkWidget *w, int *option) |
131 { | 135 { |
132 general_options = general_options ^ (int)option; | 136 general_options = general_options ^ (int)option; |
133 | 137 |
134 if ((int)option == OPT_GEN_SHOW_LAGMETER) | 138 if ((int)option == OPT_GEN_SHOW_LAGMETER) |
135 update_lagometer(-1); | 139 update_lagometer(-1); |
136 if ((int)option == OPT_GEN_LOG_ALL) | 140 if ((int)option == OPT_GEN_LOG_ALL) |
137 update_log_convs(); | 141 update_log_convs(); |
142 save_prefs(); | |
138 | 143 |
139 /* | 144 /* |
140 if (data == &show_grp_nums) | 145 if (data == &show_grp_nums) |
141 update_num_groups(); | 146 update_num_groups(); |
142 if (data == &showidle || data == &showpix) | 147 if (data == &showidle || data == &showpix) |
155 if (debugbutton) | 160 if (debugbutton) |
156 gtk_button_clicked(GTK_BUTTON(debugbutton)); | 161 gtk_button_clicked(GTK_BUTTON(debugbutton)); |
157 if (general_options & OPT_GEN_DEBUG) | 162 if (general_options & OPT_GEN_DEBUG) |
158 { | 163 { |
159 general_options = general_options ^ (int)OPT_GEN_DEBUG; | 164 general_options = general_options ^ (int)OPT_GEN_DEBUG; |
165 save_prefs(); | |
160 } | 166 } |
161 g_free(dw); | 167 g_free(dw); |
162 dw=NULL; | 168 dw=NULL; |
163 return FALSE; | 169 return FALSE; |
164 | 170 |
182 /* Store the data for later use */ | 188 /* Store the data for later use */ |
183 strcpy(a->message, pd->edited_message); | 189 strcpy(a->message, pd->edited_message); |
184 | 190 |
185 } | 191 } |
186 | 192 |
193 save_prefs(); | |
187 | 194 |
188 if (event == NULL) | 195 if (event == NULL) |
189 { | 196 { |
190 gtk_widget_destroy(pd->window); | 197 gtk_widget_destroy(pd->window); |
191 debugbutton=NULL; | 198 debugbutton=NULL; |
198 } | 205 } |
199 | 206 |
200 static int | 207 static int |
201 manualentry_key_pressed(GtkWidget *w, GdkEvent *event, void *dummy) | 208 manualentry_key_pressed(GtkWidget *w, GdkEvent *event, void *dummy) |
202 { | 209 { |
203 g_snprintf(web_command, sizeof(web_command), "%s", gtk_entry_get_text(GTK_ENTRY(pd->browser_entry))); | 210 g_snprintf(web_command, sizeof(web_command), "%s", gtk_entry_get_text(GTK_ENTRY(pd->browser_entry))); |
204 | 211 save_prefs(); |
205 return TRUE; | 212 return TRUE; |
206 } | 213 } |
207 | 214 |
208 static int | 215 static int |
209 connection_key_pressed(GtkWidget *w, GdkEvent *event, void *dummy) | 216 connection_key_pressed(GtkWidget *w, GdkEvent *event, void *dummy) |
215 sscanf(gtk_entry_get_text(GTK_ENTRY(pd->proxy_port_entry)), "%d", &proxy_port); | 222 sscanf(gtk_entry_get_text(GTK_ENTRY(pd->proxy_port_entry)), "%d", &proxy_port); |
216 } | 223 } |
217 | 224 |
218 g_snprintf(login_host, sizeof(login_host), "%s", gtk_entry_get_text(GTK_ENTRY(pd->login_host_entry))); | 225 g_snprintf(login_host, sizeof(login_host), "%s", gtk_entry_get_text(GTK_ENTRY(pd->login_host_entry))); |
219 sscanf(gtk_entry_get_text(GTK_ENTRY(pd->login_port_entry)), "%d", &login_port); | 226 sscanf(gtk_entry_get_text(GTK_ENTRY(pd->login_port_entry)), "%d", &login_port); |
227 save_prefs(); | |
220 return TRUE; | 228 return TRUE; |
221 } | 229 } |
222 | 230 |
223 | 231 |
224 | 232 |
239 gtk_widget_set_sensitive(pd->nwbutton, FALSE); | 247 gtk_widget_set_sensitive(pd->nwbutton, FALSE); |
240 } else { | 248 } else { |
241 if (pd->nwbutton) | 249 if (pd->nwbutton) |
242 gtk_widget_set_sensitive(pd->nwbutton, TRUE); | 250 gtk_widget_set_sensitive(pd->nwbutton, TRUE); |
243 } | 251 } |
252 | |
253 | |
254 save_prefs(); | |
244 } | 255 } |
245 | 256 |
246 static void set_connect(GtkWidget *w, int *data) | 257 static void set_connect(GtkWidget *w, int *data) |
247 { | 258 { |
248 proxy_type = (int)data; | 259 proxy_type = (int)data; |
256 gtk_widget_set_sensitive(pd->proxy_host_entry, FALSE); | 267 gtk_widget_set_sensitive(pd->proxy_host_entry, FALSE); |
257 if (pd->proxy_port_entry) | 268 if (pd->proxy_port_entry) |
258 gtk_widget_set_sensitive(pd->proxy_port_entry, FALSE); | 269 gtk_widget_set_sensitive(pd->proxy_port_entry, FALSE); |
259 } | 270 } |
260 | 271 |
272 save_prefs(); | |
261 } | 273 } |
262 | 274 |
263 static void set_idle(GtkWidget *w, int *data) | 275 static void set_idle(GtkWidget *w, int *data) |
264 { | 276 { |
265 report_idle = (int)data; | 277 report_idle = (int)data; |
278 save_prefs(); | |
266 } | 279 } |
267 | 280 |
268 | 281 |
269 GtkWidget *gaim_button(const char *text, int *options, int option, GtkWidget *page) | 282 GtkWidget *gaim_button(const char *text, int *options, int option, GtkWidget *page) |
270 { | 283 { |
285 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_general_option), (int *)option); | 298 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_general_option), (int *)option); |
286 gtk_widget_show(button); | 299 gtk_widget_show(button); |
287 | 300 |
288 return button; | 301 return button; |
289 } | 302 } |
303 | |
290 | 304 |
291 void build_prefs() | 305 void build_prefs() |
292 { | 306 { |
293 GtkWidget *bbox; | 307 GtkWidget *bbox; |
294 GtkWidget *vbox; | 308 GtkWidget *vbox; |
300 GtkWidget *appbox; | 314 GtkWidget *appbox; |
301 GtkWidget *away_topbox; | 315 GtkWidget *away_topbox; |
302 GtkWidget *away_botbox; | 316 GtkWidget *away_botbox; |
303 GtkWidget *add_away; | 317 GtkWidget *add_away; |
304 GtkWidget *remove_away; | 318 GtkWidget *remove_away; |
319 GtkWidget *close; | |
305 GtkWidget *notebook; | 320 GtkWidget *notebook; |
306 GtkWidget *sound_page; | 321 GtkWidget *sound_page; |
307 /* GtkWidget *debug_page; */ | 322 /* GtkWidget *debug_page; */ |
308 GtkWidget *general_page; | 323 GtkWidget *general_page; |
309 GtkWidget *appearance_page; | 324 GtkWidget *appearance_page; |
318 GtkWidget *appletbox; | 333 GtkWidget *appletbox; |
319 #endif | 334 #endif |
320 GtkWidget *label; | 335 GtkWidget *label; |
321 GtkWidget *browseropt; | 336 GtkWidget *browseropt; |
322 GtkWidget *idleopt; | 337 GtkWidget *idleopt; |
323 | 338 |
324 GList *awy = away_messages; | 339 GList *awy = away_messages; |
325 struct away_message *a; | 340 struct away_message *a; |
326 GtkWidget *sw; | 341 GtkWidget *sw; |
327 GtkWidget *sw2; | 342 GtkWidget *sw2; |
328 GtkWidget *away_page; | 343 GtkWidget *away_page; |
329 GtkWidget *select_font; | 344 GtkWidget *select_font; |
330 GtkWidget *font_face_for_text; | 345 GtkWidget *font_face_for_text; |
346 | |
331 GtkWidget *list_item; | 347 GtkWidget *list_item; |
332 GtkWidget *button_box, *save, *cancel, *icon_i, *button_label; | |
333 GdkBitmap *mask; | |
334 GdkPixmap *icon; | |
335 | 348 |
336 gchar buffer[64]; | 349 gchar buffer[64]; |
337 | 350 |
338 if (!pd) | 351 if (!pd) |
339 pd = g_new0(struct prefs_data, 1); | 352 pd = g_new0(struct prefs_data, 1); |
797 | 810 |
798 do_chat_page(chat_page); | 811 do_chat_page(chat_page); |
799 gtk_widget_show(chat_page); | 812 gtk_widget_show(chat_page); |
800 | 813 |
801 bbox = gtk_hbox_new(FALSE, 5); | 814 bbox = gtk_hbox_new(FALSE, 5); |
802 | 815 close = gtk_button_new_with_label(_("Close")); |
803 /* Build Save Button */ | |
804 | |
805 save = gtk_button_new(); | |
806 | |
807 button_box = gtk_hbox_new(FALSE, 5); | |
808 icon = gdk_pixmap_create_from_xpm_d ( pd->window->window, &mask, NULL, save_xpm); | |
809 | |
810 icon_i = gtk_pixmap_new(icon, mask); | |
811 | |
812 button_label = gtk_label_new(_("Save")); | |
813 | |
814 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
815 gtk_box_pack_end(GTK_BOX(button_box), button_label, FALSE, FALSE, 2); | |
816 | |
817 gtk_widget_show(button_label); | |
818 gtk_widget_show(icon_i); | |
819 | |
820 gtk_widget_show(button_box); | |
821 | |
822 gtk_container_add(GTK_CONTAINER(save), button_box); | |
823 | |
824 /* End of Save Button */ | |
825 | |
826 /* Build Cancel Button */ | |
827 | |
828 cancel = gtk_button_new(); | |
829 | |
830 button_box = gtk_hbox_new(FALSE, 5); | |
831 icon = gdk_pixmap_create_from_xpm_d ( pd->window->window, &mask, NULL, cancel_xpm); | |
832 | |
833 icon_i = gtk_pixmap_new(icon, mask); | |
834 | |
835 button_label = gtk_label_new(_("Cancel")); | |
836 | |
837 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
838 gtk_box_pack_end(GTK_BOX(button_box), button_label, FALSE, FALSE, 2); | |
839 | |
840 gtk_widget_show(button_label); | |
841 gtk_widget_show(icon_i); | |
842 | |
843 gtk_widget_show(button_box); | |
844 | |
845 gtk_container_add(GTK_CONTAINER(cancel), button_box); | |
846 | |
847 /* End of Cancel Button */ | |
848 | |
849 | |
850 if (display_options & OPT_DISP_COOL_LOOK) | 816 if (display_options & OPT_DISP_COOL_LOOK) |
851 { | 817 gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE); |
852 gtk_button_set_relief(GTK_BUTTON(save), GTK_RELIEF_NONE); | |
853 gtk_button_set_relief(GTK_BUTTON(cancel), GTK_RELIEF_NONE); | |
854 } | |
855 | |
856 /* close = gtk_button_new_with_label(_("Close")); | |
857 if (display_options & OPT_DISP_COOL_LOOK) | |
858 gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE);*/ | |
859 | 818 |
860 /* Pack the button(s) in the button box */ | 819 /* Pack the button(s) in the button box */ |
861 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5); | 820 gtk_box_pack_end(GTK_BOX(bbox), close, FALSE, FALSE, 5); |
862 gtk_box_pack_end(GTK_BOX(bbox), save, FALSE, FALSE, 5); | |
863 gtk_box_pack_start(GTK_BOX(vbox),bbox, FALSE, FALSE, 5); | 821 gtk_box_pack_start(GTK_BOX(vbox),bbox, FALSE, FALSE, 5); |
864 | 822 |
865 gtk_widget_show(notebook); | 823 gtk_widget_show(notebook); |
866 gtk_widget_show(save); | 824 gtk_widget_show(close); |
867 gtk_widget_show(cancel); | 825 |
868 | |
869 gtk_widget_show(bbox); | 826 gtk_widget_show(bbox); |
870 gtk_widget_show(vbox); | 827 gtk_widget_show(vbox); |
871 | 828 |
872 gtk_signal_connect(GTK_OBJECT(save), "clicked", GTK_SIGNAL_FUNC(save_prefs), NULL); | 829 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(handle_delete), NULL); |
873 gtk_signal_connect(GTK_OBJECT(save), "clicked", GTK_SIGNAL_FUNC(handle_delete), NULL); | 830 gtk_signal_connect(GTK_OBJECT(pd->window),"delete_event", GTK_SIGNAL_FUNC(handle_delete), NULL); |
874 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(set_defaults), NULL); | |
875 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(load_prefs), NULL); | |
876 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(handle_delete), NULL); | |
877 gtk_signal_connect(GTK_OBJECT(pd->window),"delete_event", GTK_SIGNAL_FUNC(handle_delete), NULL); | |
878 | 831 |
879 } | 832 } |
880 | 833 |
881 void show_prefs() | 834 void show_prefs() |
882 { | 835 { |
911 sel = g_list_append(NULL, item); | 864 sel = g_list_append(NULL, item); |
912 gtk_list_append_items(GTK_LIST(cp->list2), sel); | 865 gtk_list_append_items(GTK_LIST(cp->list2), sel); |
913 chat_rooms = g_list_append(chat_rooms, cr2); | 866 chat_rooms = g_list_append(chat_rooms, cr2); |
914 | 867 |
915 setup_buddy_chats(); | 868 setup_buddy_chats(); |
869 save_prefs(); | |
870 | |
871 | |
916 } | 872 } |
917 | 873 |
918 void remove_chat(GtkWidget *w, struct chat_page *cp) | 874 void remove_chat(GtkWidget *w, struct chat_page *cp) |
919 { | 875 { |
920 GList *sel = GTK_LIST(cp->list2)->selection; | 876 GList *sel = GTK_LIST(cp->list2)->selection; |
948 | 904 |
949 crs = crs->next; | 905 crs = crs->next; |
950 } | 906 } |
951 | 907 |
952 setup_buddy_chats(); | 908 setup_buddy_chats(); |
909 save_prefs(); | |
953 } | 910 } |
954 | 911 |
955 void refresh_list(GtkWidget *w, struct chat_page *cp) | 912 void refresh_list(GtkWidget *w, struct chat_page *cp) |
956 { | 913 { |
957 char *text = grab_url("http://www.aol.com/community/chat/allchats.html"); | 914 char *text = grab_url("http://www.aol.com/community/chat/allchats.html"); |