changeset 8807:482fc53c969d

[gaim-migrate @ 9569] A patch from Jon Oberheide to add a confirmation dialog when removing an away message. And then two other small changes I thought I had already committed. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 25 Apr 2004 17:01:38 +0000
parents 8212661dc3cc
children bbd8cdaf0ad5
files src/away.c src/gtkeventloop.c src/gtkimhtmltoolbar.c
diffstat 3 files changed, 31 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/away.c	Sun Apr 25 16:23:20 2004 +0000
+++ b/src/away.c	Sun Apr 25 17:01:38 2004 +0000
@@ -29,6 +29,7 @@
 #include "prpl.h"
 #include "status.h"
 #include "util.h"
+#include "request.h"
 
 /* XXX CORE/UI: Until we can get rid of the message queue stuff... */
 #include "gaim.h"
@@ -284,12 +285,26 @@
 	serv_set_away_all(awaymessage->message);
 }
 
-void rem_away_mess(GtkWidget *w, struct away_message *a)
+void do_rem_away_mess(gchar *name)
 {
+	struct away_message *a;
 	struct away_message *default_away = NULL;
 	const char *default_away_name;
 	GSList *l;
 
+	/* Lookup the away message based on the title */
+	for (l = away_messages; l != NULL; l = l->next) {
+		a = l->data;
+		if (!strcmp(a->name, name))
+			break;
+	}
+	g_free(name);
+
+	if (l == NULL) {
+		/* Could not find away message! */
+		return;
+	}
+
 	default_away_name = gaim_prefs_get_string("/core/away/default_message");
 
 	for(l = away_messages; l; l = l->next) {
@@ -308,6 +323,19 @@
 	gaim_status_sync();
 }
 
+void rem_away_mess(GtkWidget *w, struct away_message *a)
+{
+	gchar *text;
+
+	text = g_strdup_printf(_("Are you sure you want to remove the away message \"%s\"?"), a->name);
+
+	gaim_request_action(NULL, NULL, _("Remove Away Message"), text, -1, g_strdup(a->name), 2,
+						_("Remove"), G_CALLBACK(do_rem_away_mess),
+						_("Cancel"), G_CALLBACK(g_free));
+
+	g_free(text);
+}
+
 static void set_gc_away(GObject *obj, GaimConnection *gc)
 {
 	struct away_message *awy = g_object_get_data(obj, "away_message");
--- a/src/gtkeventloop.c	Sun Apr 25 16:23:20 2004 +0000
+++ b/src/gtkeventloop.c	Sun Apr 25 17:01:38 2004 +0000
@@ -97,7 +97,7 @@
 	g_timeout_add,
 	(guint (*)(guint))g_source_remove,
 	gaim_gtk_input_add,
-	(void (*)(guint))g_source_remove
+	(guint (*)(guint))g_source_remove
 };
 
 GaimEventLoopUiOps *
--- a/src/gtkimhtmltoolbar.c	Sun Apr 25 16:23:20 2004 +0000
+++ b/src/gtkimhtmltoolbar.c	Sun Apr 25 17:01:38 2004 +0000
@@ -1033,7 +1033,7 @@
 	g_signal_connect_after(G_OBJECT(GTK_IMHTML(imhtml)->text_buffer), "mark-set", G_CALLBACK(mark_set_cb), toolbar);
 
 	buttons = gtk_imhtml_get_format_functions(GTK_IMHTML(imhtml));
-	update_buttons_cb(imhtml, buttons, toolbar);
+	update_buttons_cb(GTK_IMHTML(imhtml), buttons, toolbar);
 
 	bold = italic = underline = FALSE;