~ubuntu-branches/ubuntu/quantal/shotwell/quantal

« back to all changes in this revision

Viewing changes to src/searches/Branch.vala

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-08-24 11:45:16 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110824114516-01cf7d83qvc9nse1
Tags: 0.11.0-0ubuntu1
New upstream version, drop patches which are in the new version

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
    }
61
61
}
62
62
 
63
 
public class Searches.Grouping : Sidebar.Grouping {
 
63
public class Searches.Grouping : Sidebar.Grouping, Sidebar.Contextable {
 
64
    private Gtk.UIManager ui = new Gtk.UIManager();
 
65
    private Gtk.Menu? context_menu = null;
 
66
    
64
67
    public Grouping() {
65
68
        base (_("Saved Searches"), new ThemedIcon(Gtk.Stock.FIND));
 
69
        setup_context_menu();
 
70
    }
 
71
    
 
72
    private void setup_context_menu() {
 
73
        Gtk.ActionGroup group = new Gtk.ActionGroup("SidebarDefault");
 
74
        Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0];
 
75
        
 
76
        Gtk.ActionEntry new_search = { "CommonNewSearch", null, TRANSLATABLE, null, null, on_new_search };
 
77
        new_search.label = _("Ne_w Search...");
 
78
        actions += new_search;
 
79
        
 
80
        group.add_actions(actions, this);
 
81
        ui.insert_action_group(group, 0);
 
82
        
 
83
        File ui_file = Resources.get_ui("search_sidebar_context.ui");
 
84
        try {
 
85
            ui.add_ui_from_file(ui_file.get_path());
 
86
        } catch (Error err) {
 
87
            AppWindow.error_message("Error loading UI file %s: %s".printf(
 
88
                ui_file.get_path(), err.message));
 
89
            Application.get_instance().panic();
 
90
        }
 
91
        context_menu = (Gtk.Menu) ui.get_widget("/SidebarSearchContextMenu");
 
92
        
 
93
        ui.ensure_update();
 
94
    }
 
95
    
 
96
    public Gtk.Menu? get_sidebar_context_menu(Gdk.EventButton event) {
 
97
        return context_menu;
 
98
    }
 
99
    
 
100
    private void on_new_search() {
 
101
        (new SavedSearchDialog()).show();
66
102
    }
67
103
}
68
104