[gnome-builder/wip/chergert/completion] completion: allow markup for LHS
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/completion] completion: allow markup for LHS
- Date: Tue, 5 Jun 2018 04:42:05 +0000 (UTC)
commit e807f2a21b691c8709aa2f3cd3ede4cd312bce5b
Author: Christian Hergert <chergert redhat com>
Date: Mon Jun 4 21:37:47 2018 -0700
completion: allow markup for LHS
.../completion/ide-completion-list-box-row.c | 26 ++++++++++++++++++++++
.../completion/ide-completion-list-box-row.h | 3 +++
2 files changed, 29 insertions(+)
---
diff --git a/src/libide/completion/ide-completion-list-box-row.c
b/src/libide/completion/ide-completion-list-box-row.c
index 65a493a53..942666ac6 100644
--- a/src/libide/completion/ide-completion-list-box-row.c
+++ b/src/libide/completion/ide-completion-list-box-row.c
@@ -204,6 +204,32 @@ ide_completion_list_box_row_set_left (IdeCompletionListBoxRow *self,
gtk_label_set_label (self->left, left);
}
+/**
+ * ide_completion_list_box_row_set_left_markup:
+ * @self: a #IdeCompletionListBoxRow
+ * @left_markup: (nullable): markup for the left column
+ *
+ */
+void
+ide_completion_list_box_row_set_left_markup (IdeCompletionListBoxRow *self,
+ const gchar *left_markup)
+{
+ g_autofree gchar *adjusted = NULL;
+
+ g_return_if_fail (IDE_IS_COMPLETION_LIST_BOX_ROW (self));
+
+ /*
+ * HACK: For some reason labels ending in a <span fgalpha=xxx> span
+ * cause fgalpha to effect external pango contexts and i have
+ * no idea how/why that is happening.
+ */
+ if (left_markup != NULL && g_str_has_suffix (left_markup, "</span>"))
+ left_markup = adjusted = g_strdup_printf ("%s ", left_markup);
+
+ gtk_label_set_label (self->left, left_markup);
+ gtk_label_set_use_markup (self->left, TRUE);
+}
+
/**
* ide_completion_list_box_row_set_center:
* @self: a #IdeCompletionListBoxRow
diff --git a/src/libide/completion/ide-completion-list-box-row.h
b/src/libide/completion/ide-completion-list-box-row.h
index 6aede5253..4a7177e15 100644
--- a/src/libide/completion/ide-completion-list-box-row.h
+++ b/src/libide/completion/ide-completion-list-box-row.h
@@ -44,6 +44,9 @@ IDE_AVAILABLE_IN_3_30
void ide_completion_list_box_row_set_left (IdeCompletionListBoxRow *self,
const gchar *left);
IDE_AVAILABLE_IN_3_30
+void ide_completion_list_box_row_set_left_markup (IdeCompletionListBoxRow *self,
+ const gchar *left_markup);
+IDE_AVAILABLE_IN_3_30
void ide_completion_list_box_row_set_right (IdeCompletionListBoxRow *self,
const gchar *right);
IDE_AVAILABLE_IN_3_30
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]