changeset 4082:4b04ecb3eb97

[gaim-migrate @ 4297] (22:54:38) Robot101: * Make sure prefs are saved before plugins are removed, and not afterwards. (22:54:59) Robot101: * Move do_quit() into aim.c and make sure everything appropriate uses it. (22:55:12) Robot101: * Remove duplicated cancel_login for closing the main window, use do_quit instead. (22:55:49) Robot101: * Remove uncalled code pertaining to closing the about window from when it was called via gaim -v. (22:56:06) LSchiere: what's this in sounds? (22:56:29) Robot101: * Add correct ifdefs to prefs so only compiled-in sound methods are shown. (22:56:34) LSchiere: if you broke my sounds... (22:57:07) Robot101: * Remove unused sound order data, and clarify comments and debug output. (22:57:56) Robot101: * Remove duplicated check which is performed at the start of play_file anyway. (22:58:03) Robot101: that's the lot committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 16 Dec 2002 03:58:54 +0000
parents b35cf600fe30
children 42f9ebe32de4
files src/about.c src/aim.c src/buddy.c src/core.c src/gaim.h src/multi.c src/prefs.c src/sound.c
diffstat 8 files changed, 39 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/src/about.c	Mon Dec 16 00:19:44 2002 +0000
+++ b/src/about.c	Mon Dec 16 03:58:54 2002 +0000
@@ -40,13 +40,6 @@
 	about = NULL;
 }
 
-
-static void version_exit()
-{
-	gtk_main_quit();
-}
-
-
 char *name()
 {
 	return PACKAGE;
@@ -62,7 +55,7 @@
 	return VERSION;
 }
 
-void show_about(GtkWidget *w, void *null)
+void show_about(GtkWidget *w, void *data)
 {
 	GtkWidget *vbox;
 	GtkWidget *frame;
@@ -180,18 +173,10 @@
 		button = gaim_pixbuf_button_from_stock(_("Close"), GTK_STOCK_CLOSE, GAIM_BUTTON_HORIZONTAL);
 		gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
 
-		if (null != (void *)2) {
-			/* 2 can be as sad as 1, it's the loneliest number since the number 1 */
-			gtk_signal_connect_object(GTK_OBJECT(button), "clicked",
-						  GTK_SIGNAL_FUNC(destroy_about), GTK_OBJECT(about));
-			gtk_signal_connect(GTK_OBJECT(about), "destroy",
+		gtk_signal_connect_object(GTK_OBJECT(button), "clicked",
+					  GTK_SIGNAL_FUNC(destroy_about), GTK_OBJECT(about));
+		gtk_signal_connect(GTK_OBJECT(about), "destroy",
 					   GTK_SIGNAL_FUNC(destroy_about), GTK_OBJECT(about));
-		} else {
-			gtk_signal_connect(GTK_OBJECT(button), "clicked",
-					   GTK_SIGNAL_FUNC(version_exit), NULL);
-			gtk_signal_connect(GTK_OBJECT(about), "destroy",
-					   GTK_SIGNAL_FUNC(version_exit), NULL);
-		}
 		gtk_widget_show(button);
 
 		/* this makes the sizes not work. */
@@ -203,6 +188,5 @@
 
 	/* Let's give'em something to talk about -- woah woah woah */
 	gtk_widget_show(about);
-
-	gdk_window_raise(about->window);
+	gtk_window_present(about);
 }
--- a/src/aim.c	Mon Dec 16 00:19:44 2002 +0000
+++ b/src/aim.c	Mon Dec 16 03:58:54 2002 +0000
@@ -101,22 +101,31 @@
 };
 #endif
 
-
-void cancel_logon(void)
+void do_quit()
 {
-#ifdef GAIM_PLUGINS
-	/* first we tell those who have requested it we're quitting */
+	/* captain's log, stardate... */
+	system_log(log_quit, NULL, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON);
+
+	/* the self destruct sequence has been initiated */
 	plugin_event(event_quit);
 
-	/* then we remove everyone in a mass suicide */
+	/* transmission ends */
+	signoff_all();
+
+	/* record what we have before we blow it away... */
+	save_prefs();
+
+#ifdef GAIM_PLUGINS
+	/* jettison cargo */
 	remove_all_plugins();
-#endif /* GAIM_PLUGINS */
+#endif
+
 #ifdef USE_PERL
+	/* yup, perl too */
 	perl_end();
 #endif
 
-	save_prefs();
-
+	/* and end it all... */
 	gtk_main_quit();
 }
 
@@ -271,7 +280,7 @@
 	gdk_window_set_group(mainwindow->window, mainwindow->window);
 	gtk_container_set_border_width(GTK_CONTAINER(mainwindow), 5);
 	gtk_signal_connect(GTK_OBJECT(mainwindow), "delete_event", 
-					GTK_SIGNAL_FUNC(cancel_logon), mainwindow);
+					GTK_SIGNAL_FUNC(do_quit), mainwindow);
 
 
 	icon = gaim_pixbuf(NULL, "gaim.png");
--- a/src/buddy.c	Mon Dec 16 00:19:44 2002 +0000
+++ b/src/buddy.c	Mon Dec 16 03:58:54 2002 +0000
@@ -1410,26 +1410,6 @@
 	show_import_dialog();
 }
 
-void do_quit()
-{
-	/* first we tell those who have requested it we're quitting */
-	plugin_event(event_quit);
-
-	signoff_all();
-#ifdef GAIM_PLUGINS
-	/* then we remove everyone in a mass suicide */
-	remove_all_plugins();
-#endif
-	system_log(log_quit, NULL, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON);
-#ifdef USE_PERL
-	perl_end();
-#endif
-
-	save_prefs();
-
-	gtk_main_quit();
-}
-
 void add_buddy_callback(GtkWidget *widget, void *dummy)
 {
 	char *grp = NULL;
--- a/src/core.c	Mon Dec 16 00:19:44 2002 +0000
+++ b/src/core.c	Mon Dec 16 03:58:54 2002 +0000
@@ -495,7 +495,7 @@
 
 void core_quit()
 {
-	save_prefs();
+	/* don't save prefs after plugins are gone... */
 #ifndef _WIN32
 	{
 	char buf[1024];
--- a/src/gaim.h	Mon Dec 16 00:19:44 2002 +0000
+++ b/src/gaim.h	Mon Dec 16 03:58:54 2002 +0000
@@ -325,7 +325,6 @@
 #define NUM_SOUNDS 11
 
 extern char *sound_file[NUM_SOUNDS];
-extern int sound_order[];
 
 /* global sound struct */
 struct sound_struct {
@@ -358,8 +357,10 @@
 extern struct save_pos blist_pos;
 extern struct window_size conv_size, buddy_chat_size;
 
+/* Functions in aim.c */
+extern void do_quit();
+
 /* Functions in buddy.c */
-extern void do_quit();
 extern void signoff(struct gaim_connection *);
 extern void do_pounce(struct gaim_connection *, char *, int);
 void create_prpl_icon(GtkWidget *widget, struct gaim_connection *gc,
--- a/src/multi.c	Mon Dec 16 00:19:44 2002 +0000
+++ b/src/multi.c	Mon Dec 16 03:58:54 2002 +0000
@@ -149,14 +149,14 @@
 	acctedit = NULL;
 	treeview = NULL;
 	if (!d && !blist && !mainwindow && !connections)
-		gtk_main_quit();
+		do_quit();
 }
 
 static gint acctedit_close(GtkWidget *w, gpointer d)
 {
 	gtk_widget_destroy(acctedit);
 	if (!d && !blist && !mainwindow && !connections)
-		gtk_main_quit();
+		do_quit();
 	return FALSE;
 }
 
--- a/src/prefs.c	Mon Dec 16 00:19:44 2002 +0000
+++ b/src/prefs.c	Mon Dec 16 03:58:54 2002 +0000
@@ -674,9 +674,13 @@
 		      "Console beep", OPT_SOUND_BEEP,
 #ifdef ESD_SOUND
 		      "ESD", OPT_SOUND_ESD,
-#endif /* ESD_SOUND */
+#endif
+#ifdef ARTSC_SOUND
 		      "ArtsC", OPT_SOUND_ARTSC,
+#endif
+#ifdef NAS_SOUND
 		      "NAS", OPT_SOUND_NAS,
+#endif
 		      "Internal", OPT_SOUND_NORMAL,
 		      "Command", OPT_SOUND_CMD, NULL);
 	gtk_size_group_add_widget(sg, dd);
--- a/src/sound.c	Mon Dec 16 00:19:44 2002 +0000
+++ b/src/sound.c	Mon Dec 16 03:58:54 2002 +0000
@@ -60,11 +60,10 @@
 
 gboolean mute_sounds = 0;
 
-/* description, option bit, default sound file                    *
- * if you want it to get displayed in the prefs dialog, it needs  *
- * to be added to the sound_order array in prefs.c, if not, and   *
- * it has no option bit, set it to 0. the order here has to match *
- * the defines in gaim.h.                               -Robot101 */
+/* description, option bit, default sound file             *
+ * set the option bit to 0 to have it not display in prefs *
+ * the order here has to match the defines in gaim.h.      *
+ *                                               -Robot101 */
 struct sound_struct sounds[NUM_SOUNDS] = {
 	{N_("Buddy logs in"), OPT_SOUND_LOGIN, "arrive.wav"},
 	{N_("Buddy logs out"), OPT_SOUND_LOGOUT, "leave.wav"},
@@ -79,12 +78,6 @@
 	{NULL, 0, "redalert.wav"},
 	{N_("Someone says your name in chat"), OPT_SOUND_CHAT_NICK, "redalert.wav"}
 };
-int sound_order[] = {
-	SND_BUDDY_ARRIVE, SND_BUDDY_LEAVE,
-	SND_FIRST_RECEIVE, SND_RECEIVE, SND_SEND,
-	SND_CHAT_JOIN, SND_CHAT_LEAVE,
-	SND_CHAT_YOU_SAY, SND_CHAT_SAY, SND_CHAT_NICK, 0
-};
 
 #ifndef _WIN32
 static int check_dev(char *dev)
@@ -464,14 +457,11 @@
 	if (mute_sounds)
 		return;
 	
-	if (awaymessage && !(sound_options & OPT_SOUND_WHEN_AWAY))
-		return;
-
 	if ((sound == SND_BUDDY_ARRIVE) && !logins_not_muted)
 		return;
 
 	if (sound >= NUM_SOUNDS) {
-		debug_printf("sorry old fruit... can't say I know that sound: ", sound, "\n");
+		debug_printf("got request for unknown sound: %d\n", sound);
 		return;
 	}