Mercurial > pidgin.yaz
comparison src/away.c @ 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 | 92cbf9713795 |
children | 86944ae7c033 |
comparison
equal
deleted
inserted
replaced
8806:8212661dc3cc | 8807:482fc53c969d |
---|---|
27 #include "plugin.h" | 27 #include "plugin.h" |
28 #include "prefs.h" | 28 #include "prefs.h" |
29 #include "prpl.h" | 29 #include "prpl.h" |
30 #include "status.h" | 30 #include "status.h" |
31 #include "util.h" | 31 #include "util.h" |
32 #include "request.h" | |
32 | 33 |
33 /* XXX CORE/UI: Until we can get rid of the message queue stuff... */ | 34 /* XXX CORE/UI: Until we can get rid of the message queue stuff... */ |
34 #include "gaim.h" | 35 #include "gaim.h" |
35 #include "gtkinternal.h" | 36 #include "gtkinternal.h" |
36 #include "gtkblist.h" | 37 #include "gtkblist.h" |
282 | 283 |
283 gtk_widget_show(imaway); | 284 gtk_widget_show(imaway); |
284 serv_set_away_all(awaymessage->message); | 285 serv_set_away_all(awaymessage->message); |
285 } | 286 } |
286 | 287 |
287 void rem_away_mess(GtkWidget *w, struct away_message *a) | 288 void do_rem_away_mess(gchar *name) |
288 { | 289 { |
290 struct away_message *a; | |
289 struct away_message *default_away = NULL; | 291 struct away_message *default_away = NULL; |
290 const char *default_away_name; | 292 const char *default_away_name; |
291 GSList *l; | 293 GSList *l; |
294 | |
295 /* Lookup the away message based on the title */ | |
296 for (l = away_messages; l != NULL; l = l->next) { | |
297 a = l->data; | |
298 if (!strcmp(a->name, name)) | |
299 break; | |
300 } | |
301 g_free(name); | |
302 | |
303 if (l == NULL) { | |
304 /* Could not find away message! */ | |
305 return; | |
306 } | |
292 | 307 |
293 default_away_name = gaim_prefs_get_string("/core/away/default_message"); | 308 default_away_name = gaim_prefs_get_string("/core/away/default_message"); |
294 | 309 |
295 for(l = away_messages; l; l = l->next) { | 310 for(l = away_messages; l; l = l->next) { |
296 if(!strcmp(default_away_name, ((struct away_message *)l->data)->name)) { | 311 if(!strcmp(default_away_name, ((struct away_message *)l->data)->name)) { |
304 | 319 |
305 away_messages = g_slist_remove(away_messages, a); | 320 away_messages = g_slist_remove(away_messages, a); |
306 g_free(a); | 321 g_free(a); |
307 do_away_menu(); | 322 do_away_menu(); |
308 gaim_status_sync(); | 323 gaim_status_sync(); |
324 } | |
325 | |
326 void rem_away_mess(GtkWidget *w, struct away_message *a) | |
327 { | |
328 gchar *text; | |
329 | |
330 text = g_strdup_printf(_("Are you sure you want to remove the away message \"%s\"?"), a->name); | |
331 | |
332 gaim_request_action(NULL, NULL, _("Remove Away Message"), text, -1, g_strdup(a->name), 2, | |
333 _("Remove"), G_CALLBACK(do_rem_away_mess), | |
334 _("Cancel"), G_CALLBACK(g_free)); | |
335 | |
336 g_free(text); | |
309 } | 337 } |
310 | 338 |
311 static void set_gc_away(GObject *obj, GaimConnection *gc) | 339 static void set_gc_away(GObject *obj, GaimConnection *gc) |
312 { | 340 { |
313 struct away_message *awy = g_object_get_data(obj, "away_message"); | 341 struct away_message *awy = g_object_get_data(obj, "away_message"); |