[gnome-builder] search: tweak ellipsis using new libdazzle property



commit 6f7897bb02231e2f1cd1bc6acb281fe1340fd013
Author: Christian Hergert <chergert redhat com>
Date:   Thu Apr 12 23:39:53 2018 -0700

    search: tweak ellipsis using new libdazzle property

 src/libide/libide.gresource.xml       |  1 +
 src/libide/search/ide-search-entry.c  | 10 +++++++++-
 src/libide/search/ide-search-entry.ui | 11 +++++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/libide.gresource.xml b/src/libide/libide.gresource.xml
index 887f49500..cfee83b87 100644
--- a/src/libide/libide.gresource.xml
+++ b/src/libide/libide.gresource.xml
@@ -86,6 +86,7 @@
     <file preprocess="xml-stripblanks" alias="ide-terminal-search.ui">terminal/ide-terminal-search.ui</file>
     <file preprocess="xml-stripblanks" alias="ide-transfer-row.ui">transfers/ide-transfer-row.ui</file>
     <file preprocess="xml-stripblanks" 
alias="ide-transfers-button.ui">transfers/ide-transfers-button.ui</file>
+    <file preprocess="xml-stripblanks" alias="ide-search-entry.ui">search/ide-search-entry.ui</file>
     <file preprocess="xml-stripblanks" 
alias="ide-shortcuts-window.ui">keybindings/ide-shortcuts-window.ui</file>
     <file preprocess="xml-stripblanks" 
alias="ide-workbench-header-bar.ui">workbench/ide-workbench-header-bar.ui</file>
     <file preprocess="xml-stripblanks" alias="ide-workbench.ui">workbench/ide-workbench.ui</file>
diff --git a/src/libide/search/ide-search-entry.c b/src/libide/search/ide-search-entry.c
index b45812d5d..fe0a8751b 100644
--- a/src/libide/search/ide-search-entry.c
+++ b/src/libide/search/ide-search-entry.c
@@ -236,6 +236,7 @@ static void
 ide_search_entry_class_init (IdeSearchEntryClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
   DzlSuggestionEntryClass *suggestion_entry_class = DZL_SUGGESTION_ENTRY_CLASS (klass);
   GtkBindingSet *bindings;
 
@@ -262,6 +263,8 @@ ide_search_entry_class_init (IdeSearchEntryClass *klass)
                                 G_CALLBACK (ide_search_entry_unfocus),
                                 NULL, NULL, NULL, G_TYPE_NONE, 0);
 
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/ui/ide-search-entry.ui");
+
   bindings = gtk_binding_set_by_class (klass);
   gtk_binding_entry_add_signal (bindings, GDK_KEY_Escape, 0, "unfocus", 0);
 }
@@ -271,7 +274,12 @@ ide_search_entry_init (IdeSearchEntry *self)
 {
   self->max_results = DEFAULT_SEARCH_MAX;
 
+  gtk_widget_init_template (GTK_WIDGET (self));
+
   dzl_gtk_widget_add_style_class (GTK_WIDGET (self), "global-search");
 
-  g_signal_connect (self, "changed", G_CALLBACK (ide_search_entry_changed), NULL);
+  g_signal_connect (self,
+                    "changed",
+                    G_CALLBACK (ide_search_entry_changed),
+                    NULL);
 }
diff --git a/src/libide/search/ide-search-entry.ui b/src/libide/search/ide-search-entry.ui
new file mode 100644
index 000000000..f5e623ca1
--- /dev/null
+++ b/src/libide/search/ide-search-entry.ui
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="IdeSearchEntry" parent="DzlSuggestionEntry">
+    <child internal-child="popover">
+      <object class="DzlSuggestionPopover">
+        <property name="title-ellipsize">middle</property>
+        <property name="subtitle-ellipsize">end</property>
+      </object>
+    </child>
+  </template>
+</interface>


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