annotate src/gtklog.c @ 8395:09083081643a

[gaim-migrate @ 9124] Remove that little bit of documentation... committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 04 Mar 2004 05:47:41 +0000
parents 4971193f761d
children 7dcd6f26e4a7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file gtklog.c GTK+ Log viewer
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 * @ingroup gtkui
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 *
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * gaim
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7685
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7685
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7685
diff changeset
9 * source distribution.
7537
083427fd8ba8 [gaim-migrate @ 8150]
Christian Hammond <chipx86@chipx86.com>
parents: 7535
diff changeset
10 *
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * (at your option) any later version.
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * GNU General Public License for more details.
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 *
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 */
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "gtkinternal.h"
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "account.h"
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "util.h"
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "gtkblist.h"
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "gtkimhtml.h"
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "gtklog.h"
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "gtkutils.h"
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "log.h"
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 static GHashTable *log_viewers = NULL;
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
37 static void populate_log_tree(GaimGtkLogViewer *lv);
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 struct log_viewer_hash_t {
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 char *screenname;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 GaimAccount *account;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 };
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
44 static guint log_viewer_hash(gconstpointer data)
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 {
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
46 const struct log_viewer_hash_t *viewer = data;
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 return g_str_hash(viewer->screenname) + g_str_hash(gaim_account_get_username(viewer->account));
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
48
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 }
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
51 static gint log_viewer_equal(gconstpointer y, gconstpointer z)
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 {
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
53 const struct log_viewer_hash_t *a, *b;
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 int ret;
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
55 char *normal;
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
56
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
57 a = y;
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
58 b = z;
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
59
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
60 normal = g_strdup(gaim_normalize(a->account, a->screenname));
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
61 ret = (a->account == b->account) &&
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
62 !strcmp(normal, gaim_normalize(b->account, b->screenname));
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 g_free(normal);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 return ret;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 }
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
67 static void search_cb(GtkWidget *button, GaimGtkLogViewer *lv)
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
68 {
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
69 const char *search_term = gtk_entry_get_text(GTK_ENTRY(lv->entry));
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
70 GList *logs;
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
71 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
72
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
73 if (lv->search)
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
74 g_free(lv->search);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
75
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
76 gtk_tree_store_clear(lv->treestore);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
77 if (strlen(search_term) == 0) {/* reset the tree */
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
78 populate_log_tree(lv);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
79 lv->search = NULL;
7537
083427fd8ba8 [gaim-migrate @ 8150]
Christian Hammond <chipx86@chipx86.com>
parents: 7535
diff changeset
80 gtk_imhtml_search_clear(GTK_IMHTML(lv->imhtml));
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
81 return;
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
82 }
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
83
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
84 lv->search = g_strdup(search_term);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
85
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
86 gdk_window_set_cursor(lv->window->window, cursor);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
87 while (gtk_events_pending())
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
88 gtk_main_iteration();
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
89 gdk_cursor_unref(cursor);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
90
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
91 for (logs = lv->logs; logs != NULL; logs = logs->next) {
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
92 char *read = gaim_log_read((GaimLog*)logs->data, NULL);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
93 if (gaim_strcasestr(read, search_term)) {
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
94 GtkTreeIter iter;
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
95 GaimLog *log = logs->data;
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
96 char title[64];
7676
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
97 char *title_utf8; /* temporary variable for utf8 conversion */
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
98 strftime(title, sizeof(title), "%c", localtime(&log->time));
7676
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
99 title_utf8 = gaim_utf8_try_convert(title);
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
100 strncpy(title, title_utf8, sizeof(title));
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
101 g_free(title_utf8);
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
102 gtk_tree_store_append (lv->treestore, &iter, NULL);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
103 gtk_tree_store_set(lv->treestore, &iter,
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
104 0, title,
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
105 1, log, -1);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
106 }
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
107 }
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
108
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
109
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
110 cursor = gdk_cursor_new(GDK_LEFT_PTR);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
111 gdk_window_set_cursor(lv->window->window, cursor);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
112 gdk_cursor_unref(cursor);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
113 }
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
114
7454
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
115 static gboolean destroy_cb(GtkWidget *w, gint resp, struct log_viewer_hash_t *ht) {
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
116 GaimGtkLogViewer *lv = g_hash_table_lookup(log_viewers, ht);
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
117
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
118 g_hash_table_remove(log_viewers, ht);
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
119 g_free(ht->screenname);
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
120 g_free(ht);
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
121 while (lv->logs) {
7533
66d6f5c4a14a [gaim-migrate @ 8146]
Sean Egan <seanegan@gmail.com>
parents: 7485
diff changeset
122 GaimLog *log = lv->logs->data;
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
123 GList *logs2;
7685
9e122b8f564f [gaim-migrate @ 8329]
Ethan Blanton <elb@pidgin.im>
parents: 7676
diff changeset
124 gaim_log_free(log);
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
125 logs2 = lv->logs->next;
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
126 g_list_free_1(lv->logs);
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
127 lv->logs = logs2;
7533
66d6f5c4a14a [gaim-migrate @ 8146]
Sean Egan <seanegan@gmail.com>
parents: 7485
diff changeset
128 }
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
129 if (lv->search)
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
130 g_free(lv->search);
7533
66d6f5c4a14a [gaim-migrate @ 8146]
Sean Egan <seanegan@gmail.com>
parents: 7485
diff changeset
131 g_free(lv);
7454
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
132 gtk_widget_destroy(w);
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
133
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
134 return TRUE;
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
135 }
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
136
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
137 static void log_select_cb(GtkTreeSelection *sel, GaimGtkLogViewer *viewer) {
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 GtkTreeIter iter;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 GValue val = { 0, };
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 GtkTreeModel *model = GTK_TREE_MODEL(viewer->treestore);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 GaimLog *log = NULL;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 GaimLogReadFlags flags;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 char *read = NULL;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 char time[64];
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 char *title;
7676
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
147 char *title_utf8; /* temporary variable for utf8 conversion */
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 if (! gtk_tree_selection_get_selected (sel, &model, &iter))
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 return;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 gtk_tree_model_get_value (model, &iter, 1, &val);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 log = g_value_get_pointer(&val);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 g_value_unset(&val);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 if (!log)
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 return;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 read = gaim_log_read(log, &flags);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 viewer->flags = flags;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 strftime(time, sizeof(time), "%c", localtime(&log->time));
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 title = g_strdup_printf("%s - %s", log->name, time);
7676
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
162 title_utf8 = gaim_utf8_try_convert(title);
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
163 g_free(title);
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
164 title = title_utf8;
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 gtk_window_set_title(GTK_WINDOW(viewer->window), title);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 gtk_imhtml_clear(GTK_IMHTML(viewer->imhtml));
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 gtk_imhtml_append_text(GTK_IMHTML(viewer->imhtml), read,
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL |
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 ((flags & GAIM_LOG_READ_NO_NEWLINE) ? GTK_IMHTML_NO_NEWLINE : 0));
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
170
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
171 if (viewer->search)
7537
083427fd8ba8 [gaim-migrate @ 8150]
Christian Hammond <chipx86@chipx86.com>
parents: 7535
diff changeset
172 gtk_imhtml_search_find(GTK_IMHTML(viewer->imhtml), viewer->search);
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
173
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 g_free(read);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 g_free(title);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 }
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 /* I want to make this smarter, but haven't come up with a cool algorithm to do so, yet.
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 * I want the tree to be divided into groups like "Today," "Yesterday," "Last week,"
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 * "August," "2002," etc. based on how many conversation took place in each subdivision.
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 *
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 * For now, I'll just make it a flat list.
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 */
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 static void populate_log_tree(GaimGtkLogViewer *lv)
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 /* Logs are made from trees in real life.
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 This is a tree made from logs */
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 {
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
188 char title[64];
7676
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
189 char *title_utf8; /* temporary variable for utf8 conversion */
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 GtkTreeIter iter;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 GList *logs = lv->logs;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 while (logs) {
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 GaimLog *log = logs->data;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 strftime(title, sizeof(title), "%c", localtime(&log->time));
7676
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
195 title_utf8 = gaim_utf8_try_convert(title);
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
196 strncpy(title, title_utf8, sizeof(title));
5c5acdf8b982 [gaim-migrate @ 8320]
Sean Egan <seanegan@gmail.com>
parents: 7537
diff changeset
197 g_free(title_utf8);
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 gtk_tree_store_append (lv->treestore, &iter, NULL);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 gtk_tree_store_set(lv->treestore, &iter,
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 0, title,
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 1, log, -1);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 logs = logs->next;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 }
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 }
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 void gaim_gtk_log_show(const char *screenname, GaimAccount *account) {
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 /* if (log_viewers && g_hash_table */
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 GtkWidget *hbox, *vbox;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 GdkPixbuf *pixbuf, *scale;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 GtkCellRenderer *rend;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 GtkTreeViewColumn *col;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 GaimGtkLogViewer *lv = NULL;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 GtkTreeSelection *sel;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 GtkWidget *icon, *label, *pane, *sw, *button;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 GList *logs;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 char *text;
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7432
diff changeset
217 struct log_viewer_hash_t *ht = g_new0(struct log_viewer_hash_t, 1);
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7432
diff changeset
218
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 ht->screenname = g_strdup(screenname);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 ht->account = account;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 if (!log_viewers) {
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 log_viewers = g_hash_table_new(log_viewer_hash, log_viewer_equal);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 } else if ((lv = g_hash_table_lookup(log_viewers, ht))) {
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 gtk_window_present(GTK_WINDOW(lv->window));
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 return;
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 }
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 lv = g_new0(GaimGtkLogViewer, 1);
7485
8126e7a422b0 [gaim-migrate @ 8098]
Mark Doliner <mark@kingant.net>
parents: 7454
diff changeset
230 lv->logs = logs = gaim_log_get_logs(screenname, account);
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 g_hash_table_insert(log_viewers, ht, lv);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 /* Window ***********/
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 lv->window = gtk_dialog_new_with_buttons(screenname, NULL, 0,
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 gtk_container_set_border_width (GTK_CONTAINER(lv->window), 6);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(lv->window)->vbox), 0);
7454
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
239 g_signal_connect(G_OBJECT(lv->window), "response",
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
240 G_CALLBACK(destroy_cb), ht);
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
241
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 hbox = gtk_hbox_new(FALSE, 6);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), hbox, FALSE, FALSE, 0);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 /* Icon *************/
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 pixbuf = create_prpl_icon(account);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 icon = gtk_image_new_from_pixbuf(scale);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 g_object_unref(G_OBJECT(pixbuf));
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 g_object_unref(G_OBJECT(scale));
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 /* Label ************/
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 label = gtk_label_new(NULL);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 text = g_strdup_printf("<span size='larger' weight='bold'>%s %s</span>",
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 _("Conversations with"), screenname);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 gtk_label_set_markup(GTK_LABEL(label), text);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 g_free(text);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 /* Pane *************/
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 pane = gtk_hpaned_new();
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 gtk_container_set_border_width(GTK_CONTAINER(pane), 6);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), pane, TRUE, TRUE, 0);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 /* List *************/
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 sw = gtk_scrolled_window_new (NULL, NULL);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 gtk_paned_add1(GTK_PANED(pane), sw);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 lv->treestore = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 lv->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (lv->treestore));
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 rend = gtk_cell_renderer_text_new();
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 gtk_tree_view_append_column (GTK_TREE_VIEW(lv->treeview), col);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (lv->treeview), FALSE);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 gtk_container_add (GTK_CONTAINER (sw), lv->treeview);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 gtk_widget_set_size_request(lv->treeview, 170, 200);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 populate_log_tree(lv);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (lv->treeview));
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 g_signal_connect (G_OBJECT (sel), "changed",
7454
50f4386a8262 [gaim-migrate @ 8067]
Mark Doliner <mark@kingant.net>
parents: 7440
diff changeset
285 G_CALLBACK (log_select_cb),
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 lv);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 /* Viewer ************/
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 vbox = gtk_vbox_new(FALSE, 6);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 gtk_paned_add2(GTK_PANED(pane), vbox);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 sw = gtk_scrolled_window_new(NULL, NULL);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 lv->imhtml = gtk_imhtml_new(NULL, NULL);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 gtk_container_add(GTK_CONTAINER(sw), lv->imhtml);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 gaim_setup_imhtml(lv->imhtml);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 gtk_widget_set_size_request(lv->imhtml, 320, 200);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 /* Search box **********/
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 hbox = gtk_hbox_new(FALSE, 6);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 lv->entry = gtk_entry_new();
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 gtk_box_pack_start(GTK_BOX(hbox), lv->entry, TRUE, TRUE, 0);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 button = gtk_button_new_from_stock(GTK_STOCK_FIND);
7535
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
306 g_signal_connect (G_OBJECT (button), "pressed",
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
307 G_CALLBACK (search_cb),
f771759739c1 [gaim-migrate @ 8148]
Sean Egan <seanegan@gmail.com>
parents: 7533
diff changeset
308 lv);
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
310 gaim_set_accessible_label (lv->treeview, label);
7432
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 gtk_widget_show_all(lv->window);
31faec55ef8e [gaim-migrate @ 8037]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 }