search: Stop using AdwPreferencesWindow for search locations window

That's not what it's for.
This commit is contained in:
Alice Mikhaylenko 2023-07-31 00:10:14 +04:00 committed by Felipe Borges
parent 52f4919c94
commit ee4c5f8115
3 changed files with 74 additions and 64 deletions

View file

@ -48,7 +48,7 @@ typedef struct {
} PlaceRowWidgets;
struct _CcSearchLocationsDialog {
AdwPreferencesWindow parent;
AdwWindow parent;
GSettings *tracker_preferences;
@ -64,7 +64,7 @@ struct _CcSearchLocationsDialogClass {
AdwPreferencesWindowClass parent_class;
};
G_DEFINE_TYPE (CcSearchLocationsDialog, cc_search_locations_dialog, ADW_TYPE_PREFERENCES_WINDOW)
G_DEFINE_TYPE (CcSearchLocationsDialog, cc_search_locations_dialog, ADW_TYPE_WINDOW)
static gboolean
keynav_failed_cb (CcSearchLocationsDialog *self,
@ -782,4 +782,6 @@ cc_search_locations_dialog_class_init (CcSearchLocationsDialogClass *klass)
gtk_widget_class_bind_template_callback (widget_class, add_button_clicked);
gtk_widget_class_bind_template_callback (widget_class, keynav_failed_cb);
gtk_widget_class_add_binding_action (widget_class, GDK_KEY_Escape, 0, "window.close", NULL);
}

View file

@ -23,7 +23,7 @@
#include "cc-search-panel.h"
#define CC_SEARCH_LOCATIONS_DIALOG_TYPE (cc_search_locations_dialog_get_type ())
G_DECLARE_FINAL_TYPE (CcSearchLocationsDialog, cc_search_locations_dialog, CC, SEARCH_LOCATIONS_DIALOG, AdwPreferencesWindow)
G_DECLARE_FINAL_TYPE (CcSearchLocationsDialog, cc_search_locations_dialog, CC, SEARCH_LOCATIONS_DIALOG, AdwWindow)
CcSearchLocationsDialog *cc_search_locations_dialog_new (CcSearchPanel *panel);

View file

@ -1,83 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<template class="CcSearchLocationsDialog" parent="AdwPreferencesWindow">
<template class="CcSearchLocationsDialog" parent="AdwWindow">
<property name="modal">True</property>
<property name="width-request">360</property>
<property name="height-request">294</property>
<property name="default-width">640</property>
<property name="default-height">576</property>
<property name="hide-on-close">True</property>
<property name="search-enabled">False</property>
<property name="title" translatable="yes">Search Locations</property>
<child>
<object class="AdwPreferencesPage">
<property name="description" translatable="yes">Folders which are searched by system apps, such as Files, Photos and Videos.</property>
<child>
<object class="AdwPreferencesGroup" id="places_group">
<property name="title" translatable="yes">Places</property>
<property name="content">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar"/>
</child>
<property name="content">
<object class="AdwPreferencesPage">
<property name="description" translatable="yes">Folders which are searched by system apps, such as Files, Photos and Videos.</property>
<child>
<object class="GtkListBox" id="places_list">
<property name="selection-mode">none</property>
<signal name="keynav-failed" handler="keynav_failed_cb" object="CcSearchLocationsDialog" swapped="yes"/>
<accessibility>
<relation name="labelled-by">places_group</relation>
</accessibility>
<style>
<class name="boxed-list"/>
</style>
<object class="AdwPreferencesGroup" id="places_group">
<property name="title" translatable="yes">Places</property>
<child>
<object class="GtkListBox" id="places_list">
<property name="selection-mode">none</property>
<signal name="keynav-failed" handler="keynav_failed_cb" object="CcSearchLocationsDialog" swapped="yes"/>
<accessibility>
<relation name="labelled-by">places_group</relation>
</accessibility>
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="bookmarks_group">
<property name="title" translatable="yes">Bookmarks</property>
<child>
<object class="GtkListBox" id="bookmarks_list">
<property name="selection-mode">none</property>
<signal name="keynav-failed" handler="keynav_failed_cb" object="CcSearchLocationsDialog" swapped="yes"/>
<accessibility>
<relation name="labelled-by">bookmarks_group</relation>
</accessibility>
<style>
<class name="boxed-list"/>
</style>
<object class="AdwPreferencesGroup" id="bookmarks_group">
<property name="title" translatable="yes">Bookmarks</property>
<child>
<object class="GtkListBox" id="bookmarks_list">
<property name="selection-mode">none</property>
<signal name="keynav-failed" handler="keynav_failed_cb" object="CcSearchLocationsDialog" swapped="yes"/>
<accessibility>
<relation name="labelled-by">bookmarks_group</relation>
</accessibility>
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="others_group">
<property name="title" translatable="yes">Others</property>
<property name="header-suffix">
<object class="GtkButton" id="locations_add">
<property name="valign">center</property>
<property name="child">
<object class="AdwButtonContent">
<property name="icon-name">list-add-symbolic</property>
<property name="label" translatable="yes">Add Location</property>
<child>
<object class="AdwPreferencesGroup" id="others_group">
<property name="title" translatable="yes">Others</property>
<property name="header-suffix">
<object class="GtkButton" id="locations_add">
<property name="valign">center</property>
<property name="child">
<object class="AdwButtonContent">
<property name="icon-name">list-add-symbolic</property>
<property name="label" translatable="yes">Add Location</property>
</object>
</property>
<signal name="clicked" handler="add_button_clicked" object="CcSearchLocationsDialog" swapped="yes"/>
<style>
<class name="flat"/>
</style>
</object>
</property>
<signal name="clicked" handler="add_button_clicked" object="CcSearchLocationsDialog" swapped="yes"/>
<style>
<class name="flat"/>
</style>
</object>
</property>
<child>
<object class="GtkListBox" id="others_list">
<property name="selection-mode">none</property>
<signal name="keynav-failed" handler="keynav_failed_cb" object="CcSearchLocationsDialog" swapped="yes"/>
<accessibility>
<relation name="labelled-by">others_group</relation>
</accessibility>
<style>
<class name="boxed-list"/>
</style>
<child>
<object class="GtkListBox" id="others_list">
<property name="selection-mode">none</property>
<signal name="keynav-failed" handler="keynav_failed_cb" object="CcSearchLocationsDialog" swapped="yes"/>
<accessibility>
<relation name="labelled-by">others_group</relation>
</accessibility>
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</property>
</object>
</child>
</property>
</template>
</interface>