[libadwaita/wip/sophie-h/pref-row-markup] First round fixing issues
- From: Sophie Herold <sophieherold src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/wip/sophie-h/pref-row-markup] First round fixing issues
- Date: Mon, 4 Apr 2022 15:54:37 +0000 (UTC)
commit c14c61199f793b5fa9da8618259f276f1d1cb74b
Author: Sophie Herold <sophie hemio de>
Date: Mon Apr 4 17:53:39 2022 +0200
First round fixing issues
src/adw-preferences-row.c | 12 ++++++------
src/adw-preferences-window.c | 26 +++++++++++++++-----------
2 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/src/adw-preferences-row.c b/src/adw-preferences-row.c
index f1573e1d..d1d525ab 100644
--- a/src/adw-preferences-row.c
+++ b/src/adw-preferences-row.c
@@ -165,14 +165,14 @@ adw_preferences_row_class_init (AdwPreferencesRowClass *klass)
/**
* AdwPreferencesRow:use-markup: (attributes org.gtk.Property.get=adw_preferences_row_get_use_markup
org.gtk.Property.set=adw_preferences_row_set_use_markup)
*
- * Whether to use markup syntax for all elements.
+ * Whether to use markup syntax for all texts.
*
* Since: 1.2
*/
props[PROP_USE_MARKUP] =
g_param_spec_boolean ("use-markup",
"Use markup",
- "Whether to use markup syntax for all elements",
+ "Whether to use markup syntax for all texts",
TRUE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -354,9 +354,9 @@ adw_preferences_row_set_title_selectable (AdwPreferencesRow *self,
* adw_preferences_row_get_use_markup: (attributes org.gtk.Method.get_property=use-markup)
* @self: a preferences row
*
- * Gets whether elements use markup.
+ * Gets whether texts inside the row use markup.
*
- * Returns: whether elements use markup.
+ * Returns: whether texts inside the row use markup.
*
* Since: 1.2
*/
@@ -375,9 +375,9 @@ adw_preferences_row_get_use_markup (AdwPreferencesRow *self)
/**
* adw_preferences_row_set_use_markup: (attributes org.gtk.Method.set_property=use-markup)
* @self: a preferences row
- * @use_underline: `TRUE` if elements use markup
+ * @use_markup: `TRUE` if texts inside the row use markup
*
- * Sets whether elements use markup.
+ * Sets whether texts inside the row use markup.
*
* Since: 1.2
*/
diff --git a/src/adw-preferences-window.c b/src/adw-preferences-window.c
index 1d15074b..0efbeb92 100644
--- a/src/adw-preferences-window.c
+++ b/src/adw-preferences-window.c
@@ -135,25 +135,29 @@ make_comparable (const char *src,
gboolean allow_underline)
{
char* plaintext = g_utf8_casefold (src, -1);
+ char* comparable;
GError *error = NULL;
if (adw_preferences_row_get_use_markup (row)) {
- pango_parse_markup (
- plaintext,
- -1,
- 0,
- NULL,
- &plaintext,
- NULL,
- &error
- );
+ comparable = g_strdup (plaintext);
+ pango_parse_markup (comparable, -1, 0, NULL, &plaintext, NULL, &error);
+ free (comparable);
+
+ g_assert_nonnull (error);
+ if (error) {
+ free (error);
+ }
}
if (adw_preferences_row_get_use_underline (row) && allow_underline) {
- plaintext = strip_mnemonic (plaintext);
+ comparable = strip_mnemonic (plaintext);
+ } else {
+ comparable = plaintext;
}
- return plaintext;
+ free (plaintext);
+
+ return comparable;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]