[gnome-builder] editor: use italics for modified state



commit be859c472afe0609ffef31117a818602dc58ab9b
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 28 15:04:45 2019 -0700

    editor: use italics for modified state

 src/libide/editor/ide-editor-sidebar.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/editor/ide-editor-sidebar.c b/src/libide/editor/ide-editor-sidebar.c
index 6c8a68198..6aec4e1b1 100644
--- a/src/libide/editor/ide-editor-sidebar.c
+++ b/src/libide/editor/ide-editor-sidebar.c
@@ -434,6 +434,25 @@ ide_editor_sidebar_close_view (GtkButton     *button,
     _ide_frame_request_close (IDE_FRAME (stack), view);
 }
 
+static gboolean
+modified_to_attrs (GBinding     *binding,
+                   const GValue *src_value,
+                   GValue       *dst_value,
+                   gpointer      user_data)
+{
+  PangoAttrList *attrs = NULL;
+
+  if (g_value_get_boolean (src_value))
+    {
+      attrs = pango_attr_list_new ();
+      pango_attr_list_insert (attrs, pango_attr_style_new (PANGO_STYLE_ITALIC));
+    }
+
+  g_value_take_boxed (dst_value, attrs);
+
+  return TRUE;
+}
+
 static GtkWidget *
 create_open_page_row (gpointer item,
                       gpointer user_data)
@@ -467,14 +486,16 @@ create_open_page_row (gpointer item,
   g_object_bind_property (view, "icon", image, "gicon", G_BINDING_SYNC_CREATE);
   gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (image));
 
-  label = g_object_new (DZL_TYPE_BOLDING_LABEL,
+  label = g_object_new (GTK_TYPE_LABEL,
                         "ellipsize", PANGO_ELLIPSIZE_START,
                         "visible", TRUE,
                         "hexpand", TRUE,
                         "xalign", 0.0f,
                         NULL);
   g_object_bind_property (view, "title", label, "label", G_BINDING_SYNC_CREATE);
-  g_object_bind_property (view, "modified", label, "bold", G_BINDING_SYNC_CREATE);
+  g_object_bind_property_full (view, "modified", label, "attributes",
+                               G_BINDING_SYNC_CREATE,
+                               modified_to_attrs, NULL, NULL, NULL);
   gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (label));
 
   button = g_object_new (GTK_TYPE_BUTTON,


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