Add movie menu, an AppMenu for the movie detail window
authorPhilipp Zabel <philipp.zabel@gmail.com>
Thu, 12 Nov 2009 17:37:09 +0000 (18:37 +0100)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Thu, 12 Nov 2009 18:23:25 +0000 (19:23 +0100)
This menu is filled with movie actions supplied by the plugins.

Makefile.am
src/movie-menu.vala [new file with mode: 0644]
src/movie-window.vala

index b93d76e..20d6765 100644 (file)
@@ -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 (file)
index 0000000..cd787ae
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+
+using Hildon;
+using Osso;
+
+public class MovieMenu : AppMenu {
+       private Movie movie;
+       private List<MovieAction> 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 ();
+       }
+}
+
index 92ff56e..6e5b060 100644 (file)
@@ -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);