Sat, 22 Sep 2007 20:55:11 +0000
Re-worked gtklog functions and perl bindings
| 7432 | 1 | /** |
| 2 | * @file gtklog.c GTK+ Log viewer | |
|
16254
eeb2bba4dc94
Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents:
15931
diff
changeset
|
3 | * @ingroup pidgin |
|
20330
650a7af9c238
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
650a7af9c238
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
650a7af9c238
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* pidgin |
| 7432 | 7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
8 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
|
7537
4c3be2f554b1
[gaim-migrate @ 8150]
Christian Hammond <chipx86@chipx86.com>
parents:
7535
diff
changeset
|
11 | * |
| 7432 | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * 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:
18743
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 7432 | 25 | */ |
| 9791 | 26 | #include "internal.h" |
| 15577 | 27 | #include "pidgin.h" |
| 7432 | 28 | |
| 29 | #include "account.h" | |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
30 | #include "debug.h" |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
31 | #include "log.h" |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
32 | #include "notify.h" |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
33 | #include "request.h" |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
34 | #include "util.h" |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
35 | |
|
15883
969b74a3e27a
According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@pidgin.im>
parents:
15882
diff
changeset
|
36 | #include "pidginstock.h" |
| 7432 | 37 | #include "gtkblist.h" |
| 38 | #include "gtkimhtml.h" | |
| 39 | #include "gtklog.h" | |
| 40 | #include "gtkutils.h" | |
| 41 | ||
| 42 | static GHashTable *log_viewers = NULL; | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
43 | static void populate_log_tree(PidginLogViewer *lv); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
44 | static PidginLogViewer *syslog_viewer = NULL; |
| 7432 | 45 | |
| 46 | struct log_viewer_hash_t { | |
| 15884 | 47 | PurpleLogType type; |
| 7432 | 48 | char *screenname; |
| 15884 | 49 | PurpleAccount *account; |
| 50 | PurpleContact *contact; | |
| 7432 | 51 | }; |
| 52 | ||
| 7440 | 53 | static guint log_viewer_hash(gconstpointer data) |
| 7432 | 54 | { |
| 7440 | 55 | const struct log_viewer_hash_t *viewer = data; |
| 56 | ||
| 10663 | 57 | if (viewer->contact != NULL) |
| 58 | return g_direct_hash(viewer->contact); | |
| 59 | ||
| 60 | return g_str_hash(viewer->screenname) + | |
| 15884 | 61 | g_str_hash(purple_account_get_username(viewer->account)); |
| 7432 | 62 | } |
| 63 | ||
| 10663 | 64 | static gboolean log_viewer_equal(gconstpointer y, gconstpointer z) |
| 7432 | 65 | { |
| 7440 | 66 | const struct log_viewer_hash_t *a, *b; |
| 7432 | 67 | int ret; |
| 7440 | 68 | char *normal; |
| 69 | ||
| 70 | a = y; | |
| 71 | b = z; | |
| 72 | ||
| 10663 | 73 | if (a->contact != NULL) { |
| 74 | if (b->contact != NULL) | |
| 75 | return (a->contact == b->contact); | |
| 76 | else | |
| 77 | return FALSE; | |
| 78 | } else { | |
| 79 | if (b->contact != NULL) | |
| 80 | return FALSE; | |
| 81 | } | |
| 82 | ||
| 15884 | 83 | normal = g_strdup(purple_normalize(a->account, a->screenname)); |
| 7440 | 84 | ret = (a->account == b->account) && |
| 15884 | 85 | !strcmp(normal, purple_normalize(b->account, b->screenname)); |
| 7432 | 86 | g_free(normal); |
| 10663 | 87 | |
| 7432 | 88 | return ret; |
| 89 | } | |
| 90 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
91 | static void select_first_log(PidginLogViewer *lv) |
|
13569
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
92 | { |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
93 | GtkTreeModel *model; |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
94 | GtkTreeIter iter, it; |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
95 | GtkTreePath *path; |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
96 | |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
97 | model = GTK_TREE_MODEL(lv->treestore); |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
98 | |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
99 | if (!gtk_tree_model_get_iter_first(model, &iter)) |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
100 | return; |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
101 | |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
102 | path = gtk_tree_model_get_path(model, &iter); |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
103 | if (gtk_tree_model_iter_children(model, &it, &iter)) |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
104 | { |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
105 | gtk_tree_view_expand_row(GTK_TREE_VIEW(lv->treeview), path, TRUE); |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
106 | path = gtk_tree_model_get_path(model, &it); |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
107 | } |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
108 | |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
109 | gtk_tree_selection_select_path(gtk_tree_view_get_selection(GTK_TREE_VIEW(lv->treeview)), path); |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
110 | |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
111 | gtk_tree_path_free(path); |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
112 | } |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
113 | |
| 15884 | 114 | static const char *log_get_date(PurpleLog *log) |
|
15060
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
115 | { |
|
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
116 | if (log->tm) |
| 15884 | 117 | return purple_date_format_full(log->tm); |
|
15060
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
118 | else |
| 15884 | 119 | return purple_date_format_full(localtime(&log->time)); |
|
15060
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
120 | } |
|
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
121 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
122 | static void search_cb(GtkWidget *button, PidginLogViewer *lv) |
| 7535 | 123 | { |
| 124 | const char *search_term = gtk_entry_get_text(GTK_ENTRY(lv->entry)); | |
| 125 | GList *logs; | |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
126 | |
|
12232
857f087ec86b
[gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents:
11869
diff
changeset
|
127 | if (!(*search_term)) { |
|
857f087ec86b
[gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents:
11869
diff
changeset
|
128 | /* reset the tree */ |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
129 | gtk_tree_store_clear(lv->treestore); |
| 7535 | 130 | populate_log_tree(lv); |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
131 | g_free(lv->search); |
| 7535 | 132 | lv->search = NULL; |
|
7537
4c3be2f554b1
[gaim-migrate @ 8150]
Christian Hammond <chipx86@chipx86.com>
parents:
7535
diff
changeset
|
133 | gtk_imhtml_search_clear(GTK_IMHTML(lv->imhtml)); |
|
13569
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
134 | select_first_log(lv); |
| 7535 | 135 | return; |
| 136 | } | |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
137 | |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
138 | if (lv->search != NULL && !strcmp(lv->search, search_term)) |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
139 | { |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
140 | /* Searching for the same term acts as "Find Next" */ |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
141 | gtk_imhtml_search_find(GTK_IMHTML(lv->imhtml), lv->search); |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
142 | return; |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
143 | } |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
144 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
145 | pidgin_set_cursor(lv->window, GDK_WATCH); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
146 | |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
147 | g_free(lv->search); |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
148 | lv->search = g_strdup(search_term); |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
149 | |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
150 | gtk_tree_store_clear(lv->treestore); |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
151 | gtk_imhtml_clear(GTK_IMHTML(lv->imhtml)); |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
152 | |
| 7535 | 153 | for (logs = lv->logs; logs != NULL; logs = logs->next) { |
| 15884 | 154 | char *read = purple_log_read((PurpleLog*)logs->data, NULL); |
| 155 | if (read && *read && purple_strcasestr(read, search_term)) { | |
| 7535 | 156 | GtkTreeIter iter; |
| 15884 | 157 | PurpleLog *log = logs->data; |
|
12232
857f087ec86b
[gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents:
11869
diff
changeset
|
158 | |
| 7535 | 159 | gtk_tree_store_append (lv->treestore, &iter, NULL); |
| 160 | gtk_tree_store_set(lv->treestore, &iter, | |
|
15060
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
161 | 0, log_get_date(log), |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
162 | 1, log, -1); |
| 7535 | 163 | } |
|
10574
5abb2931b6ff
[gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10181
diff
changeset
|
164 | g_free(read); |
| 7535 | 165 | } |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
166 | |
|
13569
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
167 | select_first_log(lv); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
168 | pidgin_clear_cursor(lv->window); |
| 7535 | 169 | } |
| 170 | ||
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
171 | static void destroy_cb(GtkWidget *w, gint resp, struct log_viewer_hash_t *ht) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
172 | PidginLogViewer *lv = syslog_viewer; |
|
7454
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
173 | |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
174 | #ifdef _WIN32 |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
175 | if (resp == GTK_RESPONSE_HELP) { |
|
18743
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
176 | GtkTreeSelection *sel; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
177 | GtkTreeIter iter; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
178 | GtkTreeModel *model; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
179 | PurpleLog *log = NULL; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
180 | char *logdir; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
181 | |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
182 | if (ht != NULL) |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
183 | lv = g_hash_table_lookup(log_viewers, ht); |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
184 | model = GTK_TREE_MODEL(lv->treestore); |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
185 | |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
186 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(lv->treeview)); |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
187 | if (gtk_tree_selection_get_selected(sel, &model, &iter)) { |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
188 | GValue val; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
189 | |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
190 | val.g_type = 0; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
191 | gtk_tree_model_get_value (model, &iter, 1, &val); |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
192 | log = g_value_get_pointer(&val); |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
193 | g_value_unset(&val); |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
194 | } |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
195 | |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
196 | |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
197 | if (log == NULL) |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
198 | logdir = g_build_filename(purple_user_dir(), "logs", NULL); |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
199 | else |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
200 | logdir = purple_log_get_log_dir(log->type, log->name, log->account); |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
201 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15568
diff
changeset
|
202 | winpidgin_shell_execute(logdir, "explore", NULL); |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
203 | g_free(logdir); |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
204 | return; |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
205 | } |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
206 | #endif |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
207 | |
| 10663 | 208 | if (ht != NULL) { |
| 8573 | 209 | lv = g_hash_table_lookup(log_viewers, ht); |
| 210 | g_hash_table_remove(log_viewers, ht); | |
| 10663 | 211 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13569
diff
changeset
|
212 | g_free(ht->screenname); |
| 8573 | 213 | g_free(ht); |
| 214 | } else | |
| 215 | syslog_viewer = NULL; | |
| 216 | ||
| 15884 | 217 | purple_request_close_with_handle(lv); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
218 | |
| 15884 | 219 | g_list_foreach(lv->logs, (GFunc)purple_log_free, NULL); |
|
13569
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
220 | g_list_free(lv->logs); |
| 10663 | 221 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13569
diff
changeset
|
222 | g_free(lv->search); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13569
diff
changeset
|
223 | g_free(lv); |
| 10663 | 224 | |
|
7454
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
225 | gtk_widget_destroy(w); |
|
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
226 | } |
|
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
227 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
228 | static void log_row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *col, PidginLogViewer *viewer) { |
| 10663 | 229 | if (gtk_tree_view_row_expanded(tv, path)) |
| 230 | gtk_tree_view_collapse_row(tv, path); | |
| 231 | else | |
| 232 | gtk_tree_view_expand_row(tv, path, FALSE); | |
| 8573 | 233 | } |
| 10663 | 234 | |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
235 | static void delete_log_cleanup_cb(gpointer *data) |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
236 | { |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
237 | g_free(data[1]); /* iter */ |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
238 | g_free(data); |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
239 | } |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
240 | |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
241 | static void delete_log_cb(gpointer *data) |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
242 | { |
| 15884 | 243 | if (!purple_log_delete((PurpleLog *)data[2])) |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
244 | { |
| 15884 | 245 | purple_notify_error(NULL, NULL, "Log Deletion Failed", |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
246 | "Check permissions and try again."); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
247 | } |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
248 | else |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
249 | { |
|
15613
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
250 | GtkTreeStore *treestore = data[0]; |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
251 | GtkTreeIter *iter = (GtkTreeIter *)data[1]; |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
252 | GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), iter); |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
253 | gboolean first = !gtk_tree_path_prev(path); |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
254 | |
| 16293 | 255 | #if GTK_CHECK_VERSION(2,2,0) |
|
15613
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
256 | if (!gtk_tree_store_remove(treestore, iter) && first) |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
257 | { |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
258 | /* iter was the last child at its level */ |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
259 | |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
260 | if (gtk_tree_path_up(path)) |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
261 | { |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
262 | gtk_tree_model_get_iter(GTK_TREE_MODEL(treestore), iter, path); |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
263 | gtk_tree_store_remove(treestore, iter); |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
264 | } |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
265 | } |
|
9a6ec23fe078
If you delete the last log for a month, delete the month header as well.
Richard Laager <rlaager@pidgin.im>
parents:
15612
diff
changeset
|
266 | gtk_tree_path_free(path); |
| 16293 | 267 | #else |
| 268 | gtk_tree_store_remove(treestore, iter); | |
| 269 | gtk_tree_path_free(path); | |
| 270 | #endif | |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
271 | } |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
272 | |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
273 | delete_log_cleanup_cb(data); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
274 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
275 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
276 | static void log_delete_log_cb(GtkWidget *menuitem, gpointer *data) |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
277 | { |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
278 | PidginLogViewer *lv = data[0]; |
| 15884 | 279 | PurpleLog *log = data[1]; |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
280 | const char *time = log_get_date(log); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
281 | const char *name; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
282 | char *tmp; |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
283 | gpointer *data2; |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
284 | |
| 15884 | 285 | if (log->type == PURPLE_LOG_IM) |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
286 | { |
| 15884 | 287 | PurpleBuddy *buddy = purple_find_buddy(log->account, log->name); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
288 | if (buddy != NULL) |
| 15884 | 289 | name = purple_buddy_get_contact_alias(buddy); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
290 | else |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
291 | name = log->name; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
292 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
293 | tmp = g_strdup_printf(_("Are you sure you want to permanently delete the log of the " |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
294 | "conversation with %s which started at %s?"), name, time); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
295 | } |
| 15884 | 296 | else if (log->type == PURPLE_LOG_CHAT) |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
297 | { |
| 15884 | 298 | PurpleChat *chat = purple_blist_find_chat(log->account, log->name); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
299 | if (chat != NULL) |
| 15884 | 300 | name = purple_chat_get_name(chat); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
301 | else |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
302 | name = log->name; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
303 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
304 | tmp = g_strdup_printf(_("Are you sure you want to permanently delete the log of the " |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
305 | "conversation in %s which started at %s?"), name, time); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
306 | } |
| 15884 | 307 | else if (log->type == PURPLE_LOG_SYSTEM) |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
308 | { |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
309 | tmp = g_strdup_printf(_("Are you sure you want to permanently delete the system log " |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
310 | "which started at %s?"), time); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
311 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
312 | else |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
313 | g_return_if_reached(); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
314 | |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
315 | /* The only way to free data in all cases is to tie it to the menuitem with |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
316 | * g_object_set_data_full(). But, since we need to get some data down to |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
317 | * delete_log_cb() to delete the log from the log viewer after the file is |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
318 | * deleted, we have to allocate a new data array and make sure it gets freed |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
319 | * either way. */ |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
320 | data2 = g_new(gpointer, 3); |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
321 | data2[0] = lv->treestore; |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
322 | data2[1] = data[3]; /* iter */ |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
323 | data2[2] = log; |
|
20685
039aef89faf6
Updated hinting to be less invasive
Gabriel Schulhof <nix@go-nix.ca>
parents:
20684
diff
changeset
|
324 | purple_request_action_with_hint(lv, NULL, "Delete Log?", tmp, 0, |
|
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:
16478
diff
changeset
|
325 | NULL, NULL, NULL, |
|
19300
c55fa83a55ea
Finished implem in gtkrequest.c
Gabriel Schulhof <nix@go-nix.ca>
parents:
19292
diff
changeset
|
326 | "log_viewer", data2, 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:
16478
diff
changeset
|
327 | _("Delete"), delete_log_cb, |
|
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:
16478
diff
changeset
|
328 | _("Cancel"), delete_log_cleanup_cb); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
329 | g_free(tmp); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
330 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
331 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
332 | static void log_show_popup_menu(GtkWidget *treeview, GdkEventButton *event, gpointer *data) |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
333 | { |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
334 | GtkWidget *menu = gtk_menu_new(); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
335 | GtkWidget *menuitem = gtk_menu_item_new_with_label("Delete Log..."); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
336 | |
| 15884 | 337 | if (!purple_log_is_deletable((PurpleLog *)data[1])) |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
338 | gtk_widget_set_sensitive(menuitem, FALSE); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
339 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
340 | g_signal_connect(menuitem, "activate", G_CALLBACK(log_delete_log_cb), data); |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
341 | g_object_set_data_full(G_OBJECT(menuitem), "log-viewer-data", data, g_free); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
342 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
343 | gtk_widget_show_all(menu); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
344 | |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
345 | gtk_menu_popup(GTK_MENU(menu), NULL, NULL, (GtkMenuPositionFunc)data[2], NULL, |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
346 | (event != NULL) ? event->button : 0, |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
347 | gdk_event_get_time((GdkEvent *)event)); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
348 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
349 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
350 | static gboolean log_button_press_cb(GtkWidget *treeview, GdkEventButton *event, PidginLogViewer *lv) |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
351 | { |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
352 | if (event->type == GDK_BUTTON_PRESS && event->button == 3) |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
353 | { |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
354 | GtkTreePath *path; |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
355 | GtkTreeIter *iter; |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
356 | GValue val; |
| 15884 | 357 | PurpleLog *log; |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
358 | gpointer *data; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
359 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
360 | if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview), event->x, event->y, &path, NULL, NULL, NULL)) |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
361 | return FALSE; |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
362 | iter = g_new(GtkTreeIter, 1); |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
363 | gtk_tree_model_get_iter(GTK_TREE_MODEL(lv->treestore), iter, path); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
364 | val.g_type = 0; |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
365 | gtk_tree_model_get_value(GTK_TREE_MODEL(lv->treestore), iter, 1, &val); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
366 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
367 | log = g_value_get_pointer(&val); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
368 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
369 | if (log == NULL) |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
370 | { |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
371 | g_free(iter); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
372 | return FALSE; |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
373 | } |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
374 | |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
375 | data = g_new(gpointer, 4); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
376 | data[0] = lv; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
377 | data[1] = log; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
378 | data[2] = NULL; |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
379 | data[3] = iter; |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
380 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
381 | log_show_popup_menu(treeview, event, data); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
382 | return TRUE; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
383 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
384 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
385 | return FALSE; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
386 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
387 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
388 | static gboolean log_popup_menu_cb(GtkWidget *treeview, PidginLogViewer *lv) |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
389 | { |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
390 | GtkTreeSelection *sel; |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
391 | GtkTreeIter *iter; |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
392 | GValue val; |
| 15884 | 393 | PurpleLog *log; |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
394 | gpointer *data; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
395 | |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
396 | iter = g_new(GtkTreeIter, 1); |
|
18743
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
397 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(lv->treeview)); |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
398 | if (!gtk_tree_selection_get_selected(sel, NULL, iter)) |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
399 | { |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
400 | return FALSE; |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
401 | } |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
402 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
403 | val.g_type = 0; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
404 | gtk_tree_model_get_value(GTK_TREE_MODEL(lv->treestore), |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
405 | iter, NODE_COLUMN, &val); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
406 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
407 | log = g_value_get_pointer(&val); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
408 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
409 | if (log == NULL) |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
410 | return FALSE; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
411 | |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
412 | data = g_new(gpointer, 4); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
413 | data[0] = lv; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
414 | data[1] = log; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
415 | data[2] = pidgin_treeview_popup_menu_position_func; |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
416 | data[3] = iter; |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
417 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
418 | log_show_popup_menu(treeview, NULL, data); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
419 | return TRUE; |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
420 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
421 | |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
422 | static gboolean search_find_cb(gpointer data) |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
423 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
424 | PidginLogViewer *viewer = data; |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
425 | gtk_imhtml_search_find(GTK_IMHTML(viewer->imhtml), viewer->search); |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
426 | return FALSE; |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
427 | } |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
428 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
429 | static void log_select_cb(GtkTreeSelection *sel, PidginLogViewer *viewer) { |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
430 | GtkTreeIter iter; |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12232
diff
changeset
|
431 | GValue val; |
| 7432 | 432 | GtkTreeModel *model = GTK_TREE_MODEL(viewer->treestore); |
| 15884 | 433 | PurpleLog *log = NULL; |
| 434 | PurpleLogReadFlags flags; | |
| 7432 | 435 | char *read = NULL; |
| 436 | ||
| 10663 | 437 | if (!gtk_tree_selection_get_selected(sel, &model, &iter)) |
| 7432 | 438 | return; |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12232
diff
changeset
|
439 | |
|
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12232
diff
changeset
|
440 | val.g_type = 0; |
| 7432 | 441 | gtk_tree_model_get_value (model, &iter, 1, &val); |
| 442 | log = g_value_get_pointer(&val); | |
| 443 | g_value_unset(&val); | |
| 444 | ||
| 10663 | 445 | if (log == NULL) |
| 7432 | 446 | return; |
| 447 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
448 | pidgin_set_cursor(viewer->window, GDK_WATCH); |
|
12232
857f087ec86b
[gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents:
11869
diff
changeset
|
449 | |
| 15884 | 450 | if (log->type != PURPLE_LOG_SYSTEM) { |
| 10663 | 451 | char *title; |
| 15884 | 452 | if (log->type == PURPLE_LOG_CHAT) |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
453 | title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation in %s on %s</span>"), |
|
15060
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
454 | log->name, log_get_date(log)); |
| 10663 | 455 | else |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
456 | title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation with %s on %s</span>"), |
|
15060
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
457 | log->name, log_get_date(log)); |
| 10663 | 458 | |
| 459 | gtk_label_set_markup(GTK_LABEL(viewer->label), title); | |
| 460 | g_free(title); | |
| 461 | } | |
| 462 | ||
| 15884 | 463 | read = purple_log_read(log, &flags); |
| 7432 | 464 | viewer->flags = flags; |
| 10663 | 465 | |
| 7432 | 466 | gtk_imhtml_clear(GTK_IMHTML(viewer->imhtml)); |
|
10645
f00e65bebc8b
[gaim-migrate @ 12157]
Richard Laager <rlaager@pidgin.im>
parents:
10636
diff
changeset
|
467 | gtk_imhtml_set_protocol_name(GTK_IMHTML(viewer->imhtml), |
| 15884 | 468 | purple_account_get_protocol_name(log->account)); |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
469 | |
| 15884 | 470 | purple_signal_emit(pidgin_log_get_handle(), "log-displaying", viewer, log); |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
471 | |
|
10574
5abb2931b6ff
[gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10181
diff
changeset
|
472 | gtk_imhtml_append_text(GTK_IMHTML(viewer->imhtml), read, |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
473 | GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL | |
| 15884 | 474 | ((flags & PURPLE_LOG_READ_NO_NEWLINE) ? GTK_IMHTML_NO_NEWLINE : 0)); |
|
12232
857f087ec86b
[gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents:
11869
diff
changeset
|
475 | g_free(read); |
| 7535 | 476 | |
| 10663 | 477 | if (viewer->search != NULL) { |
|
10574
5abb2931b6ff
[gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10181
diff
changeset
|
478 | gtk_imhtml_search_clear(GTK_IMHTML(viewer->imhtml)); |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
479 | g_idle_add(search_find_cb, viewer); |
|
10574
5abb2931b6ff
[gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10181
diff
changeset
|
480 | } |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
481 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
482 | pidgin_clear_cursor(viewer->window); |
| 7432 | 483 | } |
| 484 | ||
| 485 | /* I want to make this smarter, but haven't come up with a cool algorithm to do so, yet. | |
| 486 | * I want the tree to be divided into groups like "Today," "Yesterday," "Last week," | |
| 487 | * "August," "2002," etc. based on how many conversation took place in each subdivision. | |
| 488 | * | |
| 489 | * For now, I'll just make it a flat list. | |
| 490 | */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
491 | static void populate_log_tree(PidginLogViewer *lv) |
| 11585 | 492 | /* Logs are made from trees in real life. |
| 7432 | 493 | This is a tree made from logs */ |
| 494 | { | |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
495 | const char *month; |
| 10663 | 496 | char prev_top_month[30] = ""; |
| 9435 | 497 | GtkTreeIter toplevel, child; |
| 7432 | 498 | GList *logs = lv->logs; |
| 10663 | 499 | |
| 500 | while (logs != NULL) { | |
| 15884 | 501 | PurpleLog *log = logs->data; |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
502 | |
| 15884 | 503 | month = purple_utf8_strftime(_("%B %Y"), |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
504 | log->tm ? log->tm : localtime(&log->time)); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
505 | |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
506 | if (strcmp(month, prev_top_month) != 0) |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
507 | { |
| 9435 | 508 | /* top level */ |
| 509 | gtk_tree_store_append(lv->treestore, &toplevel, NULL); | |
| 510 | gtk_tree_store_set(lv->treestore, &toplevel, 0, month, 1, NULL, -1); | |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
511 | |
|
10680
e4a00ce2fc35
[gaim-migrate @ 12226]
Richard Laager <rlaager@pidgin.im>
parents:
10669
diff
changeset
|
512 | strncpy(prev_top_month, month, sizeof(prev_top_month)); |
|
e4a00ce2fc35
[gaim-migrate @ 12226]
Richard Laager <rlaager@pidgin.im>
parents:
10669
diff
changeset
|
513 | } |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
514 | |
|
10680
e4a00ce2fc35
[gaim-migrate @ 12226]
Richard Laager <rlaager@pidgin.im>
parents:
10669
diff
changeset
|
515 | /* sub */ |
|
e4a00ce2fc35
[gaim-migrate @ 12226]
Richard Laager <rlaager@pidgin.im>
parents:
10669
diff
changeset
|
516 | gtk_tree_store_append(lv->treestore, &child, &toplevel); |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
517 | gtk_tree_store_set(lv->treestore, &child, |
|
15060
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
518 | 0, log_get_date(log), |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
519 | 1, log, |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
520 | -1); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
521 | |
| 7432 | 522 | logs = logs->next; |
| 523 | } | |
| 524 | } | |
| 525 | ||
| 19304 | 526 | static PidginLogViewer *display_log_viewer(GtkWindow *parent, struct log_viewer_hash_t *ht, GList *logs, |
|
15639
4d29fa62453d
Use person icon for Person log viewer
Sean Egan <seanegan@pidgin.im>
parents:
15613
diff
changeset
|
527 | const char *title, GtkWidget *icon, int log_size) |
| 10663 | 528 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
529 | PidginLogViewer *lv; |
| 10663 | 530 | GtkWidget *title_box; |
| 531 | char *text; | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
532 | GtkWidget *pane; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
533 | GtkWidget *sw; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
534 | GtkCellRenderer *rend; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
535 | GtkTreeViewColumn *col; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
536 | GtkTreeSelection *sel; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
537 | GtkWidget *vbox; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
538 | GtkWidget *frame; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
539 | GtkWidget *hbox; |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
540 | GtkWidget *find_button; |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
541 | GtkWidget *size_label; |
| 7432 | 542 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
543 | if (logs == NULL) |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
544 | { |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
545 | /* No logs were found. */ |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
546 | const char *log_preferences = NULL; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
547 | |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
548 | if (ht == NULL) { |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16293
diff
changeset
|
549 | if (!purple_prefs_get_bool("/purple/logging/log_system")) |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
550 | log_preferences = _("System events will only be logged if the \"Log all status changes to system log\" preference is enabled."); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
551 | } else { |
| 15884 | 552 | if (ht->type == PURPLE_LOG_IM) { |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16293
diff
changeset
|
553 | if (!purple_prefs_get_bool("/purple/logging/log_ims")) |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
554 | log_preferences = _("Instant messages will only be logged if the \"Log all instant messages\" preference is enabled."); |
| 15884 | 555 | } else if (ht->type == PURPLE_LOG_CHAT) { |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16293
diff
changeset
|
556 | if (!purple_prefs_get_bool("/purple/logging/log_chats")) |
|
11869
e77f2f29b09d
[gaim-migrate @ 14160]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11780
diff
changeset
|
557 | log_preferences = _("Chats will only be logged if the \"Log all chats\" preference is enabled."); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
558 | } |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
559 | } |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
560 | |
| 15884 | 561 | purple_notify_info(NULL, title, _("No logs were found"), log_preferences); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
562 | return NULL; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
563 | } |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
564 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
565 | lv = g_new0(PidginLogViewer, 1); |
|
13569
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
566 | lv->logs = logs; |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
567 | |
| 10663 | 568 | if (ht != NULL) |
| 569 | g_hash_table_insert(log_viewers, ht, lv); | |
| 7432 | 570 | |
| 571 | /* Window ***********/ | |
| 19304 | 572 | lv->window = gtk_dialog_new_with_buttons(title, parent, 0, |
| 7432 | 573 | GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
574 | #ifdef _WIN32 |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
575 | /* Steal the "HELP" response and use it to trigger browsing to the logs folder */ |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
576 | gtk_dialog_add_button(GTK_DIALOG(lv->window), _("_Browse logs folder"), GTK_RESPONSE_HELP); |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
577 | #endif |
| 15882 | 578 | gtk_container_set_border_width (GTK_CONTAINER(lv->window), PIDGIN_HIG_BOX_SPACE); |
| 7432 | 579 | gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE); |
| 580 | gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(lv->window)->vbox), 0); | |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
581 | g_signal_connect(G_OBJECT(lv->window), "response", |
|
7454
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
582 | G_CALLBACK(destroy_cb), ht); |
|
11004
2323998d6cb9
[gaim-migrate @ 12859]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10884
diff
changeset
|
583 | gtk_window_set_role(GTK_WINDOW(lv->window), "log_viewer"); |
|
7454
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
584 | |
| 10663 | 585 | /* Icon *************/ |
|
15639
4d29fa62453d
Use person icon for Person log viewer
Sean Egan <seanegan@pidgin.im>
parents:
15613
diff
changeset
|
586 | if (icon != NULL) { |
| 15882 | 587 | title_box = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
| 588 | gtk_container_set_border_width(GTK_CONTAINER(title_box), PIDGIN_HIG_BOX_SPACE); | |
| 10663 | 589 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), title_box, FALSE, FALSE, 0); |
| 590 | ||
| 591 | gtk_box_pack_start(GTK_BOX(title_box), icon, FALSE, FALSE, 0); | |
| 592 | } else | |
| 593 | title_box = GTK_DIALOG(lv->window)->vbox; | |
| 7432 | 594 | |
| 595 | /* Label ************/ | |
| 10663 | 596 | lv->label = gtk_label_new(NULL); |
| 597 | ||
| 598 | text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>", title); | |
| 9624 | 599 | |
| 10663 | 600 | gtk_label_set_markup(GTK_LABEL(lv->label), text); |
| 601 | gtk_misc_set_alignment(GTK_MISC(lv->label), 0, 0); | |
| 602 | gtk_box_pack_start(GTK_BOX(title_box), lv->label, FALSE, FALSE, 0); | |
| 7432 | 603 | g_free(text); |
| 604 | ||
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
605 | /* Pane *************/ |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
606 | pane = gtk_hpaned_new(); |
| 15882 | 607 | gtk_container_set_border_width(GTK_CONTAINER(pane), PIDGIN_HIG_BOX_SPACE); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
608 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), pane, TRUE, TRUE, 0); |
| 7432 | 609 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
610 | /* List *************/ |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
611 | sw = gtk_scrolled_window_new (NULL, NULL); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
612 | gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
613 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
614 | gtk_paned_add1(GTK_PANED(pane), sw); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
615 | lv->treestore = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
616 | lv->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (lv->treestore)); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
617 | rend = gtk_cell_renderer_text_new(); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
618 | col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
619 | gtk_tree_view_append_column (GTK_TREE_VIEW(lv->treeview), col); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
620 | gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (lv->treeview), FALSE); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
621 | gtk_container_add (GTK_CONTAINER (sw), lv->treeview); |
|
11402
1be90c47f022
[gaim-migrate @ 13637]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
11243
diff
changeset
|
622 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
623 | populate_log_tree(lv); |
|
11402
1be90c47f022
[gaim-migrate @ 13637]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
11243
diff
changeset
|
624 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
625 | sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (lv->treeview)); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
626 | g_signal_connect (G_OBJECT (sel), "changed", |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
627 | G_CALLBACK (log_select_cb), |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
628 | lv); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
629 | g_signal_connect (G_OBJECT(lv->treeview), "row-activated", |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
630 | G_CALLBACK(log_row_activated_cb), |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
631 | lv); |
| 15568 | 632 | pidgin_set_accessible_label(lv->treeview, lv->label); |
| 11585 | 633 | |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
634 | g_signal_connect(lv->treeview, "button-press-event", G_CALLBACK(log_button_press_cb), lv); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
635 | g_signal_connect(lv->treeview, "popup-menu", G_CALLBACK(log_popup_menu_cb), lv); |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
636 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
637 | /* Log size ************/ |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
638 | if(log_size) { |
| 15884 | 639 | char *sz_txt = purple_str_size_to_units(log_size); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
640 | text = g_strdup_printf("<span weight='bold'>%s</span> %s", _("Total log size:"), sz_txt); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
641 | size_label = gtk_label_new(NULL); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
642 | gtk_label_set_markup(GTK_LABEL(size_label), text); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
643 | /* gtk_paned_add1(GTK_PANED(pane), size_label); */ |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
644 | gtk_misc_set_alignment(GTK_MISC(size_label), 0, 0); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
645 | gtk_box_pack_end(GTK_BOX(GTK_DIALOG(lv->window)->vbox), size_label, FALSE, FALSE, 0); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
646 | g_free(sz_txt); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
647 | g_free(text); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
648 | } |
|
11402
1be90c47f022
[gaim-migrate @ 13637]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
11243
diff
changeset
|
649 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
650 | /* A fancy little box ************/ |
| 15882 | 651 | vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
652 | gtk_paned_add2(GTK_PANED(pane), vbox); |
|
11402
1be90c47f022
[gaim-migrate @ 13637]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
11243
diff
changeset
|
653 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
654 | /* Viewer ************/ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
655 | frame = pidgin_create_imhtml(FALSE, &lv->imhtml, NULL, NULL); |
|
16259
73b7c796c8d3
I don't like the pidginfoo_bar widget names that resulted from the sed.
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
656 | gtk_widget_set_name(lv->imhtml, "pidgin_log_imhtml"); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
657 | gtk_widget_set_size_request(lv->imhtml, 320, 200); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
658 | gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
659 | gtk_widget_show(frame); |
|
10181
2425c3773266
[gaim-migrate @ 11296]
Mark Doliner <markdoliner@pidgin.im>
parents:
10175
diff
changeset
|
660 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
661 | /* Search box **********/ |
| 15882 | 662 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
663 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
664 | lv->entry = gtk_entry_new(); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
665 | gtk_box_pack_start(GTK_BOX(hbox), lv->entry, TRUE, TRUE, 0); |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
666 | find_button = gtk_button_new_from_stock(GTK_STOCK_FIND); |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
667 | gtk_box_pack_start(GTK_BOX(hbox), find_button, FALSE, FALSE, 0); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
668 | g_signal_connect(GTK_ENTRY(lv->entry), "activate", G_CALLBACK(search_cb), lv); |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
669 | g_signal_connect(GTK_BUTTON(find_button), "clicked", G_CALLBACK(search_cb), lv); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
670 | |
|
13569
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
671 | select_first_log(lv); |
| 7432 | 672 | |
| 673 | gtk_widget_show_all(lv->window); | |
| 10663 | 674 | |
| 675 | return lv; | |
| 676 | } | |
| 677 | ||
|
20702
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
678 | void pidgin_log_show(PurpleLogType type, const char *screenname, PurpleAccount *account) { |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
679 | pidgin_log_show_with_parent(NULL, type, screenname, account); |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
680 | } |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
681 | |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
682 | void pidgin_log_show_with_parent(GtkWindow *parent, PurpleLogType type, const char *screenname, PurpleAccount *account) { |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
683 | struct log_viewer_hash_t *ht; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
684 | PidginLogViewer *lv = NULL; |
| 10663 | 685 | const char *name = screenname; |
| 686 | char *title; | |
| 687 | ||
| 688 | g_return_if_fail(account != NULL); | |
| 689 | g_return_if_fail(screenname != NULL); | |
| 690 | ||
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
691 | ht = g_new0(struct log_viewer_hash_t, 1); |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
692 | |
| 10663 | 693 | ht->type = type; |
| 694 | ht->screenname = g_strdup(screenname); | |
| 695 | ht->account = account; | |
| 696 | ||
| 697 | if (log_viewers == NULL) { | |
| 698 | log_viewers = g_hash_table_new(log_viewer_hash, log_viewer_equal); | |
| 699 | } else if ((lv = g_hash_table_lookup(log_viewers, ht))) { | |
| 700 | gtk_window_present(GTK_WINDOW(lv->window)); | |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
701 | g_free(ht->screenname); |
| 10663 | 702 | g_free(ht); |
| 703 | return; | |
| 704 | } | |
| 705 | ||
| 15884 | 706 | if (type == PURPLE_LOG_CHAT) { |
| 707 | PurpleChat *chat; | |
| 10663 | 708 | |
| 15884 | 709 | chat = purple_blist_find_chat(account, screenname); |
| 10663 | 710 | if (chat != NULL) |
| 15884 | 711 | name = purple_chat_get_name(chat); |
| 10663 | 712 | |
| 713 | title = g_strdup_printf(_("Conversations in %s"), name); | |
| 714 | } else { | |
| 15884 | 715 | PurpleBuddy *buddy; |
| 10663 | 716 | |
| 15884 | 717 | buddy = purple_find_buddy(account, screenname); |
| 10663 | 718 | if (buddy != NULL) |
| 15884 | 719 | name = purple_buddy_get_contact_alias(buddy); |
| 10663 | 720 | |
| 721 | title = g_strdup_printf(_("Conversations with %s"), name); | |
| 722 | } | |
| 723 | ||
|
19438
dc8d0b7b47cd
Adding syslog + compile fixes
Gabriel Schulhof <nix@go-nix.ca>
parents:
19304
diff
changeset
|
724 | display_log_viewer(parent, ht, purple_log_get_logs(type, screenname, account), |
|
15639
4d29fa62453d
Use person icon for Person log viewer
Sean Egan <seanegan@pidgin.im>
parents:
15613
diff
changeset
|
725 | title, gtk_image_new_from_pixbuf(pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM)), |
| 15884 | 726 | purple_log_get_total_size(type, screenname, account)); |
| 10663 | 727 | g_free(title); |
| 728 | } | |
| 729 | ||
|
20702
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
730 | void pidgin_log_show_contact(PurpleContact *contact) { |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
731 | pidgin_log_show_contact_with_parent(NULL, contact); |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
732 | } |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
733 | |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
734 | void pidgin_log_show_contact_with_parent(GtkWindow *parent, PurpleContact *contact) { |
| 10663 | 735 | struct log_viewer_hash_t *ht = g_new0(struct log_viewer_hash_t, 1); |
| 15884 | 736 | PurpleBlistNode *child; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
737 | PidginLogViewer *lv = NULL; |
| 10663 | 738 | GList *logs = NULL; |
| 739 | GdkPixbuf *pixbuf; | |
|
15656
c1f66538f8c6
Fix a few small compile warnings:
Mark Doliner <markdoliner@pidgin.im>
parents:
15639
diff
changeset
|
740 | GtkWidget *image = gtk_image_new(); |
| 10663 | 741 | const char *name = NULL; |
| 742 | char *title; | |
| 11585 | 743 | int total_log_size = 0; |
| 10663 | 744 | |
| 745 | g_return_if_fail(contact != NULL); | |
| 746 | ||
| 15884 | 747 | ht->type = PURPLE_LOG_IM; |
| 10663 | 748 | ht->contact = contact; |
| 749 | ||
| 750 | if (log_viewers == NULL) { | |
| 751 | log_viewers = g_hash_table_new(log_viewer_hash, log_viewer_equal); | |
| 752 | } else if ((lv = g_hash_table_lookup(log_viewers, ht))) { | |
| 753 | gtk_window_present(GTK_WINDOW(lv->window)); | |
| 754 | g_free(ht); | |
| 755 | return; | |
| 756 | } | |
| 757 | ||
| 758 | for (child = contact->node.child ; child ; child = child->next) { | |
| 15884 | 759 | if (!PURPLE_BLIST_NODE_IS_BUDDY(child)) |
| 10663 | 760 | continue; |
| 761 | ||
| 15884 | 762 | logs = g_list_concat(purple_log_get_logs(PURPLE_LOG_IM, ((PurpleBuddy *)child)->name, |
| 763 | ((PurpleBuddy *)child)->account), logs); | |
| 764 | total_log_size += purple_log_get_total_size(PURPLE_LOG_IM, ((PurpleBuddy *)child)->name, ((PurpleBuddy *)child)->account); | |
| 10663 | 765 | } |
| 15884 | 766 | logs = g_list_sort(logs, purple_log_compare); |
| 10663 | 767 | |
|
16280
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
768 | pixbuf = gtk_widget_render_icon(image, PIDGIN_STOCK_STATUS_PERSON, |
|
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
769 | gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow"); |
|
15639
4d29fa62453d
Use person icon for Person log viewer
Sean Egan <seanegan@pidgin.im>
parents:
15613
diff
changeset
|
770 | gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf); |
|
16280
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
771 | |
| 10663 | 772 | if (contact->alias != NULL) |
| 773 | name = contact->alias; | |
| 774 | else if (contact->priority != NULL) | |
| 15884 | 775 | name = purple_buddy_get_contact_alias(contact->priority); |
| 10663 | 776 | |
|
16280
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
777 | /* This will happen if the contact doesn't have an alias, |
|
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
778 | * and none of the contact's buddies are online. |
|
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
779 | * There is probably a better way to deal with this. */ |
|
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
780 | if (name == NULL) { |
|
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
781 | if (contact->node.child != NULL && PURPLE_BLIST_NODE_IS_BUDDY(contact->node.child)) |
|
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
782 | name = purple_buddy_get_contact_alias((PurpleBuddy *) contact->node.child); |
|
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
783 | if (name == NULL) |
|
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
784 | name = ""; |
|
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
785 | } |
|
f1174892ed45
Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
Daniel Atallah <datallah@pidgin.im>
parents:
16259
diff
changeset
|
786 | |
| 10663 | 787 | title = g_strdup_printf(_("Conversations with %s"), name); |
|
19438
dc8d0b7b47cd
Adding syslog + compile fixes
Gabriel Schulhof <nix@go-nix.ca>
parents:
19304
diff
changeset
|
788 | display_log_viewer(parent, ht, logs, title, image, total_log_size); |
| 10663 | 789 | g_free(title); |
| 7432 | 790 | } |
| 8573 | 791 | |
|
20702
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
792 | void pidgin_syslog_show(void) |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
793 | { |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
794 | pidgin_syslog_show_with_parent(NULL); |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
795 | } |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
796 | |
|
9548d4fb8c8e
Re-worked gtklog functions and perl bindings
Gabriel Schulhof <nix@go-nix.ca>
parents:
20685
diff
changeset
|
797 | void pidgin_syslog_show_with_parent(GtkWindow *parent) |
| 8573 | 798 | { |
| 799 | GList *accounts = NULL; | |
| 10663 | 800 | GList *logs = NULL; |
| 8573 | 801 | |
|
10181
2425c3773266
[gaim-migrate @ 11296]
Mark Doliner <markdoliner@pidgin.im>
parents:
10175
diff
changeset
|
802 | if (syslog_viewer != NULL) { |
| 8573 | 803 | gtk_window_present(GTK_WINDOW(syslog_viewer->window)); |
| 804 | return; | |
| 805 | } | |
| 806 | ||
| 15884 | 807 | for(accounts = purple_accounts_get_all(); accounts != NULL; accounts = accounts->next) { |
| 8573 | 808 | |
| 15884 | 809 | PurpleAccount *account = (PurpleAccount *)accounts->data; |
| 810 | if(purple_find_prpl(purple_account_get_protocol_id(account)) == NULL) | |
| 8573 | 811 | continue; |
| 812 | ||
| 15884 | 813 | logs = g_list_concat(purple_log_get_system_logs(account), logs); |
| 8573 | 814 | } |
| 15884 | 815 | logs = g_list_sort(logs, purple_log_compare); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
816 | |
| 19440 | 817 | syslog_viewer = display_log_viewer(parent, NULL, logs, _("System Log"), NULL, 0); |
| 8573 | 818 | } |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
819 | |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
820 | /**************************************************************************** |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
821 | * GTK+ LOG SUBSYSTEM ******************************************************* |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
822 | ****************************************************************************/ |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
823 | |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
824 | void * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
825 | pidgin_log_get_handle(void) |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
826 | { |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
827 | static int handle; |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
828 | |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
829 | return &handle; |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
830 | } |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
831 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
832 | void pidgin_log_init(void) |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
833 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
834 | void *handle = pidgin_log_get_handle(); |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
835 | |
| 15884 | 836 | purple_signal_register(handle, "log-displaying", |
| 837 | purple_marshal_VOID__POINTER_POINTER, | |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
838 | NULL, 2, |
| 15884 | 839 | purple_value_new(PURPLE_TYPE_BOXED, |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
840 | "PidginLogViewer *"), |
| 15884 | 841 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
| 842 | PURPLE_SUBTYPE_LOG)); | |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
843 | } |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
844 | |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
845 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
846 | pidgin_log_uninit(void) |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
847 | { |
| 15884 | 848 | purple_signals_unregister_by_instance(pidgin_log_get_handle()); |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
849 | } |