pidgin/pidginaccountfilterprotocol.c

Sun, 03 Nov 2024 00:05:44 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sun, 03 Nov 2024 00:05:44 -0500
changeset 43045
308e8d0ce68c
parent 42767
8cf1d11b59c1
child 43072
a59a119b74f5
permissions
-rw-r--r--

remove purple3-url-handler.desktop.in.in

The application that did the launching was removed long ago. Also this should
be implemented by the user interfaces and they might provide separate files to
groups schemas as well.

Testing Done:
Called in the turtles.

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

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.
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 */
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 properties[PROP_PROTOCOL_ID] = g_param_spec_string(
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 "protocol-id", "protocol-id", "The id of the protocol to filter",
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 NULL,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 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
157
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 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
159 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160
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 * API
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 *****************************************************************************/
41864
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
164 GtkFilter *
6f490dec468f Move PidginAccountChooser to GtkDropDown
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41479
diff changeset
165 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
166 return g_object_new(
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 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
168 "protocol-id", protocol_id,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 NULL);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 const gchar *
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 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
174 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
175
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 return filter->protocol_id;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 }

mercurial