diff options
author | Gary Kramlich <grim@reaperworld.com> | 2022-08-25 22:29:50 -0500 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2022-08-25 22:29:50 -0500 |
commit | 35580727aa4a537a4ca38cb2c0693fda29be9ac4 (patch) | |
tree | 3d314704f0a856a882868fe739bd4cb85a402cf6 | |
parent | e87089d2d0f9eafbba4c05eeaff82df94cb56006 (diff) | |
download | pidgin-35580727aa4a537a4ca38cb2c0693fda29be9ac4.tar.gz |
Make the plugins dialog work under GTK4
Testing Done:
Opened the plugins dialog and made sure it showed them plugins
Reviewed at https://reviews.imfreedom.org/r/1650/
-rw-r--r-- | pidgin/pidginpluginsdialog.c | 27 | ||||
-rw-r--r-- | pidgin/resources/Plugins/dialog.ui | 15 |
2 files changed, 38 insertions, 4 deletions
diff --git a/pidgin/pidginpluginsdialog.c b/pidgin/pidginpluginsdialog.c index 2249f759c7..696a5f229a 100644 --- a/pidgin/pidginpluginsdialog.c +++ b/pidgin/pidginpluginsdialog.c @@ -35,9 +35,25 @@ struct _PidginPluginsDialog { GtkDialog parent; + + GtkWidget *view; }; /****************************************************************************** + * Callbacks + *****************************************************************************/ +static void +pidgin_plugins_dialog_response_cb(GtkDialog* self, gint response_id, + G_GNUC_UNUSED gpointer data) +{ + switch(response_id) { + case GTK_RESPONSE_DELETE_EVENT: + gtk_window_destroy(GTK_WINDOW(self)); + break; + } +} + +/****************************************************************************** * GObject Implementation *****************************************************************************/ G_DEFINE_TYPE(PidginPluginsDialog, pidgin_plugins_dialog, GTK_TYPE_DIALOG); @@ -50,11 +66,22 @@ pidgin_plugins_dialog_class_init(PidginPluginsDialogClass *klass) { widget_class, "/im/pidgin/Pidgin3/Plugins/dialog.ui" ); + + gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, + view); + + gtk_widget_class_bind_template_callback(widget_class, + pidgin_plugins_dialog_response_cb); } static void pidgin_plugins_dialog_init(PidginPluginsDialog *dialog) { + GPluginManager *manager = NULL; + gtk_widget_init_template(GTK_WIDGET(dialog)); + + manager = gplugin_manager_get_default(); + gplugin_gtk_view_set_manager(GPLUGIN_GTK_VIEW(dialog->view), manager); } /****************************************************************************** diff --git a/pidgin/resources/Plugins/dialog.ui b/pidgin/resources/Plugins/dialog.ui index 1ca41a71ac..6ec180ea6d 100644 --- a/pidgin/resources/Plugins/dialog.ui +++ b/pidgin/resources/Plugins/dialog.ui @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this library; if not, see <https://www.gnu.org/licenses/>. +along with this program; if not, see <https://www.gnu.org/licenses/>. --> <interface> <requires lib="gtk" version="4.0"/> @@ -25,10 +25,17 @@ along with this library; if not, see <https://www.gnu.org/licenses/>. <!-- interface-copyright Pidgin Developers <devel@pidgin.im> --> <template class="PidginPluginsDialog" parent="GtkDialog"> <property name="title" translatable="1">Plugins</property> - <property name="type-hint">dialog</property> - <signal name="delete-event" handler="gtk_widget_destroy" swapped="no"/> + <signal name="response" handler="pidgin_plugins_dialog_response_cb" swapped="no"/> <child internal-child="content_area"> - <object class="GPluginGtkView" id="view"/> + <object class="GtkBox"> + <property name="orientation">vertical</property> + <child> + <object class="GPluginGtkView" id="view"> + <property name="vexpand">1</property> + <property name="valign">fill</property> + </object> + </child> + </object> </child> <child internal-child="action_area"/> </template> |