diff options
Diffstat (limited to 'src/searches/Branch.vala')
-rw-r--r-- | src/searches/Branch.vala | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/src/searches/Branch.vala b/src/searches/Branch.vala index 0c86733..f557baa 100644 --- a/src/searches/Branch.vala +++ b/src/searches/Branch.vala @@ -61,45 +61,31 @@ public class Searches.Branch : Sidebar.Branch { } public class Searches.Header : Sidebar.Header, Sidebar.Contextable { - private Gtk.UIManager ui = new Gtk.UIManager(); + private Gtk.Builder builder; private Gtk.Menu? context_menu = null; public Header() { base (_("Saved Searches")); setup_context_menu(); } - + private void setup_context_menu() { - Gtk.ActionGroup group = new Gtk.ActionGroup("SidebarDefault"); - Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0]; - - Gtk.ActionEntry new_search = { "CommonNewSearch", null, TRANSLATABLE, null, null, on_new_search }; - new_search.label = _("Ne_w Saved Search…"); - actions += new_search; - - group.add_actions(actions, this); - ui.insert_action_group(group, 0); - - File ui_file = Resources.get_ui("search_sidebar_context.ui"); + this.builder = new Gtk.Builder (); try { - ui.add_ui_from_file(ui_file.get_path()); - } catch (Error err) { - AppWindow.error_message("Error loading UI file %s: %s".printf( - ui_file.get_path(), err.message)); + this.builder.add_from_resource + ("/org/gnome/Shotwell/search_sidebar_context.ui"); + var model = builder.get_object ("popup-menu") as GLib.MenuModel; + this.context_menu = new Gtk.Menu.from_model (model); + } catch (Error error) { + AppWindow.error_message("Error loading UI resource: %s".printf( + error.message)); Application.get_instance().panic(); } - context_menu = (Gtk.Menu) ui.get_widget("/SidebarSearchContextMenu"); - - ui.ensure_update(); } - + public Gtk.Menu? get_sidebar_context_menu(Gdk.EventButton? event) { return context_menu; } - - private void on_new_search() { - (new SavedSearchDialog()).show(); - } } public class Searches.SidebarEntry : Sidebar.SimplePageEntry, Sidebar.RenameableEntry, |