[shotwell/wip/gtk4: 10/27] Tags branch
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/wip/gtk4: 10/27] Tags branch
- Date: Sat, 9 Apr 2022 18:47:06 +0000 (UTC)
commit b065547fd72f363ecec0e7056ccfcf3acb059b53
Author: Jens Georg <mail jensge org>
Date: Sun Apr 3 20:18:30 2022 +0200
Tags branch
src/library/LibraryWindow.vala | 23 ++++++++---------------
src/meson.build | 1 +
src/tags/Tags.vala | 4 ++--
src/tags/TagsBranch.vala | 19 +++++++++++++------
4 files changed, 24 insertions(+), 23 deletions(-)
---
diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala
index 46205cee..e7d2cffc 100644
--- a/src/library/LibraryWindow.vala
+++ b/src/library/LibraryWindow.vala
@@ -107,8 +107,8 @@ public class LibraryWindow : AppWindow {
// Sidebar tree and roots (ordered by SidebarRootPosition)
private Sidebar.Tree sidebar_tree;
private Library.Branch library_branch = new Library.Branch();
-#if DOES_NOT_WORK_WITH_GTK4
private Tags.Branch tags_branch = new Tags.Branch();
+#if DOES_NOT_WORK_WITH_GTK4
private Folders.Branch folders_branch = new Folders.Branch();
private Faces.Branch faces_branch = new Faces.Branch();
private Events.Branch events_branch = new Events.Branch();
@@ -160,8 +160,8 @@ public class LibraryWindow : AppWindow {
sidebar_tree.selected_entry_removed.connect(on_sidebar_selected_entry_removed);
sidebar_tree.graft(library_branch, SidebarRootPosition.LIBRARY);
- #if 0
sidebar_tree.graft(tags_branch, SidebarRootPosition.TAGS);
+ #if 0
sidebar_tree.graft(folders_branch, SidebarRootPosition.FOLDERS);
#if ENABLE_FACES
sidebar_tree.graft(faces_branch, SidebarRootPosition.FACES);
@@ -381,13 +381,11 @@ public class LibraryWindow : AppWindow {
}
public void rename_tag_in_sidebar(Tag tag) {
- #if 0
Tags.SidebarEntry? entry = tags_branch.get_entry_for_tag(tag);
if (entry != null)
sidebar_tree.rename_entry_in_place(entry);
else
debug("No tag entry found for rename");
- #endif
}
public void rename_event_in_sidebar(Event event) {
@@ -931,9 +929,9 @@ public class LibraryWindow : AppWindow {
}
public void switch_to_tag(Tag tag) {
- //Tags.SidebarEntry? entry = tags_branch.get_entry_for_tag(tag);
- //if (entry != null)
- //switch_to_page(entry.get_page());
+ Tags.SidebarEntry? entry = tags_branch.get_entry_for_tag(tag);
+ if (entry != null)
+ switch_to_page(entry.get_page());
}
public void switch_to_saved_search(SavedSearch search) {
@@ -1067,8 +1065,9 @@ public class LibraryWindow : AppWindow {
// put the sidebar in a scrolling window
Gtk.ScrolledWindow scrolled_sidebar = new Gtk.ScrolledWindow();
+ scrolled_sidebar.vexpand = true;
scrolled_sidebar.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
- //scrolled_sidebar.set_child(sidebar_tree);
+ scrolled_sidebar.set_child(sidebar_tree);
background_progress_frame.set_child(background_progress_bar);
background_progress_frame.set_transition_type(Gtk.RevealerTransitionType.SLIDE_UP);
@@ -1109,7 +1108,7 @@ public class LibraryWindow : AppWindow {
client_paned = new Gtk.Paned(Gtk.Orientation.HORIZONTAL);
client_paned.set_start_child(sidebar_paned);
- //sidebar_tree.set_size_request(SIDEBAR_MIN_WIDTH, -1);
+ sidebar_tree.set_size_request(SIDEBAR_MIN_WIDTH, -1);
client_paned.set_end_child(right_vbox);
client_paned.set_position(Config.Facade.get_instance().get_sidebar_position());
// TODO: Calc according to layout's size, to give sidebar a maximum width
@@ -1175,10 +1174,8 @@ public class LibraryWindow : AppWindow {
// see note below about why the sidebar is uneditable while the LibraryPhotoPage is
// visible
- #if 0
if (current_page is LibraryPhotoPage)
sidebar_tree.enable_editing();
- #endif
// old page unsubscribes to these signals (new page subscribes below)
unsubscribe_from_basic_information(current_page);
@@ -1194,16 +1191,13 @@ public class LibraryWindow : AppWindow {
// renaming in the sidebar because a single click while in the LibraryPhotoPage indicates
// the user wants to return to the controlling page ... that is, in this special case, the
// sidebar cursor is set not to the 'current' page, but the page the user came from
- #if 0
if (page is LibraryPhotoPage)
sidebar_tree.disable_editing();
- #endif
// Update search filter to new page.
toggle_search_bar(should_show_search_bar(), page as CheckerboardPage);
// Not all pages have sidebar entries
- #if 0
Sidebar.Entry? entry = page_map.get(page);
if (entry != null) {
// if the corresponding sidebar entry is an expandable entry and wants to be
@@ -1214,7 +1208,6 @@ public class LibraryWindow : AppWindow {
sidebar_tree.place_cursor(entry, true);
}
- #endif
on_update_properties();
diff --git a/src/meson.build b/src/meson.build
index 60ea4049..5f29687a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -132,6 +132,7 @@ executable(
'events/EventPage.vala',
'events/EventDirectoryItem.vala',
'tags/Tags.vala',
+ 'tags/TagsBranch.vala',
'tags/TagPage.vala',
'tags/HierarchicalTagIndex.vala',
'tags/HierarchicalTagUtilities.vala',
diff --git a/src/tags/Tags.vala b/src/tags/Tags.vala
index 335572b3..308865be 100644
--- a/src/tags/Tags.vala
+++ b/src/tags/Tags.vala
@@ -7,11 +7,11 @@
namespace Tags {
public void init() throws Error {
- //Tags.SidebarEntry.init();
+ Tags.SidebarEntry.init();
}
public void terminate() {
- //Tags.SidebarEntry.terminate();
+ Tags.SidebarEntry.terminate();
}
}
diff --git a/src/tags/TagsBranch.vala b/src/tags/TagsBranch.vala
index e11ea5d5..b5ef052b 100644
--- a/src/tags/TagsBranch.vala
+++ b/src/tags/TagsBranch.vala
@@ -123,9 +123,9 @@ public class Tags.Branch : Sidebar.Branch {
}
public class Tags.Header : Sidebar.Header, Sidebar.InternalDropTargetEntry,
- Sidebar.InternalDragSourceEntry, Sidebar.Contextable {
+ Sidebar.Contextable {
private Gtk.Builder builder;
- private Gtk.Menu? context_menu = null;
+ private Gtk.PopoverMenu? context_menu = null;
public Header() {
base (_("Tags"), _("Organize and browse your photo’s tags"));
@@ -137,7 +137,7 @@ public class Tags.Header : Sidebar.Header, Sidebar.InternalDropTargetEntry,
try {
this.builder.add_from_resource(Resources.get_ui("tag_sidebar_context.ui"));
var model = builder.get_object ("popup-menu") as GLib.MenuModel;
- this.context_menu = new Gtk.Menu.from_model (model);
+ this.context_menu = new Gtk.PopoverMenu.from_model (model);
} catch (Error error) {
AppWindow.error_message("Error loading UI resource: %s".printf(
error.message));
@@ -156,6 +156,7 @@ public class Tags.Header : Sidebar.Header, Sidebar.InternalDropTargetEntry,
return true;
}
+#if 0
public bool internal_drop_received_arbitrary(Gtk.SelectionData data) {
if (data.get_data_type().name() == LibraryWindow.TAG_PATH_MIME_TYPE) {
string old_tag_path = (string) data.get_data();
@@ -177,15 +178,16 @@ public class Tags.Header : Sidebar.Header, Sidebar.InternalDropTargetEntry,
public void prepare_selection_data(Gtk.SelectionData data) {
;
}
+ #endif
- public Gtk.Menu? get_sidebar_context_menu(Gdk.EventButton? event) {
+ public Gtk.PopoverMenu? get_sidebar_context_menu() {
return context_menu;
}
}
public class Tags.SidebarEntry : Sidebar.SimplePageEntry, Sidebar.RenameableEntry,
- Sidebar.DestroyableEntry, Sidebar.InternalDropTargetEntry, Sidebar.ExpandableEntry,
- Sidebar.InternalDragSourceEntry {
+ Sidebar.DestroyableEntry, Sidebar.InternalDropTargetEntry, Sidebar.ExpandableEntry
+ {
private string single_tag_icon = Resources.ICON_ONE_TAG;
private Tag tag;
@@ -248,6 +250,7 @@ public class Tags.SidebarEntry : Sidebar.SimplePageEntry, Sidebar.RenameableEntr
return true;
}
+#if 0
public bool internal_drop_received_arbitrary(Gtk.SelectionData data) {
if (data.get_data_type().name() == LibraryWindow.TAG_PATH_MIME_TYPE) {
string old_tag_path = (string) data.get_data();
@@ -278,14 +281,18 @@ public class Tags.SidebarEntry : Sidebar.SimplePageEntry, Sidebar.RenameableEntr
return false;
}
+ #endif
public bool expand_on_select() {
return false;
}
+
+#if 0
public void prepare_selection_data(Gtk.SelectionData data) {
data.set(Gdk.Atom.intern_static_string(LibraryWindow.TAG_PATH_MIME_TYPE), 0,
tag.get_path().data);
}
+ #endif
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]