diff options
Diffstat (limited to 'src/gui/gcal-search-button.ui')
-rw-r--r-- | src/gui/gcal-search-button.ui | 123 |
1 files changed, 114 insertions, 9 deletions
diff --git a/src/gui/gcal-search-button.ui b/src/gui/gcal-search-button.ui index d9bcf1c8..25db262a 100644 --- a/src/gui/gcal-search-button.ui +++ b/src/gui/gcal-search-button.ui @@ -52,8 +52,29 @@ <object class="GtkSearchEntry" id="entry"> <property name="max-width-chars">0</property> <property name="width-chars">0</property> + <signal name="activate" handler="on_entry_activate_cb" object="GcalSearchButton" swapped="no" /> + <signal name="next-match" handler="on_entry_next_match_cb" object="GcalSearchButton" swapped="no" /> + <signal name="previous-match" handler="on_entry_previous_match_cb" object="GcalSearchButton" swapped="no" /> <signal name="search-changed" handler="on_entry_search_changed_cb" object="GcalSearchButton" swapped="no" /> <signal name="stop-search" handler="on_entry_stop_search_cb" object="GcalSearchButton" swapped="no" /> + + <child> + <object class="GtkShortcutController"> + <child> + <object class="GtkShortcut"> + <property name='trigger'>Up</property> + <property name='action'>signal(previous-match)</property> + </object> + </child> + <child> + <object class="GtkShortcut"> + <property name='trigger'>Down</property> + <property name='action'>signal(next-match)</property> + </object> + </child> + </object> + </child> + </object> </property> </object> @@ -65,7 +86,7 @@ <object class="GtkPopover" id="popover"> <property name="position">bottom</property> <property name="autohide">False</property> - <property name="default-widget">results_listbox</property> + <property name="default-widget">results_listview</property> <style> <class name="menu" /> </style> @@ -84,18 +105,102 @@ <property name="hscrollbar-policy">never</property> <child> - <object class="GtkViewport"> - <property name="scroll-to-focus">True</property> + <object class="GtkListView" id="results_listview"> <property name="hscroll-policy">natural</property> <property name="vscroll-policy">natural</property> - - <child> - <object class="GtkListBox" id="results_listbox"> - <property name="selection-mode">none</property> - <signal name="row-activated" handler="on_results_listbox_row_activated_cb" object="GcalSearchButton" swapped="no" /> + <property name="single-click-activate">True</property> + <property name="model"> + <object class="GtkSingleSelection" id="results_selection_model"> + <property name="autoselect">True</property> + <property name="can-unselect">False</property> </object> - </child> + </property> + <property name="factory"> + <object class="GtkBuilderListItemFactory"> + <property name="bytes"><![CDATA[ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <template class="GtkListItem"> + <property name="activatable">True</property> + <property name="selectable">True</property> + <property name="child"> + <object class="GtkBox"> + + <child> + <object class="GtkImage" id="image"> + <property name="valign">center</property> + <property name="hexpand">False</property> + <property name="icon-size">normal</property> + <binding name="paintable"> + <lookup name="primary-icon" type="GcalSearchHit"> + <lookup name="item">GtkListItem</lookup> + </lookup> + </binding> + <style> + <class name="title"/> + </style> + </object> + </child> + + <child> + <object class="GtkLabel" id="title"> + <property name="use-markup">True</property> + <property name="ellipsize">end</property> + <property name="xalign">0.0</property> + <property name="max-width-chars">40</property> + <binding name="label"> + <closure type="gchararray" function="escape_markup_cb"> + <lookup name="title" type="GcalSearchHit"> + <lookup name="item">GtkListItem</lookup> + </lookup> + </closure> + </binding> + </object> + </child> + + <child> + <object class="GtkLabel" id="separator"> + <property name="label">—</property> + <binding name="visible"> + <closure type="gboolean" function="string_is_not_empty_cb"> + <lookup name="subtitle" type="GcalSearchHit"> + <lookup name="item">GtkListItem</lookup> + </lookup> + </closure> + </binding> + <style> + <class name="dim-label"/> + </style> + </object> + </child> + + <child> + <object class="GtkLabel" id="subtitle"> + <property name="hexpand">True</property> + <property name="use-markup">True</property> + <property name="ellipsize">end</property> + <property name="xalign">0.0</property> + <binding name="label"> + <closure type="gchararray" function="escape_markup_cb"> + <lookup name="subtitle" type="GcalSearchHit"> + <lookup name="item">GtkListItem</lookup> + </lookup> + </closure> + </binding> + <style> + <class name="subtitle"/> + </style> + </object> + </child> + </object> + </property> + </template> +</interface> + ]]></property> + </object> + </property> + <signal name="activate" handler="on_results_listview_activated_cb" object="GcalSearchButton" swapped="no" /> </object> </child> |