From 6b18017f8240d6ce4880a1ed7d9158be8d914c95 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 9 Aug 2007 17:17:12 +0000 Subject: Remove per-state "Custom message..." item and add one on the bottom of the 2007-08-09 Xavier Claessens * libempathy-gtk/empathy-presence-chooser.glade: * libempathy-gtk/empathy-presence-chooser.c: * libempathy-gtk/empathy-status-presets.c: * libempathy-gtk/empathy-status-presets.h: * libempathy-gtk/empathy-ui-utils.c: Remove per-state "Custom message..." item and add one on the bottom of the menu. Add a combobox on the custom message dialog to select the state and change the action of the checkbox, now it add/remove the message from saved messages. Make easier to add other states to the list if needed. Fixes bug #460678. svn path=/trunk/; revision=241 --- libempathy-gtk/empathy-status-presets.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'libempathy-gtk/empathy-status-presets.c') diff --git a/libempathy-gtk/empathy-status-presets.c b/libempathy-gtk/empathy-status-presets.c index 80ce4149a..502772228 100644 --- a/libempathy-gtk/empathy-status-presets.c +++ b/libempathy-gtk/empathy-status-presets.c @@ -288,16 +288,13 @@ empathy_status_presets_set_last (McPresence state, StatusPreset *preset; gint num; - /* Remove any duplicate. */ + /* Check if duplicate */ for (l = presets; l; l = l->next) { preset = l->data; - if (state == preset->state) { - if (strcmp (status, preset->status) == 0) { - status_preset_free (preset); - presets = g_list_delete_link (presets, l); - break; - } + if (state == preset->state && + !empathy_strdiff (status, preset->status)) { + return; } } @@ -324,6 +321,26 @@ empathy_status_presets_set_last (McPresence state, status_presets_file_save (); } +void +empathy_status_presets_remove (McPresence state, + const gchar *status) +{ + StatusPreset *preset; + GList *l; + + for (l = presets; l; l = l->next) { + preset = l->data; + + if (state == preset->state && + !empathy_strdiff (status, preset->status)) { + status_preset_free (preset); + presets = g_list_delete_link (presets, l); + status_presets_file_save (); + break; + } + } +} + void empathy_status_presets_reset (void) { -- cgit v1.2.3