comparison src/prefs.c @ 1170:16d748023b2b

[gaim-migrate @ 1180] You can now choose the sound(s) you want to hear for various events. It doesnt update the preferences wnidow but it really does save them, honest! I'll fix the rest tomrrow. I'm sleepy. All Work and No play Makes Timmy TIIMMY TIimmMYY GOBBLES! committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Wed, 29 Nov 2000 10:30:56 +0000
parents 65e0608e19f7
children 4135d8fc7b4e
comparison
equal deleted inserted replaced
1169:71661061013d 1170:16d748023b2b
57 static void prefs_build_deny(); 57 static void prefs_build_deny();
58 static gint handle_delete(GtkWidget *, GdkEvent *, void *); 58 static gint handle_delete(GtkWidget *, GdkEvent *, void *);
59 static void delete_prefs(GtkWidget *, void *); 59 static void delete_prefs(GtkWidget *, void *);
60 void set_default_away(GtkWidget *, gpointer); 60 void set_default_away(GtkWidget *, gpointer);
61 61
62 static GtkWidget *sounddialog = NULL;
62 static GtkWidget *prefdialog = NULL; 63 static GtkWidget *prefdialog = NULL;
63 static GtkWidget *debugbutton = NULL; 64 static GtkWidget *debugbutton = NULL;
64 GtkWidget *prefs_away_list = NULL; 65 GtkWidget *prefs_away_list = NULL;
65 GtkWidget *prefs_away_menu = NULL; 66 GtkWidget *prefs_away_menu = NULL;
66 GtkWidget *preftree = NULL; 67 GtkWidget *preftree = NULL;
898 gtk_widget_show(prefdialog); 899 gtk_widget_show(prefdialog);
899 } 900 }
900 901
901 static GtkWidget *sndent[NUM_SOUNDS]; 902 static GtkWidget *sndent[NUM_SOUNDS];
902 903
904 void close_sounddialog(GtkWidget *w, GtkWidget *w2)
905 {
906
907 GtkWidget *dest;
908
909 if (!GTK_IS_WIDGET(w2))
910 dest = w;
911 else
912 dest = w2;
913
914 sounddialog = NULL;
915
916 gtk_widget_destroy(dest);
917 }
918
919 void do_select_sound(GtkWidget *w, int snd) {
920
921 char *file;
922
923 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sounddialog));
924
925 /* If they type in a directory, change there */
926 if (file_is_dir(file, sounddialog))
927 return;
928
929 /* Let's just be safe */
930 if (sound_file[snd])
931 free(sound_file[snd]);
932
933 /* Set it -- and forget it */
934 sound_file[snd] = g_strdup(file);
935
936 save_prefs();
937
938 /* Close the window! It's getting cold in here! */
939 close_sounddialog(NULL, sounddialog);
940 }
941
903 static void sel_sound(GtkWidget *button, int snd) { 942 static void sel_sound(GtkWidget *button, int snd) {
904 do_error_dialog("This isn't implemented yet! Ain't that a pisser? That's what you get for using CVS, I guess. So you have two options now: 1. Implement it yourself (this message should be pretty damn easy to find in the code), or 2. Hand-edit ~/.gaimrc. I suggest 2.", "Implement me!"); 943
944 char *buf = g_malloc(BUF_LEN);
945
946 if (!sounddialog)
947 {
948 sounddialog = gtk_file_selection_new(_("Gaim - Sound Configuration"));
949
950 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(sounddialog));
951
952 g_snprintf(buf, BUF_LEN -1, "%s/", getenv("HOME"));
953
954 gtk_file_selection_set_filename(GTK_FILE_SELECTION(sounddialog), buf);
955
956 gtk_signal_connect(GTK_OBJECT(sounddialog), "destroy",
957 GTK_SIGNAL_FUNC(close_sounddialog), sounddialog);
958
959 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(sounddialog)->ok_button),
960 "clicked", GTK_SIGNAL_FUNC(do_select_sound), (int *)snd);
961
962 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(sounddialog)->cancel_button),
963 "clicked", GTK_SIGNAL_FUNC(close_sounddialog), sounddialog);
964 }
965
966 g_free(buf);
967 gtk_widget_show(sounddialog);
968 gdk_window_raise(sounddialog->window);
905 } 969 }
906 970
907 static void sound_entry(char *label, int opt, GtkWidget *box, int snd) { 971 static void sound_entry(char *label, int opt, GtkWidget *box, int snd) {
908 GtkWidget *hbox; 972 GtkWidget *hbox;
909 GtkWidget *entry; 973 GtkWidget *entry;