pidgin/pidginaccountfilterconnected.c

Fri, 25 Mar 2022 02:51:58 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Fri, 25 Mar 2022 02:51:58 -0500
changeset 41314
0dc72eacd8bf
parent 40539
2941deda6d8d
child 41864
6f490dec468f
permissions
-rw-r--r--

Replace PURPLE_CALLBACK by G_CALLBACK

Another straight search-and-replace for 'easy' review.

Testing Done:
Compile only.

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

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/pidginaccountfilterconnected.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 "pidgin/pidginaccountstore.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 #include <purple.h>
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 struct _PidginAccountFilterConnected {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 GtkTreeModelFilter parent;
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 /******************************************************************************
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 * Callbacks
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 *****************************************************************************/
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 static void
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 pidgin_account_filter_connected_changed(PurpleConnection *connection,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 gpointer data)
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 PidginAccountFilterConnected *filter = NULL;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 filter = PIDGIN_ACCOUNT_FILTER_CONNECTED(data);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(filter));
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 /******************************************************************************
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 * GObject Implementation
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 *****************************************************************************/
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 static gboolean
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 pidgin_account_filter_connected_func(GtkTreeModel *model, GtkTreeIter *iter,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 gpointer data)
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 PurpleAccount *account = NULL;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 gboolean ret = FALSE;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 g_return_val_if_fail(GTK_IS_TREE_MODEL(model), FALSE);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 g_return_val_if_fail(iter != NULL, FALSE);
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 gtk_tree_model_get(model, iter, PIDGIN_ACCOUNT_STORE_COLUMN_ACCOUNT,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 &account, -1);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 if(!PURPLE_IS_ACCOUNT(account)) {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 return FALSE;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 ret = purple_account_is_connected(account);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 g_object_unref(G_OBJECT(account));
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 return ret;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 /******************************************************************************
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 * GObject Implementation
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 G_DEFINE_TYPE(PidginAccountFilterConnected, pidgin_account_filter_connected,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 GTK_TYPE_TREE_MODEL_FILTER)
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 static void
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 pidgin_account_filter_connected_init(PidginAccountFilterConnected *filter) {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 gpointer connections_handle = NULL;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(filter),
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 pidgin_account_filter_connected_func,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 NULL, NULL);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 /* we connect to the connections signals to force a refresh of the filter */
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 connections_handle = purple_connections_get_handle();
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 purple_signal_connect(connections_handle, "signed-on", filter,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 G_CALLBACK(pidgin_account_filter_connected_changed),
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 filter);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 purple_signal_connect(connections_handle, "signed-off", filter,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 G_CALLBACK(pidgin_account_filter_connected_changed),
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 filter);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 }
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 static void
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 pidgin_account_filter_connected_finalize(GObject *obj) {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 purple_signals_disconnect_by_handle(obj);
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 G_OBJECT_CLASS(pidgin_account_filter_connected_parent_class)->finalize(obj);
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
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 static void
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 pidgin_account_filter_connected_class_init(PidginAccountFilterConnectedClass *klass) {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
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 obj_class->finalize = pidgin_account_filter_connected_finalize;
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
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 /******************************************************************************
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 * API
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 *****************************************************************************/
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 GtkTreeModel *
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 pidgin_account_filter_connected_new(GtkTreeModel *child_model,
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 GtkTreePath *root)
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 {
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 g_return_val_if_fail(GTK_IS_TREE_MODEL(child_model), NULL);
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 return g_object_new(PIDGIN_TYPE_ACCOUNT_FILTER_CONNECTED, "child-model",
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 child_model, "virtual-root", root, NULL);
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 }

mercurial