From: Philipp Zabel Date: Thu, 12 Nov 2009 17:37:09 +0000 (+0100) Subject: Add movie menu, an AppMenu for the movie detail window X-Git-Tag: v0.0.4~11 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=f8c20622956655c2c564b643e32333170600cf3e;hp=61701d8f185c7c72726789c220bf66f6eee322e9;p=cinaest Add movie menu, an AppMenu for the movie detail window This menu is filled with movie actions supplied by the plugins. --- diff --git a/Makefile.am b/Makefile.am index b93d76e..20d6765 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,6 +36,7 @@ cinaest_SOURCES = \ src/movie-list-store.c \ src/movie-list-view.c \ src/movie-list-window.c \ + src/movie-menu.c \ src/movie-window.c \ src/plugin-interface.c \ src/plugin-registrar.c \ @@ -53,6 +54,7 @@ cinaest_VALASOURCES = \ src/movie-list-store.vala \ src/movie-list-view.vala \ src/movie-list-window.vala \ + src/movie-menu.vala \ src/movie-window.vala \ src/plugin-interface.vala \ src/plugin-registrar.vala \ diff --git a/src/movie-menu.vala b/src/movie-menu.vala new file mode 100644 index 0000000..cd787ae --- /dev/null +++ b/src/movie-menu.vala @@ -0,0 +1,41 @@ +/* This file is part of Cinaest. + * + * Copyright (C) 2009 Philipp Zabel + * + * Cinaest is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cinaest is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cinaest. If not, see . + */ + +using Hildon; +using Osso; + +public class MovieMenu : AppMenu { + private Movie movie; + private List actions; + + public MovieMenu (Movie _movie) { + movie = _movie; + + foreach (Plugin plugin in CinaestProgram.plugins) { + foreach (MovieAction action in plugin.get_actions (movie)) { + var button = new Gtk.Button.with_label (action.name); + button.clicked.connect (action.execute); + append (button); + actions.append (action); + } + } + + show_all (); + } +} + diff --git a/src/movie-window.vala b/src/movie-window.vala index 92ff56e..6e5b060 100644 --- a/src/movie-window.vala +++ b/src/movie-window.vala @@ -21,6 +21,7 @@ using Hildon; public class MovieWindow : StackableWindow { private Movie movie; + private MovieMenu menu; private Gdk.Pixbuf no_poster; private MoviePoster.Factory poster_factory; private Image image; @@ -29,6 +30,11 @@ public class MovieWindow : StackableWindow { movie = movie_; set_title (movie.title); + // View menu + menu = new MovieMenu (movie); + + set_main_menu (menu); + // Poster image = new Image (); image.set_size_request (268, 424);