Mercurial > pidgin
annotate console/gntstatus.c @ 14298:6e2e9e84b99d
[gaim-migrate @ 16988]
This should fix Luke's crash, and this causes the default colors to be used.
You can enable custom colors from ~/.gntrc by setting "customcolor=1" under
"[general]".
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 23 Aug 2006 01:09:33 +0000 |
parents | 789d80a6b9d9 |
children | 81650a27f253 |
rev | line source |
---|---|
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include <gnt.h> |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 #include <gntbox.h> |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 #include <gntbutton.h> |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
4 #include <gntcombobox.h> |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 #include <gntentry.h> |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 #include <gntlabel.h> |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
7 #include <gntline.h> |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 #include <gnttree.h> |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
10 #include <notify.h> |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 #include <request.h> |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 #include "gntgaim.h" |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 #include "gntstatus.h" |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 static struct |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 GntWidget *window; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 GntWidget *tree; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 } statuses; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
22 typedef struct |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
23 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
24 GaimSavedStatus *saved; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
25 GntWidget *window; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
26 GntWidget *title; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
27 GntWidget *type; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
28 GntWidget *message; |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
29 GntWidget *tree; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
30 GHashTable *hash; /* list of windows for substatuses */ |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
31 } EditStatus; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
32 |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
33 typedef struct |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
34 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
35 GntWidget *window; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
36 GntWidget *type; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
37 GntWidget *message; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
38 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
39 EditStatus *parent; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
40 GaimAccount *account; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
41 } EditSubStatus; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
42 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
43 static GList *edits; /* List of opened edit-status dialogs */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
44 |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 static void |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 reset_status_window(GntWidget *widget, gpointer null) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 statuses.window = NULL; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 statuses.tree = NULL; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 static void |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 populate_statuses(GntTree *tree) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 const GList *list; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 for (list = gaim_savedstatuses_get_all(); list; list = list->next) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 GaimSavedStatus *saved = list->data; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 const char *title, *type, *message; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 if (gaim_savedstatus_is_transient(saved)) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 continue; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 title = gaim_savedstatus_get_title(saved); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 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
|
67 message = gaim_savedstatus_get_message(saved); /* XXX: Strip possible markups */ |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 gnt_tree_add_row_last(tree, saved, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 gnt_tree_create_row(tree, title, type, message), 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 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 static void |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 really_delete_status(GaimSavedStatus *saved) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 { |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
77 GList *iter; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
78 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
79 for (iter = edits; iter; iter = iter->next) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
80 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
81 EditStatus *edit = iter->data; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
82 if (edit->saved == saved) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
83 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
84 gnt_widget_destroy(edit->window); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
85 break; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
86 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
87 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
88 |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 if (statuses.tree) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 gnt_tree_remove(GNT_TREE(statuses.tree), saved); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 gaim_savedstatus_delete(gaim_savedstatus_get_title(saved)); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 static void |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 ask_before_delete(GntWidget *button, gpointer null) |
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 char *ask; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 GaimSavedStatus *saved; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 g_return_if_fail(statuses.tree != NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
103 saved = gnt_tree_get_selection_data(GNT_TREE(statuses.tree)); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 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
|
105 gaim_savedstatus_get_title(saved)); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
106 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 gaim_request_action(saved, _("Delete Status"), ask, NULL, 0, saved, 2, |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 _("Delete"), really_delete_status, _("Cancel"), NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 g_free(ask); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 static void |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 use_savedstatus_cb(GntWidget *widget, gpointer null) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 g_return_if_fail(statuses.tree != NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 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
|
118 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
120 static void |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
121 edit_savedstatus_cb(GntWidget *widget, gpointer null) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
122 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
123 g_return_if_fail(statuses.tree != NULL); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
124 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
125 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
|
126 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
127 |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 void gg_savedstatus_show_all() |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 { |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 GntWidget *window, *tree, *box, *button; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 if (statuses.window) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 return; |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
133 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 statuses.window = window = gnt_vbox_new(FALSE); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
135 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 gnt_box_set_title(GNT_BOX(window), _("Saved Statuses")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 gnt_box_set_fill(GNT_BOX(window), FALSE); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 gnt_box_set_pad(GNT_BOX(window), 0); |
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 /* XXX: Add some sorting function to sort alphabetically, perhaps */ |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 statuses.tree = tree = gnt_tree_new_with_columns(3); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 gnt_tree_set_column_titles(GNT_TREE(tree), _("Title"), _("Type"), _("Message")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 gnt_tree_set_col_width(GNT_TREE(tree), 0, 25); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 gnt_tree_set_col_width(GNT_TREE(tree), 1, 12); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 gnt_tree_set_col_width(GNT_TREE(tree), 2, 35); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 gnt_box_add_widget(GNT_BOX(window), tree); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 populate_statuses(GNT_TREE(tree)); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 box = gnt_hbox_new(FALSE); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
153 gnt_box_add_widget(GNT_BOX(window), box); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 button = gnt_button_new(_("Use")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 gnt_box_add_widget(GNT_BOX(box), button); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 g_signal_connect(G_OBJECT(button), "activate", |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 G_CALLBACK(use_savedstatus_cb), NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
159 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 button = gnt_button_new(_("Add")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 gnt_box_add_widget(GNT_BOX(box), button); |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
162 g_signal_connect_swapped(G_OBJECT(button), "activate", |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
163 G_CALLBACK(gg_savedstatus_edit), NULL); |
14126
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 button = gnt_button_new(_("Edit")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 gnt_box_add_widget(GNT_BOX(box), button); |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
167 g_signal_connect(G_OBJECT(button), "activate", |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
168 G_CALLBACK(edit_savedstatus_cb), NULL); |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
169 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 button = gnt_button_new(_("Delete")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 gnt_box_add_widget(GNT_BOX(box), button); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
172 g_signal_connect(G_OBJECT(button), "activate", |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 G_CALLBACK(ask_before_delete), NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 button = gnt_button_new(_("Close")); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 gnt_box_add_widget(GNT_BOX(box), button); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 g_signal_connect_swapped(G_OBJECT(button), "activate", |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 G_CALLBACK(gnt_widget_destroy), window); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 g_signal_connect(G_OBJECT(window), "destroy", |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 G_CALLBACK(reset_status_window), NULL); |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 gnt_widget_show(window); |
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 |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
185 static void |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
186 destroy_substatus_win(GaimAccount *account, EditSubStatus *sub, gpointer null) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
187 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
188 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
|
189 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
190 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
191 static void |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
192 update_edit_list(GntWidget *widget, EditStatus *edit) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
193 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
194 edits = g_list_remove(edits, edit); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
195 gaim_notify_close_with_handle(edit); |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
196 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
|
197 g_free(edit); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
198 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
199 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
200 static void |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
201 save_savedstatus_cb(GntWidget *button, EditStatus *edit) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
202 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
203 const char *title, *message; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
204 GaimStatusPrimitive prim; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
205 GaimSavedStatus *find; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
206 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
207 title = gnt_entry_get_text(GNT_ENTRY(edit->title)); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
208 message = gnt_entry_get_text(GNT_ENTRY(edit->message)); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
209 if (!message || !*message) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
210 message = NULL; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
211 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
212 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
|
213 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
214 if (!title || !*title) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
215 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
216 gaim_notify_error(edit, _("Error"), _("Invalid title"), |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
217 _("Please enter a non-empty title for the status.")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
218 return; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
219 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
220 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
221 find = gaim_savedstatus_find(title); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
222 if (find && find != edit->saved) |
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 gaim_notify_error(edit, _("Error"), _("Duplicate title"), |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
225 _("Please enter a different title for the status.")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
226 return; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
227 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
228 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
229 if (edit->saved == NULL) |
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 edit->saved = gaim_savedstatus_new(title, prim); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
232 gaim_savedstatus_set_message(edit->saved, message); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
233 if (statuses.tree) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
234 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
|
235 gnt_tree_create_row(GNT_TREE(statuses.tree), title, |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
236 gaim_primitive_get_name_from_type(prim), message), NULL); |
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 else |
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_savedstatus_set_title(edit->saved, title); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
241 gaim_savedstatus_set_type(edit->saved, prim); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
242 gaim_savedstatus_set_message(edit->saved, message); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
243 if (statuses.tree) |
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 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
|
246 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
|
247 gaim_primitive_get_name_from_type(prim)); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
248 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
|
249 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
250 } |
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 if (g_object_get_data(G_OBJECT(button), "use")) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
253 gaim_savedstatus_activate(edit->saved); |
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 gnt_widget_destroy(edit->window); |
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 |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
258 static void |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
259 add_substatus(EditStatus *edit, GaimAccount *account) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
260 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
261 char *name; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
262 const char *type = NULL, *message = NULL; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
263 GaimSavedStatusSub *sub = NULL; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
264 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
265 if (!edit || !edit->tree) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
266 return; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
267 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
268 if (edit->saved) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
269 sub = gaim_savedstatus_get_substatus(edit->saved, account); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
270 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
271 if (sub) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
272 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
273 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
|
274 message = gaim_savedstatus_substatus_get_message(sub); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
275 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
276 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
277 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
|
278 gaim_account_get_protocol_name(account)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
279 gnt_tree_add_choice(GNT_TREE(edit->tree), account, |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
280 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
|
281 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
282 if (sub) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
283 gnt_tree_set_choice(GNT_TREE(edit->tree), account, TRUE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
284 g_free(name); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
285 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
286 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
287 static void |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
288 substatus_window_destroy_cb(GntWidget *window, EditSubStatus *sub) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
289 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
290 g_hash_table_remove(sub->parent->hash, sub->account); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
291 g_free(sub); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
292 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
293 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
294 static void |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
295 save_substatus_cb(GntWidget *widget, EditSubStatus *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 GaimSavedStatus *saved = sub->parent->saved; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
298 GaimAccount *account = sub->account; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
299 const char *message; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
300 GaimStatusType *type; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
301 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
302 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
|
303 message = gnt_entry_get_text(GNT_ENTRY(sub->message)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
304 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
305 gaim_savedstatus_set_substatus(saved, account, type, message); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
306 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
307 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
|
308 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
|
309 gaim_status_type_get_name(type)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
310 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
|
311 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
312 gnt_widget_destroy(sub->window); |
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 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
315 static gboolean |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
316 popup_substatus(GntTree *tree, const char *key, EditStatus *edit) |
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 if (key[0] == ' ' && key[1] == 0) |
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 EditSubStatus *sub; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
321 GntWidget *window, *combo, *entry, *box, *button, *l; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
322 GaimSavedStatusSub *substatus = NULL; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
323 const GList *iter; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
324 char *name; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
325 GaimAccount *account = gnt_tree_get_selection_data(tree); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
326 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
327 if (gnt_tree_get_choice(tree, account)) |
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 /* There was a savedstatus for this account. Now remove it. */ |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
330 gaim_savedstatus_unset_substatus(edit->saved, account); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
331 gnt_tree_change_text(tree, account, 1, NULL); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
332 gnt_tree_change_text(tree, account, 2, NULL); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
333 return FALSE; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
334 } |
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 if (g_hash_table_lookup(edit->hash, account)) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
337 return TRUE; |
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 if (edit->saved) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
340 substatus = gaim_savedstatus_get_substatus(edit->saved, account); |
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 sub = g_new0(EditSubStatus, 1); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
343 sub->parent = edit; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
344 sub->account = account; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
345 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
346 sub->window = window = gnt_vbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
347 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
348 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
|
349 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
350 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
351 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
|
352 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
|
353 gaim_account_get_protocol_name(account)); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
354 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
|
355 g_free(name); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
356 gnt_box_add_widget(GNT_BOX(window), box); |
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 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
359 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
|
360 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
|
361 sub->type = combo = gnt_combo_box_new(); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
362 gnt_box_add_widget(GNT_BOX(box), combo); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
363 gnt_box_add_widget(GNT_BOX(window), box); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
364 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
365 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
|
366 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
367 GaimStatusType *type = iter->data; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
368 if (!gaim_status_type_is_user_settable(type)) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
369 continue; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
370 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
|
371 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
372 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
373 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
374 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
|
375 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
|
376 gnt_box_add_widget(GNT_BOX(box), entry); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
377 gnt_box_add_widget(GNT_BOX(window), box); |
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 box = gnt_hbox_new(FALSE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
380 button = gnt_button_new(_("Cancel")); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
381 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
|
382 gnt_box_add_widget(GNT_BOX(box), button); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
383 button = gnt_button_new(_("Save")); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
384 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
|
385 gnt_box_add_widget(GNT_BOX(box), button); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
386 gnt_box_add_widget(GNT_BOX(window), box); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
387 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
388 gnt_widget_show(window); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
389 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
390 g_hash_table_insert(edit->hash, account, sub); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
391 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
392 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
|
393 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
394 return TRUE; |
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 return FALSE; |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
397 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
398 |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
399 void gg_savedstatus_edit(GaimSavedStatus *saved) |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
400 { |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
401 EditStatus *edit; |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
402 GntWidget *window, *box, *button, *entry, *combo, *label, *tree; |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
403 GaimStatusPrimitive prims[] = {GAIM_STATUS_AVAILABLE, GAIM_STATUS_AWAY, |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
404 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
|
405 GList *iter; |
14132
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
406 int i; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
407 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
408 if (saved) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
409 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
410 GList *iter; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
411 for (iter = edits; iter; iter = iter->next) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
412 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
413 edit = iter->data; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
414 if (edit->saved == saved) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
415 return; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
416 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
417 } |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
418 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
419 edit = g_new0(EditStatus, 1); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
420 edit->saved = saved; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
421 edit->window = window = gnt_vbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
422 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
423 gnt_box_set_title(GNT_BOX(window), _("Edit Status")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
424 gnt_box_set_fill(GNT_BOX(window), TRUE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
425 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_LEFT); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
426 gnt_box_set_pad(GNT_BOX(window), 0); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
427 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
428 edits = g_list_append(edits, edit); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
429 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
430 /* Title */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
431 box = gnt_hbox_new(FALSE); |
14189
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
432 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
|
433 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
434 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
|
435 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
436 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
|
437 gnt_box_add_widget(GNT_BOX(box), entry); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
438 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
439 /* Type */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
440 box = gnt_hbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
441 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
442 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
|
443 gnt_widget_set_size(label, 0, 1); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
444 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
445 edit->type = combo = gnt_combo_box_new(); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
446 gnt_box_add_widget(GNT_BOX(box), combo); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
447 current = saved ? gaim_savedstatus_get_type(saved) : GAIM_STATUS_UNSET; |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
448 for (i = 0; prims[i] != GAIM_STATUS_UNSET; i++) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
449 { |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
450 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
|
451 gaim_primitive_get_name_from_type(prims[i])); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
452 if (prims[i] == current) |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
453 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
|
454 } |
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 /* Message */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
457 box = gnt_hbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
458 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
459 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
|
460 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
461 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
|
462 gnt_box_add_widget(GNT_BOX(window), entry); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
463 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
464 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
465 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
|
466 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
467 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
|
468 edit->tree = tree = gnt_tree_new_with_columns(3); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
469 gnt_box_add_widget(GNT_BOX(window), tree); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
470 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
471 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
|
472 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
473 gnt_tree_set_col_width(GNT_TREE(tree), 1, 10); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
474 gnt_tree_set_col_width(GNT_TREE(tree), 2, 30); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
475 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
476 for (iter = gaim_accounts_get_all(); iter; iter = iter->next) |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
477 { |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
478 add_substatus(edit, iter->data); |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
479 } |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
480 |
789d80a6b9d9
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14132
diff
changeset
|
481 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
|
482 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
483 /* The buttons */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
484 box = gnt_hbox_new(FALSE); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
485 gnt_box_add_widget(GNT_BOX(window), box); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
486 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
487 /* Save */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
488 button = gnt_button_new(_("Save")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
489 gnt_box_add_widget(GNT_BOX(box), button); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
490 g_object_set_data(G_OBJECT(button), "use", NULL); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
491 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
|
492 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
493 /* Save & Use */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
494 button = gnt_button_new(_("Save & Use")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
495 gnt_box_add_widget(GNT_BOX(box), button); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
496 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
|
497 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
|
498 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
499 /* Cancel */ |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
500 button = gnt_button_new(_("Cancel")); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
501 gnt_box_add_widget(GNT_BOX(box), button); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
502 g_signal_connect_swapped(G_OBJECT(button), "activate", |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
503 G_CALLBACK(gnt_widget_destroy), window); |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
504 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
505 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
|
506 |
2c85b0f97dd0
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14126
diff
changeset
|
507 gnt_widget_show(window); |
14126
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
508 } |
b71bfeaaed58
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
509 |