[gnome-builder/wip/gtk4-port] plugins/find-other-file: use menu style for popover
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] plugins/find-other-file: use menu style for popover
- Date: Wed, 1 Jun 2022 20:07:26 +0000 (UTC)
commit 7b98e3da915319dc20753e30e2636a30dd44e99e
Author: Christian Hergert <chergert redhat com>
Date: Wed Jun 1 13:07:03 2022 -0700
plugins/find-other-file: use menu style for popover
Much like we did for the create-project and vcsui plugins, we can make this
listview in a popover look more like a menu.
Also, to be more like those plugins, just embed the sub-template within
the parent template for row styling.
.../find-other-file/find-other-file.gresource.xml | 1 -
.../gbp-find-other-file-popover-row.ui | 47 -------------
.../find-other-file/gbp-find-other-file-popover.ui | 79 +++++++++++++++++-----
3 files changed, 61 insertions(+), 66 deletions(-)
---
diff --git a/src/plugins/find-other-file/find-other-file.gresource.xml
b/src/plugins/find-other-file/find-other-file.gresource.xml
index 5d5f56f1f..e0108f7c9 100644
--- a/src/plugins/find-other-file/find-other-file.gresource.xml
+++ b/src/plugins/find-other-file/find-other-file.gresource.xml
@@ -4,6 +4,5 @@
<file>find-other-file.plugin</file>
<file>gtk/keybindings.json</file>
<file preprocess="xml-stripblanks">gbp-find-other-file-popover.ui</file>
- <file preprocess="xml-stripblanks">gbp-find-other-file-popover-row.ui</file>
</gresource>
</gresources>
diff --git a/src/plugins/find-other-file/gbp-find-other-file-popover.ui
b/src/plugins/find-other-file/gbp-find-other-file-popover.ui
index 19602bcdf..96aa995cc 100644
--- a/src/plugins/find-other-file/gbp-find-other-file-popover.ui
+++ b/src/plugins/find-other-file/gbp-find-other-file-popover.ui
@@ -1,32 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GbpFindOtherFilePopover" parent="GtkPopover">
+ <style>
+ <class name="menu"/>
+ </style>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkFrame">
+ <object class="GtkScrolledWindow" id="scroller">
+ <property name="propagate-natural-height">true</property>
+ <property name="propagate-natural-width">true</property>
+ <property name="min-content-height">100</property>
+ <property name="max-content-height">600</property>
+ <property name="min-content-width">300</property>
+ <property name="max-content-width">300</property>
<child>
- <object class="GtkScrolledWindow" id="scroller">
- <property name="propagate-natural-height">true</property>
- <property name="propagate-natural-width">true</property>
- <property name="min-content-height">100</property>
- <property name="max-content-height">600</property>
- <property name="min-content-width">300</property>
- <property name="max-content-width">300</property>
- <child>
- <object class="GtkListView" id="list_view">
- <signal name="activate" handler="gbp_find_other_file_popover_activate_cb" swapped="true"
object="GbpFindOtherFilePopover"/>
- <property name="orientation">vertical</property>
- <property name="single-click-activate">True</property>
- <property name="factory">
- <object class="GtkBuilderListItemFactory">
- <property
name="resource">/plugins/find-other-file/gbp-find-other-file-popover-row.ui</property>
- </object>
+ <object class="GtkListView" id="list_view">
+ <signal name="activate" handler="gbp_find_other_file_popover_activate_cb" swapped="true"
object="GbpFindOtherFilePopover"/>
+ <property name="orientation">vertical</property>
+ <property name="single-click-activate">True</property>
+ <property name="factory">
+ <object class="GtkBuilderListItemFactory">
+ <property name="bytes"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="GtkListItem">
+ <property name="child">
+ <object class="GtkBox">
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage">
+ <property name="pixel-size">16</property>
+ <binding name="gicon">
+ <lookup name="gicon" type="GbpFoundFile">
+ <lookup name="item">GtkListItem</lookup>
+ </lookup>
+ </binding>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="halign">start</property>
+ <property name="hexpand">true</property>
+ <property name="ellipsize">start</property>
+ <binding name="label">
+ <lookup name="display-name" type="GbpFoundFile">
+ <lookup name="item">GtkListItem</lookup>
+ </lookup>
+ </binding>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">go-next-symbolic</property>
+ <binding name="visible">
+ <lookup name="is-directory" type="GbpFoundFile">
+ <lookup name="item">GtkListItem</lookup>
+ </lookup>
+ </binding>
+ </object>
+ </child>
+ </object>
+ </property>
+ </template>
+</interface>
+]]>
</property>
</object>
- </child>
+ </property>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]