Mercurial > pidgin.yaz
annotate console/gntstatus.c @ 14558:81650a27f253
[gaim-migrate @ 17281]
Doxygen for console/
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 15 Sep 2006 01:21:53 +0000 |
parents | 789d80a6b9d9 |
children | fa0c8fa2b5a7 |
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 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
225 save_savedstatus_cb(GntWidget *button, EditStatus *edit) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
226 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
227 const char *title, *message; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
228 GaimStatusPrimitive prim; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
229 GaimSavedStatus *find; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
230 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
231 title = gnt_entry_get_text(GNT_ENTRY(edit->title)); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
232 message = gnt_entry_get_text(GNT_ENTRY(edit->message)); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
233 if (!message || !*message) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
234 message = NULL; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
235 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
236 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
|
237 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
238 if (!title || !*title) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
239 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
240 gaim_notify_error(edit, _("Error"), _("Invalid title"), |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
241 _("Please enter a non-empty title for the status.")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
242 return; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
243 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
244 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
245 find = gaim_savedstatus_find(title); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
246 if (find && find != edit->saved) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
247 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
248 gaim_notify_error(edit, _("Error"), _("Duplicate title"), |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
249 _("Please enter a different title for the status.")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
250 return; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
251 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
252 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
253 if (edit->saved == 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 edit->saved = gaim_savedstatus_new(title, prim); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
256 gaim_savedstatus_set_message(edit->saved, message); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
257 if (statuses.tree) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
258 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
|
259 gnt_tree_create_row(GNT_TREE(statuses.tree), title, |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
260 gaim_primitive_get_name_from_type(prim), message), NULL); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
261 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
262 else |
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 gaim_savedstatus_set_title(edit->saved, title); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
265 gaim_savedstatus_set_type(edit->saved, prim); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
266 gaim_savedstatus_set_message(edit->saved, message); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
267 if (statuses.tree) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
268 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
269 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
|
270 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
|
271 gaim_primitive_get_name_from_type(prim)); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
272 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
|
273 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
274 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
275 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
276 if (g_object_get_data(G_OBJECT(button), "use")) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
277 gaim_savedstatus_activate(edit->saved); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
278 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
279 gnt_widget_destroy(edit->window); |
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 |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
282 static void |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
283 add_substatus(EditStatus *edit, GaimAccount *account) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
284 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
285 char *name; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
286 const char *type = NULL, *message = NULL; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
287 GaimSavedStatusSub *sub = NULL; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
288 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
289 if (!edit || !edit->tree) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
290 return; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
291 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
292 if (edit->saved) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
293 sub = gaim_savedstatus_get_substatus(edit->saved, account); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
294 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
295 if (sub) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
296 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
297 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
|
298 message = gaim_savedstatus_substatus_get_message(sub); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
299 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
300 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
301 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
|
302 gaim_account_get_protocol_name(account)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
303 gnt_tree_add_choice(GNT_TREE(edit->tree), account, |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
304 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
|
305 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
306 if (sub) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
307 gnt_tree_set_choice(GNT_TREE(edit->tree), account, TRUE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
308 g_free(name); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
309 } |
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 static void |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
312 substatus_window_destroy_cb(GntWidget *window, EditSubStatus *sub) |
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 g_hash_table_remove(sub->parent->hash, sub->account); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
315 g_free(sub); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
316 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
317 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
318 static void |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
319 save_substatus_cb(GntWidget *widget, EditSubStatus *sub) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
320 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
321 GaimSavedStatus *saved = sub->parent->saved; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
322 GaimAccount *account = sub->account; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
323 const char *message; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
324 GaimStatusType *type; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
325 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
326 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
|
327 message = gnt_entry_get_text(GNT_ENTRY(sub->message)); |
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 gaim_savedstatus_set_substatus(saved, account, type, message); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
330 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
331 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
|
332 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
|
333 gaim_status_type_get_name(type)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
334 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
|
335 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
336 gnt_widget_destroy(sub->window); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
337 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
338 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
339 static gboolean |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
340 popup_substatus(GntTree *tree, const char *key, EditStatus *edit) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
341 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
342 if (key[0] == ' ' && key[1] == 0) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
343 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
344 EditSubStatus *sub; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
345 GntWidget *window, *combo, *entry, *box, *button, *l; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
346 GaimSavedStatusSub *substatus = NULL; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
347 const GList *iter; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
348 char *name; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
349 GaimAccount *account = gnt_tree_get_selection_data(tree); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
350 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
351 if (gnt_tree_get_choice(tree, account)) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
352 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
353 /* There was a savedstatus for this account. Now remove it. */ |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
354 gaim_savedstatus_unset_substatus(edit->saved, account); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
355 gnt_tree_change_text(tree, account, 1, NULL); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
356 gnt_tree_change_text(tree, account, 2, NULL); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
357 return FALSE; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
358 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
359 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
360 if (g_hash_table_lookup(edit->hash, account)) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
361 return TRUE; |
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 if (edit->saved) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
364 substatus = gaim_savedstatus_get_substatus(edit->saved, account); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
365 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
366 sub = g_new0(EditSubStatus, 1); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
367 sub->parent = edit; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
368 sub->account = account; |
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 sub->window = window = gnt_vbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
371 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
372 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
|
373 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
374 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
375 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
|
376 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
|
377 gaim_account_get_protocol_name(account)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
378 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
|
379 g_free(name); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
380 gnt_box_add_widget(GNT_BOX(window), box); |
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 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
383 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
|
384 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
|
385 sub->type = combo = gnt_combo_box_new(); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
386 gnt_box_add_widget(GNT_BOX(box), combo); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
387 gnt_box_add_widget(GNT_BOX(window), box); |
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 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
|
390 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
391 GaimStatusType *type = iter->data; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
392 if (!gaim_status_type_is_user_settable(type)) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
393 continue; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
394 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
|
395 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
396 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
397 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
398 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
|
399 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
|
400 gnt_box_add_widget(GNT_BOX(box), entry); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
401 gnt_box_add_widget(GNT_BOX(window), box); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
402 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
403 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
404 button = gnt_button_new(_("Cancel")); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
405 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
|
406 gnt_box_add_widget(GNT_BOX(box), button); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
407 button = gnt_button_new(_("Save")); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
408 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
|
409 gnt_box_add_widget(GNT_BOX(box), button); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
410 gnt_box_add_widget(GNT_BOX(window), box); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
411 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
412 gnt_widget_show(window); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
413 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
414 g_hash_table_insert(edit->hash, account, sub); |
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 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
|
417 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
418 return TRUE; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
419 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
420 return FALSE; |
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 |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
423 void gg_savedstatus_edit(GaimSavedStatus *saved) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
424 { |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
425 EditStatus *edit; |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
426 GntWidget *window, *box, *button, *entry, *combo, *label, *tree; |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
427 GaimStatusPrimitive prims[] = {GAIM_STATUS_AVAILABLE, GAIM_STATUS_AWAY, |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
428 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
|
429 GList *iter; |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
430 int i; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
431 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
432 if (saved) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
433 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
434 GList *iter; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
435 for (iter = edits; iter; iter = iter->next) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
436 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
437 edit = iter->data; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
438 if (edit->saved == saved) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
439 return; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
440 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
441 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
442 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
443 edit = g_new0(EditStatus, 1); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
444 edit->saved = saved; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
445 edit->window = window = gnt_vbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
446 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
447 gnt_box_set_title(GNT_BOX(window), _("Edit Status")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
448 gnt_box_set_fill(GNT_BOX(window), TRUE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
449 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_LEFT); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
450 gnt_box_set_pad(GNT_BOX(window), 0); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
451 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
452 edits = g_list_append(edits, edit); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
453 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
454 /* Title */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
455 box = gnt_hbox_new(FALSE); |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
456 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
|
457 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
458 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
|
459 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
460 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
|
461 gnt_box_add_widget(GNT_BOX(box), entry); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
462 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
463 /* Type */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
464 box = gnt_hbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
465 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
466 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
|
467 gnt_widget_set_size(label, 0, 1); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
468 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
469 edit->type = combo = gnt_combo_box_new(); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
470 gnt_box_add_widget(GNT_BOX(box), combo); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
471 current = saved ? gaim_savedstatus_get_type(saved) : GAIM_STATUS_UNSET; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
472 for (i = 0; prims[i] != GAIM_STATUS_UNSET; i++) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
473 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
474 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
|
475 gaim_primitive_get_name_from_type(prims[i])); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
476 if (prims[i] == current) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
477 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
|
478 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
479 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
480 /* Message */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
481 box = gnt_hbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
482 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
483 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
|
484 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
485 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
|
486 gnt_box_add_widget(GNT_BOX(window), entry); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
487 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
488 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
489 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
|
490 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
491 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
|
492 edit->tree = tree = gnt_tree_new_with_columns(3); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
493 gnt_box_add_widget(GNT_BOX(window), tree); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
494 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
495 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
|
496 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
497 gnt_tree_set_col_width(GNT_TREE(tree), 1, 10); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
498 gnt_tree_set_col_width(GNT_TREE(tree), 2, 30); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
499 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
500 for (iter = gaim_accounts_get_all(); iter; iter = iter->next) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
501 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
502 add_substatus(edit, iter->data); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
503 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
504 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
505 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
|
506 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
507 /* The buttons */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
508 box = gnt_hbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
509 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
510 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
511 /* Save */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
512 button = gnt_button_new(_("Save")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
513 gnt_box_add_widget(GNT_BOX(box), button); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
514 g_object_set_data(G_OBJECT(button), "use", NULL); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
515 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
|
516 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
517 /* Save & Use */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
518 button = gnt_button_new(_("Save & Use")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
519 gnt_box_add_widget(GNT_BOX(box), button); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
520 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
|
521 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
|
522 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
523 /* Cancel */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
524 button = gnt_button_new(_("Cancel")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
525 gnt_box_add_widget(GNT_BOX(box), button); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
526 g_signal_connect_swapped(G_OBJECT(button), "activate", |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
527 G_CALLBACK(gnt_widget_destroy), window); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
528 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
529 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
|
530 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
531 gnt_widget_show(window); |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
532 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
533 |