pidgin/pidginpluginsdialog.c

Tue, 20 Feb 2024 00:55:28 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 20 Feb 2024 00:55:28 -0600
changeset 42592
6b65c0e4ba15
parent 42575
580339aa47cc
permissions
-rw-r--r--

Remove unnecessary casts for GObject methods

Testing Done:
Compiled with the turtles and verified no new warnings appeared.

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

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>
42093
8929e5854422 Set settings backend on the plugin view
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41593
diff changeset
27 #define G_SETTINGS_ENABLE_BACKEND
8929e5854422 Set settings backend on the plugin view
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41593
diff changeset
28 #include <gio/gsettingsbackend.h>
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
40218
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
30 #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
31 #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
32
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
33 #include <purple.h>
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
34
40496
6941fece679b phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents: 40225
diff changeset
35 #include "pidgincore.h"
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
36
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 struct _PidginPluginsDialog {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 GtkDialog parent;
41593
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
39
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
40 GtkWidget *view;
40216
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
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 /******************************************************************************
41593
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
44 * Callbacks
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
45 *****************************************************************************/
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
46 static void
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
47 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
48 G_GNUC_UNUSED gpointer data)
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
49 {
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
50 switch(response_id) {
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
51 case GTK_RESPONSE_DELETE_EVENT:
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
52 gtk_window_destroy(GTK_WINDOW(self));
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
53 break;
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
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
57 /******************************************************************************
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 * GObject Implementation
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 *****************************************************************************/
42575
580339aa47cc Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42190
diff changeset
60 G_DEFINE_FINAL_TYPE(PidginPluginsDialog, pidgin_plugins_dialog,
580339aa47cc Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42190
diff changeset
61 GTK_TYPE_DIALOG)
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 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
65 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
66
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 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
68 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
69 "/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
70 );
41593
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
71
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
72 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
73 view);
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
74
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
75 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
76 pidgin_plugins_dialog_response_cb);
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 pidgin_plugins_dialog_init(PidginPluginsDialog *dialog) {
41593
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
81 GPluginManager *manager = NULL;
42093
8929e5854422 Set settings backend on the plugin view
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41593
diff changeset
82 GSettingsBackend *backend = NULL;
41593
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
83
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 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
85
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
86 manager = gplugin_manager_get_default();
6928f02e807a Make the plugins dialog work under GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41538
diff changeset
87 gplugin_gtk_view_set_manager(GPLUGIN_GTK_VIEW(dialog->view), manager);
42093
8929e5854422 Set settings backend on the plugin view
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41593
diff changeset
88
8929e5854422 Set settings backend on the plugin view
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41593
diff changeset
89 backend = purple_core_get_settings_backend();
8929e5854422 Set settings backend on the plugin view
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41593
diff changeset
90 gplugin_gtk_view_set_settings_backend(GPLUGIN_GTK_VIEW(dialog->view),
8929e5854422 Set settings backend on the plugin view
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41593
diff changeset
91 backend);
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93
40736
c2b876aa4c03 Fix a number of issues with the Plugins dialog
Gary Kramlich <grim@reaperworld.com>
parents: 40544
diff changeset
94 /******************************************************************************
c2b876aa4c03 Fix a number of issues with the Plugins dialog
Gary Kramlich <grim@reaperworld.com>
parents: 40544
diff changeset
95 * Public API
c2b876aa4c03 Fix a number of issues with the Plugins dialog
Gary Kramlich <grim@reaperworld.com>
parents: 40544
diff changeset
96 *****************************************************************************/
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 GtkWidget *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 pidgin_plugins_dialog_new(void) {
42592
6b65c0e4ba15 Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
99 return 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
100 }

mercurial