Mercurial > pidgin
annotate console/gntstatus.c @ 14741:fbb2e1657acb
[gaim-migrate @ 17498]
This error message seems more clear to me
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 17 Oct 2006 14:30:58 +0000 |
parents | fa0c8fa2b5a7 |
children | 811464ba52de |
rev | line source |
---|---|
14558
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
1 /** |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
2 * @file gntstatus.c GNT Status API |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
3 * @ingroup gntui |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
4 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
5 * gaim |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
6 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
7 * Gaim is the legal property of its developers, whose names are too numerous |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
9 * source distribution. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
10 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
14 * (at your option) any later version. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
15 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
19 * GNU General Public License for more details. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
20 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
22 * along with this program; if not, write to the Free Software |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14189
diff
changeset
|
24 */ |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 #include <gnt.h> |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 #include <gntbox.h> |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 #include <gntbutton.h> |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
28 #include <gntcombobox.h> |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 #include <gntentry.h> |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 #include <gntlabel.h> |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
31 #include <gntline.h> |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 #include <gnttree.h> |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
34 #include <notify.h> |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 #include <request.h> |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 #include "gntgaim.h" |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 #include "gntstatus.h" |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 static struct |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 GntWidget *window; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 GntWidget *tree; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 } statuses; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
46 typedef struct |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
47 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
48 GaimSavedStatus *saved; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
49 GntWidget *window; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
50 GntWidget *title; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
51 GntWidget *type; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
52 GntWidget *message; |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
53 GntWidget *tree; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
54 GHashTable *hash; /* list of windows for substatuses */ |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
55 } EditStatus; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
56 |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
57 typedef struct |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
58 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
59 GntWidget *window; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
60 GntWidget *type; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
61 GntWidget *message; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
62 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
63 EditStatus *parent; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
64 GaimAccount *account; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
65 } EditSubStatus; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
66 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
67 static GList *edits; /* List of opened edit-status dialogs */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
68 |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 static void |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 reset_status_window(GntWidget *widget, gpointer null) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 statuses.window = NULL; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 statuses.tree = NULL; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 static void |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 populate_statuses(GntTree *tree) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 const GList *list; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 for (list = gaim_savedstatuses_get_all(); list; list = list->next) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 GaimSavedStatus *saved = list->data; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 const char *title, *type, *message; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 if (gaim_savedstatus_is_transient(saved)) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 continue; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 title = gaim_savedstatus_get_title(saved); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 type = gaim_primitive_get_name_from_type(gaim_savedstatus_get_type(saved)); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 message = gaim_savedstatus_get_message(saved); /* XXX: Strip possible markups */ |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 gnt_tree_add_row_last(tree, saved, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 gnt_tree_create_row(tree, title, type, message), NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 static void |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 really_delete_status(GaimSavedStatus *saved) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 { |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
101 GList *iter; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
102 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
103 for (iter = edits; iter; iter = iter->next) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
104 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
105 EditStatus *edit = iter->data; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
106 if (edit->saved == saved) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
107 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
108 gnt_widget_destroy(edit->window); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
109 break; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
110 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
111 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
112 |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 if (statuses.tree) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 gnt_tree_remove(GNT_TREE(statuses.tree), saved); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 gaim_savedstatus_delete(gaim_savedstatus_get_title(saved)); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 static void |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 ask_before_delete(GntWidget *button, gpointer null) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
121 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
122 char *ask; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
123 GaimSavedStatus *saved; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
124 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
125 g_return_if_fail(statuses.tree != NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
126 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
127 saved = gnt_tree_get_selection_data(GNT_TREE(statuses.tree)); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 ask = g_strdup_printf(_("Are you sure you want to delete \"%s\""), |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 gaim_savedstatus_get_title(saved)); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 gaim_request_action(saved, _("Delete Status"), ask, NULL, 0, saved, 2, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 _("Delete"), really_delete_status, _("Cancel"), NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
133 g_free(ask); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
135 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 static void |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 use_savedstatus_cb(GntWidget *widget, gpointer null) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 g_return_if_fail(statuses.tree != NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 gaim_savedstatus_activate(gnt_tree_get_selection_data(GNT_TREE(statuses.tree))); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
144 static void |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
145 edit_savedstatus_cb(GntWidget *widget, gpointer null) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
146 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
147 g_return_if_fail(statuses.tree != NULL); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
148 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
149 gg_savedstatus_edit(gnt_tree_get_selection_data(GNT_TREE(statuses.tree))); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
150 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
151 |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 void gg_savedstatus_show_all() |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
153 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 GntWidget *window, *tree, *box, *button; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 if (statuses.window) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 return; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 statuses.window = window = gnt_vbox_new(FALSE); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
159 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 gnt_box_set_title(GNT_BOX(window), _("Saved Statuses")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 gnt_box_set_fill(GNT_BOX(window), FALSE); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
162 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
163 gnt_box_set_pad(GNT_BOX(window), 0); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
164 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 /* XXX: Add some sorting function to sort alphabetically, perhaps */ |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 statuses.tree = tree = gnt_tree_new_with_columns(3); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 gnt_tree_set_column_titles(GNT_TREE(tree), _("Title"), _("Type"), _("Message")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
168 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
169 gnt_tree_set_col_width(GNT_TREE(tree), 0, 25); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 gnt_tree_set_col_width(GNT_TREE(tree), 1, 12); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 gnt_tree_set_col_width(GNT_TREE(tree), 2, 35); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
172 gnt_box_add_widget(GNT_BOX(window), tree); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 populate_statuses(GNT_TREE(tree)); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 box = gnt_hbox_new(FALSE); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 gnt_box_add_widget(GNT_BOX(window), box); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 button = gnt_button_new(_("Use")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 gnt_box_add_widget(GNT_BOX(box), button); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 g_signal_connect(G_OBJECT(button), "activate", |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 G_CALLBACK(use_savedstatus_cb), NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 button = gnt_button_new(_("Add")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 gnt_box_add_widget(GNT_BOX(box), button); |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
186 g_signal_connect_swapped(G_OBJECT(button), "activate", |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
187 G_CALLBACK(gg_savedstatus_edit), NULL); |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 button = gnt_button_new(_("Edit")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 gnt_box_add_widget(GNT_BOX(box), button); |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
191 g_signal_connect(G_OBJECT(button), "activate", |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
192 G_CALLBACK(edit_savedstatus_cb), NULL); |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 button = gnt_button_new(_("Delete")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 gnt_box_add_widget(GNT_BOX(box), button); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 g_signal_connect(G_OBJECT(button), "activate", |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 G_CALLBACK(ask_before_delete), NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 button = gnt_button_new(_("Close")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 gnt_box_add_widget(GNT_BOX(box), button); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 g_signal_connect_swapped(G_OBJECT(button), "activate", |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 G_CALLBACK(gnt_widget_destroy), window); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 g_signal_connect(G_OBJECT(window), "destroy", |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 G_CALLBACK(reset_status_window), NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 gnt_widget_show(window); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
209 static void |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
210 destroy_substatus_win(GaimAccount *account, EditSubStatus *sub, gpointer null) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
211 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
212 gnt_widget_destroy(sub->window); /* the "destroy" callback will remove entry from the hashtable */ |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
213 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
214 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
215 static void |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
216 update_edit_list(GntWidget *widget, EditStatus *edit) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
217 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
218 edits = g_list_remove(edits, edit); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
219 gaim_notify_close_with_handle(edit); |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
220 g_hash_table_foreach(edit->hash, (GHFunc)destroy_substatus_win, NULL); |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
221 g_free(edit); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
222 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
223 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
224 static void |
14695
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
225 use_trans_status_cb(GntWidget *button, EditStatus *edit) |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
226 { |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
227 const char *message; |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
228 GaimStatusPrimitive prim; |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
229 GaimSavedStatus *saved; |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
230 |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
231 message = gnt_entry_get_text(GNT_ENTRY(edit->message)); |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
232 prim = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(edit->type))); |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
233 |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
234 saved = gaim_savedstatus_find_transient_by_type_and_message(prim, message); |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
235 if (saved == NULL) { |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
236 saved = gaim_savedstatus_new(NULL, prim); |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
237 } |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
238 gaim_savedstatus_set_message(saved, message); |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
239 gaim_savedstatus_activate(saved); |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
240 gnt_widget_destroy(edit->window); |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
241 } |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
242 |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
243 static void |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
244 save_savedstatus_cb(GntWidget *button, EditStatus *edit) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
245 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
246 const char *title, *message; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
247 GaimStatusPrimitive prim; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
248 GaimSavedStatus *find; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
249 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
250 title = gnt_entry_get_text(GNT_ENTRY(edit->title)); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
251 message = gnt_entry_get_text(GNT_ENTRY(edit->message)); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
252 if (!message || !*message) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
253 message = NULL; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
254 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
255 prim = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(edit->type))); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
256 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
257 if (!title || !*title) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
258 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
259 gaim_notify_error(edit, _("Error"), _("Invalid title"), |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
260 _("Please enter a non-empty title for the status.")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
261 return; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
262 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
263 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
264 find = gaim_savedstatus_find(title); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
265 if (find && find != edit->saved) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
266 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
267 gaim_notify_error(edit, _("Error"), _("Duplicate title"), |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
268 _("Please enter a different title for the status.")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
269 return; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
270 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
271 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
272 if (edit->saved == NULL) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
273 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
274 edit->saved = gaim_savedstatus_new(title, prim); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
275 gaim_savedstatus_set_message(edit->saved, message); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
276 if (statuses.tree) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
277 gnt_tree_add_row_last(GNT_TREE(statuses.tree), edit->saved, |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
278 gnt_tree_create_row(GNT_TREE(statuses.tree), title, |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
279 gaim_primitive_get_name_from_type(prim), message), NULL); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
280 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
281 else |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
282 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
283 gaim_savedstatus_set_title(edit->saved, title); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
284 gaim_savedstatus_set_type(edit->saved, prim); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
285 gaim_savedstatus_set_message(edit->saved, message); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
286 if (statuses.tree) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
287 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
288 gnt_tree_change_text(GNT_TREE(statuses.tree), edit->saved, 0, title); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
289 gnt_tree_change_text(GNT_TREE(statuses.tree), edit->saved, 1, |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
290 gaim_primitive_get_name_from_type(prim)); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
291 gnt_tree_change_text(GNT_TREE(statuses.tree), edit->saved, 2, message); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
292 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
293 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
294 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
295 if (g_object_get_data(G_OBJECT(button), "use")) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
296 gaim_savedstatus_activate(edit->saved); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
297 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
298 gnt_widget_destroy(edit->window); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
299 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
300 |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
301 static void |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
302 add_substatus(EditStatus *edit, GaimAccount *account) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
303 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
304 char *name; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
305 const char *type = NULL, *message = NULL; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
306 GaimSavedStatusSub *sub = NULL; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
307 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
308 if (!edit || !edit->tree) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
309 return; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
310 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
311 if (edit->saved) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
312 sub = gaim_savedstatus_get_substatus(edit->saved, account); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
313 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
314 if (sub) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
315 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
316 type = gaim_status_type_get_name(gaim_savedstatus_substatus_get_type(sub)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
317 message = gaim_savedstatus_substatus_get_message(sub); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
318 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
319 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
320 name = g_strdup_printf("%s (%s)", gaim_account_get_username(account), |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
321 gaim_account_get_protocol_name(account)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
322 gnt_tree_add_choice(GNT_TREE(edit->tree), account, |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
323 gnt_tree_create_row(GNT_TREE(edit->tree), name, type, message), NULL, NULL); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
324 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
325 if (sub) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
326 gnt_tree_set_choice(GNT_TREE(edit->tree), account, TRUE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
327 g_free(name); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
328 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
329 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
330 static void |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
331 substatus_window_destroy_cb(GntWidget *window, EditSubStatus *sub) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
332 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
333 g_hash_table_remove(sub->parent->hash, sub->account); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
334 g_free(sub); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
335 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
336 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
337 static void |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
338 save_substatus_cb(GntWidget *widget, EditSubStatus *sub) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
339 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
340 GaimSavedStatus *saved = sub->parent->saved; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
341 GaimAccount *account = sub->account; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
342 const char *message; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
343 GaimStatusType *type; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
344 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
345 type = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(sub->type)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
346 message = gnt_entry_get_text(GNT_ENTRY(sub->message)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
347 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
348 gaim_savedstatus_set_substatus(saved, account, type, message); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
349 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
350 gnt_tree_set_choice(GNT_TREE(sub->parent->tree), account, TRUE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
351 gnt_tree_change_text(GNT_TREE(sub->parent->tree), account, 1, |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
352 gaim_status_type_get_name(type)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
353 gnt_tree_change_text(GNT_TREE(sub->parent->tree), account, 2, message); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
354 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
355 gnt_widget_destroy(sub->window); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
356 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
357 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
358 static gboolean |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
359 popup_substatus(GntTree *tree, const char *key, EditStatus *edit) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
360 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
361 if (key[0] == ' ' && key[1] == 0) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
362 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
363 EditSubStatus *sub; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
364 GntWidget *window, *combo, *entry, *box, *button, *l; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
365 GaimSavedStatusSub *substatus = NULL; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
366 const GList *iter; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
367 char *name; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
368 GaimAccount *account = gnt_tree_get_selection_data(tree); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
369 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
370 if (gnt_tree_get_choice(tree, account)) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
371 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
372 /* There was a savedstatus for this account. Now remove it. */ |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
373 gaim_savedstatus_unset_substatus(edit->saved, account); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
374 gnt_tree_change_text(tree, account, 1, NULL); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
375 gnt_tree_change_text(tree, account, 2, NULL); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
376 return FALSE; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
377 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
378 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
379 if (g_hash_table_lookup(edit->hash, account)) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
380 return TRUE; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
381 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
382 if (edit->saved) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
383 substatus = gaim_savedstatus_get_substatus(edit->saved, account); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
384 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
385 sub = g_new0(EditSubStatus, 1); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
386 sub->parent = edit; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
387 sub->account = account; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
388 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
389 sub->window = window = gnt_vbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
390 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
391 gnt_box_set_title(GNT_BOX(window), _("Substatus")); /* XXX: a better title */ |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
392 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
393 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
394 gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Account:"))); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
395 name = g_strdup_printf("%s (%s)", gaim_account_get_username(account), |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
396 gaim_account_get_protocol_name(account)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
397 gnt_box_add_widget(GNT_BOX(box), gnt_label_new(name)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
398 g_free(name); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
399 gnt_box_add_widget(GNT_BOX(window), box); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
400 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
401 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
402 gnt_box_add_widget(GNT_BOX(box), (l = gnt_label_new(_("Status:")))); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
403 gnt_widget_set_size(l, 0, 1); /* I don't like having to do this */ |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
404 sub->type = combo = gnt_combo_box_new(); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
405 gnt_box_add_widget(GNT_BOX(box), combo); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
406 gnt_box_add_widget(GNT_BOX(window), box); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
407 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
408 for (iter = gaim_account_get_status_types(account); iter; iter = iter->next) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
409 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
410 GaimStatusType *type = iter->data; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
411 if (!gaim_status_type_is_user_settable(type)) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
412 continue; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
413 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), type, gaim_status_type_get_name(type)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
414 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
415 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
416 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
417 gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Message:"))); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
418 sub->message = entry = gnt_entry_new(substatus ? gaim_savedstatus_substatus_get_message(substatus) : NULL); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
419 gnt_box_add_widget(GNT_BOX(box), entry); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
420 gnt_box_add_widget(GNT_BOX(window), box); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
421 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
422 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
423 button = gnt_button_new(_("Cancel")); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
424 g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), window); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
425 gnt_box_add_widget(GNT_BOX(box), button); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
426 button = gnt_button_new(_("Save")); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
427 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(save_substatus_cb), sub); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
428 gnt_box_add_widget(GNT_BOX(box), button); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
429 gnt_box_add_widget(GNT_BOX(window), box); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
430 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
431 gnt_widget_show(window); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
432 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
433 g_hash_table_insert(edit->hash, account, sub); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
434 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
435 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(substatus_window_destroy_cb), sub); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
436 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
437 return TRUE; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
438 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
439 return FALSE; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
440 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
441 |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
442 void gg_savedstatus_edit(GaimSavedStatus *saved) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
443 { |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
444 EditStatus *edit; |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
445 GntWidget *window, *box, *button, *entry, *combo, *label, *tree; |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
446 GaimStatusPrimitive prims[] = {GAIM_STATUS_AVAILABLE, GAIM_STATUS_AWAY, |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
447 GAIM_STATUS_INVISIBLE, GAIM_STATUS_OFFLINE, GAIM_STATUS_UNSET}, current; |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
448 GList *iter; |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
449 int i; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
450 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
451 if (saved) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
452 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
453 GList *iter; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
454 for (iter = edits; iter; iter = iter->next) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
455 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
456 edit = iter->data; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
457 if (edit->saved == saved) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
458 return; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
459 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
460 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
461 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
462 edit = g_new0(EditStatus, 1); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
463 edit->saved = saved; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
464 edit->window = window = gnt_vbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
465 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
466 gnt_box_set_title(GNT_BOX(window), _("Edit Status")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
467 gnt_box_set_fill(GNT_BOX(window), TRUE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
468 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_LEFT); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
469 gnt_box_set_pad(GNT_BOX(window), 0); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
470 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
471 edits = g_list_append(edits, edit); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
472 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
473 /* Title */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
474 box = gnt_hbox_new(FALSE); |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
475 gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_LEFT); |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
476 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
477 gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Title"))); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
478 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
479 edit->title = entry = gnt_entry_new(saved ? gaim_savedstatus_get_title(saved) : NULL); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
480 gnt_box_add_widget(GNT_BOX(box), entry); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
481 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
482 /* Type */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
483 box = gnt_hbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
484 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
485 gnt_box_add_widget(GNT_BOX(box), label = gnt_label_new(_("Status"))); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
486 gnt_widget_set_size(label, 0, 1); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
487 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
488 edit->type = combo = gnt_combo_box_new(); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
489 gnt_box_add_widget(GNT_BOX(box), combo); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
490 current = saved ? gaim_savedstatus_get_type(saved) : GAIM_STATUS_UNSET; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
491 for (i = 0; prims[i] != GAIM_STATUS_UNSET; i++) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
492 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
493 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), GINT_TO_POINTER(prims[i]), |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
494 gaim_primitive_get_name_from_type(prims[i])); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
495 if (prims[i] == current) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
496 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), GINT_TO_POINTER(current)); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
497 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
498 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
499 /* Message */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
500 box = gnt_hbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
501 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
502 gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Message"))); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
503 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
504 edit->message = entry = gnt_entry_new(saved ? gaim_savedstatus_get_message(saved) : NULL); |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
505 gnt_box_add_widget(GNT_BOX(window), entry); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
506 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
507 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
508 gnt_box_add_widget(GNT_BOX(window), gnt_label_new(_("Use different status for following accounts"))); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
509 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
510 edit->hash = g_hash_table_new(g_direct_hash, g_direct_equal); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
511 edit->tree = tree = gnt_tree_new_with_columns(3); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
512 gnt_box_add_widget(GNT_BOX(window), tree); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
513 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
514 gnt_tree_set_column_titles(GNT_TREE(tree), _("Account"), _("Status"), _("Message")); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
515 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
516 gnt_tree_set_col_width(GNT_TREE(tree), 1, 10); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
517 gnt_tree_set_col_width(GNT_TREE(tree), 2, 30); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
518 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
519 for (iter = gaim_accounts_get_all(); iter; iter = iter->next) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
520 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
521 add_substatus(edit, iter->data); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
522 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
523 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
524 g_signal_connect(G_OBJECT(tree), "key_pressed", G_CALLBACK(popup_substatus), edit); |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
525 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
526 /* The buttons */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
527 box = gnt_hbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
528 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
529 |
14695
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
530 /* Use */ |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
531 button = gnt_button_new(_("Use")); |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
532 gnt_box_add_widget(GNT_BOX(box), button); |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
533 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(use_trans_status_cb), edit); |
fa0c8fa2b5a7
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
534 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
535 /* Save */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
536 button = gnt_button_new(_("Save")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
537 gnt_box_add_widget(GNT_BOX(box), button); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
538 g_object_set_data(G_OBJECT(button), "use", NULL); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
539 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(save_savedstatus_cb), edit); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
540 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
541 /* Save & Use */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
542 button = gnt_button_new(_("Save & Use")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
543 gnt_box_add_widget(GNT_BOX(box), button); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
544 g_object_set_data(G_OBJECT(button), "use", GINT_TO_POINTER(TRUE)); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
545 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(save_savedstatus_cb), edit); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
546 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
547 /* Cancel */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
548 button = gnt_button_new(_("Cancel")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
549 gnt_box_add_widget(GNT_BOX(box), button); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
550 g_signal_connect_swapped(G_OBJECT(button), "activate", |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
551 G_CALLBACK(gnt_widget_destroy), window); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
552 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
553 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(update_edit_list), edit); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
554 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
555 gnt_widget_show(window); |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
556 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
557 |