Commit 17c8587e authored by Jens Georg's avatar Jens Georg

Remove GtkUIManager and Gtk*Action*

https://bugzilla.gnome.org/show_bug.cgi?id=768271Signed-off-by: Jens Georg's avatarJens Georg <mail@jensge.org>
parent 1206252f
......@@ -24,7 +24,12 @@ nodist_shotwell_SOURCES = \
src/resource.c
MOSTLYCLEANFILES += src/resource.c
src/resource.c: src/org.gnome.Shotwell.gresource.xml
shotwell_resource_deps = $(shell $(GLIB_COMPILE_RESOURCES) \
--sourcedir=$(abs_top_srcdir)/icons \
--sourcedir=$(abs_top_srcdir)/ui \
--generate-dependencies src/org.gnome.Shotwell.gresource.xml)
src/resource.c: src/org.gnome.Shotwell.gresource.xml $(shotwell_resource_deps)
$(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ \
--sourcedir=$(abs_top_srcdir)/icons \
--sourcedir=$(abs_top_srcdir)/ui \
......
......@@ -19,26 +19,17 @@ public class FullscreenWindow : PageWindow {
private bool switched_to = false;
private bool is_toolbar_dismissal_enabled;
private const GLib.ActionEntry[] entries = {
{ "LeaveFullscreen", on_close }
};
public FullscreenWindow(Page page) {
set_current_page(page);
File ui_file = Resources.get_ui("fullscreen.ui");
AppWindow.get_instance().add_action_entries (entries, this);
const string[] accels = { "F11" };
Application.set_accels_for_action ("win.LeaveFullscreen", accels);
try {
ui.add_ui_from_file(ui_file.get_path());
} catch (Error err) {
error("Error loading UI file %s: %s", ui_file.get_path(), err.message);
}
Gtk.ActionGroup action_group = new Gtk.ActionGroup("FullscreenActionGroup");
action_group.add_actions(create_actions(), this);
ui.insert_action_group(action_group, 0);
ui.ensure_update();
Gtk.AccelGroup accel_group = ui.get_accel_group();
if (accel_group != null)
add_accel_group(accel_group);
set_screen(AppWindow.get_instance().get_screen());
// Needed so fullscreen will occur on correct monitor in multi-monitor setups
......@@ -58,7 +49,7 @@ public class FullscreenWindow : PageWindow {
close_button.set_icon_name("view-restore");
close_button.set_tooltip_text(_("Leave fullscreen"));
close_button.clicked.connect(on_close);
close_button.set_action_name ("win.LeaveFullscreen");
toolbar = page.get_toolbar();
toolbar.set_show_arrow(false);
......@@ -130,18 +121,6 @@ public class FullscreenWindow : PageWindow {
return result;
}
private Gtk.ActionEntry[] create_actions() {
Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0];
Gtk.ActionEntry leave_fullscreen = { "LeaveFullscreen", Resources.LEAVE_FULLSCREEN_LABEL,
TRANSLATABLE, "F11", TRANSLATABLE, on_close };
leave_fullscreen.label = Resources.LEAVE_FULLSCREEN_LABEL;
leave_fullscreen.tooltip = Resources.LEAVE_FULLSCREEN_LABEL;
actions += leave_fullscreen;
return actions;
}
public override bool key_press_event(Gdk.EventKey event) {
// check for an escape/abort
......@@ -289,9 +268,7 @@ public class FullscreenWindow : PageWindow {
// subclass. A subclass should set current_page to the user-visible Page for it to receive
// various notifications. It is the responsibility of the subclass to notify Pages when they're
// switched to and from, and other aspects of the Page interface.
public abstract class PageWindow : Gtk.Window {
protected Gtk.UIManager ui = new Gtk.UIManager();
public abstract class PageWindow : Gtk.ApplicationWindow {
private Page current_page = null;
private int busy_counter = 0;
......@@ -302,12 +279,6 @@ public abstract class PageWindow : Gtk.Window {
// the current page needs to know when modifier keys are pressed
add_events(Gdk.EventMask.KEY_PRESS_MASK | Gdk.EventMask.KEY_RELEASE_MASK
| Gdk.EventMask.STRUCTURE_MASK);
set_has_resize_grip(false);
}
public Gtk.UIManager get_ui_manager() {
return ui;
}
public Page? get_current_page() {
......@@ -416,14 +387,11 @@ public abstract class AppWindow : PageWindow {
// the AppWindow maintains its own UI manager because the first UIManager an action group is
// added to is the one that claims its accelerators
protected Gtk.ActionGroup[] common_action_groups;
protected bool maximized = false;
protected Dimensions dimensions;
protected int pos_x = 0;
protected int pos_y = 0;
private Gtk.ActionGroup common_action_group = new Gtk.ActionGroup("AppWindowGlobalActionGroup");
public AppWindow() {
// although there are multiple AppWindow types, only one may exist per-process
assert(instance == null);
......@@ -454,18 +422,8 @@ public abstract class AppWindow : PageWindow {
// UIManager. In order to activate those accelerators, we need to create a dummy UI string
// that lists all the common actions. We build it on-the-fly from the actions associated
// with each ActionGroup while we're adding the groups to the UIManager.
common_action_groups = create_common_action_groups();
foreach (Gtk.ActionGroup group in common_action_groups)
ui.insert_action_group(group, 0);
try {
ui.add_ui_from_string(build_dummy_ui_string(common_action_groups), -1);
} catch (Error err) {
error("Unable to add AppWindow UI: %s", err.message);
}
ui.ensure_update();
add_accel_group(ui.get_accel_group());
add_actions ();
Gtk.CssProvider provider = new Gtk.CssProvider();
try {
......@@ -475,67 +433,20 @@ public abstract class AppWindow : PageWindow {
debug("Unable to load custom CSS: %s", err.message);
}
}
private Gtk.ActionEntry[] create_common_actions() {
Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0];
Gtk.ActionEntry quit = { "CommonQuit", Resources.QUIT_LABEL, TRANSLATABLE, "<Ctrl>Q",
TRANSLATABLE, on_quit };
quit.label = Resources.QUIT_LABEL;
actions += quit;
Gtk.ActionEntry about = { "CommonAbout", Resources.ABOUT_LABEL, TRANSLATABLE, null,
TRANSLATABLE, on_about };
about.label = Resources.ABOUT_LABEL;
actions += about;
Gtk.ActionEntry fullscreen = { "CommonFullscreen", Resources.FULLSCREEN_LABEL,
TRANSLATABLE, "F11", TRANSLATABLE, on_fullscreen };
fullscreen.label = Resources.FULLSCREEN_LABEL;
actions += fullscreen;
private const GLib.ActionEntry[] common_actions = {
{ "CommonQuit", on_quit },
{ "CommonFullscreen", on_fullscreen },
{ "CommonHelpContents", on_help_contents },
{ "CommonHelpFAQ", on_help_faq },
{ "CommonHelpReportProblem", on_help_report_problem },
{ "CommonUndo", on_undo },
{ "CommonRedo", on_redo },
{ "CommonJumpToFile", on_jump_to_file },
{ "CommonSelectAll", on_select_all },
{ "CommonSelectNone", on_select_none }
};
Gtk.ActionEntry help_contents = { "CommonHelpContents", Resources.HELP_LABEL,
TRANSLATABLE, "F1", TRANSLATABLE, on_help_contents };
help_contents.label = _("_Contents");
actions += help_contents;
Gtk.ActionEntry help_faq = { "CommonHelpFAQ", null, TRANSLATABLE, null,
TRANSLATABLE, on_help_faq };
help_faq.label = _("_Frequently Asked Questions");
actions += help_faq;
Gtk.ActionEntry help_report_problem = { "CommonHelpReportProblem", null, TRANSLATABLE, null,
TRANSLATABLE, on_help_report_problem };
help_report_problem.label = _("_Report a Problem…");
actions += help_report_problem;
Gtk.ActionEntry undo = { "CommonUndo", Resources.UNDO_MENU, TRANSLATABLE, "<Ctrl>Z",
TRANSLATABLE, on_undo };
undo.label = Resources.UNDO_MENU;
actions += undo;
Gtk.ActionEntry redo = { "CommonRedo", Resources.REDO_MENU, TRANSLATABLE, "<Ctrl><Shift>Z",
TRANSLATABLE, on_redo };
redo.label = Resources.REDO_MENU;
actions += redo;
Gtk.ActionEntry jump_to_file = { "CommonJumpToFile", Resources.JUMP_TO_FILE_MENU, TRANSLATABLE,
"<Ctrl><Shift>M", TRANSLATABLE, on_jump_to_file };
jump_to_file.label = Resources.JUMP_TO_FILE_MENU;
actions += jump_to_file;
Gtk.ActionEntry select_all = { "CommonSelectAll", Resources.SELECT_ALL_MENU, TRANSLATABLE,
"<Ctrl>A", TRANSLATABLE, on_select_all };
select_all.label = Resources.SELECT_ALL_MENU;
actions += select_all;
Gtk.ActionEntry select_none = { "CommonSelectNone", null, null,
"<Ctrl><Shift>A", TRANSLATABLE, on_select_none };
actions += select_none;
return actions;
}
protected abstract void on_fullscreen();
public static bool has_instance() {
......@@ -747,22 +658,10 @@ public abstract class AppWindow : PageWindow {
sys_show_uri(get_window().get_screen(), url);
}
protected virtual Gtk.ActionGroup[] create_common_action_groups() {
Gtk.ActionGroup[] groups = new Gtk.ActionGroup[0];
common_action_group.add_actions(create_common_actions(), this);
groups += common_action_group;
return groups;
}
public Gtk.ActionGroup[] get_common_action_groups() {
return common_action_groups;
}
public virtual void replace_common_placeholders(Gtk.UIManager ui) {
protected virtual void add_actions () {
this.add_action_entries (AppWindow.common_actions, this);
}
public void go_fullscreen(Page page) {
// if already fullscreen, use that
if (fullscreen_window != null) {
......@@ -801,34 +700,26 @@ public abstract class AppWindow : PageWindow {
present();
}
public Gtk.Action? get_common_action(string name) {
foreach (Gtk.ActionGroup group in common_action_groups) {
Gtk.Action? action = group.get_action(name);
if (action != null)
return action;
}
warning("No common action found: %s", name);
return null;
public GLib.Action? get_common_action(string name) {
return lookup_action (name);
}
public void set_common_action_sensitive(string name, bool sensitive) {
Gtk.Action? action = get_common_action(name);
var action = get_common_action(name) as GLib.SimpleAction;
if (action != null)
action.sensitive = sensitive;
action.set_enabled (sensitive);
}
public void set_common_action_important(string name, bool important) {
Gtk.Action? action = get_common_action(name);
var action = get_common_action(name) as GLib.SimpleAction;
if (action != null)
action.is_important = important;
action.set_enabled (sensitive);
}
public void set_common_action_visible(string name, bool visible) {
Gtk.Action? action = get_common_action(name);
var action = get_common_action(name) as GLib.SimpleAction;
if (action != null)
action.visible = visible;
action.set_enabled (sensitive);
}
protected override void switched_pages(Page? old_page, Page? new_page) {
......@@ -891,6 +782,7 @@ public abstract class AppWindow : PageWindow {
private void decorate_command_manager_action(string name, string prefix,
string default_explanation, CommandDescription? desc) {
#if 0
Gtk.Action? action = get_common_action(name);
if (action == null)
return;
......@@ -904,6 +796,7 @@ public abstract class AppWindow : PageWindow {
action.tooltip = default_explanation;
action.sensitive = false;
}
#endif
}
public void decorate_undo_action() {
......
......@@ -91,6 +91,10 @@ public class Application {
return get_instance().direct;
}
public static void set_accels_for_action (string action, string[] accel) {
get_instance().system_app.set_accels_for_action (action, accel);
}
/**
* @brief Signal handler for GApplication's 'command-line' signal.
*
......
......@@ -34,8 +34,8 @@ public abstract class CollectionPage : MediaPage {
get_view().items_altered.connect(on_photos_altered);
init_item_context_menu("/CollectionContextMenu");
init_toolbar("/CollectionToolbar");
init_item_context_menu("CollectionContextMenu");
init_toolbar("CollectionToolbar");
show_all();
......@@ -46,7 +46,7 @@ public abstract class CollectionPage : MediaPage {
public override Gtk.Toolbar get_toolbar() {
if (toolbar == null) {
base.get_toolbar();
// separator to force slider to right side of toolbar
Gtk.SeparatorToolItem separator = new Gtk.SeparatorToolItem();
separator.set_expand(true);
......@@ -69,66 +69,78 @@ public abstract class CollectionPage : MediaPage {
}
private static InjectionGroup create_file_menu_injectables() {
InjectionGroup group = new InjectionGroup("/MenuBar/FileMenu/FileExtrasPlaceholder");
InjectionGroup group = new InjectionGroup("FileExtrasPlaceholder");
group.add_menu_item("Print");
group.add_menu_item(_("_Print"), "Print", "<Primary>p");
group.add_separator();
group.add_menu_item("Publish");
group.add_menu_item("SendTo");
group.add_menu_item("SetBackground");
group.add_menu_item(_("_Publish"), "Publish", "<Primary><Shift>p");
group.add_menu_item(_("Send _To…"), "SendTo");
group.add_menu_item(_("Set as _Desktop Background"), "SetBackground");
return group;
}
private static InjectionGroup create_edit_menu_injectables() {
InjectionGroup group = new InjectionGroup("/MenuBar/EditMenu/EditExtrasPlaceholder");
InjectionGroup group = new InjectionGroup("EditExtrasPlaceholder");
group.add_menu_item("Duplicate");
group.add_menu_item(_("_Duplicate"), "Duplicate", "<Primary>D");
return group;
}
private static InjectionGroup create_view_menu_fullscreen_injectables() {
InjectionGroup group = new InjectionGroup("/MenuBar/ViewMenu/ViewExtrasFullscreenSlideshowPlaceholder");
InjectionGroup group = new InjectionGroup("ViewExtrasFullscreenSlideshowPlaceholder");
group.add_menu_item("Fullscreen", "CommonFullscreen");
group.add_menu_item(_("Fullscreen"), "CommonFullscreen", "F11");
group.add_separator();
group.add_menu_item("Slideshow");
group.add_menu_item(_("S_lideshow"), "Slideshow", "F5");
return group;
}
private static InjectionGroup create_photos_menu_edits_injectables() {
InjectionGroup group = new InjectionGroup("/MenuBar/PhotosMenu/PhotosExtrasEditsPlaceholder");
group.add_menu_item("RotateClockwise");
group.add_menu_item("RotateCounterclockwise");
group.add_menu_item("FlipHorizontally");
group.add_menu_item("FlipVertically");
InjectionGroup group = new InjectionGroup("PhotosExtrasEditsPlaceholder");
group.add_menu_item(_("Rotate _Right"),
"RotateClockwise",
"<Primary>r");
group.add_menu_item(_("Rotate _Left"),
"RotateCounterclockwise",
"<Primary><Shift>r");
group.add_menu_item(_("Flip Hori_zontally"), "FlipHorizontally");
group.add_menu_item(_("Flip Verti_cally"), "FlipVertically");
group.add_separator();
group.add_menu_item("Enhance");
group.add_menu_item("Revert");
group.add_menu_item(_("_Enhance"), "Enhance");
group.add_menu_item(_("Re_vert to Original"), "Revert");
group.add_separator();
group.add_menu_item("CopyColorAdjustments");
group.add_menu_item("PasteColorAdjustments");
group.add_menu_item(_("_Copy Color Adjustments"),
"CopyColorAdjustments",
"<Primary><Shift>c");
group.add_menu_item(_("_Paste Color Adjustments"),
"PasteColorAdjustments",
"<Primary><Shift>v");
return group;
}
private static InjectionGroup create_photos_menu_date_injectables() {
InjectionGroup group = new InjectionGroup("/MenuBar/PhotosMenu/PhotosExtrasDateTimePlaceholder");
InjectionGroup group = new InjectionGroup("PhotosExtrasDateTimePlaceholder");
group.add_menu_item("AdjustDateTime");
group.add_menu_item(_("Adjust Date and Time…"), "AdjustDateTime");
return group;
}
private static InjectionGroup create_photos_menu_externals_injectables() {
InjectionGroup group = new InjectionGroup("/MenuBar/PhotosMenu/PhotosExtrasExternalsPlaceholder");
InjectionGroup group = new InjectionGroup("PhotosExtrasExternalsPlaceholder");
group.add_menu_item("ExternalEdit");
group.add_menu_item("ExternalEditRAW");
group.add_menu_item("PlayVideo");
group.add_menu_item(_("Open With E_xternal Editor"),
"ExternalEdit",
"<Primary>Return");
group.add_menu_item(_("Open With RA_W Editor"),
"ExternalEditRAW",
"<Primary><Shift>Return");
group.add_menu_item(_("_Play"), "PlayVideo", "<Primary>Y");
return group;
}
......@@ -138,102 +150,32 @@ public abstract class CollectionPage : MediaPage {
ui_filenames.add("collection.ui");
}
protected override Gtk.ActionEntry[] init_collect_action_entries() {
Gtk.ActionEntry[] actions = base.init_collect_action_entries();
Gtk.ActionEntry print = { "Print", Resources.PRINT_LABEL, TRANSLATABLE, "<Ctrl>P",
TRANSLATABLE, on_print };
print.label = Resources.PRINT_MENU;
actions += print;
Gtk.ActionEntry publish = { "Publish", Resources.PUBLISH, TRANSLATABLE, "<Ctrl><Shift>P",
TRANSLATABLE, on_publish };
publish.label = Resources.PUBLISH_MENU;
publish.tooltip = Resources.PUBLISH_TOOLTIP;
actions += publish;
Gtk.ActionEntry rotate_right = { "RotateClockwise", Resources.CLOCKWISE,
TRANSLATABLE, "<Ctrl>R", TRANSLATABLE, on_rotate_clockwise };
rotate_right.label = Resources.ROTATE_CW_MENU;
rotate_right.tooltip = Resources.ROTATE_CW_TOOLTIP;
actions += rotate_right;
Gtk.ActionEntry rotate_left = { "RotateCounterclockwise", Resources.COUNTERCLOCKWISE,
TRANSLATABLE, "<Ctrl><Shift>R", TRANSLATABLE, on_rotate_counterclockwise };
rotate_left.label = Resources.ROTATE_CCW_MENU;
rotate_left.tooltip = Resources.ROTATE_CCW_TOOLTIP;
actions += rotate_left;
Gtk.ActionEntry hflip = { "FlipHorizontally", Resources.HFLIP, TRANSLATABLE, null,
TRANSLATABLE, on_flip_horizontally };
hflip.label = Resources.HFLIP_MENU;
actions += hflip;
Gtk.ActionEntry vflip = { "FlipVertically", Resources.VFLIP, TRANSLATABLE, null,
TRANSLATABLE, on_flip_vertically };
vflip.label = Resources.VFLIP_MENU;
actions += vflip;
Gtk.ActionEntry enhance = { "Enhance", Resources.ENHANCE, TRANSLATABLE, "<Ctrl>E",
TRANSLATABLE, on_enhance };
enhance.label = Resources.ENHANCE_MENU;
enhance.tooltip = Resources.ENHANCE_TOOLTIP;
actions += enhance;
Gtk.ActionEntry copy_adjustments = { "CopyColorAdjustments", null, TRANSLATABLE,
"<Ctrl><Shift>C", TRANSLATABLE, on_copy_adjustments};
copy_adjustments.label = Resources.COPY_ADJUSTMENTS_MENU;
copy_adjustments.tooltip = Resources.COPY_ADJUSTMENTS_TOOLTIP;
actions += copy_adjustments;
Gtk.ActionEntry paste_adjustments = { "PasteColorAdjustments", null, TRANSLATABLE,
"<Ctrl><Shift>V", TRANSLATABLE, on_paste_adjustments};
paste_adjustments.label = Resources.PASTE_ADJUSTMENTS_MENU;
paste_adjustments.tooltip = Resources.PASTE_ADJUSTMENTS_TOOLTIP;
actions += paste_adjustments;
Gtk.ActionEntry revert = { "Revert", null, TRANSLATABLE, null,
TRANSLATABLE, on_revert };
revert.label = Resources.REVERT_MENU;
actions += revert;
Gtk.ActionEntry set_background = { "SetBackground", null, TRANSLATABLE, "<Ctrl>B",
TRANSLATABLE, on_set_background };
set_background.label = Resources.SET_BACKGROUND_MENU;
set_background.tooltip = Resources.SET_BACKGROUND_TOOLTIP;
actions += set_background;
Gtk.ActionEntry duplicate = { "Duplicate", null, TRANSLATABLE, "<Ctrl>D", TRANSLATABLE,
on_duplicate_photo };
duplicate.label = Resources.DUPLICATE_PHOTO_MENU;
duplicate.tooltip = Resources.DUPLICATE_PHOTO_TOOLTIP;
actions += duplicate;
Gtk.ActionEntry adjust_date_time = { "AdjustDateTime", null, TRANSLATABLE, null,
TRANSLATABLE, on_adjust_date_time };
adjust_date_time.label = Resources.ADJUST_DATE_TIME_MENU;
actions += adjust_date_time;
Gtk.ActionEntry external_edit = { "ExternalEdit", Resources.EDIT_LABEL, TRANSLATABLE, "<Ctrl>Return",
TRANSLATABLE, on_external_edit };
external_edit.label = Resources.EXTERNAL_EDIT_MENU;
actions += external_edit;
Gtk.ActionEntry edit_raw = { "ExternalEditRAW", null, TRANSLATABLE, "<Ctrl><Shift>Return",
TRANSLATABLE, on_external_edit_raw };
edit_raw.label = Resources.EXTERNAL_EDIT_RAW_MENU;
actions += edit_raw;
Gtk.ActionEntry slideshow = { "Slideshow", null, TRANSLATABLE, "F5", TRANSLATABLE,
on_slideshow };
slideshow.label = _("S_lideshow");
slideshow.tooltip = _("Play a slideshow");
actions += slideshow;
return actions;
private const GLib.ActionEntry[] entries = {
{ "Print", on_print },
{ "Publish", on_publish },
{ "RotateClockwise", on_rotate_clockwise },
{ "RotateCounterclockwise", on_rotate_counterclockwise },
{ "FlipHorizontally", on_flip_horizontally },
{ "FlipVertically", on_flip_vertically },
{ "Enhance", on_enhance },
{ "CopyColorAdjustments", on_copy_adjustments },
{ "PasteColorAdjustments", on_paste_adjustments },
{ "Revert", on_revert },
{ "SetBackground", on_set_background },
{ "Duplicate", on_duplicate_photo },
{ "AdjustDateTime", on_adjust_date_time },
{ "ExternalEdit", on_external_edit },
{ "ExternalEditRAW", on_external_edit_raw },
{ "Slideshow", on_slideshow }
};
protected override void add_actions () {
base.add_actions ();
AppWindow.get_instance ().add_action_entries (entries, this);
}
protected override InjectionGroup[] init_collect_injection_groups() {
InjectionGroup[] groups = base.init_collect_injection_groups();
......@@ -321,12 +263,13 @@ public abstract class CollectionPage : MediaPage {
set_action_sensitive("SetBackground", (!selection_has_videos) && has_selected );
if (has_selected) {
Gtk.Action? set_background = get_action("SetBackground");
debug ("Setting action label for SetBackground...");
/* Gtk.Action? set_background = get_action("SetBackground");
if (set_background != null) {
set_background.label = one_selected
? Resources.SET_BACKGROUND_MENU
: Resources.SET_BACKGROUND_SLIDESHOW_MENU;
}
} */
}
}
......@@ -745,20 +688,24 @@ public abstract class CollectionPage : MediaPage {
}
protected override bool on_ctrl_pressed(Gdk.EventKey? event) {
Gtk.ToolButton? rotate_button = ui.get_widget("/CollectionToolbar/ToolRotate")
as Gtk.ToolButton;
if (rotate_button != null)
rotate_button.set_related_action(get_action("RotateCounterclockwise"));
Gtk.ToolButton? rotate_button = this.builder.get_object ("ToolRotate") as Gtk.ToolButton;
if (rotate_button != null) {
rotate_button.set_action_name ("win.RotateCounterclockwise");
rotate_button.set_icon_name ("object-rotate-left");
rotate_button.set_tooltip_text (Resources.ROTATE_CCW_TOOLTIP);
}
return base.on_ctrl_pressed(event);
}
protected override bool on_ctrl_released(Gdk.EventKey? event) {
Gtk.ToolButton? rotate_button = ui.get_widget("/CollectionToolbar/ToolRotate")
as Gtk.ToolButton;
if (rotate_button != null)
rotate_button.set_related_action(get_action("RotateClockwise"));
Gtk.ToolButton? rotate_button = this.builder.get_object ("ToolRotate") as Gtk.ToolButton;
if (rotate_button != null) {
rotate_button.set_action_name ("win.RotateClockwise");
rotate_button.set_icon_name ("object-rotate-right");
rotate_button.set_tooltip_text (Resources.ROTATE_CW_TOOLTIP);
}
return base.on_ctrl_released(event);
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -423,27 +423,6 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
return _("Delete Search “%s”").printf(name);
}
private unowned string rating_menu(Rating rating) {
switch (rating) {
case Rating.REJECTED:
return RATE_REJECTED_MENU;
case Rating.UNRATED:
return RATE_UNRATED_MENU;
case Rating.ONE:
return RATE_ONE_MENU;
case Rating.TWO:
return RATE_TWO_MENU;
case Rating.THREE:
return RATE_THREE_MENU;
case Rating.FOUR:
return RATE_FOUR_MENU;
case Rating.FIVE:
return RATE_FIVE_MENU;
default:
return RATE_UNRATED_MENU;
}
}
private unowned string rating_label(Rating rating) {
switch (rating) {
case Rating.REJECTED:
......
This diff is collapsed.
......@@ -801,7 +801,7 @@ public class ImportPage : CheckerboardPage {
// Find button
Gtk.ToggleToolButton find_button = new Gtk.ToggleToolButton();
find_button.set_related_action(get_action("CommonDisplaySearchbar"));
find_button.set_action_name ("win.CommonDisplaySearchbar");
toolbar.insert(find_button, -1);
......@@ -811,14 +811,14 @@ public class ImportPage : CheckerboardPage {
// Import selected
Gtk.ToolButton import_selected_button = new Gtk.ToolButton(null, null);
import_selected_button.set_icon_name(Resources.IMPORT);
import_selected_button.set_related_action(get_action("ImportSelected"));
import_selected_button.set_action_name ("win.ImportSelected");
toolbar.insert(import_selected_button, -1);
// Import all
Gtk.ToolButton import_all_button = new Gtk.ToolButton(null, null);
import_all_button.set_icon_name(Resources.IMPORT_ALL);
import_all_button.set_related_action(get_action("ImportAll"));
import_all_button.set_action_name ("win.ImportAll");
toolbar.insert(import_all_button, -1);
......@@ -864,35 +864,20 @@ public class ImportPage : CheckerboardPage {
ui_filenames.add("import.ui");
}
protected override Gtk.ToggleActionEntry[] init_collect_toggle_action_entries() {
Gtk.ToggleActionEntry[] toggle_actions = base.init_collect_toggle_action_entries();
Gtk.ToggleActionEntry titles = { "ViewTitle", null, TRANSLATABLE, "<Ctrl><Shift>T",
TRANSLATABLE, on_display_titles, Config.Facade.get_instance().get_display_photo_titles() };
titles.label = _("_Titles");
titles.tooltip = _("Display the title of each photo");
toggle_actions += titles;
private const GLib.ActionEntry[] entries = {
{ "ImportSelected", on_import_selected },
{ "ImportAll", on_import_all },
// Toggle actions
{ "ViewTitle", on_action_toggle, null, "false", on_display_titles },
};
return toggle_actions;
}
protected override void add_actions () {
base.add_actions ();
protected override Gtk.ActionEntry[] init_collect_action_entries() {
Gtk.ActionEntry[] actions = base.init_collect_action_entries();
Gtk.ActionEntry import_selected = { "ImportSelected", Resources.IMPORT,
TRANSLATABLE, null, null, on_import_selected };
import_selected.label = _("Import _Selected");
import_selected.tooltip = _("Import the selected photos into your library");
actions += import_selected;
AppWindow.get_instance ().add_action_entries (entries, this);
Gtk.ActionEntry import_all = { "ImportAll", Resources.IMPORT_ALL, TRANSLATABLE,
null, null, on_import_all };
import_all.label = _("Import _All");
import_all.tooltip = _("Import all the photos into your library");