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