[shotwell/wip/dedeprecate] WIP
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/wip/dedeprecate] WIP
- Date: Sat, 5 Nov 2016 00:28:14 +0000 (UTC)
commit f270d03551e296c9bbe88e4813b3ce9b5da22d32
Author: Jens Georg <mail jensge org>
Date: Thu Nov 3 21:36:04 2016 +0100
WIP
src/events/EventPage.vala | 26 +++++----------
src/events/EventsDirectoryPage.vala | 56 ++++++++++++++--------------------
src/searches/SavedSearchPage.vala | 25 +++++++---------
3 files changed, 43 insertions(+), 64 deletions(-)
---
diff --git a/src/events/EventPage.vala b/src/events/EventPage.vala
index fdaf80b..bfabea1 100644
--- a/src/events/EventPage.vala
+++ b/src/events/EventPage.vala
@@ -46,27 +46,19 @@ public class EventPage : CollectionPage {
ui_filenames.add("event.ui");
}
-
- protected override Gtk.ActionEntry[] init_collect_action_entries() {
- Gtk.ActionEntry[] new_actions = base.init_collect_action_entries();
-
- Gtk.ActionEntry make_primary = { "MakePrimary", Resources.MAKE_PRIMARY,
- TRANSLATABLE, null, TRANSLATABLE, on_make_primary };
- make_primary.label = Resources.MAKE_KEY_PHOTO_MENU;
- new_actions += make_primary;
- Gtk.ActionEntry rename = { "Rename", null, TRANSLATABLE, null, TRANSLATABLE, on_rename };
- rename.label = Resources.RENAME_EVENT_MENU;
- new_actions += rename;
+ private const GLib.ActionEntry[] entries = {
+ { "MakePrimary", on_make_primary },
+ { "Rename", on_rename },
+ { "EditEventComment", on_edit_comment }
+ };
- Gtk.ActionEntry comment = { "EditEventComment", null, TRANSLATABLE, null,
- Resources.EDIT_EVENT_COMMENT_MENU, on_edit_comment};
- comment.label = Resources.EDIT_EVENT_COMMENT_MENU;
- new_actions += comment;
+ protected override void init_actions () {
+ base.init_actions ();
- return new_actions;
+ AppWindow.get_instance.add_action_entries (entries, this);
}
-
+
protected override void init_actions(int selected_count, int count) {
base.init_actions(selected_count, count);
}
diff --git a/src/events/EventsDirectoryPage.vala b/src/events/EventsDirectoryPage.vala
index b0d9c2c..2e0624f 100644
--- a/src/events/EventsDirectoryPage.vala
+++ b/src/events/EventsDirectoryPage.vala
@@ -64,6 +64,9 @@ public abstract class EventsDirectoryPage : CheckerboardPage {
// merge tool
Gtk.ToolButton merge_button = new Gtk.ToolButton.from_stock(Resources.MERGE);
merge_button.set_action_name("win.Merge");
+ merge_button.is_important = true;
+ merge_button.set_tooltip_text (Resources.MERGE_TOOLTIP);
+ merge_button.set_label (Resources.MERGE_LABEL);
toolbar.insert(merge_button, -1);
}
@@ -101,37 +104,22 @@ public abstract class EventsDirectoryPage : CheckerboardPage {
else
return event_descending_comparator;
}
-
- protected override Gtk.ActionEntry[] init_collect_action_entries() {
- Gtk.ActionEntry[] actions = base.init_collect_action_entries();
-
- Gtk.ActionEntry rename = { "Rename", null, TRANSLATABLE, "F2", TRANSLATABLE, on_rename };
- rename.label = Resources.RENAME_EVENT_MENU;
- actions += rename;
-
- Gtk.ActionEntry merge = { "Merge", Resources.MERGE, TRANSLATABLE, null, Resources.MERGE_TOOLTIP,
- on_merge };
- merge.label = Resources.MERGE_MENU;
- actions += merge;
-
- Gtk.ActionEntry comment = { "EditComment", null, TRANSLATABLE, null, Resources.EDIT_COMMENT_MENU,
- on_edit_comment };
- comment.label = Resources.EDIT_COMMENT_MENU;
- actions += comment;
-
- return actions;
- }
-
- protected override Gtk.ToggleActionEntry[] init_collect_toggle_action_entries() {
- Gtk.ToggleActionEntry[] toggle_actions = base.init_collect_toggle_action_entries();
-
- Gtk.ToggleActionEntry comments = { "ViewComment", null, TRANSLATABLE, "<Ctrl><Shift>C",
- TRANSLATABLE, on_display_comments, Config.Facade.get_instance().get_display_event_comments() };
- comments.label = _("_Comments");
- comments.tooltip = _("Display the comment of each event");
- toggle_actions += comments;
-
- return toggle_actions;
+
+ private const GLib.ActionEntry[] entries = {
+ { "Rename", on_rename },
+ { "Merge", on_merge },
+ { "EditComment", on_edit_comment },
+
+ // Toggle actions
+ { "ViewComment", on_action_toggle, null, "false", on_display_comments }
+ };
+
+ protected override void add_actions () {
+ base.add_actions ();
+ AppWindow.get_instance ().add_action_entries (entries, this);
+
+ (get_action ("ViewComment") as GLib.SimpleAction).set_state
+ (Config.Facade.get_instance().get_display_event_comments());
}
protected override void init_actions(int selected_count, int count) {
@@ -213,12 +201,14 @@ public abstract class EventsDirectoryPage : CheckerboardPage {
get_command_manager().execute(command);
}
- private void on_display_comments(Gtk.Action action) {
- bool display = ((Gtk.ToggleAction) action).get_active();
+ private void on_display_comments(GLib.SimpleAction action, Variant? value) {
+ bool display = value.get_boolean ();
set_display_comments(display);
Config.Facade.get_instance().set_display_event_comments(display);
+
+ action.set_state (value);
}
public override SearchViewFilter get_search_view_filter() {
diff --git a/src/searches/SavedSearchPage.vala b/src/searches/SavedSearchPage.vala
index 1693ca3..13c2630 100644
--- a/src/searches/SavedSearchPage.vala
+++ b/src/searches/SavedSearchPage.vala
@@ -46,20 +46,17 @@ public class SavedSearchPage : CollectionPage {
base.init_collect_ui_filenames(ui_filenames);
ui_filenames.add("savedsearch.ui");
}
-
- protected override Gtk.ActionEntry[] init_collect_action_entries() {
- Gtk.ActionEntry[] actions = base.init_collect_action_entries();
-
- Gtk.ActionEntry rename_search = { "RenameSearch", null, TRANSLATABLE, null, null, on_rename_search };
- actions += rename_search;
-
- Gtk.ActionEntry edit_search = { "EditSearch", null, TRANSLATABLE, null, null, on_edit_search };
- actions += edit_search;
-
- Gtk.ActionEntry delete_search = { "DeleteSearch", null, TRANSLATABLE, null, null, on_delete_search };
- actions += delete_search;
-
- return actions;
+
+ private const GLib.ActionEntry[] entries = {
+ { "RenameSearch", on_rename_search },
+ { "EditSearch", on_edit_search },
+ { "DeleteSearch", on_delete_search }
+ };
+
+ protected override void init_actions () {
+ base.init_actions ();
+
+ AppWindow.get_instance ().add_action_entries (entries, this);
}
private void on_delete_search() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]