--- a/gplugin-gtk4/data/plugin-row.ui Sun Sep 25 23:58:35 2022 -0500
+++ b/gplugin-gtk4/data/plugin-row.ui Mon Sep 26 00:03:15 2022 -0500
@@ -19,14 +19,14 @@
<object class="GtkSwitch" id="enable">
<property name="valign">center</property>
<binding name="sensitive">
- <closure type="gboolean" function="gplugin_gtk_plugin_row_lookup_sensitive_cb">
+ <closure type="gboolean" function="gplugin_gtk_lookup_plugin_state_sensitivity"> <lookup name="state" type="GPluginPlugin">
<lookup name="plugin">GPluginGtkPluginRow</lookup>
- <closure type="gboolean" function="gplugin_gtk_plugin_row_lookup_state_cb">
+ <closure type="gboolean" function="gplugin_gtk_lookup_plugin_state"> <lookup name="state" type="GPluginPlugin">
<lookup name="plugin">GPluginGtkPluginRow</lookup>
@@ -46,7 +46,7 @@
<property name="css-classes">heading</property>
<property name="hexpand">1</property>
- <closure type="gchararray" function="gplugin_gtk_plugin_row_lookup_name_cb">
+ <closure type="gchararray" function="gplugin_gtk_lookup_plugin_name"> <lookup name="info" type="GPluginPlugin">
<lookup name="plugin">GPluginGtkPluginRow</lookup>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/gplugin-gtk-plugin-closures.c Mon Sep 26 00:03:15 2022 -0500
@@ -0,0 +1,104 @@
+ * Copyright (C) 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <https://www.gnu.org/licenses/>. +#include <glib/gi18n-lib.h> +#include <gplugin-gtk-plugin-closures.h> +/****************************************************************************** + *****************************************************************************/ +gplugin_gtk_lookup_plugin_name( + G_GNUC_UNUSED GtkClosureExpression *expression, + GPluginPluginInfo *info, + G_GNUC_UNUSED gpointer data) + const gchar *name = NULL; + gchar *basename = NULL; + name = gplugin_plugin_info_get_name(info); + /* Add a default name if unavailable. */ + basename = g_path_get_basename(filename); + unnamed = g_strdup_printf(_("Unnamed Plugin: %s"), basename); +gplugin_gtk_lookup_plugin_state_sensitivity( + G_GNUC_UNUSED GtkClosureExpression *expression, + GPluginPluginState state, + G_GNUC_UNUSED gpointer data) + gboolean result = FALSE; + case GPLUGIN_PLUGIN_STATE_QUERIED: + case GPLUGIN_PLUGIN_STATE_REQUERY: + case GPLUGIN_PLUGIN_STATE_LOADED: + case GPLUGIN_PLUGIN_STATE_UNLOAD_FAILED: + case GPLUGIN_PLUGIN_STATE_ERROR: + case GPLUGIN_PLUGIN_STATE_LOAD_FAILED: + case GPLUGIN_PLUGIN_STATE_UNKNOWN: +gplugin_gtk_lookup_plugin_state( + G_GNUC_UNUSED GtkClosureExpression *expression, + GPluginPluginState state, + G_GNUC_UNUSED gpointer data) + gboolean result = FALSE; + case GPLUGIN_PLUGIN_STATE_LOADED: + case GPLUGIN_PLUGIN_STATE_UNLOAD_FAILED: + case GPLUGIN_PLUGIN_STATE_QUERIED: + case GPLUGIN_PLUGIN_STATE_REQUERY: + case GPLUGIN_PLUGIN_STATE_ERROR: + case GPLUGIN_PLUGIN_STATE_LOAD_FAILED: + case GPLUGIN_PLUGIN_STATE_UNKNOWN: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/gplugin-gtk-plugin-closures.h Mon Sep 26 00:03:15 2022 -0500
@@ -0,0 +1,55 @@
+ * Copyright (C) 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <https://www.gnu.org/licenses/>. +#if !defined(GPLUGIN_GTK_GLOBAL_HEADER_INSIDE) && \ + !defined(GPLUGIN_GTK_COMPILATION) +#error "only <gplugin-gtk.h> may be included directly" +#ifndef GPLUGIN_GTK_PLUGIN_CLOSURES_H +#define GPLUGIN_GTK_PLUGIN_CLOSURES_H +gchar *gplugin_gtk_lookup_plugin_name( + GtkClosureExpression *expression, + GPluginPluginInfo *info, +gboolean gplugin_gtk_lookup_plugin_state_sensitivity( + GtkClosureExpression *expression, + GPluginPluginState state, +gboolean gplugin_gtk_lookup_plugin_state( + GtkClosureExpression *expression, + GPluginPluginState state, +#endif /* GPLUGIN_GTK_PLUGIN_CLOSURES_H */ --- a/gplugin-gtk4/gplugin-gtk-plugin-row.c Sun Sep 25 23:58:35 2022 -0500
+++ b/gplugin-gtk4/gplugin-gtk-plugin-row.c Mon Sep 26 00:03:15 2022 -0500
@@ -19,6 +19,7 @@
+#include <gplugin-gtk-plugin-closures.h> #include <gplugin-gtk-plugin-row.h>
@@ -223,84 +224,6 @@
-gplugin_gtk_plugin_row_lookup_name_cb(
- G_GNUC_UNUSED GtkClosureExpression *expression,
- GPluginPluginInfo *info,
- G_GNUC_UNUSED gpointer data)
- const gchar *name = NULL;
- gchar *basename = NULL;
- name = gplugin_plugin_info_get_name(info);
- /* Add a default name if unavailable. */
- basename = g_path_get_basename(filename);
- unnamed = g_strdup_printf(_("Unnamed Plugin: %s"), basename);
-gplugin_gtk_plugin_row_lookup_sensitive_cb(
- G_GNUC_UNUSED GtkClosureExpression *expression,
- GPluginPluginState state,
- G_GNUC_UNUSED gpointer data)
- gboolean result = FALSE;
- case GPLUGIN_PLUGIN_STATE_QUERIED:
- case GPLUGIN_PLUGIN_STATE_REQUERY:
- case GPLUGIN_PLUGIN_STATE_LOADED:
- case GPLUGIN_PLUGIN_STATE_UNLOAD_FAILED:
- case GPLUGIN_PLUGIN_STATE_ERROR:
- case GPLUGIN_PLUGIN_STATE_LOAD_FAILED:
- case GPLUGIN_PLUGIN_STATE_UNKNOWN:
-gplugin_gtk_plugin_row_lookup_state_cb(
- G_GNUC_UNUSED GtkClosureExpression *expression,
- GPluginPluginState state,
- G_GNUC_UNUSED gpointer data)
- gboolean result = FALSE;
- case GPLUGIN_PLUGIN_STATE_LOADED:
- case GPLUGIN_PLUGIN_STATE_UNLOAD_FAILED:
- case GPLUGIN_PLUGIN_STATE_QUERIED:
- case GPLUGIN_PLUGIN_STATE_REQUERY:
- case GPLUGIN_PLUGIN_STATE_ERROR:
- case GPLUGIN_PLUGIN_STATE_LOAD_FAILED:
- case GPLUGIN_PLUGIN_STATE_UNKNOWN:
/******************************************************************************
*****************************************************************************/
@@ -458,13 +381,13 @@
gplugin_gtk_plugin_row_enable_state_set_cb);
gtk_widget_class_bind_template_callback(
- gplugin_gtk_plugin_row_lookup_name_cb);
+ gplugin_gtk_lookup_plugin_name); gtk_widget_class_bind_template_callback(
- gplugin_gtk_plugin_row_lookup_sensitive_cb);
+ gplugin_gtk_lookup_plugin_state); gtk_widget_class_bind_template_callback(
- gplugin_gtk_plugin_row_lookup_state_cb);
+ gplugin_gtk_lookup_plugin_state_sensitivity); gtk_widget_class_bind_template_child(
--- a/gplugin-gtk4/meson.build Sun Sep 25 23:58:35 2022 -0500
+++ b/gplugin-gtk4/meson.build Mon Sep 26 00:03:15 2022 -0500
@@ -19,9 +19,11 @@
GPLUGIN_GTK4_PRIVATE_SOURCES = [
+ 'gplugin-gtk-plugin-closures.c', GPLUGIN_GTK4_PRIVATE_HEADERS = [
+ 'gplugin-gtk-plugin-closures.h', GPLUGIN_GTK4_PUBLIC_BUILT_SOURCES = [