pidgin/pidginpluginsdialog.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 41593
6928f02e807a
child 42093
8929e5854422
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/

40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * pidgin
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * source distribution.
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * (at your option) any later version.
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * GNU General Public License for more details.
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 */
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 #include "pidginpluginsdialog.h"
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 #include <glib/gi18n.h>
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27
40218
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
28 #include <gplugin.h>
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
29 #include <gplugin-gtk.h>
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
30
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
31 #include <purple.h>
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
32
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
33 #include "gtkpluginpref.h"
40496
6941fece679b phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents: 40225
diff changeset
34 #include "pidgincore.h"
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
35
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 struct _PidginPluginsDialog {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 GtkDialog parent;
41593
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
38
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
39 GtkWidget *view;
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 };
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 /******************************************************************************
41593
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
43 * Callbacks
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
44 *****************************************************************************/
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
45 static void
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
46 pidgin_plugins_dialog_response_cb(GtkDialog* self, gint response_id,
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
47 G_GNUC_UNUSED gpointer data)
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
48 {
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
49 switch(response_id) {
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
50 case GTK_RESPONSE_DELETE_EVENT:
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
51 gtk_window_destroy(GTK_WINDOW(self));
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
52 break;
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
53 }
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
54 }
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
55
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
56 /******************************************************************************
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 * GObject Implementation
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 *****************************************************************************/
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 G_DEFINE_TYPE(PidginPluginsDialog, pidgin_plugins_dialog, GTK_TYPE_DIALOG);
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 pidgin_plugins_dialog_class_init(PidginPluginsDialogClass *klass) {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 gtk_widget_class_set_template_from_resource(
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 widget_class,
41030
ec8b76f3bf0a Fix the resource path so we can use the automatic stuff that GtkApplication supports
Gary Kramlich <grim@reaperworld.com>
parents: 40736
diff changeset
67 "/im/pidgin/Pidgin3/Plugins/dialog.ui"
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 );
41593
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
69
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
70 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog,
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
71 view);
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
72
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
73 gtk_widget_class_bind_template_callback(widget_class,
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
74 pidgin_plugins_dialog_response_cb);
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 pidgin_plugins_dialog_init(PidginPluginsDialog *dialog) {
41593
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
79 GPluginManager *manager = NULL;
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
80
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 gtk_widget_init_template(GTK_WIDGET(dialog));
41593
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
82
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
83 manager = gplugin_manager_get_default();
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
84 gplugin_gtk_view_set_manager(GPLUGIN_GTK_VIEW(dialog->view), manager);
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
40736
c2b876aa4c03 Fix a number of issues with the Plugins dialog
Gary Kramlich <grim@reaperworld.com>
parents: 40544
diff changeset
87 /******************************************************************************
c2b876aa4c03 Fix a number of issues with the Plugins dialog
Gary Kramlich <grim@reaperworld.com>
parents: 40544
diff changeset
88 * Public API
c2b876aa4c03 Fix a number of issues with the Plugins dialog
Gary Kramlich <grim@reaperworld.com>
parents: 40544
diff changeset
89 *****************************************************************************/
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 GtkWidget *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 pidgin_plugins_dialog_new(void) {
40736
c2b876aa4c03 Fix a number of issues with the Plugins dialog
Gary Kramlich <grim@reaperworld.com>
parents: 40544
diff changeset
92 return GTK_WIDGET(g_object_new(PIDGIN_TYPE_PLUGINS_DIALOG, NULL));
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 }

mercurial