Thu, 16 Nov 2023 23:44:39 -0600
Depend on GPlugin 0.42.1
Testing Done:
Ran `ninja turtles` without issues and noted that the ircv3 introspection was successful.
Reviewed at https://reviews.imfreedom.org/r/2827/
|
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; |
|
42367
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
37 | GtkWidget *avatar; |
|
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; |
|
40858
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | }; |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | enum { |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | PROP_0, |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | PROP_CONVERSATION, |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | N_PROPERTIES, |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | }; |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
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 | 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
|
54 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | /****************************************************************************** |
|
42367
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
56 | * Helpers |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
57 | *****************************************************************************/ |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
58 | static gboolean |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
59 | pidgin_info_pane_topic_to_label(G_GNUC_UNUSED GBinding *binding, |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
60 | const GValue *from_value, |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
61 | GValue *to_value, |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
62 | gpointer data) |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
63 | { |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
64 | PidginInfoPane *pane = data; |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
65 | const char *topic = NULL; |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
66 | gboolean visible = FALSE; |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
67 | |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
68 | topic = g_value_get_string(from_value); |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
69 | visible = !purple_strempty(topic); |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
70 | g_value_set_string(to_value, topic); |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
71 | |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
72 | gtk_widget_set_visible(pane->topic, visible); |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
73 | |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
74 | return TRUE; |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
75 | } |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
76 | |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
77 | /****************************************************************************** |
|
40858
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | * GObject Implementation |
|
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 | static void |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | 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
|
82 | GParamSpec *pspec) |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | { |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | PidginInfoPane *pane = PIDGIN_INFO_PANE(obj); |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | switch(param_id) { |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | case PROP_CONVERSATION: |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | 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
|
89 | break; |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | default: |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | 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
|
92 | break; |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | } |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | } |
|
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 | static void |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | 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
|
98 | GParamSpec *pspec) |
|
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 | PidginInfoPane *pane = PIDGIN_INFO_PANE(obj); |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | switch(param_id) { |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | case PROP_CONVERSATION: |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | 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
|
105 | break; |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | default: |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | 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
|
108 | break; |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | } |
|
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 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | static void |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
113 | pidgin_info_pane_dispose(GObject *obj) { |
|
40858
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | PidginInfoPane *pane = PIDGIN_INFO_PANE(obj); |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | g_clear_object(&pane->conversation); |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
118 | 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
|
119 | } |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | static void |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | pidgin_info_pane_init(PidginInfoPane *pane) { |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | gtk_widget_init_template(GTK_WIDGET(pane)); |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | } |
|
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 | static void |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | pidgin_info_pane_class_init(PidginInfoPaneClass *klass) { |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | 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
|
132 | 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
|
133 | obj_class->dispose = pidgin_info_pane_dispose; |
|
40858
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | /** |
|
41479
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
136 | * PidginInfoPane:conversation |
|
40858
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | * |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | * The #PurpleConversation whose information will be displayed. |
|
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 | properties[PROP_CONVERSATION] = g_param_spec_object( |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | "conversation", "conversation", |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | "The PurpleConversation instance", |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | PURPLE_TYPE_CONVERSATION, |
|
42296
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
144 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
40858
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | 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
|
147 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | gtk_widget_class_set_template_from_resource( |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | 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
|
150 | "/im/pidgin/Pidgin3/Conversations/infopane.ui" |
|
40858
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | ); |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | 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
|
154 | 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
|
155 | 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
|
156 | 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
|
157 | } |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | /****************************************************************************** |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | * API |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | *****************************************************************************/ |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | GtkWidget * |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | pidgin_info_pane_new(PurpleConversation *conversation) { |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | return GTK_WIDGET(g_object_new( |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | PIDGIN_TYPE_INFO_PANE, |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | "conversation", conversation, |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | NULL)); |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | } |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | PurpleConversation * |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | pidgin_info_pane_get_conversation(PidginInfoPane *pane) { |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | 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
|
173 | |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | return pane->conversation; |
|
2bd48c93678a
Create a new standalone info pane widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | } |
|
42296
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
176 | |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
177 | void |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
178 | 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
|
179 | PurpleConversation *conversation) |
|
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 | 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
|
182 | |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
183 | 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
|
184 | return; |
|
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 | |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
187 | /* Remove the old bindings. */ |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
188 | 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
|
189 | 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
|
190 | |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
191 | /* 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
|
192 | 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
|
193 | pane->conversation); |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
194 | |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
195 | if(PURPLE_IS_CONVERSATION(conversation)) { |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
196 | pane->name_binding = |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
197 | 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
|
198 | G_OBJECT(pane->name), "label", |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
199 | 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
|
200 | |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
201 | pane->topic_binding = |
|
42367
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
202 | g_object_bind_property_full(G_OBJECT(conversation), "topic", |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
203 | G_OBJECT(pane->topic), "label", |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
204 | G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE, |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
205 | pidgin_info_pane_topic_to_label, |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
206 | NULL, |
|
12b865212d37
Rework the info pane a bit
Gary Kramlich <grim@reaperworld.com>
parents:
42296
diff
changeset
|
207 | pane, NULL); |
|
42296
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 | |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
210 | /* Notify that we changed. */ |
|
1707a28b1258
Allow the conversation property of PidginInfoPane to be changed
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
211 | 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
|
212 | } |