Thu, 12 Mar 2020 23:04:27 -0500
Remove the old logger which means you can longer read old logs. This is fine since purple3 no longerg uses the share config directory as purple2 and in fact requires the ui to set it. This means old data won't be there.
|
39887
9c8f874c74a0
Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents:
38240
diff
changeset
|
1 | /* |
|
9c8f874c74a0
Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents:
38240
diff
changeset
|
2 | * finch |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
3 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15906
diff
changeset
|
4 | * Finch is the legal property of its developers, whose names are too numerous |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
6 | * source distribution. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
7 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
11 | * (at your option) any later version. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
12 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
16 | * GNU General Public License for more details. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
17 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19554
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14251
diff
changeset
|
21 | */ |
|
39887
9c8f874c74a0
Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents:
38240
diff
changeset
|
22 | |
|
29049
ea3c1e7d47f4
*** Plucked rev ea18c8ce78c0229a5b968aab268f38e9bcae0aee (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents:
27829
diff
changeset
|
23 | #include <internal.h> |
|
ea3c1e7d47f4
*** Plucked rev ea18c8ce78c0229a5b968aab268f38e9bcae0aee (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents:
27829
diff
changeset
|
24 | |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
25 | #include <gnt.h> |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
26 | #include <gntbox.h> |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
27 | #include <gntbutton.h> |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
28 | #include <gntcombobox.h> |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
29 | #include <gntentry.h> |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
30 | #include <gntlabel.h> |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
31 | #include <gntline.h> |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
32 | #include <gnttree.h> |
|
18763
7731e1028071
Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18558
diff
changeset
|
33 | #include <gntutils.h> |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
34 | |
|
18273
e61c53184c52
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18190
diff
changeset
|
35 | #include "finch.h" |
|
e61c53184c52
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18190
diff
changeset
|
36 | |
|
26477
245d9650bb2b
Remove some extra edits that snuck into Finch.
Michael Ruprecht <maiku@pidgin.im>
parents:
22069
diff
changeset
|
37 | #include <notify.h> |
|
245d9650bb2b
Remove some extra edits that snuck into Finch.
Michael Ruprecht <maiku@pidgin.im>
parents:
22069
diff
changeset
|
38 | #include <request.h> |
|
245d9650bb2b
Remove some extra edits that snuck into Finch.
Michael Ruprecht <maiku@pidgin.im>
parents:
22069
diff
changeset
|
39 | |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
40 | #include "gntstatus.h" |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
41 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
42 | static struct |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
43 | { |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
44 | GntWidget *window; |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
45 | GntWidget *tree; |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
46 | } statuses; |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
47 | |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
48 | typedef struct |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
49 | { |
| 15884 | 50 | PurpleSavedStatus *saved; |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
51 | GntWidget *window; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
52 | GntWidget *title; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
53 | GntWidget *type; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
54 | GntWidget *message; |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
55 | GntWidget *tree; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
56 | GHashTable *hash; /* list of windows for substatuses */ |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
57 | } EditStatus; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
58 | |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
59 | typedef struct |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
60 | { |
| 15884 | 61 | PurpleAccount *account; |
| 62 | const PurpleStatusType *type; | |
| 14817 | 63 | char *message; |
| 64 | } RowInfo; | |
| 65 | ||
| 66 | typedef struct | |
| 67 | { | |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
68 | GntWidget *window; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
69 | GntWidget *type; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
70 | GntWidget *message; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
71 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
72 | EditStatus *parent; |
| 14817 | 73 | RowInfo *key; |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
74 | } EditSubStatus; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
75 | |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
76 | static GList *edits; /* List of opened edit-status dialogs */ |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
77 | |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
78 | static void |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
79 | reset_status_window(GntWidget *widget, gpointer null) |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
80 | { |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
81 | statuses.window = NULL; |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
82 | statuses.tree = NULL; |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
83 | } |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
84 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
85 | static void |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
86 | populate_statuses(GntTree *tree) |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
87 | { |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
88 | GList *list; |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
89 | |
| 15884 | 90 | for (list = purple_savedstatuses_get_all(); list; list = list->next) |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
91 | { |
| 15884 | 92 | PurpleSavedStatus *saved = list->data; |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
93 | const char *title, *type, *message; |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
94 | |
| 15884 | 95 | if (purple_savedstatus_is_transient(saved)) |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
96 | continue; |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
97 | |
| 15884 | 98 | title = purple_savedstatus_get_title(saved); |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34449
diff
changeset
|
99 | type = purple_primitive_get_name_from_type(purple_savedstatus_get_primitive_type(saved)); |
| 15884 | 100 | message = purple_savedstatus_get_message(saved); /* XXX: Strip possible markups */ |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
101 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
102 | gnt_tree_add_row_last(tree, saved, |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
103 | gnt_tree_create_row(tree, title, type, message), NULL); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
104 | } |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
105 | } |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
106 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
107 | static void |
| 15884 | 108 | really_delete_status(PurpleSavedStatus *saved) |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
109 | { |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
110 | GList *iter; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
111 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
112 | for (iter = edits; iter; iter = iter->next) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
113 | { |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
114 | EditStatus *edit = iter->data; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
115 | if (edit->saved == saved) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
116 | { |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
117 | gnt_widget_destroy(edit->window); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
118 | break; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
119 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
120 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
121 | |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
122 | if (statuses.tree) |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
123 | gnt_tree_remove(GNT_TREE(statuses.tree), saved); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
124 | |
| 15884 | 125 | purple_savedstatus_delete(purple_savedstatus_get_title(saved)); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
126 | } |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
127 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
128 | static void |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
129 | ask_before_delete(GntWidget *button, gpointer null) |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
130 | { |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
131 | char *ask; |
| 15884 | 132 | PurpleSavedStatus *saved; |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
133 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
134 | g_return_if_fail(statuses.tree != NULL); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
135 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
136 | saved = gnt_tree_get_selection_data(GNT_TREE(statuses.tree)); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
137 | ask = g_strdup_printf(_("Are you sure you want to delete \"%s\""), |
| 15884 | 138 | purple_savedstatus_get_title(saved)); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
139 | |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16255
diff
changeset
|
140 | purple_request_action(saved, _("Delete Status"), ask, NULL, 0, |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
141 | NULL, saved, 2, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16255
diff
changeset
|
142 | _("Delete"), really_delete_status, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16255
diff
changeset
|
143 | _("Cancel"), NULL); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
144 | g_free(ask); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
145 | } |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
146 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
147 | static void |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
148 | use_savedstatus_cb(GntWidget *widget, gpointer null) |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
149 | { |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
150 | g_return_if_fail(statuses.tree != NULL); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
151 | |
| 15884 | 152 | purple_savedstatus_activate(gnt_tree_get_selection_data(GNT_TREE(statuses.tree))); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
153 | } |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
154 | |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
155 | static void |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
156 | edit_savedstatus_cb(GntWidget *widget, gpointer null) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
157 | { |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
158 | g_return_if_fail(statuses.tree != NULL); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
159 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15113
diff
changeset
|
160 | finch_savedstatus_edit(gnt_tree_get_selection_data(GNT_TREE(statuses.tree))); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
161 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
162 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15113
diff
changeset
|
163 | void finch_savedstatus_show_all() |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
164 | { |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
165 | GntWidget *window, *tree, *box, *button; |
|
18558
1a90a2b56443
Resize tree-columns nicely when the tree is resized. We can tell it to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18400
diff
changeset
|
166 | int widths[] = {25, 12, 35}; |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18273
diff
changeset
|
167 | if (statuses.window) { |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18273
diff
changeset
|
168 | gnt_window_present(statuses.window); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
169 | return; |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18273
diff
changeset
|
170 | } |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
171 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
172 | statuses.window = window = gnt_vbox_new(FALSE); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
173 | gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
174 | gnt_box_set_title(GNT_BOX(window), _("Saved Statuses")); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
175 | gnt_box_set_fill(GNT_BOX(window), FALSE); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
176 | gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
177 | gnt_box_set_pad(GNT_BOX(window), 0); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
178 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
179 | /* XXX: Add some sorting function to sort alphabetically, perhaps */ |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
180 | statuses.tree = tree = gnt_tree_new_with_columns(3); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
181 | gnt_tree_set_column_titles(GNT_TREE(tree), _("Title"), _("Type"), _("Message")); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
182 | gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
|
18558
1a90a2b56443
Resize tree-columns nicely when the tree is resized. We can tell it to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18400
diff
changeset
|
183 | gnt_tree_set_column_width_ratio(GNT_TREE(tree), widths); |
|
1a90a2b56443
Resize tree-columns nicely when the tree is resized. We can tell it to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18400
diff
changeset
|
184 | gnt_widget_set_size(tree, 72, 0); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
185 | gnt_box_add_widget(GNT_BOX(window), tree); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
186 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
187 | populate_statuses(GNT_TREE(tree)); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
188 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
189 | box = gnt_hbox_new(FALSE); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
190 | gnt_box_add_widget(GNT_BOX(window), box); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
191 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
192 | button = gnt_button_new(_("Use")); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
193 | gnt_box_add_widget(GNT_BOX(box), button); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
194 | g_signal_connect(G_OBJECT(button), "activate", |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
195 | G_CALLBACK(use_savedstatus_cb), NULL); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
196 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
197 | button = gnt_button_new(_("Add")); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
198 | gnt_box_add_widget(GNT_BOX(box), button); |
|
18763
7731e1028071
Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18558
diff
changeset
|
199 | gnt_util_set_trigger_widget(tree, GNT_KEY_INS, button); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
200 | g_signal_connect_swapped(G_OBJECT(button), "activate", |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15113
diff
changeset
|
201 | G_CALLBACK(finch_savedstatus_edit), NULL); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
202 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
203 | button = gnt_button_new(_("Edit")); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
204 | gnt_box_add_widget(GNT_BOX(box), button); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
205 | g_signal_connect(G_OBJECT(button), "activate", |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
206 | G_CALLBACK(edit_savedstatus_cb), NULL); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
207 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
208 | button = gnt_button_new(_("Delete")); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
209 | gnt_box_add_widget(GNT_BOX(box), button); |
|
18763
7731e1028071
Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18558
diff
changeset
|
210 | gnt_util_set_trigger_widget(tree, GNT_KEY_DEL, button); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
211 | g_signal_connect(G_OBJECT(button), "activate", |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
212 | G_CALLBACK(ask_before_delete), NULL); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
213 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
214 | button = gnt_button_new(_("Close")); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
215 | gnt_box_add_widget(GNT_BOX(box), button); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
216 | g_signal_connect_swapped(G_OBJECT(button), "activate", |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
217 | G_CALLBACK(gnt_widget_destroy), window); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
218 | |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
219 | g_signal_connect(G_OBJECT(window), "destroy", |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
220 | G_CALLBACK(reset_status_window), NULL); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
221 | gnt_widget_show(window); |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
222 | } |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
223 | |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
224 | static void |
| 15884 | 225 | destroy_substatus_win(PurpleAccount *account, EditSubStatus *sub, gpointer null) |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
226 | { |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
227 | gnt_widget_destroy(sub->window); /* the "destroy" callback will remove entry from the hashtable */ |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
228 | } |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
229 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
230 | static void |
| 14817 | 231 | free_key(gpointer key, gpointer n) |
| 232 | { | |
| 233 | RowInfo *row = key; | |
| 234 | g_free(row->message); | |
| 235 | g_free(key); | |
| 236 | } | |
| 237 | ||
| 238 | ||
| 239 | static void | |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
240 | update_edit_list(GntWidget *widget, EditStatus *edit) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
241 | { |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
242 | edits = g_list_remove(edits, edit); |
| 15884 | 243 | purple_notify_close_with_handle(edit); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
244 | g_hash_table_foreach(edit->hash, (GHFunc)destroy_substatus_win, NULL); |
| 14817 | 245 | g_list_foreach((GList*)gnt_tree_get_rows(GNT_TREE(edit->tree)), free_key, NULL); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
246 | g_free(edit); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
247 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
248 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
249 | static void |
| 14817 | 250 | set_substatuses(EditStatus *edit) |
| 251 | { | |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
252 | GList *iter; |
| 14817 | 253 | for (iter = gnt_tree_get_rows(GNT_TREE(edit->tree)); iter; iter = iter->next) { |
| 254 | RowInfo *key = iter->data; | |
| 255 | if (gnt_tree_get_choice(GNT_TREE(edit->tree), key)) { | |
| 15884 | 256 | purple_savedstatus_set_substatus(edit->saved, key->account, key->type, key->message); |
| 14817 | 257 | } |
| 258 | } | |
| 259 | } | |
| 260 | ||
| 261 | ||
| 262 | static void | |
|
14757
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
263 | use_trans_status_cb(GntWidget *button, EditStatus *edit) |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
264 | { |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
265 | const char *message; |
| 15884 | 266 | PurpleStatusPrimitive prim; |
| 267 | PurpleSavedStatus *saved; | |
|
14757
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
268 | |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
269 | message = gnt_entry_get_text(GNT_ENTRY(edit->message)); |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
270 | prim = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(edit->type))); |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
271 | |
| 15884 | 272 | saved = purple_savedstatus_find_transient_by_type_and_message(prim, message); |
|
14757
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
273 | if (saved == NULL) { |
| 15884 | 274 | saved = purple_savedstatus_new(NULL, prim); |
| 14817 | 275 | edit->saved = saved; |
| 276 | set_substatuses(edit); | |
|
14757
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
277 | } |
| 15884 | 278 | purple_savedstatus_set_message(saved, message); |
| 279 | purple_savedstatus_activate(saved); | |
|
14757
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
280 | gnt_widget_destroy(edit->window); |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
281 | } |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
282 | |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
283 | static void |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
284 | save_savedstatus_cb(GntWidget *button, EditStatus *edit) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
285 | { |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
286 | const char *title, *message; |
| 15884 | 287 | PurpleStatusPrimitive prim; |
| 288 | PurpleSavedStatus *find; | |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
289 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
290 | title = gnt_entry_get_text(GNT_ENTRY(edit->title)); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
291 | message = gnt_entry_get_text(GNT_ENTRY(edit->message)); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
292 | if (!message || !*message) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
293 | message = NULL; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
294 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
295 | prim = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(edit->type))); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
296 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
297 | if (!title || !*title) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
298 | { |
| 15884 | 299 | purple_notify_error(edit, _("Error"), _("Invalid title"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
300 | _("Please enter a non-empty title for the status."), NULL); |
|
19554
90d1bbdcf0ed
Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18763
diff
changeset
|
301 | gnt_box_give_focus_to_child(GNT_BOX(edit->window), edit->title); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
302 | return; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
303 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
304 | |
| 15884 | 305 | find = purple_savedstatus_find(title); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
306 | if (find && find != edit->saved) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
307 | { |
| 15884 | 308 | purple_notify_error(edit, _("Error"), _("Duplicate title"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
309 | _("Please enter a different title for the status."), NULL); |
|
19554
90d1bbdcf0ed
Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18763
diff
changeset
|
310 | gnt_box_give_focus_to_child(GNT_BOX(edit->window), edit->title); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
311 | return; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
312 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29049
diff
changeset
|
313 | |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
314 | if (edit->saved == NULL) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
315 | { |
| 15884 | 316 | edit->saved = purple_savedstatus_new(title, prim); |
| 317 | purple_savedstatus_set_message(edit->saved, message); | |
| 14817 | 318 | set_substatuses(edit); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
319 | if (statuses.tree) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
320 | gnt_tree_add_row_last(GNT_TREE(statuses.tree), edit->saved, |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
321 | gnt_tree_create_row(GNT_TREE(statuses.tree), title, |
| 15884 | 322 | purple_primitive_get_name_from_type(prim), message), NULL); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
323 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
324 | else |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
325 | { |
| 15884 | 326 | purple_savedstatus_set_title(edit->saved, title); |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34449
diff
changeset
|
327 | purple_savedstatus_set_primitive_type(edit->saved, prim); |
| 15884 | 328 | purple_savedstatus_set_message(edit->saved, message); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
329 | if (statuses.tree) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
330 | { |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
331 | gnt_tree_change_text(GNT_TREE(statuses.tree), edit->saved, 0, title); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
332 | gnt_tree_change_text(GNT_TREE(statuses.tree), edit->saved, 1, |
| 15884 | 333 | purple_primitive_get_name_from_type(prim)); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
334 | gnt_tree_change_text(GNT_TREE(statuses.tree), edit->saved, 2, message); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
335 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
336 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
337 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
338 | if (g_object_get_data(G_OBJECT(button), "use")) |
| 15884 | 339 | purple_savedstatus_activate(edit->saved); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
340 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
341 | gnt_widget_destroy(edit->window); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
342 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
343 | |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
344 | static void |
| 15884 | 345 | add_substatus(EditStatus *edit, PurpleAccount *account) |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
346 | { |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
347 | char *name; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
348 | const char *type = NULL, *message = NULL; |
| 15884 | 349 | PurpleSavedStatusSub *sub = NULL; |
| 14817 | 350 | RowInfo *key; |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
351 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
352 | if (!edit || !edit->tree) |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
353 | return; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
354 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
355 | if (edit->saved) |
| 15884 | 356 | sub = purple_savedstatus_get_substatus(edit->saved, account); |
| 14817 | 357 | |
| 358 | key = g_new0(RowInfo, 1); | |
| 359 | key->account = account; | |
| 360 | ||
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
361 | if (sub) |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
362 | { |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34449
diff
changeset
|
363 | key->type = purple_savedstatus_substatus_get_status_type(sub); |
| 15884 | 364 | type = purple_status_type_get_name(key->type); |
| 365 | message = purple_savedstatus_substatus_get_message(sub); | |
| 14817 | 366 | key->message = g_strdup(message); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
367 | } |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
368 | |
| 15884 | 369 | name = g_strdup_printf("%s (%s)", purple_account_get_username(account), |
| 370 | purple_account_get_protocol_name(account)); | |
| 14817 | 371 | gnt_tree_add_choice(GNT_TREE(edit->tree), key, |
|
15113
956d8ac87bf6
[gaim-migrate @ 17835]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14817
diff
changeset
|
372 | gnt_tree_create_row(GNT_TREE(edit->tree), |
|
956d8ac87bf6
[gaim-migrate @ 17835]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14817
diff
changeset
|
373 | name, type ? type : "", message ? message : ""), NULL, NULL); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
374 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
375 | if (sub) |
| 14817 | 376 | gnt_tree_set_choice(GNT_TREE(edit->tree), key, TRUE); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
377 | g_free(name); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
378 | } |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
379 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
380 | static void |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
381 | substatus_window_destroy_cb(GntWidget *window, EditSubStatus *sub) |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
382 | { |
| 14817 | 383 | g_hash_table_remove(sub->parent->hash, sub->key->account); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
384 | g_free(sub); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
385 | } |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
386 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
387 | static void |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
388 | save_substatus_cb(GntWidget *widget, EditSubStatus *sub) |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
389 | { |
| 15884 | 390 | PurpleSavedStatus *saved = sub->parent->saved; |
| 14817 | 391 | RowInfo *row = sub->key; |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
392 | const char *message; |
| 15884 | 393 | PurpleStatusType *type; |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
394 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
395 | type = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(sub->type)); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
396 | message = gnt_entry_get_text(GNT_ENTRY(sub->message)); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
397 | |
| 14817 | 398 | row->type = type; |
| 399 | row->message = g_strdup(message); | |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
400 | |
| 14817 | 401 | if (saved) /* Save the substatus if the savedstatus actually exists. */ |
| 15884 | 402 | purple_savedstatus_set_substatus(saved, row->account, type, message); |
| 14817 | 403 | |
| 404 | gnt_tree_set_choice(GNT_TREE(sub->parent->tree), row, TRUE); | |
| 405 | gnt_tree_change_text(GNT_TREE(sub->parent->tree), row, 1, | |
| 15884 | 406 | purple_status_type_get_name(type)); |
| 14817 | 407 | gnt_tree_change_text(GNT_TREE(sub->parent->tree), row, 2, message); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29049
diff
changeset
|
408 | |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
409 | gnt_widget_destroy(sub->window); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
410 | } |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
411 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
412 | static gboolean |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
413 | popup_substatus(GntTree *tree, const char *key, EditStatus *edit) |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
414 | { |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
415 | if (key[0] == ' ' && key[1] == 0) |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
416 | { |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
417 | EditSubStatus *sub; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
418 | GntWidget *window, *combo, *entry, *box, *button, *l; |
| 15884 | 419 | PurpleSavedStatusSub *substatus = NULL; |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
420 | GList *iter; |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
421 | char *name; |
| 14817 | 422 | RowInfo *selected = gnt_tree_get_selection_data(tree); |
| 15884 | 423 | PurpleAccount *account = selected->account; |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
424 | |
| 14817 | 425 | if (gnt_tree_get_choice(tree, selected)) |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
426 | { |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
427 | /* There was a savedstatus for this account. Now remove it. */ |
| 14817 | 428 | g_free(selected->message); |
| 429 | selected->type = NULL; | |
| 430 | selected->message = NULL; | |
| 431 | /* XXX: should we really be saving it right now? */ | |
| 15884 | 432 | purple_savedstatus_unset_substatus(edit->saved, account); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
433 | gnt_tree_change_text(tree, account, 1, NULL); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
434 | gnt_tree_change_text(tree, account, 2, NULL); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
435 | return FALSE; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
436 | } |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
437 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
438 | if (g_hash_table_lookup(edit->hash, account)) |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
439 | return TRUE; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
440 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
441 | if (edit->saved) |
| 15884 | 442 | substatus = purple_savedstatus_get_substatus(edit->saved, account); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
443 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
444 | sub = g_new0(EditSubStatus, 1); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
445 | sub->parent = edit; |
| 14817 | 446 | sub->key = selected; |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
447 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
448 | sub->window = window = gnt_vbox_new(FALSE); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
449 | gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
450 | gnt_box_set_title(GNT_BOX(window), _("Substatus")); /* XXX: a better title */ |
|
19554
90d1bbdcf0ed
Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18763
diff
changeset
|
451 | gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
452 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
453 | box = gnt_hbox_new(FALSE); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
454 | gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Account:"))); |
| 15884 | 455 | name = g_strdup_printf("%s (%s)", purple_account_get_username(account), |
| 456 | purple_account_get_protocol_name(account)); | |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
457 | gnt_box_add_widget(GNT_BOX(box), gnt_label_new(name)); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
458 | g_free(name); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
459 | gnt_box_add_widget(GNT_BOX(window), box); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
460 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
461 | box = gnt_hbox_new(FALSE); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
462 | gnt_box_add_widget(GNT_BOX(box), (l = gnt_label_new(_("Status:")))); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
463 | gnt_widget_set_size(l, 0, 1); /* I don't like having to do this */ |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
464 | sub->type = combo = gnt_combo_box_new(); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
465 | gnt_box_add_widget(GNT_BOX(box), combo); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
466 | gnt_box_add_widget(GNT_BOX(window), box); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
467 | |
| 15884 | 468 | for (iter = purple_account_get_status_types(account); iter; iter = iter->next) |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
469 | { |
| 15884 | 470 | PurpleStatusType *type = iter->data; |
| 471 | if (!purple_status_type_is_user_settable(type)) | |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
472 | continue; |
| 15884 | 473 | gnt_combo_box_add_data(GNT_COMBO_BOX(combo), type, purple_status_type_get_name(type)); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
474 | } |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
475 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
476 | box = gnt_hbox_new(FALSE); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
477 | gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Message:"))); |
| 15884 | 478 | sub->message = entry = gnt_entry_new(substatus ? purple_savedstatus_substatus_get_message(substatus) : NULL); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
479 | gnt_box_add_widget(GNT_BOX(box), entry); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
480 | gnt_box_add_widget(GNT_BOX(window), box); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
481 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
482 | box = gnt_hbox_new(FALSE); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
483 | button = gnt_button_new(_("Cancel")); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
484 | g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), window); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
485 | gnt_box_add_widget(GNT_BOX(box), button); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
486 | button = gnt_button_new(_("Save")); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
487 | g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(save_substatus_cb), sub); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
488 | gnt_box_add_widget(GNT_BOX(box), button); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
489 | gnt_box_add_widget(GNT_BOX(window), box); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
490 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
491 | gnt_widget_show(window); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
492 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
493 | g_hash_table_insert(edit->hash, account, sub); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
494 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
495 | g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(substatus_window_destroy_cb), sub); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
496 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
497 | return TRUE; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
498 | } |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
499 | return FALSE; |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
500 | } |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
501 | |
| 15884 | 502 | void finch_savedstatus_edit(PurpleSavedStatus *saved) |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
503 | { |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
504 | EditStatus *edit; |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
505 | GntWidget *window, *box, *button, *entry, *combo, *label, *tree; |
| 15884 | 506 | PurpleStatusPrimitive prims[] = {PURPLE_STATUS_AVAILABLE, PURPLE_STATUS_AWAY, |
| 507 | PURPLE_STATUS_INVISIBLE, PURPLE_STATUS_OFFLINE, PURPLE_STATUS_UNSET}, current; | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
508 | GList *iter; |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
509 | int i; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
510 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
511 | if (saved) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
512 | { |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
513 | GList *iter; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
514 | for (iter = edits; iter; iter = iter->next) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
515 | { |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
516 | edit = iter->data; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
517 | if (edit->saved == saved) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
518 | return; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
519 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
520 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
521 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
522 | edit = g_new0(EditStatus, 1); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
523 | edit->saved = saved; |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
524 | edit->window = window = gnt_vbox_new(FALSE); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
525 | gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
526 | gnt_box_set_title(GNT_BOX(window), _("Edit Status")); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
527 | gnt_box_set_fill(GNT_BOX(window), TRUE); |
|
19554
90d1bbdcf0ed
Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18763
diff
changeset
|
528 | gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
529 | gnt_box_set_pad(GNT_BOX(window), 0); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
530 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
531 | edits = g_list_append(edits, edit); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
532 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
533 | /* Title */ |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
534 | box = gnt_hbox_new(FALSE); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
535 | gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_LEFT); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
536 | gnt_box_add_widget(GNT_BOX(window), box); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
537 | gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Title"))); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
538 | |
| 15884 | 539 | edit->title = entry = gnt_entry_new(saved ? purple_savedstatus_get_title(saved) : NULL); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
540 | gnt_box_add_widget(GNT_BOX(box), entry); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
541 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
542 | /* Type */ |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
543 | box = gnt_hbox_new(FALSE); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
544 | gnt_box_add_widget(GNT_BOX(window), box); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
545 | gnt_box_add_widget(GNT_BOX(box), label = gnt_label_new(_("Status"))); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
546 | gnt_widget_set_size(label, 0, 1); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
547 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
548 | edit->type = combo = gnt_combo_box_new(); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
549 | gnt_box_add_widget(GNT_BOX(box), combo); |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34449
diff
changeset
|
550 | current = saved ? purple_savedstatus_get_primitive_type(saved) : PURPLE_STATUS_UNSET; |
| 15884 | 551 | for (i = 0; prims[i] != PURPLE_STATUS_UNSET; i++) |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
552 | { |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
553 | gnt_combo_box_add_data(GNT_COMBO_BOX(combo), GINT_TO_POINTER(prims[i]), |
| 15884 | 554 | purple_primitive_get_name_from_type(prims[i])); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
555 | if (prims[i] == current) |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
556 | gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), GINT_TO_POINTER(current)); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
557 | } |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
558 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
559 | /* Message */ |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
560 | box = gnt_hbox_new(FALSE); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
561 | gnt_box_add_widget(GNT_BOX(window), box); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
562 | gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Message"))); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
563 | |
| 15884 | 564 | edit->message = entry = gnt_entry_new(saved ? purple_savedstatus_get_message(saved) : NULL); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
565 | gnt_box_add_widget(GNT_BOX(window), entry); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
566 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
567 | gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); |
|
37863
6143bf4f9cc0
Reword a string in Finch's status creator
Richard Laager <rlaager@pidgin.im>
parents:
31294
diff
changeset
|
568 | gnt_box_add_widget(GNT_BOX(window), gnt_label_new(_("Use a different status for some accounts"))); |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
569 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
570 | edit->hash = g_hash_table_new(g_direct_hash, g_direct_equal); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
571 | edit->tree = tree = gnt_tree_new_with_columns(3); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
572 | gnt_box_add_widget(GNT_BOX(window), tree); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
573 | gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
574 | gnt_tree_set_column_titles(GNT_TREE(tree), _("Account"), _("Status"), _("Message")); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
575 | gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
576 | gnt_tree_set_col_width(GNT_TREE(tree), 1, 10); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
577 | gnt_tree_set_col_width(GNT_TREE(tree), 2, 30); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
578 | |
| 15884 | 579 | for (iter = purple_accounts_get_all(); iter; iter = iter->next) |
|
14251
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
580 | { |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
581 | add_substatus(edit, iter->data); |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
582 | } |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
583 | |
|
25305470c355
[gaim-migrate @ 16853]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14194
diff
changeset
|
584 | g_signal_connect(G_OBJECT(tree), "key_pressed", G_CALLBACK(popup_substatus), edit); |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
585 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
586 | /* The buttons */ |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
587 | box = gnt_hbox_new(FALSE); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
588 | gnt_box_add_widget(GNT_BOX(window), box); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
589 | |
|
14757
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
590 | /* Use */ |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
591 | button = gnt_button_new(_("Use")); |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
592 | gnt_box_add_widget(GNT_BOX(box), button); |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
593 | g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(use_trans_status_cb), edit); |
|
8b8073188289
[gaim-migrate @ 17447]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14620
diff
changeset
|
594 | |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
595 | /* Save */ |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
596 | button = gnt_button_new(_("Save")); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
597 | gnt_box_add_widget(GNT_BOX(box), button); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
598 | g_object_set_data(G_OBJECT(button), "use", NULL); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
599 | g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(save_savedstatus_cb), edit); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
600 | |
| 37868 | 601 | /* Save and Use */ |
| 602 | button = gnt_button_new(_("Save and Use")); | |
|
14194
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
603 | gnt_box_add_widget(GNT_BOX(box), button); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
604 | g_object_set_data(G_OBJECT(button), "use", GINT_TO_POINTER(TRUE)); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
605 | g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(save_savedstatus_cb), edit); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
606 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
607 | /* Cancel */ |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
608 | button = gnt_button_new(_("Cancel")); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
609 | gnt_box_add_widget(GNT_BOX(box), button); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
610 | g_signal_connect_swapped(G_OBJECT(button), "activate", |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
611 | G_CALLBACK(gnt_widget_destroy), window); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
612 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
613 | g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(update_edit_list), edit); |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
614 | |
|
b371a53b1695
[gaim-migrate @ 16774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14188
diff
changeset
|
615 | gnt_widget_show(window); |
|
14188
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
616 | } |
|
cff503f91616
[gaim-migrate @ 16764]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
617 |