pidgin/pidgininfopane.c

Thu, 12 Oct 2023 22:31:22 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Thu, 12 Oct 2023 22:31:22 -0500
changeset 42352
1c53950f9052
parent 42296
1707a28b1258
child 42367
12b865212d37
permissions
-rw-r--r--

Migrate from GtkFileChooserNative to GtkFileDialog

Testing Done:
Compiled, and opened a few dialogs from the demo protocol.

Reviewed at https://reviews.imfreedom.org/r/2475/

40858
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include "pidgin/pidgininfopane.h"
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include "pidgin/gtkblist.h"
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 #include "pidgin/gtkutils.h"
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include "pidgin/pidginavatar.h"
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 #include "pidgin/pidgincore.h"
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 #include "pidgin/pidginpresenceicon.h"
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 struct _PidginInfoPane {
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 GtkBox parent;
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 PurpleConversation *conversation;
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 GtkWidget *hbox;
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 GtkWidget *presence_icon;
42296
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
38
40858
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 GtkWidget *name;
42296
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
40 GBinding *name_binding;
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
41
40858
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 GtkWidget *topic;
42296
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
43 GBinding *topic_binding;
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
44
40858
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 GtkWidget *avatar;
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 };
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 enum {
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 PROP_0,
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 PROP_CONVERSATION,
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 N_PROPERTIES,
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 };
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 G_DEFINE_TYPE(PidginInfoPane, pidgin_info_pane, GTK_TYPE_BOX)
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 /******************************************************************************
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 * GObject Implementation
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 *****************************************************************************/
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 static void
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 pidgin_info_pane_get_property(GObject *obj, guint param_id, GValue *value,
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 GParamSpec *pspec)
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 {
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 PidginInfoPane *pane = PIDGIN_INFO_PANE(obj);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 switch(param_id) {
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 case PROP_CONVERSATION:
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 g_value_set_object(value, pidgin_info_pane_get_conversation(pane));
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 break;
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 default:
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 break;
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 }
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 }
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 static void
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 pidgin_info_pane_set_property(GObject *obj, guint param_id, const GValue *value,
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 GParamSpec *pspec)
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 {
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 PidginInfoPane *pane = PIDGIN_INFO_PANE(obj);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 switch(param_id) {
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 case PROP_CONVERSATION:
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 pidgin_info_pane_set_conversation(pane, g_value_get_object(value));
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 break;
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 default:
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 break;
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 }
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 }
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 static void
41184
05b5c210352b Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41030
diff changeset
93 pidgin_info_pane_dispose(GObject *obj) {
40858
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 PidginInfoPane *pane = PIDGIN_INFO_PANE(obj);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 g_clear_object(&pane->conversation);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97
41184
05b5c210352b Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41030
diff changeset
98 G_OBJECT_CLASS(pidgin_info_pane_parent_class)->dispose(obj);
40858
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 }
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 static void
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 pidgin_info_pane_init(PidginInfoPane *pane) {
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 gtk_widget_init_template(GTK_WIDGET(pane));
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 }
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 static void
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 pidgin_info_pane_class_init(PidginInfoPaneClass *klass) {
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 obj_class->get_property = pidgin_info_pane_get_property;
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 obj_class->set_property = pidgin_info_pane_set_property;
41184
05b5c210352b Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41030
diff changeset
113 obj_class->dispose = pidgin_info_pane_dispose;
40858
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 /**
41479
3d2e114380f6 Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41184
diff changeset
116 * PidginInfoPane:conversation
40858
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 *
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 * The #PurpleConversation whose information will be displayed.
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 */
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 properties[PROP_CONVERSATION] = g_param_spec_object(
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 "conversation", "conversation",
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 "The PurpleConversation instance",
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 PURPLE_TYPE_CONVERSATION,
42296
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
124 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
40858
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 gtk_widget_class_set_template_from_resource(
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 widget_class,
41030
ec8b76f3bf0a Fix the resource path so we can use the automatic stuff that GtkApplication supports
Gary Kramlich <grim@reaperworld.com>
parents: 41027
diff changeset
130 "/im/pidgin/Pidgin3/Conversations/infopane.ui"
40858
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 );
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 gtk_widget_class_bind_template_child(widget_class, PidginInfoPane, hbox);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 gtk_widget_class_bind_template_child(widget_class, PidginInfoPane, avatar);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 gtk_widget_class_bind_template_child(widget_class, PidginInfoPane, presence_icon);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 gtk_widget_class_bind_template_child(widget_class, PidginInfoPane, name);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 gtk_widget_class_bind_template_child(widget_class, PidginInfoPane, topic);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 }
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 /******************************************************************************
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 * API
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 *****************************************************************************/
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 GtkWidget *
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 pidgin_info_pane_new(PurpleConversation *conversation) {
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 return GTK_WIDGET(g_object_new(
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 PIDGIN_TYPE_INFO_PANE,
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 "conversation", conversation,
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 NULL));
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 }
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 PurpleConversation *
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 pidgin_info_pane_get_conversation(PidginInfoPane *pane) {
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 g_return_val_if_fail(PIDGIN_IS_INFO_PANE(pane), NULL);
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 return pane->conversation;
2bd48c93678a Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 }
42296
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
157
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
158 void
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
159 pidgin_info_pane_set_conversation(PidginInfoPane *pane,
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
160 PurpleConversation *conversation)
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
161 {
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
162 g_return_if_fail(PIDGIN_IS_INFO_PANE(pane));
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
163
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
164 if(!g_set_object(&pane->conversation, conversation)) {
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
165 return;
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
166 }
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
167
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
168 /* Remove the old bindings. */
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
169 g_clear_pointer(&pane->name_binding, g_binding_unbind);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
170 g_clear_pointer(&pane->topic_binding, g_binding_unbind);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
171
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
172 /* Tell the avatar about the new conversation. */
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
173 pidgin_avatar_set_conversation(PIDGIN_AVATAR(pane->avatar),
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
174 pane->conversation);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
175
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
176 if(PURPLE_IS_CONVERSATION(conversation)) {
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
177 PidginPresenceIcon *presence_icon = NULL;
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
178 PurplePresence *presence = NULL;
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
179 const gchar *fallback = "person";
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
180
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
181 pane->name_binding =
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
182 g_object_bind_property(G_OBJECT(conversation), "name",
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
183 G_OBJECT(pane->name), "label",
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
184 G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
185
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
186 pane->topic_binding =
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
187 g_object_bind_property(G_OBJECT(conversation), "topic",
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
188 G_OBJECT(pane->topic), "label",
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
189 G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
190
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
191 if(PURPLE_IS_CHAT_CONVERSATION(conversation)) {
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
192 fallback = "chat";
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
193 } else if(PURPLE_IS_IM_CONVERSATION(conversation)) {
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
194 PurpleAccount *account = NULL;
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
195 PurpleBuddy *buddy = NULL;
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
196 const gchar *name = NULL;
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
197
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
198 account = purple_conversation_get_account(conversation);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
199 name = purple_conversation_get_name(conversation);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
200 buddy = purple_blist_find_buddy(account, name);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
201
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
202 if(PURPLE_IS_BUDDY(buddy)) {
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
203 presence = purple_buddy_get_presence(buddy);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
204 }
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
205
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
206 fallback = "person";
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
207 }
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
208
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
209 presence_icon = PIDGIN_PRESENCE_ICON(pane->presence_icon);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
210 pidgin_presence_icon_set_fallback(presence_icon, fallback);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
211 pidgin_presence_icon_set_presence(presence_icon, presence);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
212 }
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
213
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
214 /* Notify that we changed. */
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
215 g_object_notify_by_pspec(G_OBJECT(pane), properties[PROP_CONVERSATION]);
1707a28b1258 Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
216 }

mercurial