annotate src/gtksavedstatuses.c @ 11400:62db025d3eb0

[gaim-migrate @ 13635] sf patch #1277824, from Will Thompson (resiak) Fix C99isms in gtkstatusbox.c Although, I'm not conviced these ARE C99isms committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 01 Sep 2005 02:22:03 +0000
parents ad9a61894d9b
children 30ad548e8537
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /**
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2 * @file gtksavedstatus.c GTK+ Saved Status Editor UI
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 * @ingroup gtkui
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 *
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5 * gaim
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 *
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 * source distribution.
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 *
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14 * (at your option) any later version.
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 *
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 * GNU General Public License for more details.
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20 *
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26 #include "account.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27 #include "internal.h"
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
28 #include "notify.h"
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29 #include "request.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30 #include "savedstatuses.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 #include "status.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32 #include "util.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34 #include "gtkblist.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35 #include "gtkgaim.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36 #include "gtkgaim-disclosure.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 #include "gtkimhtml.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38 #include "gtkimhtmltoolbar.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39 #include "gtksavedstatuses.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40 #include "gtkstock.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
41 #include "gtkutils.h"
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43 enum
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
44 {
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
45 STATUS_WINDOW_COLUMN_TITLE,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
46 STATUS_WINDOW_COLUMN_TYPE,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
47 STATUS_WINDOW_COLUMN_MESSAGE,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
48 STATUS_WINDOW_NUM_COLUMNS
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
49 };
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
50
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
51 enum
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
52 {
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
53 STATUS_EDITOR_COLUMN_CUSTOM_STATUS,
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
54 STATUS_EDITOR_COLUMN_ICON,
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
55 STATUS_EDITOR_COLUMN_SCREENNAME,
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
56 STATUS_EDITOR_NUM_COLUMNS
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
57 };
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
58
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
59 typedef struct
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
60 {
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
61 GtkWidget *window;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
62 GtkListStore *model;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
63 GtkWidget *treeview;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
64 GtkWidget *modify_button;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
65 GtkWidget *delete_button;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
66 } StatusWindow;
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
67
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
68 typedef struct
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
69 {
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
70 GtkWidget *window;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
71 GtkListStore *model;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
72 GtkWidget *treeview;
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
73 GtkWidget *save_button;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
74
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
75 gchar *original_title;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
76 GtkEntry *title;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
77 GtkOptionMenu *type;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
78 GtkIMHtml *message;
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
79 } StatusEditor;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
80
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
81 static StatusWindow *status_window = NULL;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
82
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
83
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
84 /**************************************************************************
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
85 * Status window
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
86 **************************************************************************/
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
87
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
88 static gboolean
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
89 status_window_find_savedstatus(GtkTreeIter *iter, const char *title)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
90 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
91 GtkTreeModel *model = GTK_TREE_MODEL(status_window->model);
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
92 char *cur;
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
93
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
94 if (!gtk_tree_model_get_iter_first(model, iter))
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
95 return FALSE;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
96
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
97 gtk_tree_model_get(model, iter, STATUS_WINDOW_COLUMN_TITLE, &cur, -1);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
98 if (!strcmp(title, cur))
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
99 {
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
100 g_free(cur);
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
101 return TRUE;
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
102 }
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
103 g_free(cur);
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
104
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
105 while (gtk_tree_model_iter_next(model, iter))
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
106 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
107 gtk_tree_model_get(model, iter, STATUS_WINDOW_COLUMN_TITLE, &cur, -1);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
108 if (!strcmp(title, cur))
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
109 {
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
110 g_free(cur);
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
111 return TRUE;
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
112 }
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
113 g_free(cur);
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
114 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
115
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
116 return FALSE;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
117 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
118
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
119 static gboolean
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
120 status_window_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
121 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
122 StatusWindow *dialog = user_data;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
123
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
124 dialog->window = NULL;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
125 gaim_gtk_status_window_hide();
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
126
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
127 return FALSE;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
128 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
129
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
130 static void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
131 status_window_add_cb(GtkButton *button, gpointer user_data)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
132 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
133 gaim_gtk_status_editor_show(NULL);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
134 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
135
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
136 static void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
137 status_window_modify_foreach(GtkTreeModel *model, GtkTreePath *path,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
138 GtkTreeIter *iter, gpointer user_data)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
139 {
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
140 char *title;
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
141 GaimSavedStatus *status;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
142
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
143 gtk_tree_model_get(model, iter, STATUS_WINDOW_COLUMN_TITLE, &title, -1);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
144
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
145 status = gaim_savedstatus_find(title);
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
146 g_free(title);
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
147 gaim_gtk_status_editor_show(status);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
148 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
149
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
150 static void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
151 status_window_modify_cb(GtkButton *button, gpointer user_data)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
152 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
153 StatusWindow *dialog = user_data;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
154 GtkTreeSelection *selection;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
155
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
156 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview));
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
157
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
158 gtk_tree_selection_selected_foreach(selection, status_window_modify_foreach, user_data);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
159 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
160
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
161 static void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
162 status_window_delete_confirm_cb(char *title)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
163 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
164 GtkTreeIter iter;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
165
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
166 if (status_window_find_savedstatus(&iter, title))
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
167 gtk_list_store_remove(status_window->model, &iter);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
168
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
169 gaim_savedstatus_delete(title);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
170
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
171 g_free(title);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
172 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
173
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
174 static void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
175 status_window_delete_foreach(GtkTreeModel *model, GtkTreePath *path,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
176 GtkTreeIter *iter, gpointer user_data)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
177 {
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
178 char *title;
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
179 char *title_escaped, *buf;
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
180
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
181 gtk_tree_model_get(model, iter, STATUS_WINDOW_COLUMN_TITLE, &title, -1);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
182
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10591
diff changeset
183 title_escaped = g_markup_escape_text(title, -1);
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
184 buf = g_strdup_printf(_("Are you sure you want to delete %s?"), title_escaped);
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
185 free(title_escaped);
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
186 gaim_request_action(NULL, NULL, buf, NULL, 0, title, 2,
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
187 _("Delete"), status_window_delete_confirm_cb,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
188 _("Cancel"), g_free);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
189 g_free(buf);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
190 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
191
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
192 static void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
193 status_window_delete_cb(GtkButton *button, gpointer user_data)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
194 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
195 StatusWindow *dialog = user_data;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
196 GtkTreeSelection *selection;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
197
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
198 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview));
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
199
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
200 gtk_tree_selection_selected_foreach(selection, status_window_delete_foreach, user_data);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
201 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
202
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
203 static void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
204 status_window_close_cb(GtkButton *button, gpointer user_data)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
205 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
206 gaim_gtk_status_window_hide();
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
207 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
208
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
209 static void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
210 status_selected_cb(GtkTreeSelection *sel, gpointer user_data)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
211 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
212 StatusWindow *dialog = user_data;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
213 gboolean selected = FALSE;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
214
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
215 #if GTK_CHECK_VERSION(2,2,0)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
216 selected = (gtk_tree_selection_count_selected_rows(sel) > 0);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
217 #else
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
218 gtk_tree_selection_selected_foreach(sel, get_selected_helper, &selected);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
219 #endif
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
220
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
221 gtk_widget_set_sensitive(dialog->modify_button, selected);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
222 gtk_widget_set_sensitive(dialog->delete_button, selected);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
223 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
224
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
225 static void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
226 add_status_to_saved_status_list(GtkListStore *model, GaimSavedStatus *saved_status)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
227 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
228 GtkTreeIter iter;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
229 const char *title;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
230 const char *type;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
231 char *message;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
232
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
233 title = gaim_savedstatus_get_title(saved_status);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
234 type = gaim_primitive_get_name_from_type(gaim_savedstatus_get_type(saved_status));
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
235 message = gaim_markup_strip_html(gaim_savedstatus_get_message(saved_status));
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
236
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
237 gtk_list_store_append(model, &iter);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
238 gtk_list_store_set(model, &iter,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
239 STATUS_WINDOW_COLUMN_TITLE, title,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
240 STATUS_WINDOW_COLUMN_TYPE, type,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
241 STATUS_WINDOW_COLUMN_MESSAGE, message,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
242 -1);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
243 free(message);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
244 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
245
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
246 static void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
247 populate_saved_status_list(StatusWindow *dialog)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
248 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
249 const GList *saved_statuses;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
250
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
251 gtk_list_store_clear(dialog->model);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
252
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
253 for (saved_statuses = gaim_savedstatuses_get_all(); saved_statuses != NULL;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
254 saved_statuses = g_list_next(saved_statuses))
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
255 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
256 add_status_to_saved_status_list(dialog->model, saved_statuses->data);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
257 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
258 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
259
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
260 static gboolean
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
261 search_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer search_data)
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
262 {
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
263 gboolean result;
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
264 char *haystack;
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
265
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
266 gtk_tree_model_get(model, iter, column, &haystack, -1);
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
267
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
268 result = (gaim_strcasestr(haystack, key) == NULL);
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
269
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
270 g_free(haystack);
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
271
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
272 return result;
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
273 }
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
274
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
275 static GtkWidget *
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
276 create_saved_status_list(StatusWindow *dialog)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
277 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
278 GtkWidget *sw;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
279 GtkWidget *treeview;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
280 GtkTreeSelection *sel;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
281 GtkTreeViewColumn *column;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
282 GtkCellRenderer *renderer;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
283
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
284 /* Create the scrolled window */
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
285 sw = gtk_scrolled_window_new(0, 0);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
286 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
287 GTK_POLICY_AUTOMATIC,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
288 GTK_POLICY_ALWAYS);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
289 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
290 GTK_SHADOW_IN);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
291 gtk_widget_show(sw);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
292
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
293 /* Create the list model */
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
294 dialog->model = gtk_list_store_new(STATUS_WINDOW_NUM_COLUMNS,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
295 G_TYPE_STRING,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
296 G_TYPE_STRING,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
297 G_TYPE_STRING);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
298
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
299 /* Create the treeview */
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
300 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model));
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
301 dialog->treeview = treeview;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
302 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
303
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
304 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
305 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
306 g_signal_connect(G_OBJECT(sel), "changed",
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
307 G_CALLBACK(status_selected_cb), dialog);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
308
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
309 gtk_container_add(GTK_CONTAINER(sw), treeview);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
310 gtk_widget_show(treeview);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
311
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
312 /* Add columns */
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
313 column = gtk_tree_view_column_new();
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
314 gtk_tree_view_column_set_title(column, _("Title"));
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
315 gtk_tree_view_column_set_resizable(column, TRUE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
316 gtk_tree_view_column_set_sort_column_id(column,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
317 STATUS_WINDOW_COLUMN_TITLE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
318 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
319 renderer = gtk_cell_renderer_text_new();
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
320 gtk_tree_view_column_pack_start(column, renderer, TRUE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
321 gtk_tree_view_column_add_attribute(column, renderer, "text",
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
322 STATUS_WINDOW_COLUMN_TITLE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
323
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
324 column = gtk_tree_view_column_new();
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
325 gtk_tree_view_column_set_title(column, _("Type"));
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
326 gtk_tree_view_column_set_resizable(column, TRUE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
327 gtk_tree_view_column_set_sort_column_id(column,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
328 STATUS_WINDOW_COLUMN_TYPE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
329 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
330 renderer = gtk_cell_renderer_text_new();
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
331 gtk_tree_view_column_pack_start(column, renderer, TRUE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
332 gtk_tree_view_column_add_attribute(column, renderer, "text",
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
333 STATUS_WINDOW_COLUMN_TYPE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
334
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
335 column = gtk_tree_view_column_new();
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
336 gtk_tree_view_column_set_title(column, _("Message"));
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
337 gtk_tree_view_column_set_resizable(column, TRUE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
338 gtk_tree_view_column_set_sort_column_id(column,
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
339 STATUS_WINDOW_COLUMN_MESSAGE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
340 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
341 renderer = gtk_cell_renderer_text_new();
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
342 gtk_tree_view_column_pack_start(column, renderer, TRUE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
343 gtk_tree_view_column_add_attribute(column, renderer, "text",
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
344 STATUS_WINDOW_COLUMN_MESSAGE);
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
345 #if GTK_CHECK_VERSION(2,6,0)
10502
6cd5cca9c451 [gaim-migrate @ 11794]
Sean Egan <seanegan@gmail.com>
parents: 10439
diff changeset
346 g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
347 #endif
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
348
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
349 /* Enable CTRL+F searching */
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
350 gtk_tree_view_set_search_column(GTK_TREE_VIEW(treeview), STATUS_WINDOW_COLUMN_TITLE);
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10422
diff changeset
351 gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(treeview), search_func, NULL, NULL);
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
352
10422
e0cf2f3f9929 [gaim-migrate @ 11673]
Mark Doliner <mark@kingant.net>
parents: 10421
diff changeset
353 /* Sort the title column by default */
e0cf2f3f9929 [gaim-migrate @ 11673]
Mark Doliner <mark@kingant.net>
parents: 10421
diff changeset
354 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(dialog->model),
e0cf2f3f9929 [gaim-migrate @ 11673]
Mark Doliner <mark@kingant.net>
parents: 10421
diff changeset
355 STATUS_WINDOW_COLUMN_TITLE,
e0cf2f3f9929 [gaim-migrate @ 11673]
Mark Doliner <mark@kingant.net>
parents: 10421
diff changeset
356 GTK_SORT_ASCENDING);
e0cf2f3f9929 [gaim-migrate @ 11673]
Mark Doliner <mark@kingant.net>
parents: 10421
diff changeset
357
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
358 /* Populate list */
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
359 populate_saved_status_list(dialog);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
360
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
361 return sw;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
362 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
363
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
364 static gboolean
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
365 configure_cb(GtkWidget *widget, GdkEventConfigure *event, StatusWindow *dialog)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
366 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
367 if (GTK_WIDGET_VISIBLE(widget)) {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
368 gaim_prefs_set_int("/gaim/gtk/status/dialog/width", event->width);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
369 gaim_prefs_set_int("/gaim/gtk/status/dialog/height", event->height);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
370 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
371
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
372 return FALSE;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
373 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
374
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
375 void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
376 gaim_gtk_status_window_show(void)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
377 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
378 StatusWindow *dialog;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
379 GtkWidget *bbox;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
380 GtkWidget *button;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
381 GtkWidget *list;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
382 GtkWidget *vbox;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
383 GtkWidget *win;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
384 int width, height;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
385
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
386 if (status_window != NULL) {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
387 gtk_window_present(GTK_WINDOW(status_window->window));
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
388 return;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
389 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
390
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
391 status_window = dialog = g_new0(StatusWindow, 1);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
392
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
393 width = gaim_prefs_get_int("/gaim/gtk/status/dialog/width");
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
394 height = gaim_prefs_get_int("/gaim/gtk/status/dialog/height");
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
395
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
396 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
397 gtk_window_set_default_size(GTK_WINDOW(win), width, height);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
398 gtk_window_set_role(GTK_WINDOW(win), "statuses");
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
399 gtk_window_set_title(GTK_WINDOW(win), _("Saved Statuses"));
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
400 gtk_container_set_border_width(GTK_CONTAINER(win), GAIM_HIG_BORDER);
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
401
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
402 g_signal_connect(G_OBJECT(win), "delete_event",
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
403 G_CALLBACK(status_window_destroy_cb), dialog);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
404 g_signal_connect(G_OBJECT(win), "configure_event",
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
405 G_CALLBACK(configure_cb), dialog);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
406
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
407 /* Setup the vbox */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
408 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER);
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
409 gtk_container_add(GTK_CONTAINER(win), vbox);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
410 gtk_widget_show(vbox);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
411
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
412 /* List of saved status states */
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
413 list = create_saved_status_list(dialog);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
414 gtk_box_pack_start(GTK_BOX(vbox), list, TRUE, TRUE, 0);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
415
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
416 /* Button box. */
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
417 bbox = gtk_hbutton_box_new();
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
418 gtk_box_set_spacing(GTK_BOX(bbox), GAIM_HIG_BOX_SPACE);
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
419 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
420 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
421 gtk_widget_show(bbox);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
422
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
423 /* Add button */
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
424 button = gtk_button_new_from_stock(GTK_STOCK_ADD);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
425 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
426 gtk_widget_show(button);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
427
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
428 g_signal_connect(G_OBJECT(button), "clicked",
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
429 G_CALLBACK(status_window_add_cb), dialog);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
430
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
431 /* Modify button */
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
432 button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
433 dialog->modify_button = button;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
434 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
435 gtk_widget_set_sensitive(button, FALSE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
436 gtk_widget_show(button);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
437
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
438 g_signal_connect(G_OBJECT(button), "clicked",
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
439 G_CALLBACK(status_window_modify_cb), dialog);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
440
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
441 /* Delete button */
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
442 button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
443 dialog->delete_button = button;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
444 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
445 gtk_widget_set_sensitive(button, FALSE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
446 gtk_widget_show(button);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
447
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
448 g_signal_connect(G_OBJECT(button), "clicked",
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
449 G_CALLBACK(status_window_delete_cb), dialog);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
450
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
451 /* Close button */
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
452 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
453 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
454 gtk_widget_show(button);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
455
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
456 g_signal_connect(G_OBJECT(button), "clicked",
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
457 G_CALLBACK(status_window_close_cb), dialog);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
458
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
459 gtk_widget_show(win);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
460 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
461
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
462 void
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
463 gaim_gtk_status_window_hide(void)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
464 {
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
465 if (status_window == NULL)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
466 return;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
467
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
468 if (status_window->window != NULL)
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
469 gtk_widget_destroy(status_window->window);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
470
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
471 g_free(status_window);
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
472 status_window = NULL;
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
473 }
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
474
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
475
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
476 /**************************************************************************
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
477 * Status editor
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
478 **************************************************************************/
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
479
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
480 static gboolean
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
481 status_editor_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data)
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
482 {
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10535
diff changeset
483 StatusEditor *dialog = user_data;
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
484
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10535
diff changeset
485 g_free(dialog->original_title);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
486 g_free(dialog);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
487
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
488 return FALSE;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
489 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
490
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
491 static void
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
492 status_editor_cancel_cb(GtkButton *button, gpointer user_data)
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
493 {
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10535
diff changeset
494 StatusEditor *dialog = user_data;
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
495
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
496 gtk_widget_destroy(dialog->window);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
497
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10535
diff changeset
498 g_free(dialog->original_title);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
499 g_free(dialog);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
500 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
501
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
502 static void
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
503 status_editor_save_cb(GtkButton *button, gpointer user_data)
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
504 {
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
505 StatusEditor *dialog = user_data;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
506 const char *title;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
507 GaimStatusPrimitive type;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
508 char *message, *unformatted;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
509 GaimSavedStatus *status;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
510
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
511 title = gtk_entry_get_text(dialog->title);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
512
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
513 /*
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
514 * If the title is already taken then show an error dialog and
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
515 * don't do anything.
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
516 */
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
517 if ((gaim_savedstatus_find(title) != NULL) &&
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
518 ((dialog->original_title == NULL) || (strcmp(title, dialog->original_title))))
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
519 {
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
520 gaim_notify_error(NULL, NULL, _("Title already in use. You must "
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
521 "choose a unique title."), NULL);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
522 return;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
523 }
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
524
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
525 type = gtk_option_menu_get_history(dialog->type);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
526 message = gtk_imhtml_get_markup(dialog->message);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
527 unformatted = gaim_markup_strip_html(message);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
528
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
529 /*
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
530 * If we're editing an existing status, remove the old one to
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
531 * make way for the modified one.
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
532 */
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
533 if (dialog->original_title != NULL)
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
534 {
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
535 GtkTreeIter iter;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
536
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
537 gaim_savedstatus_delete(dialog->original_title);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
538
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
539 if (status_window_find_savedstatus(&iter, dialog->original_title))
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
540 {
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
541 gtk_list_store_remove(status_window->model, &iter);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
542 }
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
543 }
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
544
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
545 status = gaim_savedstatus_new(title, type);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
546 if (*unformatted != '\0')
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
547 gaim_savedstatus_set_message(status, message);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
548 g_free(message);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
549 g_free(unformatted);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
550
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
551 gtk_widget_destroy(dialog->window);
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10535
diff changeset
552 g_free(dialog->original_title);
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
553 g_free(dialog);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
554
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
555 add_status_to_saved_status_list(status_window->model, status);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
556 }
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
557
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
558 static void
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
559 status_editor_custom_status_cb(GtkCellRendererToggle *renderer, gchar *path_str, gpointer data)
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
560 {
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
561 /* StatusEditor *dialog = (StatusEditor *)data; */
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
562
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
563 /* TODO: Need to allow user to set a custom status for the highlighted account, somehow */
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
564 }
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
565
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
566 static void
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
567 editor_title_changed_cb(GtkWidget *widget, gpointer user_data)
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
568 {
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
569 StatusEditor *dialog = user_data;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
570 const gchar *text;
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
571
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
572 text = gtk_entry_get_text(dialog->title);
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
573
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
574 gtk_widget_set_sensitive(dialog->save_button, (*text != '\0'));
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
575 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
576
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
577 static GtkWidget *
10419
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
578 create_status_type_menu(GaimStatusPrimitive type)
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
579 {
10419
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
580 int i;
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
581 GtkWidget *dropdown;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
582 GtkWidget *menu;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
583 GtkWidget *item;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
584
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
585 dropdown = gtk_option_menu_new();
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
586 menu = gtk_menu_new();
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
587
10419
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
588 for (i = 0; i < GAIM_STATUS_NUM_PRIMITIVES; i++)
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
589 {
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
590 item = gtk_menu_item_new_with_label(gaim_primitive_get_name_from_type(i));
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
591 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
592 gtk_widget_show(item);
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
593 }
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
594
10419
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
595 gtk_menu_set_active(GTK_MENU(menu), type);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
596 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
597 gtk_widget_show(menu);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
598
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
599 return dropdown;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
600 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
601
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
602 static void
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
603 status_editor_add_columns(StatusEditor *dialog)
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
604 {
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
605 GtkCellRenderer *renderer;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
606 GtkTreeViewColumn *column;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
607
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
608 /* Custom status column */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
609 renderer = gtk_cell_renderer_toggle_new();
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
610 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(dialog->treeview),
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
611 -1, _("Custom status"),
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
612 renderer,
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
613 "active", STATUS_EDITOR_COLUMN_CUSTOM_STATUS,
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
614 NULL);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
615 column = gtk_tree_view_get_column(GTK_TREE_VIEW(dialog->treeview), 1);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
616 g_signal_connect(G_OBJECT(renderer), "toggled",
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
617 G_CALLBACK(status_editor_custom_status_cb), dialog);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
618
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
619 /* Screen Name column */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
620 column = gtk_tree_view_column_new();
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
621 gtk_tree_view_column_set_resizable(column, TRUE);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
622 gtk_tree_view_column_set_title(column, _("Screen Name"));
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
623 gtk_tree_view_insert_column(GTK_TREE_VIEW(dialog->treeview), column, -1);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
624 gtk_tree_view_column_set_resizable(column, TRUE);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
625
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
626 /* Icon */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
627 renderer = gtk_cell_renderer_pixbuf_new();
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
628 gtk_tree_view_column_pack_start(column, renderer, FALSE);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
629 gtk_tree_view_column_add_attribute(column, renderer, "pixbuf",
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
630 STATUS_EDITOR_COLUMN_ICON);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
631
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
632 /* Screen Name */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
633 renderer = gtk_cell_renderer_text_new();
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
634 gtk_tree_view_column_pack_start(column, renderer, TRUE);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
635 gtk_tree_view_column_add_attribute(column, renderer, "text",
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
636 STATUS_EDITOR_COLUMN_SCREENNAME);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
637 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
638
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
639 static void
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
640 status_editor_set_account(GtkListStore *store, GaimAccount *account, GtkTreeIter *iter)
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
641 {
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
642 GdkPixbuf *pixbuf;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
643 GdkPixbuf *scale;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
644
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
645 scale = NULL;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
646
10884
5cda52915a1f [gaim-migrate @ 12582]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10814
diff changeset
647 pixbuf = gaim_gtk_create_prpl_icon(account);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
648
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
649 if (pixbuf != NULL)
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
650 {
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
651 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
652
11251
ad9a61894d9b [gaim-migrate @ 13420]
Mark Doliner <mark@kingant.net>
parents: 11243
diff changeset
653 if (gaim_account_is_disconnected(account))
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
654 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
655 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
656
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
657 gtk_list_store_set(store, iter,
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
658 STATUS_EDITOR_COLUMN_ICON, scale,
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
659 STATUS_EDITOR_COLUMN_SCREENNAME, gaim_account_get_username(account),
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
660 -1);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
661
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
662 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf));
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
663 if (scale != NULL) g_object_unref(G_OBJECT(scale));
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
664 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
665
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
666 static void
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
667 status_editor_add_account(StatusEditor *dialog, GaimAccount *account)
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
668 {
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
669 GtkTreeIter iter;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
670
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
671 gtk_list_store_append(dialog->model, &iter);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
672
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
673 status_editor_set_account(dialog->model, account, &iter);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
674 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
675
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
676 static void
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
677 status_editor_populate_list(StatusEditor *dialog)
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
678 {
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
679 GList *l;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
680
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
681 gtk_list_store_clear(dialog->model);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
682
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
683 for (l = gaim_accounts_get_all(); l != NULL; l = l->next)
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
684 status_editor_add_account(dialog, (GaimAccount *)l->data);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
685 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
686
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
687 void
10419
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
688 gaim_gtk_status_editor_show(GaimSavedStatus *status)
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
689 {
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
690 StatusEditor *dialog;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
691 GtkSizeGroup *sg;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
692 GtkWidget *bbox;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
693 GtkWidget *button;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
694 GtkWidget *dbox;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
695 GtkWidget *disclosure;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
696 GtkWidget *dropdown;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
697 GtkWidget *entry;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
698 GtkWidget *frame;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
699 GtkWidget *hbox;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
700 GtkWidget *label;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
701 GtkWidget *sw;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
702 GtkWidget *text;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
703 GtkWidget *toolbar;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
704 GtkWidget *vbox;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
705 GtkWidget *win;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
706
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
707 dialog = g_new0(StatusEditor, 1);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
708
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
709 if (status != NULL)
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
710 dialog->original_title = g_strdup(gaim_savedstatus_get_title(status));
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
711
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
712 dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
713 gtk_window_set_role(GTK_WINDOW(win), "status");
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
714 gtk_window_set_title(GTK_WINDOW(win), _("Status"));
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
715 gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
716 gtk_container_set_border_width(GTK_CONTAINER(win), GAIM_HIG_BORDER);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
717
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
718 g_signal_connect(G_OBJECT(win), "delete_event",
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
719 G_CALLBACK(status_editor_destroy_cb), dialog);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
720
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
721 /* Setup the vbox */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
722 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
723 gtk_container_add(GTK_CONTAINER(win), vbox);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
724 gtk_widget_show(vbox);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
725
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
726 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
727
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
728 /* Title */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
729 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
730 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
731 gtk_widget_show(hbox);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
732
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
733 label = gtk_label_new_with_mnemonic(_("_Title:"));
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
734 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
735 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
736 gtk_widget_show(label);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
737 gtk_size_group_add_widget(sg, label);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
738
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
739 entry = gtk_entry_new();
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
740 dialog->title = GTK_ENTRY(entry);
10419
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
741 if (status != NULL)
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
742 gtk_entry_set_text(GTK_ENTRY(entry), dialog->original_title);
10419
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
743 else
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
744 gtk_entry_set_text(GTK_ENTRY(entry), _("Out of the office"));
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
745 gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
746 gtk_widget_show(entry);
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
747 g_signal_connect(G_OBJECT(entry), "changed",
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
748 G_CALLBACK(editor_title_changed_cb), dialog);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
749
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
750 /* Status type */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
751 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
752 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
753 gtk_widget_show(hbox);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
754
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
755 label = gtk_label_new_with_mnemonic(_("_Status:"));
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
756 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
757 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
758 gtk_widget_show(label);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
759 gtk_size_group_add_widget(sg, label);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
760
10419
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
761 if (status != NULL)
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
762 dropdown = create_status_type_menu(gaim_savedstatus_get_type(status));
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
763 else
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
764 dropdown = create_status_type_menu(GAIM_STATUS_AWAY);
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
765 dialog->type = GTK_OPTION_MENU(dropdown);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
766 gtk_box_pack_start(GTK_BOX(hbox), dropdown, TRUE, TRUE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
767 gtk_widget_show(dropdown);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
768
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
769 /* Status message */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
770 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
771 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
772 gtk_widget_show(hbox);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
773
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
774 label = gtk_label_new_with_mnemonic(_("_Message:"));
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
775 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
776 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
777 gtk_widget_show(label);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
778 gtk_size_group_add_widget(sg, label);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
779
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
780 frame = gaim_gtk_create_imhtml(TRUE, &text, &toolbar);
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
781 dialog->message = GTK_IMHTML(text);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
782 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
783 gtk_widget_show(frame);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
784
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10535
diff changeset
785 if ((status != NULL) && (gaim_savedstatus_get_message(status) != NULL))
10419
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
786 gtk_imhtml_append_text(GTK_IMHTML(text),
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
787 gaim_savedstatus_get_message(status), 0);
c9b1f3fac753 [gaim-migrate @ 11670]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
788
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
789 /* Custom status message disclosure */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
790 disclosure = gaim_disclosure_new(_("Use a different status for some accounts"),
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
791 _("Use a different status for some accounts"));
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
792 gtk_box_pack_start(GTK_BOX(vbox), disclosure, FALSE, FALSE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
793 gtk_widget_show(disclosure);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
794
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
795 /* Setup the box that the disclosure will cover */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
796 dbox = gtk_vbox_new(FALSE, GAIM_HIG_CAT_SPACE);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
797 gtk_box_pack_start(GTK_BOX(vbox), dbox, FALSE, FALSE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
798 gaim_disclosure_set_container(GAIM_DISCLOSURE(disclosure), dbox);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
799
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
800 /* Custom status message treeview */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
801 sw = gtk_scrolled_window_new(NULL, NULL);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
802 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
803 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
804 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
805 GTK_SHADOW_IN);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
806 gtk_box_pack_start(GTK_BOX(dbox), sw, TRUE, TRUE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
807 gtk_widget_show(sw);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
808
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
809 /* Create the list model */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
810 dialog->model = gtk_list_store_new(STATUS_EDITOR_NUM_COLUMNS,
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
811 G_TYPE_BOOLEAN,
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
812 GDK_TYPE_PIXBUF, G_TYPE_STRING);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
813
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
814 /* Create the treeview */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
815 dialog->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model));
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
816 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(dialog->treeview), TRUE);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
817 gtk_widget_set_size_request(dialog->treeview, 400, 250);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
818 gtk_container_add(GTK_CONTAINER(sw), dialog->treeview);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
819 gtk_widget_show(dialog->treeview);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
820
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
821 /* Add columns */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
822 status_editor_add_columns(dialog);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
823
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
824 /* Populate list */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
825 status_editor_populate_list(dialog);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
826
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
827 /* Button box */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
828 bbox = gtk_hbutton_box_new();
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 10884
diff changeset
829 gtk_box_set_spacing(GTK_BOX(bbox), GAIM_HIG_BOX_SPACE);
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
830 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
831 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
832 gtk_widget_show(bbox);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
833
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
834 /* Cancel button */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
835 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
836 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
837 gtk_widget_show(button);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
838
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
839 g_signal_connect(G_OBJECT(button), "clicked",
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
840 G_CALLBACK(status_editor_cancel_cb), dialog);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
841
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
842 /* Save button */
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
843 button = gtk_button_new_from_stock(GTK_STOCK_SAVE);
10420
854c972ea863 [gaim-migrate @ 11671]
Mark Doliner <mark@kingant.net>
parents: 10419
diff changeset
844 dialog->save_button = button;
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
845 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
846 gtk_widget_show(button);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
847
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
848 g_signal_connect(G_OBJECT(button), "clicked",
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
849 G_CALLBACK(status_editor_save_cb), dialog);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
850
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
851 gtk_widget_show(win);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
852 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
853
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
854
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
855 /**************************************************************************
10814
364a2ef907ae [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10732
diff changeset
856 * GTK+ saved status glue
10421
ee56a3e54fbd [gaim-migrate @ 11672]
Mark Doliner <mark@kingant.net>
parents: 10420
diff changeset
857 **************************************************************************/
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
858
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
859 void *
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
860 gaim_gtk_status_get_handle()
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
861 {
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
862 static int handle;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
863
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
864 return &handle;
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
865 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
866
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
867 void
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
868 gaim_gtk_status_init(void)
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
869 {
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
870 gaim_prefs_add_none("/gaim/gtk/status");
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
871 gaim_prefs_add_none("/gaim/gtk/status/dialog");
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
872 gaim_prefs_add_int("/gaim/gtk/status/dialog/width", 550);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
873 gaim_prefs_add_int("/gaim/gtk/status/dialog/height", 250);
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
874 }
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
875
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
876 void
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
877 gaim_gtk_status_uninit(void)
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
878 {
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
879 gaim_gtk_status_window_hide();
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
880 }