pidgin/pidgininvitedialog.c

Fri, 16 Sep 2022 01:54:11 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Fri, 16 Sep 2022 01:54:11 -0500
changeset 41694
83e6692c76a3
parent 41531
2b86501d13fe
child 41724
ad9cf22b657b
permissions
-rw-r--r--

Change the credential provider row active indicator to a CheckButton

Because I noticed that Adw has a style that is for this sort of thing.

Testing Done:
Opened Credential prefs, and changed selected provider. Also checked that clicking the check button didn't accidentally change its state without changing the row, and that it could not be selected by keyboard separately from the row.

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

39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /* Purple is the legal property of its developers, whose names are too numerous
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * to list here. Please refer to the COPYRIGHT file distributed with this
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * source distribution.
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * (at your option) any later version.
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 *
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * GNU General Public License for more details.
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 *
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 */
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 #include "pidgininvitedialog.h"
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 struct _PidginInviteDialog {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 GtkDialog parent;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 };
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 typedef struct {
39577
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
27 GtkWidget *contact;
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
28 GtkWidget *message;
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
29
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
30 PurpleChatConversation *conversation;
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 } PidginInviteDialogPrivate;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 enum {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 PROP_ZERO,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 PROP_CONTACT,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 PROP_MESSAGE,
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
37 PROP_CONVERSATION,
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 N_PROPERTIES,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 };
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40
39585
8a19d82a81f8 Unref the conversation we were created with and fix and initalizer
Gary Kramlich <grim@reaperworld.com>
parents: 39579
diff changeset
41 static GParamSpec *properties[N_PROPERTIES] = {0, };
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 G_DEFINE_TYPE_WITH_PRIVATE(PidginInviteDialog, pidgin_invite_dialog, GTK_TYPE_DIALOG);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 /******************************************************************************
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
46 * Helpers
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
47 *****************************************************************************/
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
48 static void
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
49 pidgin_invite_dialog_set_conversation(PidginInviteDialog *dialog,
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
50 PurpleChatConversation *conversation)
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
51 {
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
52 PidginInviteDialogPrivate *priv = NULL;
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
53
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
54 g_return_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog));
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
55
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
56 priv = pidgin_invite_dialog_get_instance_private(dialog);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
57
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
58 priv->conversation = g_object_ref(conversation);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
59
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
60 g_object_notify_by_pspec(G_OBJECT(dialog), properties[PROP_CONVERSATION]);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
61 }
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
62
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
63 /******************************************************************************
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 * GObject Stuff
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 *****************************************************************************/
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 static void
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 pidgin_invite_dialog_get_property(GObject *obj,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 guint param_id,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 GValue *value,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 GParamSpec *pspec)
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 PidginInviteDialog *dialog = PIDGIN_INVITE_DIALOG(obj);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 switch(param_id) {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 case PROP_CONTACT:
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 g_value_set_string(value,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 pidgin_invite_dialog_get_contact(dialog));
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 break;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 case PROP_MESSAGE:
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 g_value_set_string(value,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 pidgin_invite_dialog_get_message(dialog));
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 break;
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
83 case PROP_CONVERSATION:
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
84 g_value_set_object(value,
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
85 pidgin_invite_dialog_get_conversation(dialog));
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
86 break;
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 default:
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 break;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 static void
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 pidgin_invite_dialog_set_property(GObject *obj,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 guint param_id,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 const GValue *value,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 GParamSpec *pspec)
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 PidginInviteDialog *dialog = PIDGIN_INVITE_DIALOG(obj);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 switch(param_id) {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 case PROP_CONTACT:
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 pidgin_invite_dialog_set_contact(dialog,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 g_value_get_string(value));
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 break;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 case PROP_MESSAGE:
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 pidgin_invite_dialog_set_message(dialog,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 g_value_get_string(value));
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 break;
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
110 case PROP_CONVERSATION:
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
111 pidgin_invite_dialog_set_conversation(dialog,
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
112 g_value_get_object(value));
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
113 break;
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 default:
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 break;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 static void
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 pidgin_invite_dialog_finalize(GObject *obj) {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 PidginInviteDialogPrivate *priv = NULL;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 priv = pidgin_invite_dialog_get_instance_private(PIDGIN_INVITE_DIALOG(obj));
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 g_clear_pointer(&priv->contact, g_free);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 g_clear_pointer(&priv->message, g_free);
39585
8a19d82a81f8 Unref the conversation we were created with and fix and initalizer
Gary Kramlich <grim@reaperworld.com>
parents: 39579
diff changeset
128 g_clear_object(&priv->conversation);
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 G_OBJECT_CLASS(pidgin_invite_dialog_parent_class)->finalize(obj);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 static void
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 pidgin_invite_dialog_init(PidginInviteDialog *dialog) {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 gtk_widget_init_template(GTK_WIDGET(dialog));
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 static void
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 pidgin_invite_dialog_class_init(PidginInviteDialogClass *klass) {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 obj_class->get_property = pidgin_invite_dialog_get_property;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 obj_class->set_property = pidgin_invite_dialog_set_property;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 obj_class->finalize = pidgin_invite_dialog_finalize;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 gtk_widget_class_set_template_from_resource(
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 widget_class,
41030
ec8b76f3bf0a Fix the resource path so we can use the automatic stuff that GtkApplication supports
Gary Kramlich <grim@reaperworld.com>
parents: 39585
diff changeset
149 "/im/pidgin/Pidgin3/Conversations/invite_dialog.ui"
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 );
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151
39577
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
152 gtk_widget_class_bind_template_child_private(
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
153 widget_class,
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
154 PidginInviteDialog,
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
155 contact
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
156 );
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
157 gtk_widget_class_bind_template_child_private(
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
158 widget_class,
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
159 PidginInviteDialog,
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
160 message
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
161 );
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
162
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 properties[PROP_CONTACT] = g_param_spec_string(
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 "contact",
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 "contact",
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 "The person that is being invited",
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 NULL,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 properties[PROP_MESSAGE] = g_param_spec_string(
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 "message",
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 "message",
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 "The invite message to send",
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 NULL,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
177 properties[PROP_CONVERSATION] = g_param_spec_object(
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
178 "conversation",
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
179 "conversation",
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
180 "The conversation that someone is being invited to",
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
181 PURPLE_TYPE_CHAT_CONVERSATION,
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
182 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
183
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 /******************************************************************************
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 * Public API
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 *****************************************************************************/
39577
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
190 GtkWidget *
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
191 pidgin_invite_dialog_new(PurpleChatConversation *conversation) {
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
192 return GTK_WIDGET(g_object_new(
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
193 PIDGIN_TYPE_INVITE_DIALOG,
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
194 "conversation", conversation,
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
195 NULL));
39577
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
196 }
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
197
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 const gchar *
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 pidgin_invite_dialog_get_contact(PidginInviteDialog *dialog) {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 PidginInviteDialogPrivate *priv = NULL;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 g_return_val_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog), NULL);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 priv = pidgin_invite_dialog_get_instance_private(dialog);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205
41531
2b86501d13fe Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents: 41321
diff changeset
206 return gtk_editable_get_text(GTK_EDITABLE(priv->contact));
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 void
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 pidgin_invite_dialog_set_contact(PidginInviteDialog *dialog,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 const gchar *contact)
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 PidginInviteDialogPrivate *priv = NULL;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 g_return_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog));
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 priv = pidgin_invite_dialog_get_instance_private(dialog);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218
39577
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
219 if(contact != NULL) {
41531
2b86501d13fe Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents: 41321
diff changeset
220 gtk_editable_set_text(GTK_EDITABLE(priv->contact), contact);
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221
39577
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
222 g_object_notify_by_pspec(G_OBJECT(dialog), properties[PROP_CONTACT]);
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 const gchar *
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 pidgin_invite_dialog_get_message(PidginInviteDialog *dialog) {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 PidginInviteDialogPrivate *priv = NULL;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 g_return_val_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog), NULL);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 priv = pidgin_invite_dialog_get_instance_private(dialog);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233
41531
2b86501d13fe Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents: 41321
diff changeset
234 return gtk_editable_get_text(GTK_EDITABLE(priv->message));
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 void
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 pidgin_invite_dialog_set_message(PidginInviteDialog *dialog,
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 const gchar *message)
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 {
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 PidginInviteDialogPrivate *priv = NULL;
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 g_return_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog));
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245 priv = pidgin_invite_dialog_get_instance_private(dialog);
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246
39577
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
247 if(message != NULL) {
41531
2b86501d13fe Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents: 41321
diff changeset
248 gtk_editable_set_text(GTK_EDITABLE(priv->message), message);
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249
39577
0dd1d673bbef Invite dialog fully functional, with dnd removed
Gary Kramlich <grim@reaperworld.com>
parents: 39576
diff changeset
250 g_object_notify_by_pspec(G_OBJECT(dialog), properties[PROP_MESSAGE]);
39576
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 }
9da340b66f6d Start of the new invite widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
254 PurpleChatConversation *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
255 pidgin_invite_dialog_get_conversation(PidginInviteDialog *dialog) {
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
256 PidginInviteDialogPrivate *priv = NULL;
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
257
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
258 g_return_val_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog), NULL);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
259
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
260 priv = pidgin_invite_dialog_get_instance_private(dialog);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
261
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
262 return priv->conversation;
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents: 39577
diff changeset
263 }

mercurial