Commit e42dd0d9 authored by Jim Nelson's avatar Jim Nelson

#2350: F-Spot import now available throughout application, courtesy Bruno Girin.

parent c7e30c58
......@@ -77,6 +77,15 @@ public class AlienDatabaseHandler {
}
return discovered_databases;
}
public void add_menu_entries(Gtk.UIManager ui, string placeholder) {
foreach (AlienDatabaseDriver driver in get_drivers()) {
ui.add_ui(ui.new_merge_id(), placeholder,
driver.get_menu_name(),
driver.get_action_entry().name,
Gtk.UIManagerItemType.MENUITEM, false);
}
}
}
/**
......
......@@ -80,12 +80,9 @@ public abstract class CollectionPage : CheckerboardPage {
create_toggle_actions());
// Adds one menu entry per alien database driver
foreach (AlienDatabaseDriver driver in AlienDatabaseHandler.get_instance().get_drivers()) {
ui.add_ui(ui.new_merge_id(), "/CollectionMenuBar/FileMenu/ImportFromAlienDbPlaceholder",
driver.get_menu_name(),
driver.get_action_entry().name,
Gtk.UIManagerItemType.MENUITEM, false);
}
AlienDatabaseHandler.get_instance().add_menu_entries(
ui, "/CollectionMenuBar/FileMenu/ImportFromAlienDbPlaceholder"
);
#if !NO_PRINTING
ui.add_ui(ui.new_merge_id(), "/CollectionMenuBar/FileMenu/PrintPlaceholder", "PageSetup",
......@@ -266,12 +263,6 @@ public abstract class CollectionPage : CheckerboardPage {
export.tooltip = Resources.EXPORT_TOOLTIP;
export.tooltip = _("Export selected photos to disk");
actions += export;
// Add one action per alien database driver
foreach (AlienDatabaseDriver driver in AlienDatabaseHandler.get_instance().get_drivers()) {
Gtk.ActionEntry import_from_alien_db = driver.get_action_entry();
actions += import_from_alien_db;
}
#if !NO_PRINTING
Gtk.ActionEntry page_setup = { "PageSetup", Gtk.STOCK_PAGE_SETUP, TRANSLATABLE, null,
......
......@@ -157,6 +157,11 @@ public class EventsDirectoryPage : CheckerboardPage {
init_ui_start("events_directory.ui", "EventsDirectoryActionGroup", create_actions());
init_ui_bind("/EventsDirectoryMenuBar");
// Adds one menu entry per alien database driver
AlienDatabaseHandler.get_instance().add_menu_entries(
ui, "/EventsDirectoryMenuBar/FileMenu/ImportFromAlienDbPlaceholder"
);
init_item_context_menu("/EventsDirectoryContextMenu");
this.view_manager = view_manager;
......@@ -212,7 +217,7 @@ public class EventsDirectoryPage : CheckerboardPage {
Gtk.ActionEntry file = { "FileMenu", null, TRANSLATABLE, null, null, null };
file.label = _("_File");
actions += file;
Gtk.ActionEntry view = { "ViewMenu", null, TRANSLATABLE, null, null, on_view_menu };
view.label = _("_View");
actions += view;
......@@ -239,7 +244,7 @@ public class EventsDirectoryPage : CheckerboardPage {
merge.label = Resources.MERGE_MENU;
merge.tooltip = Resources.MERGE_TOOLTIP;
actions += merge;
return actions;
}
......@@ -376,6 +381,11 @@ public class EventPage : CollectionPage {
private EventPage(Event page_event) {
base(page_event.get_name(), "event.ui", create_actions());
// Adds one menu entry per alien database driver
AlienDatabaseHandler.get_instance().add_menu_entries(
ui, "/EventsDirectoryMenuBar/FileMenu/ImportFromAlienDbPlaceholder"
);
this.page_event = page_event;
get_view().monitor_source_collection(LibraryPhoto.global, new EventViewManager(this),
......
......@@ -374,6 +374,10 @@ public class ImportPage : CheckerboardPage {
init_ui("import.ui", "/ImportMenuBar", "ImportActionGroup", create_actions(),
create_toggle_actions());
// Adds one menu entry per alien database driver
AlienDatabaseHandler.get_instance().add_menu_entries(
ui, "/ImportMenuBar/FileMenu/ImportFromAlienDbPlaceholder"
);
init_item_context_menu("/ImportContextMenu");
init_page_context_menu("/ImportContextMenu");
......@@ -491,7 +495,7 @@ public class ImportPage : CheckerboardPage {
null, null, on_import_all };
import_all.label = _("Import _All");
actions += import_all;
Gtk.ActionEntry edit = { "EditMenu", null, TRANSLATABLE, null, null, on_edit_menu };
edit.label = _("_Edit");
actions += edit;
......@@ -1203,6 +1207,11 @@ public class ImportQueuePage : SinglePhotoPage {
init_ui("import_queue.ui", "/ImportQueueMenuBar", "ImportQueueActionGroup",
create_actions());
// Adds one menu entry per alien database driver
AlienDatabaseHandler.get_instance().add_menu_entries(
ui, "/ImportQueueMenuBar/FileMenu/ImportFromAlienDbPlaceholder"
);
// Set up toolbar
Gtk.Toolbar toolbar = get_toolbar();
......@@ -1235,7 +1244,7 @@ public class ImportQueuePage : SinglePhotoPage {
Gtk.ActionEntry file = { "FileMenu", null, TRANSLATABLE, null, null, on_file_menu };
file.label = _("_File");
actions += file;
Gtk.ActionEntry stop = { "Stop", Gtk.STOCK_STOP, TRANSLATABLE, null, TRANSLATABLE,
on_stop };
stop.label = _("_Stop Import");
......
......@@ -276,6 +276,12 @@ public class LibraryWindow : AppWindow {
import.label = _("_Import From Folder...");
import.tooltip = _("Import photos from disk to library");
actions += import;
// Add one action per alien database driver
foreach (AlienDatabaseDriver driver in AlienDatabaseHandler.get_instance().get_drivers()) {
Gtk.ActionEntry import_from_alien_db = driver.get_action_entry();
actions += import_from_alien_db;
}
Gtk.ActionEntry sort = { "CommonSortEvents", null, TRANSLATABLE, null, null,
on_sort_events };
......
......@@ -34,6 +34,11 @@ public class OfflinePage : CheckerboardPage {
base (name);
init_ui("offline.ui", "/OfflineMenuBar", "OfflineActionGroup", create_actions());
// Adds one menu entry per alien database driver
AlienDatabaseHandler.get_instance().add_menu_entries(
ui, "/OfflineMenuBar/FileMenu/ImportFromAlienDbPlaceholder"
);
get_view().selection_group_altered.connect(on_selection_group_altered);
......
......@@ -1970,6 +1970,11 @@ public class LibraryPhotoPage : EditingHostPage {
init_ui("photo.ui", "/PhotoMenuBar", "PhotoActionGroup", create_actions(),
create_toggle_actions());
// Adds one menu entry per alien database driver
AlienDatabaseHandler.get_instance().add_menu_entries(
ui, "/PhotoMenuBar/FileMenu/ImportFromAlienDbPlaceholder"
);
#if !NO_PRINTING
ui.add_ui(ui.new_merge_id(), "/PhotoMenuBar/FileMenu/PrintPlaceholder", "PageSetup",
......@@ -2014,7 +2019,7 @@ public class LibraryPhotoPage : EditingHostPage {
Gtk.ActionEntry file = { "FileMenu", null, TRANSLATABLE, null, null, on_file_menu };
file.label = _("_File");
actions += file;
Gtk.ActionEntry export = { "Export", Gtk.STOCK_SAVE_AS, TRANSLATABLE, "<Ctrl><Shift>E",
TRANSLATABLE, on_export };
export.label = Resources.EXPORT_MENU;
......
......@@ -37,6 +37,11 @@ public class TrashPage : CheckerboardPage {
init_ui("trash.ui", "/TrashMenuBar", "TrashActionGroup", create_actions());
init_item_context_menu("/TrashContextMenu");
init_page_context_menu("/TrashPageMenu");
// Adds one menu entry per alien database driver
AlienDatabaseHandler.get_instance().add_menu_entries(
ui, "/TrashMenuBar/FileMenu/ImportFromAlienDbPlaceholder"
);
Gtk.Toolbar toolbar = get_toolbar();
......
......@@ -3,6 +3,7 @@
<menubar name="EventsDirectoryMenuBar">
<menu name="FileMenu" action="FileMenu">
<menuitem name="Import" action="CommonFileImport" />
<placeholder name="ImportFromAlienDbPlaceholder" />
<separator />
<menuitem name="EmptyTrash" action="CommonEmptyTrash" />
<separator />
......
......@@ -5,6 +5,7 @@
<menuitem name="Import" action="CommonFileImport" />
<menuitem name="ImportSelected" action="ImportSelected" />
<menuitem name="ImportAll" action="ImportAll" />
<placeholder name="ImportFromAlienDbPlaceholder" />
<separator />
<menuitem name="EmptyTrash" action="CommonEmptyTrash" />
<separator />
......
......@@ -5,6 +5,7 @@
<menuitem name="Stop" action="Stop" />
<separator />
<menuitem name="Import" action="CommonFileImport" />
<placeholder name="ImportFromAlienDbPlaceholder" />
<separator />
<menuitem name="EmptyTrash" action="CommonEmptyTrash" />
<separator />
......
......@@ -3,6 +3,7 @@
<menubar name="OfflineMenuBar">
<menu name="FileMenu" action="FileMenu">
<menuitem name="Import" action="CommonFileImport" />
<placeholder name="ImportFromAlienDbPlaceholder" />
<separator />
<menuitem name="EmptyTrash" action="CommonEmptyTrash" />
<separator />
......
......@@ -3,6 +3,7 @@
<menubar name="PhotoMenuBar">
<menu name="FileMenu" action="FileMenu">
<menuitem name="Import" action="CommonFileImport" />
<placeholder name="ImportFromAlienDbPlaceholder" />
<menuitem name="Export" action="Export" />
<separator />
<placeholder name="PrintPlaceholder" />
......
......@@ -3,6 +3,7 @@
<menubar name="TrashMenuBar">
<menu name="FileMenu" action="FileMenu">
<menuitem name="Import" action="CommonFileImport" />
<placeholder name="ImportFromAlienDbPlaceholder" />
<separator />
<menuitem name="JumpToFile" action="CommonJumpToFile" />
<menuitem name="EmptyTrash" action="CommonEmptyTrash" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment