[gnome-software: 2/5] gs-context-dialog-row: Allow row components to be added to size groups
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 2/5] gs-context-dialog-row: Allow row components to be added to size groups
- Date: Thu, 12 Aug 2021 16:32:41 +0000 (UTC)
commit eef238eaf7e2a2695cb7e991dbc1764ea7475a17
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed Aug 11 10:54:20 2021 +0100
gs-context-dialog-row: Allow row components to be added to size groups
This allows, for example, all the lozenges in a list of rows to be added
to a horizontal size group to make them all the same width.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1353
src/gs-context-dialog-row.c | 31 +++++++++++++++++++++++++++++++
src/gs-context-dialog-row.h | 5 +++++
2 files changed, 36 insertions(+)
---
diff --git a/src/gs-context-dialog-row.c b/src/gs-context-dialog-row.c
index 2a7cf5edd..907e47279 100644
--- a/src/gs-context-dialog-row.c
+++ b/src/gs-context-dialog-row.c
@@ -402,3 +402,34 @@ gs_context_dialog_row_get_description (GsContextDialogRow *self)
return gtk_label_get_text (self->description);
}
+
+/**
+ * gs_context_dialog_row_set_size_groups:
+ * @self: a #GsContextDialogRow
+ * @lozenge: (nullable) (transfer none): a #GtkSizeGroup for the lozenge, or %NULL
+ * @title: (nullable) (transfer none): a #GtkSizeGroup for the title, or %NULL
+ * @description: (nullable) (transfer none): a #GtkSizeGroup for the description, or %NULL
+ *
+ * Add widgets from the #GsContextDialogRow to the given size groups. If a size
+ * group is %NULL, the corresponding widget will not be changed.
+ *
+ * Since: 41
+ */
+void
+gs_context_dialog_row_set_size_groups (GsContextDialogRow *self,
+ GtkSizeGroup *lozenge,
+ GtkSizeGroup *title,
+ GtkSizeGroup *description)
+{
+ g_return_if_fail (GS_IS_CONTEXT_DIALOG_ROW (self));
+ g_return_if_fail (lozenge == NULL || GTK_IS_SIZE_GROUP (lozenge));
+ g_return_if_fail (title == NULL || GTK_IS_SIZE_GROUP (title));
+ g_return_if_fail (description == NULL || GTK_IS_SIZE_GROUP (description));
+
+ if (lozenge != NULL)
+ gtk_size_group_add_widget (lozenge, self->lozenge);
+ if (title != NULL)
+ gtk_size_group_add_widget (title, GTK_WIDGET (self->title));
+ if (description != NULL)
+ gtk_size_group_add_widget (description, GTK_WIDGET (self->description));
+}
diff --git a/src/gs-context-dialog-row.h b/src/gs-context-dialog-row.h
index b27391b03..e6f03462e 100644
--- a/src/gs-context-dialog-row.h
+++ b/src/gs-context-dialog-row.h
@@ -57,4 +57,9 @@ GsContextDialogRowImportance gs_context_dialog_row_get_importance (GsContextDia
const gchar *gs_context_dialog_row_get_title (GsContextDialogRow *self);
const gchar *gs_context_dialog_row_get_description (GsContextDialogRow *self);
+void gs_context_dialog_row_set_size_groups (GsContextDialogRow *self,
+ GtkSizeGroup *lozenge,
+ GtkSizeGroup *title,
+ GtkSizeGroup *description);
+
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]