annotate src/protocols/qq/group_admindlg.c @ 13961:b0e37dcb3987

[gaim-migrate @ 16514] Fix the makefile. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 17 Jul 2006 23:57:12 +0000
parents 983fd420e86b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
1 /**
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
2 * The QQ2003C protocol plugin
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
3 *
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
4 * for gaim
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
5 *
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
6 * Copyright (C) 2004 Puzzlebird
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
7 *
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
11 * (at your option) any later version.
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
12 *
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
16 * GNU General Public License for more details.
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
17 *
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
21 */
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
22
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
23 // START OF FILE
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
24 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
25 #include "debug.h" // gaim_debug
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
26 #include "blist.h" // GAIM_BLIST_NODE_IS_BUDDY
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
27 #include "notify.h" // gaim_notify_warning
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
28
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
29 #include "utils.h" // gaim_name_to_uid
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
30 #include "group_admindlg.h"
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
31 #include "group_find.h" // qq_group_find_by_internal_group_id
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
32 #include "group_join.h" // auth_type
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
33 #include "group_opt.h" // QQ_GROUP_TYPE_PERMANENT
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
34
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
35 enum {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
36 COLUMN_SELECTED = 0,
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
37 COLUMN_UID,
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
38 COLUMN_NICKNAME,
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
39 NUM_COLUMNS
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
40 };
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
41
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
42 enum {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
43 PAGE_INFO = 0,
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
44 PAGE_MEMBER,
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
45 };
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
46
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
47 typedef struct _qun_info_window {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
48 guint32 internal_group_id;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
49 GaimConnection *gc;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
50 GtkWidget *window;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
51 GtkWidget *notebook;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
52 GtkWidget *lbl_external_group_id;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
53 GtkWidget *lbl_admin_uid;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
54 GtkWidget *ent_group_name;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
55 GtkWidget *cmb_group_category;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
56 GtkWidget *txt_group_desc;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
57 GtkWidget *txt_group_notice;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
58 GtkWidget *rad_auth[3];
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
59 GtkWidget *btn_mod;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
60 GtkWidget *btn_close;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
61 GtkWidget *tre_members;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
62 } qun_info_window;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
63
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
64 const gchar *qq_group_category[] = {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
65 "同学", "朋友", "同事", "其他",
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
66 }; // qq_group_category
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
67
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
68 const gchar *qq_group_auth_type_desc[] = {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
69 "无须认证", "需要认证", "不可添加",
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
70 }; // qq_group_auth_type_desc
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
71
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
72 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
73 static void _qq_group_info_window_deleteevent(GtkWidget * widget, GdkEvent * event, gpointer data) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
74 gtk_widget_destroy(widget); // this will call _window_destroy
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
75 } // _window_deleteevent
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
76
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
77 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
78 static void _qq_group_info_window_close(GtkWidget * widget, gpointer data)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
79 {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
80 // this will call _info_window_destroy if it is info-window
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
81 gtk_widget_destroy(GTK_WIDGET(data));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
82 } // _window_close
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
83
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
84 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
85 static void _qq_group_info_window_destroy(GtkWidget * widget, gpointer data)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
86 {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
87 GaimConnection *gc;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
88 GList *list;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
89 qq_data *qd;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
90 qun_info_window *info_window;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
91
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
92 gc = (GaimConnection *) data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
93 g_return_if_fail(gc != NULL && gc->proto_data != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
94 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Group info is destoryed\n");
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
95
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
96 qd = (qq_data *) gc->proto_data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
97 list = qd->qun_info_window;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
98
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
99 while (list) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
100 info_window = (qun_info_window *) (list->data);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
101 if (info_window->window != widget)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
102 list = list->next;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
103 else {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
104 qd->qun_info_window = g_list_remove(qd->qun_info_window, info_window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
105 g_free(info_window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
106 break;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
107 } // if info_window
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
108 } // while
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
109 } // _window_destroy
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
110
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
111 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
112 void qq_qun_info_window_free(qq_data * qd)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
113 {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
114 gint i;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
115 qun_info_window *info_window;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
116
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
117 i = 0;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
118 while (qd->qun_info_window) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
119 info_window = (qun_info_window *) qd->qun_info_window->data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
120 qd->qun_info_window = g_list_remove(qd->qun_info_window, info_window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
121 if (info_window->window)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
122 gtk_widget_destroy(info_window->window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
123 g_free(info_window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
124 i++;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
125 } // while
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
126
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
127 gaim_debug(GAIM_DEBUG_INFO, "QQ", "%d Qun info windows are freed\n", i);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
128 } // qq_qun_info_window_free
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
129
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
130 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
131 static void _qq_group_info_window_modify(GtkWidget * widget, gpointer data)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
132 {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
133 GaimConnection *gc;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
134 qun_info_window *info_window;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
135
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
136 g_return_if_fail(data != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
137 info_window = (qun_info_window *) data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
138
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
139 gc = info_window->gc;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
140 g_return_if_fail(gc != NULL && gc->proto_data != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
141
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
142 //henry: This function contains some codes only supported by gtk-2.4 or later
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
143 //#if !GTK_CHECK_VERSION(2,4,0)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
144 // gaim_notify_info(gc, _("QQ Qun Operation"),
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
145 // _("This version of GTK-2 does not support this function"), NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
146 // return;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
147 //#else
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
148 gint page, group_category, i = 0;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
149 qq_group *group;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
150 qq_data *qd;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
151 GtkTextIter start, end;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
152 GtkTreeModel *model;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
153 GtkTreeIter iter;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
154 GValue value = { 0, };
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
155 guint32 *new_members;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
156 guint32 uid;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
157 gboolean selected;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
158
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
159 qd = (qq_data *) gc->proto_data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
160
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
161 // we assume the modification can succeed
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
162 // maybe it needs some tweak here
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
163 group = qq_group_find_by_internal_group_id(gc, info_window->internal_group_id);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
164 g_return_if_fail(group != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
165
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
166 new_members = g_newa(guint32, QQ_QUN_MEMBER_MAX);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
167
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
168 page = gtk_notebook_get_current_page(GTK_NOTEBOOK(info_window->notebook));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
169 switch (page) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
170 case PAGE_INFO:
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
171 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Gonna change Qun detailed information\n");
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
172 // get the group_category
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
173 #if GTK_CHECK_VERSION(2,4,0)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
174 group_category = gtk_combo_box_get_active(GTK_COMBO_BOX(info_window->cmb_group_category));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
175 #else
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
176 group_category = gtk_option_menu_get_history(GTK_OPTION_MENU(info_window->cmb_group_category));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
177 #endif
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
178
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
179 if (group_category >= 0)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
180 group->group_category = group_category;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
181 else {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
182 g_free(group);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
183 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Invalid group_category: %d\n", group_category);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
184 return;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
185 } // if group_category
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
186 // get auth_type
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
187 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info_window->rad_auth[0])))
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
188 group->auth_type = QQ_GROUP_AUTH_TYPE_NO_AUTH;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
189 else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info_window->rad_auth[1])))
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
190 group->auth_type = QQ_GROUP_AUTH_TYPE_NEED_AUTH;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
191 else
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
192 group->auth_type = QQ_GROUP_AUTH_TYPE_NO_ADD;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
193 // MUST use g_strdup, otherwise core dump after info_window is closed
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
194 group->group_name_utf8 = g_strdup(gtk_entry_get_text(GTK_ENTRY(info_window->ent_group_name)));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
195 gtk_text_buffer_get_bounds(gtk_text_view_get_buffer
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
196 (GTK_TEXT_VIEW(info_window->txt_group_desc)), &start, &end);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
197 group->group_desc_utf8 =
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
198 g_strdup(gtk_text_buffer_get_text
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
199 (gtk_text_view_get_buffer
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
200 (GTK_TEXT_VIEW(info_window->txt_group_desc)), &start, &end, FALSE));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
201 gtk_text_buffer_get_bounds(gtk_text_view_get_buffer
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
202 (GTK_TEXT_VIEW(info_window->txt_group_notice)), &start, &end);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
203 group->notice_utf8 =
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
204 g_strdup(gtk_text_buffer_get_text
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
205 (gtk_text_view_get_buffer
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
206 (GTK_TEXT_VIEW(info_window->txt_group_notice)), &start, &end, FALSE));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
207 // finally we can modify it with new information
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
208 qq_group_modify_info(gc, group);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
209 break;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
210 case PAGE_MEMBER:
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
211 if (info_window->tre_members == NULL) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
212 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Member list is not ready, cannot modify!\n");
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
213 } else {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
214 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Gonna change Qun member list\n");
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
215 model = gtk_tree_view_get_model(GTK_TREE_VIEW(info_window->tre_members));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
216 if (gtk_tree_model_get_iter_first(model, &iter)) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
217 gtk_tree_model_get_value(model, &iter, COLUMN_UID, &value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
218 uid = g_value_get_uint(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
219 g_value_unset(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
220 gtk_tree_model_get_value(model, &iter, COLUMN_SELECTED, &value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
221 selected = g_value_get_boolean(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
222 g_value_unset(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
223 if (!selected)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
224 new_members[i++] = uid;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
225 while (gtk_tree_model_iter_next(model, &iter)) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
226 gtk_tree_model_get_value(model, &iter, COLUMN_UID, &value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
227 uid = g_value_get_uint(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
228 g_value_unset(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
229 gtk_tree_model_get_value(model, &iter, COLUMN_SELECTED, &value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
230 selected = g_value_get_boolean(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
231 g_value_unset(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
232 if (!selected)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
233 new_members[i++] = uid;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
234 } // while
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
235 new_members[i] = 0xffffffff; // this labels the end
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
236 } else
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
237 new_members[0] = 0xffffffff;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
238 qq_group_modify_members(gc, group, new_members);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
239 } // if info_window->tre_members
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
240 break;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
241 default:
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
242 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Invalid page number: %d\n", page);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
243 } // switch
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
244
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
245 _qq_group_info_window_close(NULL, info_window->window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
246
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
247 //#endif /* GTK_CHECK_VERSION */
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
248 } // _qq_group_info_window_modify
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
249
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
250 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
251 static void _qq_group_member_list_deleted_toggled(GtkCellRendererToggle * cell, gchar * path_str, gpointer data) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
252 qun_info_window *info_window;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
253 GaimConnection *gc;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
254 qq_group *group;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
255
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
256 info_window = (qun_info_window *) data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
257 g_return_if_fail(info_window != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
258
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
259 gc = info_window->gc;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
260 g_return_if_fail(gc != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
261
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
262 group = qq_group_find_by_internal_group_id(gc, info_window->internal_group_id);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
263 g_return_if_fail(group != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
264
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
265 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(info_window->tre_members));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
266 GtkTreeIter iter;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
267 GtkTreePath *path = gtk_tree_path_new_from_string(path_str);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
268 gboolean selected;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
269 guint32 uid;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
270
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
271 gtk_tree_model_get_iter(model, &iter, path);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
272 gtk_tree_model_get(model, &iter, COLUMN_SELECTED, &selected, -1);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
273 gtk_tree_model_get(model, &iter, COLUMN_UID, &uid, -1);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
274
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
275 if (uid != group->creator_uid) { // do not allow delete admin
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
276 selected ^= 1;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
277 gtk_list_store_set(GTK_LIST_STORE(model), &iter, COLUMN_SELECTED, selected, -1);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
278 gtk_tree_path_free(path);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
279 } else
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
280 gaim_notify_error(gc, NULL, _("Qun creator cannot be removed"), NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
281 } // _qq_group_member_list_deleted_toggled
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
282
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
283 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
284 static void _qq_group_member_list_drag_data_rcv_cb
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
285 (GtkWidget * widget, GdkDragContext * dc, guint x, guint y,
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
286 GtkSelectionData * sd, guint info, guint t, gpointer data) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
287
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
288 GaimConnection *gc;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
289 GaimAccount *account;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
290 GaimBlistNode *n = NULL;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
291 GaimContact *c = NULL;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
292 GaimBuddy *b = NULL;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
293 GtkWidget *treeview;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
294 GtkTreeModel *model;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
295 GtkListStore *store;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
296 GtkTreeIter iter;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
297 GValue value = { 0, };
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
298 guint32 uid, input_uid;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
299
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
300 treeview = widget;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
301 gc = (GaimConnection *) data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
302 g_return_if_fail(gc != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
303 account = gaim_connection_get_account(gc);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
304
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
305 if (sd->target != gdk_atom_intern("GAIM_BLIST_NODE", FALSE) || sd->data == NULL) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
306 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Invalid drag data received, discard...\n");
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
307 return;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
308 } // if (sd->target
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
309
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
310 memcpy(&n, sd->data, sizeof(n));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
311
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
312 // we expect GAIM_BLIST_CONTACT_NODE and GAIM_BLIST_BUDDY_NODE
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
313 if (GAIM_BLIST_NODE_IS_CONTACT(n)) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
314 c = (GaimContact *) n;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
315 b = c->priority; // we get the first buddy only
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
316 } else if (GAIM_BLIST_NODE_IS_BUDDY(n))
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
317 b = (GaimBuddy *) n;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
318
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
319 if (b == NULL) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
320 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "No valid GaimBuddy is passed from DnD\n");
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
321 return;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
322 } // if b == NULL
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
323
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
324 gaim_debug(GAIM_DEBUG_INFO, "QQ", "We get a GaimBuddy: %s\n", b->name);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
325 input_uid = gaim_name_to_uid(b->name);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
326 g_return_if_fail(input_uid > 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
327
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
328 model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
329 // we need to check if the user id in the member list is unique
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
330 // possibly a tree transverse is necessary to achieve this
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
331 if (gtk_tree_model_get_iter_first(model, &iter)) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
332 gtk_tree_model_get_value(model, &iter, COLUMN_UID, &value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
333 uid = g_value_get_uint(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
334 g_value_unset(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
335 while (uid != input_uid && gtk_tree_model_iter_next(model, &iter)) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
336 gtk_tree_model_get_value(model, &iter, COLUMN_UID, &value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
337 uid = g_value_get_uint(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
338 g_value_unset(&value);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
339 } // while
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
340 } else
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
341 uid = 0; // if gtk_tree_model_get_iter_first
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
342
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
343 if (uid == input_uid) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
344 gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Qun already has this buddy %s\n", b->name);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
345 return;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
346 } else { // we add it to list
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
347 store = GTK_LIST_STORE(model);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
348 gtk_list_store_append(store, &iter);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
349 gtk_list_store_set(store, &iter,
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
350 COLUMN_SELECTED, FALSE, COLUMN_UID, input_uid, COLUMN_NICKNAME, b->alias, -1);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
351 // re-sort the list
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
352 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), COLUMN_UID, GTK_SORT_ASCENDING);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
353 } // if uid
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
354
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
355 } // _qq_group_member_list_drag_data_rcv_cb
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
356
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
357 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
358 static GtkWidget *_create_page_info(GaimConnection * gc, qq_group * group, gboolean do_manage, qun_info_window * info_window) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
359 GtkWidget *vbox, *hbox;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
360 GtkWidget *frame_info, *frame_auth;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
361 GtkWidget *tbl_info;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
362 GtkWidget *label, *entry, *combo, *text, *scrolled_window;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
363 gint i;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
364
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
365 g_return_val_if_fail(gc != NULL && group != NULL, NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
366
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
367 vbox = gtk_vbox_new(FALSE, 5);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
368
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
369 frame_info = gtk_frame_new(NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
370 gtk_box_pack_start(GTK_BOX(vbox), frame_info, TRUE, TRUE, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
371
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
372 tbl_info = gtk_table_new(6, 4, FALSE);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
373 gtk_table_set_row_spacings(GTK_TABLE(tbl_info), 4);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
374 gtk_table_set_col_spacing(GTK_TABLE(tbl_info), 1, 10);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
375 gtk_container_add(GTK_CONTAINER(frame_info), tbl_info);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
376
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
377 label = gtk_label_new(_("Group ID: "));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
378 gtk_table_attach(GTK_TABLE(tbl_info), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
379 label = gtk_label_new(g_strdup_printf("%d", group->external_group_id));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
380 gtk_table_attach(GTK_TABLE(tbl_info), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
381 info_window->lbl_external_group_id = label;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
382
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
383 label = gtk_label_new(_("Group Name"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
384 gtk_table_attach(GTK_TABLE(tbl_info), label, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
385 entry = gtk_entry_new();
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
386 gtk_widget_set_size_request(entry, 100, -1);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
387 if (group->group_name_utf8 != NULL)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
388 gtk_entry_set_text(GTK_ENTRY(entry), group->group_name_utf8);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
389 gtk_table_attach(GTK_TABLE(tbl_info), entry, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
390 info_window->ent_group_name = entry;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
391
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
392 label = gtk_label_new(_("Admin: "));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
393 gtk_table_attach(GTK_TABLE(tbl_info), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
394 label = gtk_label_new(g_strdup_printf("%d", group->creator_uid));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
395 gtk_table_attach(GTK_TABLE(tbl_info), label, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
396 info_window->lbl_admin_uid = label;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
397
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
398 label = gtk_label_new(_("Category"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
399 gtk_table_attach(GTK_TABLE(tbl_info), label, 2, 3, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
400
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
401 //henry: these codes are supported only in GTK-2.4 or later
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
402 #if GTK_CHECK_VERSION(2, 4, 0)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
403 combo = gtk_combo_box_new_text();
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
404 for (i = 0; i < 4; i++)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
405 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), qq_group_category[i]);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
406 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), group->group_category);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
407 #else
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
408 GtkWidget *menu;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
409 GtkWidget *item;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
410
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
411 combo = gtk_option_menu_new();
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
412 menu = gtk_menu_new();
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
413 for (i = 0; i < 4; i++) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
414 item = gtk_menu_item_new_with_label(qq_group_category[i]);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
415 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
416 gtk_widget_show(item);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
417 }
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
418 gtk_option_menu_set_menu(GTK_OPTION_MENU(combo), menu);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
419 gtk_option_menu_set_history(GTK_OPTION_MENU(combo), group->group_category);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
420 #endif /* GTK_CHECK_VERSION */
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
421
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
422 gtk_table_attach(GTK_TABLE(tbl_info), combo, 3, 4, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
423 info_window->cmb_group_category = combo;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
424
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
425 label = gtk_label_new(_("Description"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
426 gtk_table_attach(GTK_TABLE(tbl_info), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
427 text = gtk_text_view_new();
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
428 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
429 gtk_widget_set_size_request(text, -1, 50);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
430 if (group->group_desc_utf8 != NULL)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
431 gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), group->group_desc_utf8, -1);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
432 info_window->txt_group_desc = text;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
433
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
434 scrolled_window = gtk_scrolled_window_new(NULL, NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
435 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
436 gtk_container_add(GTK_CONTAINER(scrolled_window), text);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
437 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
438 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 2);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
439 gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text), 2);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
440 gtk_table_attach(GTK_TABLE(tbl_info), scrolled_window, 0, 4, 3, 4, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
441
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
442 label = gtk_label_new(_("Group Notice"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
443 gtk_table_attach(GTK_TABLE(tbl_info), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
444 text = gtk_text_view_new();
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
445 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
446 gtk_widget_set_size_request(text, -1, 50);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
447 if (group->notice_utf8 != NULL)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
448 gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), group->notice_utf8, -1);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
449 info_window->txt_group_notice = text;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
450
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
451 scrolled_window = gtk_scrolled_window_new(NULL, NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
452 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
453 gtk_container_add(GTK_CONTAINER(scrolled_window), text);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
454 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
455 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 2);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
456 gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text), 2);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
457 gtk_table_attach(GTK_TABLE(tbl_info), scrolled_window, 0, 4, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
458
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
459 frame_auth = gtk_frame_new(_("Authentication"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
460 hbox = gtk_hbox_new(FALSE, 5);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
461 gtk_container_add(GTK_CONTAINER(frame_auth), hbox);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
462 info_window->rad_auth[0] = gtk_radio_button_new_with_label(NULL, qq_group_auth_type_desc[0]);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
463 info_window->rad_auth[1] =
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
464 gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
465 (info_window->rad_auth[0]), qq_group_auth_type_desc[1]);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
466 info_window->rad_auth[2] =
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
467 gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
468 (info_window->rad_auth[0]), qq_group_auth_type_desc[2]);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
469 for (i = 0; i < 3; i++)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
470 gtk_box_pack_start(GTK_BOX(hbox), info_window->rad_auth[i], FALSE, FALSE, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
471 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(info_window->rad_auth[group->auth_type - 1]), TRUE);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
472 gtk_box_pack_start(GTK_BOX(vbox), frame_auth, FALSE, FALSE, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
473
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
474 if (!do_manage) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
475 gtk_widget_set_sensitive(frame_info, FALSE);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
476 gtk_widget_set_sensitive(frame_auth, FALSE);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
477 } // if ! do_manage
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
478
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
479 return vbox;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
480 } // _create_info_page
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
481
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
482 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
483 static GtkWidget *_create_page_members
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
484 (GaimConnection * gc, qq_group * group, gboolean do_manage, qun_info_window * info_window) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
485 GtkWidget *vbox, *sw, *treeview;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
486 GtkTreeModel *model;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
487 GtkListStore *store;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
488 GtkTreeIter iter;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
489 GtkCellRenderer *renderer;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
490 GtkTreeViewColumn *column;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
491 GList *list;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
492 qq_buddy *q_bud;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
493 GtkTargetEntry gte = { "GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0 };
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
494
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
495 g_return_val_if_fail(gc != NULL && group != NULL, NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
496
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
497 vbox = gtk_vbox_new(FALSE, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
498
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
499 if (group->members == NULL) { // if NULL, not ready
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
500 sw = gtk_label_new(_
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
501 ("OpenQ is collecting member information.\nPlease close this window and open again"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
502 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
503 return vbox;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
504 } // if group->members
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
505
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
506 sw = gtk_scrolled_window_new(NULL, NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
507 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
508 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
509 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
510
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
511 store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_UINT, G_TYPE_STRING);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
512
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
513 list = group->members;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
514 while (list != NULL) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
515 q_bud = (qq_buddy *) list->data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
516 gtk_list_store_append(store, &iter);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
517 gtk_list_store_set(store, &iter,
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
518 COLUMN_SELECTED, FALSE,
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
519 COLUMN_UID, q_bud->uid, COLUMN_NICKNAME, q_bud->nickname, -1);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
520 list = list->next;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
521 } // for
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
522
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
523 model = GTK_TREE_MODEL(store);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
524 treeview = gtk_tree_view_new_with_model(model);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
525 info_window->tre_members = treeview;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
526
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
527 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
528 gtk_tree_view_set_search_column(GTK_TREE_VIEW(treeview), COLUMN_UID);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
529 g_object_unref(model);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
530
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
531 // set up drag & drop ONLY for managable Qun
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
532 if (do_manage) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
533 gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(treeview), &gte, 1, GDK_ACTION_COPY);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
534 g_signal_connect(G_OBJECT(treeview), "drag-data-received",
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
535 G_CALLBACK(_qq_group_member_list_drag_data_rcv_cb), gc);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
536 } // if do manage
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
537
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
538 gtk_container_add(GTK_CONTAINER(sw), treeview);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
539
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
540 model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
541 renderer = gtk_cell_renderer_toggle_new();
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
542
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
543 // it seems this signal has to be handled
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
544 // otherwise, the checkbox in the column does not reponse to user action
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
545 if (do_manage)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
546 g_signal_connect(renderer, "toggled", G_CALLBACK(_qq_group_member_list_deleted_toggled), info_window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
547
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
548 column = gtk_tree_view_column_new_with_attributes(_("Del"), renderer, "active", COLUMN_SELECTED, NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
549
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
550 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), GTK_TREE_VIEW_COLUMN_FIXED);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
551 gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column), 30);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
552 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
553
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
554 renderer = gtk_cell_renderer_text_new();
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
555 column = gtk_tree_view_column_new_with_attributes(_("UID"), renderer, "text", COLUMN_UID, NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
556 gtk_tree_view_column_set_sort_column_id(column, COLUMN_UID);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
557 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
558 // default sort by UID
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
559 gtk_tree_view_column_set_sort_order(column, GTK_SORT_ASCENDING);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
560 gtk_tree_view_column_set_sort_indicator(column, TRUE);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
561
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
562 renderer = gtk_cell_renderer_text_new();
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
563 column = gtk_tree_view_column_new_with_attributes(_("Nickname"), renderer, "text", COLUMN_NICKNAME, NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
564 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
565
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
566 return vbox;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
567 } // _create_page_members
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
568
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
569 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
570 void qq_group_detail_window_show(GaimConnection * gc, qq_group * group)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
571 {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
572 GtkWidget *vbox, *notebook;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
573 GtkWidget *label, *bbox;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
574 GList *list;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
575 qq_data *qd;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
576 qun_info_window *info_window = NULL;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
577 gboolean do_manage, do_show, do_exist;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
578
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
579 g_return_if_fail(gc != NULL && gc->proto_data != NULL && group != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
580 qd = (qq_data *) gc->proto_data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
581
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
582 do_manage = group->my_status == QQ_GROUP_MEMBER_STATUS_IS_ADMIN;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
583 do_show = do_manage || (group->my_status == QQ_GROUP_MEMBER_STATUS_IS_MEMBER);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
584
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
585 if (!do_show) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
586 gaim_notify_error(gc, _("QQ Qun Operation"),
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
587 _("You can not view Qun details"),
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
588 _("Only Qun admin or Qun member can view details"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
589 return;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
590 } // if ! do_show
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
591
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
592 list = qd->qun_info_window;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
593 do_exist = FALSE;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
594 while (list != NULL) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
595 info_window = (qun_info_window *) list->data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
596 if (info_window->internal_group_id == group->internal_group_id) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
597 break;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
598 do_exist = TRUE;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
599 } else
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
600 list = list->next;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
601 } // while list
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
602
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
603 if (!do_exist) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
604 info_window = g_new0(qun_info_window, 1);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
605 info_window->gc = gc;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
606 info_window->internal_group_id = group->internal_group_id;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
607 g_list_append(qd->qun_info_window, info_window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
608
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
609 info_window->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
610 g_signal_connect(GTK_WINDOW(info_window->window),
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
611 "delete_event", G_CALLBACK(_qq_group_info_window_deleteevent), NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
612 g_signal_connect(G_OBJECT(info_window->window), "destroy",
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
613 G_CALLBACK(_qq_group_info_window_destroy), gc);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
614
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
615 gtk_window_set_title(GTK_WINDOW(info_window->window), _("Manage Qun"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
616 gtk_window_set_resizable(GTK_WINDOW(info_window->window), FALSE);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
617 gtk_container_set_border_width(GTK_CONTAINER(info_window->window), 5);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
618
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
619 vbox = gtk_vbox_new(FALSE, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
620 gtk_container_add(GTK_CONTAINER(info_window->window), vbox);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
621
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
622 notebook = gtk_notebook_new();
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
623 info_window->notebook = notebook;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
624 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
625 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
626
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
627 label = gtk_label_new(_("Qun Information"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
628 gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
629 _create_page_info(gc, group, do_manage, info_window), label);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
630 label = gtk_label_new(_("Members"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
631 gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
632 _create_page_members(gc, group, do_manage, info_window), label);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
633
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
634 bbox = gtk_hbutton_box_new();
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
635 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
636 gtk_box_set_spacing(GTK_BOX(bbox), 10);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
637
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
638 info_window->btn_mod = gtk_button_new_with_label(_("Modify"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
639 gtk_container_add(GTK_CONTAINER(bbox), info_window->btn_mod);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
640 g_signal_connect(G_OBJECT(info_window->btn_mod), "clicked",
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
641 G_CALLBACK(_qq_group_info_window_modify), info_window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
642
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
643 info_window->btn_close = gtk_button_new_with_label(_("Close"));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
644 gtk_container_add(GTK_CONTAINER(bbox), info_window->btn_close);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
645 g_signal_connect(G_OBJECT(info_window->btn_close),
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
646 "clicked", G_CALLBACK(_qq_group_info_window_close), info_window->window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
647
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
648 if (!do_manage)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
649 gtk_widget_set_sensitive(info_window->btn_mod, FALSE);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
650 gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 5);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
651 gtk_widget_show_all(info_window->window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
652
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
653 } else // we already have this
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
654 gtk_widget_grab_focus(info_window->window);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
655
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
656 } // qq_group_manage_window_show
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
657
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
658 /*****************************************************************************/
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
659 // END OF FILE