--- a/gplugin-gtk4/data/plugin-row.ui Mon Dec 06 22:37:09 2021 -0600
+++ b/gplugin-gtk4/data/plugin-row.ui Mon Dec 06 22:37:09 2021 -0600
@@ -104,7 +104,7 @@
<object class="GtkRevealer" id="revealer">
<property name="can-focus">0</property>
- <property name="reveal-child" bind-source="expander" bind-property="expanded" bind-flags="sync-create"/>
+ <property name="reveal-child" bind-source="expander" bind-property="expanded" bind-flags="bidirectional|sync-create"/> <property name="can-focus">0</property>
--- a/gplugin-gtk4/data/view.ui Mon Dec 06 22:37:09 2021 -0600
+++ b/gplugin-gtk4/data/view.ui Mon Dec 06 22:37:09 2021 -0600
@@ -28,6 +28,7 @@
<object class="GtkListBox" id="list_box">
<property name="selection-mode">none</property>
<property name="show-separators">1</property>
+ <signal name="row-activated" handler="gplugin_gtk_view_row_activated"/> <child type="placeholder">
<object class="GtkLabel">
<property name="label" translatable="yes">No plugins found</property>
--- a/gplugin-gtk4/gplugin-gtk-plugin-row.c Mon Dec 06 22:37:09 2021 -0600
+++ b/gplugin-gtk4/gplugin-gtk-plugin-row.c Mon Dec 06 22:37:09 2021 -0600
@@ -43,6 +43,7 @@
@@ -64,6 +65,7 @@
static GParamSpec *properties[N_PROPERTIES] = {
@@ -247,6 +249,9 @@
gplugin_gtk_plugin_row_set_plugin(row, g_value_get_object(value));
+ gplugin_gtk_plugin_row_set_expanded(row, g_value_get_boolean(value)); G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec);
@@ -266,6 +271,9 @@
g_value_set_object(value, gplugin_gtk_plugin_row_get_plugin(row));
+ g_value_set_boolean(value, gplugin_gtk_plugin_row_get_expanded(row)); G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec);
@@ -311,6 +319,12 @@
"The GPluginPlugin whose info should be displayed",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
+ properties[PROP_EXPANDED] = g_param_spec_boolean( + "Whether the row has been opened to show details", + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); gtk_widget_class_set_template_from_resource(
@@ -338,6 +352,10 @@
+ gtk_widget_class_bind_template_child( gtk_widget_class_bind_template_child(
@@ -459,6 +477,37 @@
+ * gplugin_gtk_plugin_row_get_expanded: + * @row: The plugin row instance. + * Returns whether the plugin row is showing detailed information. + * Returns: %TRUE if the plugin row is expanded, %FALSE otherwise. +gplugin_gtk_plugin_row_get_expanded(GPluginGtkPluginRow *row) + g_return_val_if_fail(GPLUGIN_GTK_IS_PLUGIN_ROW(row), FALSE); + return gtk_revealer_get_reveal_child(GTK_REVEALER(row->revealer)); + * gplugin_gtk_plugin_row_set_expanded: + * @row: The plugin row instance. + * @expanded: Whether the plugin row is expanded. + * Sets whether the plugin row is showing detailed information. +gplugin_gtk_plugin_row_set_expanded(GPluginGtkPluginRow *row, gboolean expanded) + g_return_if_fail(GPLUGIN_GTK_IS_PLUGIN_ROW(row)); + gtk_revealer_set_reveal_child(GTK_REVEALER(row->revealer), expanded); * gplugin_gtk_plugin_row_get_sort_key:
* @row: The plugin row instance.
--- a/gplugin-gtk4/gplugin-gtk-plugin-row.h Mon Dec 06 22:37:09 2021 -0600
+++ b/gplugin-gtk4/gplugin-gtk-plugin-row.h Mon Dec 06 22:37:09 2021 -0600
@@ -46,6 +46,8 @@
GPluginGtkPluginRow *row,
GPluginPlugin *gplugin_gtk_plugin_row_get_plugin(GPluginGtkPluginRow *row);
+gboolean gplugin_gtk_plugin_row_get_expanded(GPluginGtkPluginRow *row); +void gplugin_gtk_plugin_row_set_expanded(GPluginGtkPluginRow *row, gboolean expanded); gchar *gplugin_gtk_plugin_row_get_sort_key(GPluginGtkPluginRow *row);
gboolean gplugin_gtk_plugin_row_matches_search(
GPluginGtkPluginRow *row,
--- a/gplugin-gtk4/gplugin-gtk-view.c Mon Dec 06 22:37:09 2021 -0600
+++ b/gplugin-gtk4/gplugin-gtk-view.c Mon Dec 06 22:37:09 2021 -0600
@@ -58,6 +58,17 @@
*****************************************************************************/
+gplugin_gtk_view_row_activated(G_GNUC_UNUSED GtkListBox *box, + GtkListBoxRow *row, G_GNUC_UNUSED gpointer data) + GPluginGtkPluginRow *plugin_row = GPLUGIN_GTK_PLUGIN_ROW(row); + gplugin_gtk_plugin_row_set_expanded( + !gplugin_gtk_plugin_row_get_expanded(plugin_row)); gplugin_gtk_view_add_plugins_to_list(
G_GNUC_UNUSED const gchar *id,
@@ -218,6 +229,9 @@
gtk_widget_class_bind_template_callback(
+ gplugin_gtk_view_row_activated); + gtk_widget_class_bind_template_callback( gplugin_gtk_view_search_changed);