pidgin/pidginaccountfilterprotocol.c

Sat, 09 Aug 2025 18:12:31 +0800

author
Gong Zhile <gongzl@stu.hebust.edu.cn>
date
Sat, 09 Aug 2025 18:12:31 +0800
branch
gir-dependency
changeset 43305
4ede49515766
parent 43285
acde304cf24c
permissions
-rw-r--r--

Add builtin library dependency for introspection

Without specifying, gir defaults to the system pidgin/purple libraries by default,
which fails the build when new symbols were added and gir failed to link for them.

40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
40539
2941deda6d8d Use an https link to gnu.org in the license file headers
Gary Kramlich <grim@reaperworld.com>
parents: 40534
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include "pidgin/pidginaccountfilterprotocol.h"
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include <purple.h>
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 struct _PidginAccountFilterProtocol {
41864
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
28 GtkFilter parent;
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 gchar *protocol_id;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 };
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 enum {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 PROP_0,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 PROP_PROTOCOL_ID,
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42575
diff changeset
36 N_PROPERTIES,
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 };
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42575
diff changeset
38 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 /******************************************************************************
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 * Helpers
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 *****************************************************************************/
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 static void
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 pidgin_account_filter_protocol_set_protocol_id(PidginAccountFilterProtocol *filter,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 const gchar *protocol_id)
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 {
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42584
diff changeset
47 if(g_set_str(&filter->protocol_id, protocol_id)) {
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42584
diff changeset
48 gtk_filter_changed(GTK_FILTER(filter), GTK_FILTER_CHANGE_DIFFERENT);
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42584
diff changeset
49 }
41864
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
50 }
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
51
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
52 /******************************************************************************
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
53 * GtkFilter Implementation
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
54 *****************************************************************************/
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
55 static GtkFilterMatch
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
56 pidgin_account_filter_protocol_get_strictness(G_GNUC_UNUSED GtkFilter *self) {
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
57 return GTK_FILTER_MATCH_SOME;
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 static gboolean
41864
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
61 pidgin_account_filter_protocol_match(G_GNUC_UNUSED GtkFilter *self,
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
62 gpointer item)
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 gboolean ret = FALSE;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65
41864
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
66 g_return_val_if_fail(PIDGIN_IS_ACCOUNT_FILTER_PROTOCOL(self), FALSE);
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67
41864
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
68 if(PURPLE_IS_ACCOUNT(item)) {
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
69 PidginAccountFilterProtocol *filter = NULL;
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
70 PurpleAccount *account = NULL;
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71
41864
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
72 filter = PIDGIN_ACCOUNT_FILTER_PROTOCOL(self);
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
73 account = PURPLE_ACCOUNT(item);
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
74 ret = purple_strequal(purple_account_get_protocol_id(account),
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
75 filter->protocol_id);
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 return ret;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 /******************************************************************************
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 * GObject Implementation
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 *****************************************************************************/
42575
580339aa47cc Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 41864
diff changeset
84 G_DEFINE_FINAL_TYPE(PidginAccountFilterProtocol,
580339aa47cc Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 41864
diff changeset
85 pidgin_account_filter_protocol, GTK_TYPE_FILTER)
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 static void
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 pidgin_account_filter_protocol_get_property(GObject *obj, guint param_id,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 GValue *value, GParamSpec *pspec)
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 PidginAccountFilterProtocol *filter = PIDGIN_ACCOUNT_FILTER_PROTOCOL(obj);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 switch(param_id) {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 case PROP_PROTOCOL_ID:
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 g_value_set_string(
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 value, pidgin_account_filter_protocol_get_protocol_id(filter));
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 break;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 default:
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 break;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 static void
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 pidgin_account_filter_protocol_set_property(GObject *obj, guint param_id,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 const GValue *value,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 GParamSpec *pspec)
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 PidginAccountFilterProtocol *filter = PIDGIN_ACCOUNT_FILTER_PROTOCOL(obj);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 switch(param_id) {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 case PROP_PROTOCOL_ID:
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 pidgin_account_filter_protocol_set_protocol_id(
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 filter, g_value_get_string(value));
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 break;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 default:
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 break;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 static void
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 pidgin_account_filter_protocol_finalize(GObject *obj) {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 PidginAccountFilterProtocol *filter = PIDGIN_ACCOUNT_FILTER_PROTOCOL(obj);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 g_free(filter->protocol_id);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 G_OBJECT_CLASS(pidgin_account_filter_protocol_parent_class)->finalize(obj);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 static void
41864
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
132 pidgin_account_filter_protocol_init(G_GNUC_UNUSED PidginAccountFilterProtocol *filter)
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
133 {
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 static void
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 pidgin_account_filter_protocol_class_init(PidginAccountFilterProtocolClass *klass) {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
41864
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
139 GtkFilterClass *filter_class = GTK_FILTER_CLASS(klass);
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 obj_class->get_property = pidgin_account_filter_protocol_get_property;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 obj_class->set_property = pidgin_account_filter_protocol_set_property;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 obj_class->finalize = pidgin_account_filter_protocol_finalize;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144
41864
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
145 filter_class->get_strictness = pidgin_account_filter_protocol_get_strictness;
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
146 filter_class->match = pidgin_account_filter_protocol_match;
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
147
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 /**
41479
3d2e114380f6 Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40539
diff changeset
149 * PidginAccountFilterProtocol:protocol-id:
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 *
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 * The protocol id that will be filtered for.
43285
acde304cf24c Fix some Since tags
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43072
diff changeset
152 *
acde304cf24c Fix some Since tags
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 43072
diff changeset
153 * Since: 3.0
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 */
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 properties[PROP_PROTOCOL_ID] = g_param_spec_string(
43072
a59a119b74f5 Remove nick and blurb from Pidgin properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42767
diff changeset
156 "protocol-id", NULL, NULL,
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 NULL,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 /******************************************************************************
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 * API
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 *****************************************************************************/
41864
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
166 GtkFilter *
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
167 pidgin_account_filter_protocol_new(const gchar *protocol_id) {
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 return g_object_new(
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 PIDGIN_TYPE_ACCOUNT_FILTER_PROTOCOL,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 "protocol-id", protocol_id,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 NULL);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 const gchar *
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 pidgin_account_filter_protocol_get_protocol_id(PidginAccountFilterProtocol *filter) {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 g_return_val_if_fail(PIDGIN_IS_ACCOUNT_FILTER_PROTOCOL(filter), NULL);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 return filter->protocol_id;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 }

mercurial