Fri, 07 Dec 2018 13:18:54 -0600
gtkblist: Port plugin actions mostly off of GtkUIManager
Pidgin generates menu items in the buddy list from PurplePluginActions.
This patch ports these menu items off of the deprecated GtkUIManager
in favor of the GMenu API, except for getting the parent menu,
currently still generated with GtkUIManager. Once more of the buddy
list menu is ported to GMenu, this can be simplified some more.
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* pidgin |
| 7432 | 2 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
|
7537
4c3be2f554b1
[gaim-migrate @ 8150]
Christian Hammond <chipx86@chipx86.com>
parents:
7535
diff
changeset
|
6 | * |
| 7432 | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * 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
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 7432 | 20 | */ |
| 9791 | 21 | #include "internal.h" |
| 15577 | 22 | #include "pidgin.h" |
| 7432 | 23 | |
| 24 | #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
|
25 | #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
|
26 | #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
|
27 | #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
|
28 | #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
|
29 | #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
|
30 | |
|
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
|
31 | #include "pidginstock.h" |
| 7432 | 32 | #include "gtkblist.h" |
| 33 | #include "gtklog.h" | |
| 34 | #include "gtkutils.h" | |
|
32439
2c681e5daeeb
Webkit Message views.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
25889
diff
changeset
|
35 | #include "gtkwebview.h" |
| 7432 | 36 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33142
diff
changeset
|
37 | #include "gtk3compat.h" |
| 7432 | 38 | |
| 39 | static GHashTable *log_viewers = NULL; | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
40 | static void populate_log_tree(PidginLogViewer *lv); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
41 | static PidginLogViewer *syslog_viewer = NULL; |
| 7432 | 42 | |
| 43 | struct log_viewer_hash_t { | |
| 15884 | 44 | PurpleLogType type; |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
45 | char *buddyname; |
| 15884 | 46 | PurpleAccount *account; |
| 47 | PurpleContact *contact; | |
| 7432 | 48 | }; |
| 49 | ||
| 7440 | 50 | static guint log_viewer_hash(gconstpointer data) |
| 7432 | 51 | { |
| 7440 | 52 | const struct log_viewer_hash_t *viewer = data; |
| 53 | ||
| 10663 | 54 | if (viewer->contact != NULL) |
| 55 | return g_direct_hash(viewer->contact); | |
| 56 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
57 | return g_str_hash(viewer->buddyname) + |
| 15884 | 58 | g_str_hash(purple_account_get_username(viewer->account)); |
| 7432 | 59 | } |
| 60 | ||
| 10663 | 61 | static gboolean log_viewer_equal(gconstpointer y, gconstpointer z) |
| 7432 | 62 | { |
| 7440 | 63 | const struct log_viewer_hash_t *a, *b; |
| 7432 | 64 | int ret; |
| 7440 | 65 | char *normal; |
| 66 | ||
| 67 | a = y; | |
| 68 | b = z; | |
| 69 | ||
| 10663 | 70 | if (a->contact != NULL) { |
| 71 | if (b->contact != NULL) | |
| 72 | return (a->contact == b->contact); | |
| 73 | else | |
| 74 | return FALSE; | |
| 75 | } else { | |
| 76 | if (b->contact != NULL) | |
| 77 | return FALSE; | |
| 78 | } | |
| 79 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
80 | normal = g_strdup(purple_normalize(a->account, a->buddyname)); |
| 7440 | 81 | ret = (a->account == b->account) && |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
33728
diff
changeset
|
82 | purple_strequal(normal, purple_normalize(b->account, b->buddyname)); |
| 7432 | 83 | g_free(normal); |
| 10663 | 84 | |
| 7432 | 85 | return ret; |
| 86 | } | |
| 87 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
88 | static void select_first_log(PidginLogViewer *lv) |
|
13569
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
89 | { |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
90 | GtkTreeModel *model; |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
91 | GtkTreeIter iter, it; |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
92 | GtkTreePath *path; |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
93 | |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
94 | model = GTK_TREE_MODEL(lv->treestore); |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
95 | |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
96 | if (!gtk_tree_model_get_iter_first(model, &iter)) |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
97 | return; |
|
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 | path = gtk_tree_model_get_path(model, &iter); |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
100 | if (gtk_tree_model_iter_children(model, &it, &iter)) |
|
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 | 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
|
103 | path = gtk_tree_model_get_path(model, &it); |
|
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 | |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
106 | 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
|
107 | |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
108 | gtk_tree_path_free(path); |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
109 | } |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
110 | |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
111 | static gchar *log_get_date(PurpleLog *log) |
|
15060
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
112 | { |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
113 | GDateTime *dt; |
|
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
114 | gchar *ret; |
|
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
115 | dt = g_date_time_to_local(log->time); |
|
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
116 | ret = g_date_time_format(dt, "%c"); |
|
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
117 | g_date_time_unref(dt); |
|
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
118 | return ret; |
|
15060
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
119 | } |
|
a5d9fafd2b8c
[gaim-migrate @ 17777]
Richard Laager <rlaager@pidgin.im>
parents:
14861
diff
changeset
|
120 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
121 | static void search_cb(GtkWidget *button, PidginLogViewer *lv) |
| 7535 | 122 | { |
| 123 | const char *search_term = gtk_entry_get_text(GTK_ENTRY(lv->entry)); | |
| 124 | GList *logs; | |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
125 | |
|
12232
857f087ec86b
[gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents:
11869
diff
changeset
|
126 | if (!(*search_term)) { |
|
857f087ec86b
[gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents:
11869
diff
changeset
|
127 | /* reset the tree */ |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
128 | gtk_tree_store_clear(lv->treestore); |
| 7535 | 129 | populate_log_tree(lv); |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
130 | g_free(lv->search); |
| 7535 | 131 | lv->search = NULL; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32504
diff
changeset
|
132 | webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(lv->web_view)); |
|
13569
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
133 | select_first_log(lv); |
| 7535 | 134 | return; |
| 135 | } | |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
136 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
33728
diff
changeset
|
137 | if (lv->search != NULL && purple_strequal(lv->search, search_term)) |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
138 | { |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
139 | /* Searching for the same term acts as "Find Next" */ |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32504
diff
changeset
|
140 | webkit_web_view_search_text(WEBKIT_WEB_VIEW(lv->web_view), lv->search, FALSE, TRUE, TRUE); |
|
22237
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
141 | return; |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
142 | } |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
143 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
144 | pidgin_set_cursor(lv->window, GDK_WATCH); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
145 | |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
146 | g_free(lv->search); |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
147 | lv->search = g_strdup(search_term); |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
148 | |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
149 | gtk_tree_store_clear(lv->treestore); |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32504
diff
changeset
|
150 | webkit_web_view_open(WEBKIT_WEB_VIEW(lv->web_view), "about:blank"); /* clear the view */ |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
151 | |
| 7535 | 152 | for (logs = lv->logs; logs != NULL; logs = logs->next) { |
| 15884 | 153 | char *read = purple_log_read((PurpleLog*)logs->data, NULL); |
| 154 | if (read && *read && purple_strcasestr(read, search_term)) { | |
| 7535 | 155 | GtkTreeIter iter; |
| 15884 | 156 | PurpleLog *log = logs->data; |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
157 | gchar *log_date = log_get_date(log); |
|
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, | |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
161 | 0, log_date, |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
162 | 1, log, -1); |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
163 | g_free(log_date); |
| 7535 | 164 | } |
|
10574
5abb2931b6ff
[gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10181
diff
changeset
|
165 | g_free(read); |
| 7535 | 166 | } |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
167 | |
|
13569
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
168 | select_first_log(lv); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
169 | pidgin_clear_cursor(lv->window); |
| 7535 | 170 | } |
| 171 | ||
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
172 | 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
|
173 | PidginLogViewer *lv = syslog_viewer; |
|
7454
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
174 | |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
175 | #ifdef _WIN32 |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
176 | 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
|
177 | GtkTreeSelection *sel; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
178 | GtkTreeIter iter; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
179 | GtkTreeModel *model; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
180 | 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
|
181 | char *logdir; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
182 | |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
183 | 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
|
184 | 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
|
185 | 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
|
186 | |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
187 | 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
|
188 | 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
|
189 | GValue val; |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
190 | |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
191 | 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
|
192 | 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
|
193 | 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
|
194 | 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
|
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 | |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
198 | if (log == NULL) |
|
38870
575e41bfc15e
Migrate certificates, icons, logs to XDG dirs
qarkai <qarkai@gmail.com>
parents:
38007
diff
changeset
|
199 | logdir = g_build_filename(purple_data_dir(), "logs", NULL); |
|
18743
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
200 | else |
|
58a367fa661a
Make the "Browse Logs Folder" button open the folder containing the log
Richard Laager <rlaager@pidgin.im>
parents:
16490
diff
changeset
|
201 | 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
|
202 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15568
diff
changeset
|
203 | winpidgin_shell_execute(logdir, "explore", NULL); |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
204 | g_free(logdir); |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
205 | return; |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
206 | } |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
207 | #endif |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
208 | |
| 10663 | 209 | if (ht != NULL) { |
| 8573 | 210 | lv = g_hash_table_lookup(log_viewers, ht); |
| 211 | g_hash_table_remove(log_viewers, ht); | |
| 10663 | 212 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
213 | g_free(ht->buddyname); |
| 8573 | 214 | g_free(ht); |
| 215 | } else | |
| 216 | syslog_viewer = NULL; | |
| 217 | ||
| 15884 | 218 | 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
|
219 | |
| 15884 | 220 | 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
|
221 | g_list_free(lv->logs); |
| 10663 | 222 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13569
diff
changeset
|
223 | g_free(lv->search); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13569
diff
changeset
|
224 | g_free(lv); |
| 10663 | 225 | |
|
7454
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
226 | gtk_widget_destroy(w); |
|
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
227 | } |
|
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
228 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
229 | static void log_row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *col, PidginLogViewer *viewer) { |
| 10663 | 230 | if (gtk_tree_view_row_expanded(tv, path)) |
| 231 | gtk_tree_view_collapse_row(tv, path); | |
| 232 | else | |
| 233 | gtk_tree_view_expand_row(tv, path, FALSE); | |
| 8573 | 234 | } |
| 10663 | 235 | |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
236 | 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
|
237 | { |
|
15612
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[1]); /* iter */ |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
239 | 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
|
240 | } |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
241 | |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
242 | 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
|
243 | { |
| 15884 | 244 | 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
|
245 | { |
|
22384
0a2c39b4a6b1
Mark some strings for translation
Mark Doliner <markdoliner@pidgin.im>
parents:
22237
diff
changeset
|
246 | purple_notify_error(NULL, NULL, _("Log Deletion Failed"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
247 | _("Check permissions and try again."), 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
|
248 | } |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
249 | else |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
250 | { |
|
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
|
251 | 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
|
252 | 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
|
253 | 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
|
254 | 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
|
255 | |
|
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 | } |
|
29500
1e0464dad92b
This should pretty much finish off the GTK_CHECK_VERSION calls in Pidgin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25889
diff
changeset
|
266 | |
| 16293 | 267 | gtk_tree_path_free(path); |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
268 | } |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
269 | |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
270 | 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
|
271 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
272 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
273 | 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
|
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 | PidginLogViewer *lv = data[0]; |
| 15884 | 276 | PurpleLog *log = data[1]; |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
277 | GtkTreeIter *iter = data[2]; |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
278 | gchar *time = log_get_date(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
|
279 | 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
|
280 | 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
|
281 | 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
|
282 | |
| 15884 | 283 | 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
|
284 | { |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34708
diff
changeset
|
285 | PurpleBuddy *buddy = purple_blist_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
|
286 | if (buddy != NULL) |
| 15884 | 287 | 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
|
288 | else |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
289 | 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
|
290 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
291 | 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
|
292 | "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
|
293 | } |
| 15884 | 294 | 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
|
295 | { |
| 15884 | 296 | 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
|
297 | if (chat != NULL) |
| 15884 | 298 | 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
|
299 | else |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
300 | 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
|
301 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
302 | 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
|
303 | "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
|
304 | } |
| 15884 | 305 | 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
|
306 | { |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
307 | 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
|
308 | "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
|
309 | } |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
310 | else { |
|
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
311 | g_free(time); |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
312 | 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
|
313 | g_return_if_reached(); |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
314 | } |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
315 | |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
316 | /* 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
|
317 | * 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
|
318 | * 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
|
319 | * 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
|
320 | * either way. */ |
|
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
321 | 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
|
322 | data2[0] = lv->treestore; |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
323 | data2[1] = iter; |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
324 | data2[2] = log; |
|
22384
0a2c39b4a6b1
Mark some strings for translation
Mark Doliner <markdoliner@pidgin.im>
parents:
22237
diff
changeset
|
325 | purple_request_action(lv, NULL, _("Delete Log?"), tmp, 0, |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
326 | NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
327 | 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
|
328 | _("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
|
329 | _("Cancel"), delete_log_cleanup_cb); |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
330 | g_free(time); |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
331 | 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
|
332 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
333 | |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
334 | static GtkWidget * |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
335 | log_create_popup_menu(GtkWidget *treeview, PidginLogViewer *lv, 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
|
336 | { |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
337 | GValue val; |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
338 | PurpleLog *log; |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
339 | GtkWidget *menu; |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
340 | GtkWidget *menuitem; |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
341 | |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
342 | val.g_type = 0; |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
343 | gtk_tree_model_get_value(GTK_TREE_MODEL(lv->treestore), iter, 1, &val); |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
344 | log = g_value_get_pointer(&val); |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
345 | if (log == NULL) { |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
346 | g_free(iter); |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
347 | return NULL; |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
348 | } |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
349 | |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
350 | menu = gtk_menu_new(); |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
351 | menuitem = gtk_menu_item_new_with_label(_("Delete 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
|
352 | |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
353 | if (purple_log_is_deletable(log)) { |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
354 | gpointer *data = g_new(gpointer, 3); |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
355 | data[0] = lv; |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
356 | data[1] = log; |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
357 | data[2] = iter; |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
358 | |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
359 | g_signal_connect(menuitem, "activate", G_CALLBACK(log_delete_log_cb), data); |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
360 | g_object_set_data_full(G_OBJECT(menuitem), "log-viewer-data", data, g_free); |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
361 | } else { |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
362 | gtk_widget_set_sensitive(menuitem, FALSE); |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
363 | } |
|
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 | 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
|
365 | 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
|
366 | |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
367 | return menu; |
|
15586
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 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
370 | 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
|
371 | { |
|
38705
62a7a975251a
Use gdk_event_triggers_context_menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38620
diff
changeset
|
372 | if (gdk_event_triggers_context_menu((GdkEvent *)event)) { |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
373 | 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
|
374 | GtkTreeIter *iter; |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
375 | GtkWidget *menu; |
|
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 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
377 | 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
|
378 | 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
|
379 | 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
|
380 | gtk_tree_model_get_iter(GTK_TREE_MODEL(lv->treestore), iter, path); |
|
22455
1e4f21a50bc6
Plug some leaks caused by GtkTreePaths not being freed.
Daniel Atallah <datallah@pidgin.im>
parents:
22384
diff
changeset
|
381 | gtk_tree_path_free(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
|
382 | |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
383 | menu = log_create_popup_menu(treeview, lv, iter); |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
384 | if (menu) { |
|
38707
6f4d3ab2f2ed
Use gtk_menu_popup_at_pointer instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38706
diff
changeset
|
385 | gtk_menu_popup_at_pointer(GTK_MENU(menu), (GdkEvent *)event); |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
386 | return TRUE; |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
387 | } else { |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
388 | 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
|
389 | } |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
390 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
391 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
392 | 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
|
393 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
394 | |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
395 | 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
|
396 | { |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
397 | 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
|
398 | GtkTreeIter *iter; |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
399 | GtkWidget *menu; |
|
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 | |
|
15612
5de26d19e4e5
After the log is deleted, remove the entry from the log viewer.
Richard Laager <rlaager@pidgin.im>
parents:
15586
diff
changeset
|
401 | 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
|
402 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(lv->treeview)); |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
403 | if (!gtk_tree_selection_get_selected(sel, NULL, iter)) { |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
404 | 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
|
405 | 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
|
406 | } |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
407 | |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
408 | menu = log_create_popup_menu(treeview, lv, iter); |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
409 | if (menu) { |
|
38709
6c80734ca3b4
Add pidgin_menu_popup_at_treeview_selection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
410 | pidgin_menu_popup_at_treeview_selection(menu, treeview); |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
411 | return TRUE; |
|
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
412 | } else { |
|
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 | return FALSE; |
|
38706
4a3f253ea22c
Reduce code duplication in log popup menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
414 | } |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
415 | } |
|
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
416 | |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
417 | static gboolean search_find_cb(gpointer data) |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
418 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
419 | PidginLogViewer *viewer = data; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32504
diff
changeset
|
420 | webkit_web_view_mark_text_matches(WEBKIT_WEB_VIEW(viewer->web_view), viewer->search, FALSE, 0); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32504
diff
changeset
|
421 | webkit_web_view_set_highlight_text_matches(WEBKIT_WEB_VIEW(viewer->web_view), TRUE); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32504
diff
changeset
|
422 | webkit_web_view_search_text(WEBKIT_WEB_VIEW(viewer->web_view), viewer->search, FALSE, TRUE, TRUE); |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
423 | return FALSE; |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
424 | } |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
425 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
426 | static void log_select_cb(GtkTreeSelection *sel, PidginLogViewer *viewer) { |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
427 | GtkTreeIter iter; |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12232
diff
changeset
|
428 | GValue val; |
| 7432 | 429 | GtkTreeModel *model = GTK_TREE_MODEL(viewer->treestore); |
| 15884 | 430 | PurpleLog *log = NULL; |
| 431 | PurpleLogReadFlags flags; | |
| 7432 | 432 | char *read = NULL; |
| 433 | ||
| 10663 | 434 | if (!gtk_tree_selection_get_selected(sel, &model, &iter)) |
| 7432 | 435 | return; |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12232
diff
changeset
|
436 | |
|
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12232
diff
changeset
|
437 | val.g_type = 0; |
| 7432 | 438 | gtk_tree_model_get_value (model, &iter, 1, &val); |
| 439 | log = g_value_get_pointer(&val); | |
| 440 | g_value_unset(&val); | |
| 441 | ||
| 10663 | 442 | if (log == NULL) |
| 7432 | 443 | return; |
| 444 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
445 | pidgin_set_cursor(viewer->window, GDK_WATCH); |
|
12232
857f087ec86b
[gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents:
11869
diff
changeset
|
446 | |
| 15884 | 447 | if (log->type != PURPLE_LOG_SYSTEM) { |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
448 | gchar *log_date = log_get_date(log); |
| 10663 | 449 | char *title; |
| 15884 | 450 | if (log->type == PURPLE_LOG_CHAT) |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
451 | title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation in %s on %s</span>"), |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
452 | log->name, log_date); |
| 10663 | 453 | else |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
454 | title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation with %s on %s</span>"), |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
455 | log->name, log_date); |
| 10663 | 456 | |
|
35721
abae078d0525
Fix some warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
457 | gtk_label_set_markup(viewer->label, title); |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
458 | g_free(log_date); |
| 10663 | 459 | g_free(title); |
| 460 | } | |
| 461 | ||
| 15884 | 462 | read = purple_log_read(log, &flags); |
| 7432 | 463 | viewer->flags = flags; |
| 10663 | 464 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32504
diff
changeset
|
465 | webkit_web_view_open(WEBKIT_WEB_VIEW(viewer->web_view), "about:blank"); |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
466 | |
| 15884 | 467 | purple_signal_emit(pidgin_log_get_handle(), "log-displaying", viewer, log); |
|
32981
19e0299e7d2d
Still making trunk usable again: correctly display plaintext logs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32912
diff
changeset
|
468 | |
|
19e0299e7d2d
Still making trunk usable again: correctly display plaintext logs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32912
diff
changeset
|
469 | /* plaintext log (html one starts with <html> tag) */ |
|
19e0299e7d2d
Still making trunk usable again: correctly display plaintext logs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32912
diff
changeset
|
470 | if (read[0] != '<') |
|
19e0299e7d2d
Still making trunk usable again: correctly display plaintext logs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32912
diff
changeset
|
471 | { |
|
19e0299e7d2d
Still making trunk usable again: correctly display plaintext logs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32912
diff
changeset
|
472 | char *newRead = purple_strreplace(read, "\n", "<br>"); |
|
19e0299e7d2d
Still making trunk usable again: correctly display plaintext logs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32912
diff
changeset
|
473 | g_free(read); |
|
19e0299e7d2d
Still making trunk usable again: correctly display plaintext logs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32912
diff
changeset
|
474 | read = newRead; |
|
19e0299e7d2d
Still making trunk usable again: correctly display plaintext logs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32912
diff
changeset
|
475 | } |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
476 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32504
diff
changeset
|
477 | webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(viewer->web_view), read, ""); |
|
12232
857f087ec86b
[gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents:
11869
diff
changeset
|
478 | g_free(read); |
| 7535 | 479 | |
| 10663 | 480 | if (viewer->search != NULL) { |
|
32439
2c681e5daeeb
Webkit Message views.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
25889
diff
changeset
|
481 | webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(viewer->web_view)); |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
482 | g_idle_add(search_find_cb, viewer); |
|
10574
5abb2931b6ff
[gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10181
diff
changeset
|
483 | } |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
484 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
485 | pidgin_clear_cursor(viewer->window); |
| 7432 | 486 | } |
| 487 | ||
| 488 | /* I want to make this smarter, but haven't come up with a cool algorithm to do so, yet. | |
| 489 | * I want the tree to be divided into groups like "Today," "Yesterday," "Last week," | |
| 490 | * "August," "2002," etc. based on how many conversation took place in each subdivision. | |
| 491 | * | |
| 492 | * For now, I'll just make it a flat list. | |
| 493 | */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
494 | static void populate_log_tree(PidginLogViewer *lv) |
| 11585 | 495 | /* Logs are made from trees in real life. |
| 7432 | 496 | This is a tree made from logs */ |
| 497 | { | |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
498 | gchar *month; |
| 10663 | 499 | char prev_top_month[30] = ""; |
| 9435 | 500 | GtkTreeIter toplevel, child; |
| 7432 | 501 | GList *logs = lv->logs; |
| 10663 | 502 | |
| 503 | while (logs != NULL) { | |
| 15884 | 504 | PurpleLog *log = logs->data; |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
505 | GDateTime *dt; |
|
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
506 | gchar *log_date; |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
507 | |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
508 | dt = g_date_time_to_local(log->time); |
|
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
509 | month = g_date_time_format(dt, _("%B %Y")); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
510 | |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
511 | if (!purple_strequal(month, prev_top_month)) { |
| 9435 | 512 | /* top level */ |
| 513 | gtk_tree_store_append(lv->treestore, &toplevel, NULL); | |
| 514 | 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
|
515 | |
|
33728
be5378bae40e
CID 731947 - Deal with the unlikely scenario that a locale would have a month+year value longer than 29 bytes.
Daniel Atallah <datallah@pidgin.im>
parents:
31321
diff
changeset
|
516 | g_strlcpy(prev_top_month, month, sizeof(prev_top_month)); |
|
10680
e4a00ce2fc35
[gaim-migrate @ 12226]
Richard Laager <rlaager@pidgin.im>
parents:
10669
diff
changeset
|
517 | } |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
518 | |
|
10680
e4a00ce2fc35
[gaim-migrate @ 12226]
Richard Laager <rlaager@pidgin.im>
parents:
10669
diff
changeset
|
519 | /* sub */ |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
520 | log_date = g_date_time_format(dt, "%c"); |
|
10680
e4a00ce2fc35
[gaim-migrate @ 12226]
Richard Laager <rlaager@pidgin.im>
parents:
10669
diff
changeset
|
521 | gtk_tree_store_append(lv->treestore, &child, &toplevel); |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
522 | gtk_tree_store_set(lv->treestore, &child, |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
523 | 0, log_date, |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
524 | 1, log, |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13091
diff
changeset
|
525 | -1); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
526 | |
|
38620
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
527 | g_free(log_date); |
|
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
528 | g_free(month); |
|
b02941b9fa9a
Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
529 | g_date_time_unref(dt); |
| 7432 | 530 | logs = logs->next; |
| 531 | } | |
| 532 | } | |
| 533 | ||
|
21214
db28e29a4990
Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents:
21172
diff
changeset
|
534 | static PidginLogViewer *display_log_viewer(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
|
535 | const char *title, GtkWidget *icon, int log_size) |
| 10663 | 536 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
537 | PidginLogViewer *lv; |
| 10663 | 538 | GtkWidget *title_box; |
| 539 | char *text; | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
540 | GtkWidget *pane; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
541 | GtkCellRenderer *rend; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
542 | GtkTreeViewColumn *col; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
543 | GtkTreeSelection *sel; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
544 | GtkWidget *vbox; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
545 | GtkWidget *frame; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
546 | GtkWidget *hbox; |
|
14400
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
547 | GtkWidget *find_button; |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
548 | GtkWidget *size_label; |
| 7432 | 549 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
550 | if (logs == NULL) |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
551 | { |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
552 | /* No logs were found. */ |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
553 | const char *log_preferences = NULL; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
554 | |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
555 | 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
|
556 | if (!purple_prefs_get_bool("/purple/logging/log_system")) |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
557 | 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
|
558 | } else { |
| 15884 | 559 | 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
|
560 | if (!purple_prefs_get_bool("/purple/logging/log_ims")) |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
561 | log_preferences = _("Instant messages will only be logged if the \"Log all instant messages\" preference is enabled."); |
| 15884 | 562 | } 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
|
563 | if (!purple_prefs_get_bool("/purple/logging/log_chats")) |
|
11869
e77f2f29b09d
[gaim-migrate @ 14160]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11780
diff
changeset
|
564 | 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
|
565 | } |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
566 | g_free(ht->buddyname); |
|
22237
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
567 | g_free(ht); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
568 | } |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
569 | |
|
22237
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
570 | if(icon != NULL) |
|
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
571 | gtk_widget_destroy(icon); |
|
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
572 | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
573 | purple_notify_info(NULL, title, _("No logs were found"), log_preferences, NULL); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
574 | return NULL; |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
575 | } |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
576 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
577 | lv = g_new0(PidginLogViewer, 1); |
|
13569
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
578 | lv->logs = logs; |
|
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
579 | |
| 10663 | 580 | if (ht != NULL) |
| 581 | g_hash_table_insert(log_viewers, ht, lv); | |
| 7432 | 582 | |
| 583 | /* Window ***********/ | |
|
21214
db28e29a4990
Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents:
21172
diff
changeset
|
584 | lv->window = gtk_dialog_new_with_buttons(title, NULL, 0, |
| 7432 | 585 | GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
586 | #ifdef _WIN32 |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
587 | /* 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
|
588 | 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
|
589 | #endif |
| 15882 | 590 | gtk_container_set_border_width (GTK_CONTAINER(lv->window), PIDGIN_HIG_BOX_SPACE); |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32394
diff
changeset
|
591 | gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), 0); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
592 | g_signal_connect(G_OBJECT(lv->window), "response", |
|
7454
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
593 | G_CALLBACK(destroy_cb), ht); |
|
11004
2323998d6cb9
[gaim-migrate @ 12859]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10884
diff
changeset
|
594 | gtk_window_set_role(GTK_WINDOW(lv->window), "log_viewer"); |
|
7454
c99a2070471e
[gaim-migrate @ 8067]
Mark Doliner <markdoliner@pidgin.im>
parents:
7440
diff
changeset
|
595 | |
| 10663 | 596 | /* Icon *************/ |
|
15639
4d29fa62453d
Use person icon for Person log viewer
Sean Egan <seanegan@pidgin.im>
parents:
15613
diff
changeset
|
597 | if (icon != NULL) { |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
598 | title_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE); |
| 15882 | 599 | gtk_container_set_border_width(GTK_CONTAINER(title_box), PIDGIN_HIG_BOX_SPACE); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
29685
diff
changeset
|
600 | gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32394
diff
changeset
|
601 | title_box, FALSE, FALSE, 0); |
| 10663 | 602 | |
| 603 | gtk_box_pack_start(GTK_BOX(title_box), icon, FALSE, FALSE, 0); | |
| 604 | } else | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
29685
diff
changeset
|
605 | title_box = gtk_dialog_get_content_area(GTK_DIALOG(lv->window)); |
| 7432 | 606 | |
| 607 | /* Label ************/ | |
|
35721
abae078d0525
Fix some warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
608 | lv->label = GTK_LABEL(gtk_label_new(NULL)); |
| 10663 | 609 | |
| 610 | text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>", title); | |
| 9624 | 611 | |
|
35721
abae078d0525
Fix some warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
612 | gtk_label_set_markup(lv->label, text); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
613 | gtk_label_set_xalign(GTK_LABEL(lv->label), 0); |
|
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
614 | gtk_label_set_yalign(GTK_LABEL(lv->label), 0); |
|
35721
abae078d0525
Fix some warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
615 | gtk_box_pack_start(GTK_BOX(title_box), GTK_WIDGET(lv->label), FALSE, FALSE, 0); |
| 7432 | 616 | g_free(text); |
| 617 | ||
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
618 | /* Pane *************/ |
|
35528
e04ba70092e9
Fix the rest of [hv] gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
619 | pane = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL); |
| 15882 | 620 | gtk_container_set_border_width(GTK_CONTAINER(pane), PIDGIN_HIG_BOX_SPACE); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
29685
diff
changeset
|
621 | gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32394
diff
changeset
|
622 | pane, TRUE, TRUE, 0); |
| 7432 | 623 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
624 | /* List *************/ |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
625 | 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
|
626 | lv->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (lv->treestore)); |
|
22214
e8a9916cb99e
It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
627 | g_object_unref(G_OBJECT(lv->treestore)); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
628 | rend = gtk_cell_renderer_text_new(); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
629 | 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
|
630 | gtk_tree_view_append_column (GTK_TREE_VIEW(lv->treeview), col); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
631 | gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (lv->treeview), FALSE); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
33728
diff
changeset
|
632 | gtk_paned_add1(GTK_PANED(pane), |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
29685
diff
changeset
|
633 | pidgin_make_scrollable(lv->treeview, GTK_POLICY_NEVER, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1)); |
|
11402
1be90c47f022
[gaim-migrate @ 13637]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
11243
diff
changeset
|
634 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
635 | populate_log_tree(lv); |
|
11402
1be90c47f022
[gaim-migrate @ 13637]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
11243
diff
changeset
|
636 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
637 | sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (lv->treeview)); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
638 | g_signal_connect (G_OBJECT (sel), "changed", |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
639 | G_CALLBACK (log_select_cb), |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
640 | lv); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
641 | g_signal_connect (G_OBJECT(lv->treeview), "row-activated", |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
642 | G_CALLBACK(log_row_activated_cb), |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
643 | lv); |
| 15568 | 644 | pidgin_set_accessible_label(lv->treeview, lv->label); |
| 11585 | 645 | |
|
15586
b03db9cb6cac
Implement the UI for deleting logs. This allows users to right-click on
Richard Laager <rlaager@pidgin.im>
parents:
15578
diff
changeset
|
646 | 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
|
647 | 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
|
648 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
649 | /* Log size ************/ |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
650 | if(log_size) { |
| 15884 | 651 | char *sz_txt = purple_str_size_to_units(log_size); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
652 | 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
|
653 | size_label = gtk_label_new(NULL); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
654 | gtk_label_set_markup(GTK_LABEL(size_label), text); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
655 | /* gtk_paned_add1(GTK_PANED(pane), size_label); */ |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
656 | gtk_label_set_xalign(GTK_LABEL(size_label), 0); |
|
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
657 | gtk_label_set_yalign(GTK_LABEL(size_label), 0); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
29685
diff
changeset
|
658 | gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32394
diff
changeset
|
659 | size_label, FALSE, FALSE, 0); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
660 | g_free(sz_txt); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
661 | g_free(text); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
662 | } |
|
11402
1be90c47f022
[gaim-migrate @ 13637]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
11243
diff
changeset
|
663 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
664 | /* A fancy little box ************/ |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
665 | vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, PIDGIN_HIG_BOX_SPACE); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
666 | gtk_paned_add2(GTK_PANED(pane), vbox); |
|
11402
1be90c47f022
[gaim-migrate @ 13637]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
11243
diff
changeset
|
667 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
668 | /* Viewer ************/ |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33760
diff
changeset
|
669 | frame = pidgin_create_webview(FALSE, &lv->web_view, NULL); |
|
32439
2c681e5daeeb
Webkit Message views.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
25889
diff
changeset
|
670 | gtk_widget_set_name(lv->web_view, "pidgin_log_web_view"); |
|
2c681e5daeeb
Webkit Message views.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
25889
diff
changeset
|
671 | gtk_widget_set_size_request(lv->web_view, 320, 200); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
672 | gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
673 | gtk_widget_show(frame); |
|
10181
2425c3773266
[gaim-migrate @ 11296]
Mark Doliner <markdoliner@pidgin.im>
parents:
10175
diff
changeset
|
674 | |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
675 | /* Search box **********/ |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
676 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE); |
|
11769
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
677 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
678 | lv->entry = gtk_entry_new(); |
|
66e922bf0ebd
[gaim-migrate @ 14060]
Mark Doliner <markdoliner@pidgin.im>
parents:
11703
diff
changeset
|
679 | 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
|
680 | find_button = gtk_button_new_from_stock(GTK_STOCK_FIND); |
|
953baf2eba1a
[gaim-migrate @ 17035]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
681 | 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
|
682 | 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
|
683 | 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
|
684 | |
|
13569
4f0396bc59fc
[gaim-migrate @ 15947]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13435
diff
changeset
|
685 | select_first_log(lv); |
| 7432 | 686 | |
| 687 | gtk_widget_show_all(lv->window); | |
| 10663 | 688 | |
| 689 | return lv; | |
| 690 | } | |
| 691 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
692 | void pidgin_log_show(PurpleLogType type, const char *buddyname, PurpleAccount *account) { |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
693 | struct log_viewer_hash_t *ht; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
694 | PidginLogViewer *lv = NULL; |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
695 | const char *name = buddyname; |
| 10663 | 696 | char *title; |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
697 | GdkPixbuf *protocol_icon; |
| 10663 | 698 | |
| 699 | g_return_if_fail(account != NULL); | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
700 | g_return_if_fail(buddyname != NULL); |
| 10663 | 701 | |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
702 | ht = g_new0(struct log_viewer_hash_t, 1); |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15060
diff
changeset
|
703 | |
| 10663 | 704 | ht->type = type; |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
705 | ht->buddyname = g_strdup(buddyname); |
| 10663 | 706 | ht->account = account; |
| 707 | ||
| 708 | if (log_viewers == NULL) { | |
| 709 | log_viewers = g_hash_table_new(log_viewer_hash, log_viewer_equal); | |
| 710 | } else if ((lv = g_hash_table_lookup(log_viewers, ht))) { | |
| 711 | gtk_window_present(GTK_WINDOW(lv->window)); | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
712 | g_free(ht->buddyname); |
| 10663 | 713 | g_free(ht); |
| 714 | return; | |
| 715 | } | |
| 716 | ||
| 15884 | 717 | if (type == PURPLE_LOG_CHAT) { |
| 718 | PurpleChat *chat; | |
| 10663 | 719 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
720 | chat = purple_blist_find_chat(account, buddyname); |
| 10663 | 721 | if (chat != NULL) |
| 15884 | 722 | name = purple_chat_get_name(chat); |
| 10663 | 723 | |
| 724 | title = g_strdup_printf(_("Conversations in %s"), name); | |
| 725 | } else { | |
| 15884 | 726 | PurpleBuddy *buddy; |
| 10663 | 727 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34708
diff
changeset
|
728 | buddy = purple_blist_find_buddy(account, buddyname); |
| 10663 | 729 | if (buddy != NULL) |
| 15884 | 730 | name = purple_buddy_get_contact_alias(buddy); |
| 10663 | 731 | |
| 732 | title = g_strdup_printf(_("Conversations with %s"), name); | |
| 733 | } | |
| 734 | ||
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
735 | protocol_icon = pidgin_create_protocol_icon(account, PIDGIN_PROTOCOL_ICON_MEDIUM); |
|
20229
0c823e1a389d
applied changes from 1e697229b1c9a564fa1e509cc9a4a83da6e664df
Luke Schierer <lschiere@pidgin.im>
parents:
20147
diff
changeset
|
736 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
737 | display_log_viewer(ht, purple_log_get_logs(type, buddyname, account), |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
738 | title, gtk_image_new_from_pixbuf(protocol_icon), |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24964
diff
changeset
|
739 | purple_log_get_total_size(type, buddyname, account)); |
|
20229
0c823e1a389d
applied changes from 1e697229b1c9a564fa1e509cc9a4a83da6e664df
Luke Schierer <lschiere@pidgin.im>
parents:
20147
diff
changeset
|
740 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
741 | if (protocol_icon) |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
742 | g_object_unref(protocol_icon); |
| 10663 | 743 | g_free(title); |
| 744 | } | |
| 745 | ||
| 15884 | 746 | void pidgin_log_show_contact(PurpleContact *contact) { |
|
22237
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
747 | struct log_viewer_hash_t *ht; |
| 15884 | 748 | PurpleBlistNode *child; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
749 | PidginLogViewer *lv = NULL; |
| 10663 | 750 | GList *logs = NULL; |
| 751 | GdkPixbuf *pixbuf; | |
|
22237
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
752 | GtkWidget *image; |
| 10663 | 753 | const char *name = NULL; |
| 754 | char *title; | |
| 11585 | 755 | int total_log_size = 0; |
| 10663 | 756 | |
| 757 | g_return_if_fail(contact != NULL); | |
| 758 | ||
|
22237
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
759 | ht = g_new0(struct log_viewer_hash_t, 1); |
| 15884 | 760 | ht->type = PURPLE_LOG_IM; |
| 10663 | 761 | ht->contact = contact; |
| 762 | ||
| 763 | if (log_viewers == NULL) { | |
| 764 | log_viewers = g_hash_table_new(log_viewer_hash, log_viewer_equal); | |
| 765 | } else if ((lv = g_hash_table_lookup(log_viewers, ht))) { | |
| 766 | gtk_window_present(GTK_WINDOW(lv->window)); | |
| 767 | g_free(ht); | |
| 768 | return; | |
| 769 | } | |
| 770 | ||
|
24959
346d2e79e719
Fix one struct hiding issue.
Richard Laager <rlaager@pidgin.im>
parents:
22455
diff
changeset
|
771 | for (child = purple_blist_node_get_first_child((PurpleBlistNode*)contact) ; |
|
346d2e79e719
Fix one struct hiding issue.
Richard Laager <rlaager@pidgin.im>
parents:
22455
diff
changeset
|
772 | child != NULL ; |
|
346d2e79e719
Fix one struct hiding issue.
Richard Laager <rlaager@pidgin.im>
parents:
22455
diff
changeset
|
773 | child = purple_blist_node_get_sibling_next(child)) { |
|
24964
ce4a5049a69f
Another small struct hiding change.
Richard Laager <rlaager@pidgin.im>
parents:
24959
diff
changeset
|
774 | const char *buddy_name; |
|
ce4a5049a69f
Another small struct hiding change.
Richard Laager <rlaager@pidgin.im>
parents:
24959
diff
changeset
|
775 | PurpleAccount *account; |
|
ce4a5049a69f
Another small struct hiding change.
Richard Laager <rlaager@pidgin.im>
parents:
24959
diff
changeset
|
776 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33760
diff
changeset
|
777 | if (!PURPLE_IS_BUDDY(child)) |
| 10663 | 778 | continue; |
| 779 | ||
|
24964
ce4a5049a69f
Another small struct hiding change.
Richard Laager <rlaager@pidgin.im>
parents:
24959
diff
changeset
|
780 | buddy_name = purple_buddy_get_name((PurpleBuddy *)child); |
|
ce4a5049a69f
Another small struct hiding change.
Richard Laager <rlaager@pidgin.im>
parents:
24959
diff
changeset
|
781 | account = purple_buddy_get_account((PurpleBuddy *)child); |
|
ce4a5049a69f
Another small struct hiding change.
Richard Laager <rlaager@pidgin.im>
parents:
24959
diff
changeset
|
782 | logs = g_list_concat(purple_log_get_logs(PURPLE_LOG_IM, buddy_name, account), logs); |
|
ce4a5049a69f
Another small struct hiding change.
Richard Laager <rlaager@pidgin.im>
parents:
24959
diff
changeset
|
783 | total_log_size += purple_log_get_total_size(PURPLE_LOG_IM, buddy_name, account); |
| 10663 | 784 | } |
| 15884 | 785 | logs = g_list_sort(logs, purple_log_compare); |
| 10663 | 786 | |
|
22237
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
787 | image = gtk_image_new(); |
|
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
|
788 | 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
|
789 | gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow"); |
|
22237
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
790 | if (pixbuf) { |
|
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
791 | gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf); |
|
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
792 | g_object_unref(pixbuf); |
|
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
793 | } else { |
|
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
794 | gtk_widget_destroy(image); |
|
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
795 | image = NULL; |
|
8865b5d78095
Some more little leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22214
diff
changeset
|
796 | } |
|
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
|
797 | |
|
34739
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
798 | name = purple_contact_get_alias(contact); |
| 10663 | 799 | |
|
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
|
800 | /* 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
|
801 | * 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
|
802 | * 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
|
803 | if (name == NULL) { |
|
34739
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
804 | if (PURPLE_BLIST_NODE(contact)->child != NULL && |
|
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
805 | PURPLE_IS_BUDDY(PURPLE_BLIST_NODE(contact)->child)) |
|
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
806 | name = purple_buddy_get_contact_alias(PURPLE_BUDDY( |
|
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
807 | PURPLE_BLIST_NODE(contact)->child)); |
|
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
|
808 | 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
|
809 | 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
|
810 | } |
|
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
|
811 | |
| 10663 | 812 | title = g_strdup_printf(_("Conversations with %s"), name); |
|
21214
db28e29a4990
Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents:
21172
diff
changeset
|
813 | display_log_viewer(ht, logs, title, image, total_log_size); |
| 10663 | 814 | g_free(title); |
| 7432 | 815 | } |
| 8573 | 816 | |
|
21214
db28e29a4990
Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents:
21172
diff
changeset
|
817 | void pidgin_syslog_show() |
| 8573 | 818 | { |
| 819 | GList *accounts = NULL; | |
| 10663 | 820 | GList *logs = NULL; |
| 8573 | 821 | |
|
10181
2425c3773266
[gaim-migrate @ 11296]
Mark Doliner <markdoliner@pidgin.im>
parents:
10175
diff
changeset
|
822 | if (syslog_viewer != NULL) { |
| 8573 | 823 | gtk_window_present(GTK_WINDOW(syslog_viewer->window)); |
| 824 | return; | |
| 825 | } | |
| 826 | ||
| 15884 | 827 | for(accounts = purple_accounts_get_all(); accounts != NULL; accounts = accounts->next) { |
| 8573 | 828 | |
| 15884 | 829 | PurpleAccount *account = (PurpleAccount *)accounts->data; |
|
36626
18fc361b3704
Renamed purple_find_protocol_info to purple_protocols_find
Ankit Vani <a@nevitus.org>
parents:
36545
diff
changeset
|
830 | if(purple_protocols_find(purple_account_get_protocol_id(account)) == NULL) |
| 8573 | 831 | continue; |
| 832 | ||
| 15884 | 833 | logs = g_list_concat(purple_log_get_system_logs(account), logs); |
| 8573 | 834 | } |
| 15884 | 835 | logs = g_list_sort(logs, purple_log_compare); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
9917
diff
changeset
|
836 | |
|
21214
db28e29a4990
Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents:
21172
diff
changeset
|
837 | syslog_viewer = display_log_viewer(NULL, logs, _("System Log"), NULL, 0); |
| 8573 | 838 | } |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
839 | |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
840 | /**************************************************************************** |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
841 | * GTK+ LOG SUBSYSTEM ******************************************************* |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
842 | ****************************************************************************/ |
|
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 | void * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
845 | pidgin_log_get_handle(void) |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
846 | { |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
847 | static int handle; |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
848 | |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
849 | return &handle; |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
850 | } |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
851 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
852 | void pidgin_log_init(void) |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
853 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
854 | void *handle = pidgin_log_get_handle(); |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
855 | |
| 15884 | 856 | purple_signal_register(handle, "log-displaying", |
| 857 | purple_marshal_VOID__POINTER_POINTER, | |
|
34827
1615d90aa584
Refactored pidgin to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34739
diff
changeset
|
858 | G_TYPE_NONE, 2, |
|
1615d90aa584
Refactored pidgin to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34739
diff
changeset
|
859 | G_TYPE_POINTER, /* (PidginLogViewer *) */ |
|
1615d90aa584
Refactored pidgin to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34739
diff
changeset
|
860 | PURPLE_TYPE_LOG); |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
861 | } |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
862 | |
|
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
863 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
864 | pidgin_log_uninit(void) |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
865 | { |
| 15884 | 866 | purple_signals_unregister_by_instance(pidgin_log_get_handle()); |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
867 | } |