[gnome-software/1391-style-storage-units-differently: 175/178] gs-context-dialog-row: Allow setting markup for the lozenge text




commit fb71b04c4d120ad8ecb88db364c386586c1ddb97
Author: Milan Crha <mcrha redhat com>
Date:   Mon Apr 11 14:09:12 2022 +0200

    gs-context-dialog-row: Allow setting markup for the lozenge text
    
    This will be used in the following commit, to draw size units
    with a different font size than the size value.

 src/gs-context-dialog-row.c | 35 +++++++++++++++++++++++++++++++++++
 src/gs-context-dialog-row.h |  5 +++++
 2 files changed, 40 insertions(+)
---
diff --git a/src/gs-context-dialog-row.c b/src/gs-context-dialog-row.c
index da72c3f1f..11c9f3822 100644
--- a/src/gs-context-dialog-row.c
+++ b/src/gs-context-dialog-row.c
@@ -302,6 +302,41 @@ gs_context_dialog_row_get_content (GsContextDialogRow *self)
        return gtk_label_get_text (self->lozenge_content_text);
 }
 
+/**
+ * gs_context_dialog_row_get_content_is_markup:
+ * @self: a #GsContextDialogRow
+ *
+ * Get whether the #GsContextDialogRow:content is markup.
+ *
+ * Returns: %TRUE when then content text is markup
+ * Since: 43
+ */
+gboolean
+gs_context_dialog_row_get_content_is_markup (GsContextDialogRow *self)
+{
+       g_return_val_if_fail (GS_IS_CONTEXT_DIALOG_ROW (self), FALSE);
+
+       return gtk_label_get_use_markup (self->lozenge_content_text);
+}
+
+/**
+ * gs_context_dialog_row_set_content_is_markup:
+ * @self: a #GsContextDialogRow
+ * @is_markup: value to set
+ *
+ * Set to %TRUE, when the #GsContextDialogRow:content is markup.
+ *
+ * Since: 43
+ */
+void
+gs_context_dialog_row_set_content_is_markup (GsContextDialogRow *self,
+                                            gboolean is_markup)
+{
+       g_return_if_fail (GS_IS_CONTEXT_DIALOG_ROW (self));
+
+       gtk_label_set_use_markup (self->lozenge_content_text, is_markup);
+}
+
 /**
  * gs_context_dialog_row_get_importance:
  * @self: a #GsContextDialogRow
diff --git a/src/gs-context-dialog-row.h b/src/gs-context-dialog-row.h
index 97b3681e1..74c805918 100644
--- a/src/gs-context-dialog-row.h
+++ b/src/gs-context-dialog-row.h
@@ -55,6 +55,11 @@ GtkListBoxRow        *gs_context_dialog_row_new_text (const gchar                    
*content,
 const gchar                    *gs_context_dialog_row_get_icon_name    (GsContextDialogRow     *self);
 const gchar                    *gs_context_dialog_row_get_content      (GsContextDialogRow     *self);
 GsContextDialogRowImportance    gs_context_dialog_row_get_importance   (GsContextDialogRow     *self);
+gboolean                        gs_context_dialog_row_get_content_is_markup
+                                                                       (GsContextDialogRow     *self);
+void                            gs_context_dialog_row_set_content_is_markup
+                                                                       (GsContextDialogRow     *self,
+                                                                        gboolean                is_markup);
 
 void                            gs_context_dialog_row_set_size_groups  (GsContextDialogRow     *self,
                                                                         GtkSizeGroup           *lozenge,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]