? .gtk.cpp.swp
? about_gnash_open_file.diff
Index: NullGui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/NullGui.h,v
retrieving revision 1.7
diff -u -p -u -r1.7 NullGui.h
--- NullGui.h	29 Oct 2006 18:34:10 -0000	1.7
+++ NullGui.h	16 Dec 2006 23:46:37 -0000
@@ -54,6 +54,7 @@ public: 
 		return true;
 	}
 	bool run();
+	bool createMenuBar()  { return true; }
 	bool createMenu()  { return true; }
 	bool setupEvents()  { return true; }
 	void renderBuffer()  { }
Index: gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.53
diff -u -p -u -r1.53 gtk.cpp
--- gtk.cpp	5 Dec 2006 23:25:42 -0000	1.53
+++ gtk.cpp	16 Dec 2006 23:46:37 -0000
@@ -65,6 +65,7 @@ GtkGui::init(int argc, char **argv[])
     GNASH_REPORT_FUNCTION;
 
 
+
     gtk_init (&argc, argv);
 
     glue.init (argc, argv);
@@ -77,6 +78,12 @@ GtkGui::init(int argc, char **argv[])
     } else {
       _window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
       dbglogfile << "Created top level window" << endl;
+
+      _vbox = gtk_vbox_new (FALSE, 0);
+      gtk_widget_show (_vbox);
+      gtk_container_add (GTK_CONTAINER (_window), _vbox);
+      createMenuBar();
+
     }
 
     // XXXbjacques: why do we need this?
@@ -98,7 +105,12 @@ GtkGui::init(int argc, char **argv[])
     setupEvents();
 
     gtk_widget_realize(_window);
-    gtk_container_add(GTK_CONTAINER(_window), _drawing_area);
+
+    if (_xid) 
+     	gtk_container_add(GTK_CONTAINER(_window), _drawing_area);
+    else 
+    	gtk_box_pack_start (GTK_BOX (_vbox), _drawing_area, FALSE, FALSE, 0);
+
     gtk_widget_show(_drawing_area);
     gtk_widget_show(_window);
 
@@ -277,13 +289,144 @@ GtkGui::run()
     return true;
 }
 
+bool GtkGui::createMenuBar()
+{
+  GtkWidget *menuitem1;
+  GtkWidget *menu1;
+  GtkWidget *nou1;
+  GtkWidget *obre1;
+  GtkWidget *desa1;
+  GtkWidget *anomena_i_desa1;
+  GtkWidget *separatormenuitem1;
+  GtkWidget *surt1;
+  GtkWidget *menuitem2;
+  GtkWidget *menu2;
+  GtkWidget *retalla1;
+  GtkWidget *copia1;
+  GtkWidget *enganxa1;
+  GtkWidget *suprimeix1;
+  GtkWidget *menuitem3;
+  GtkWidget *menu3;
+  GtkWidget *menuitem4;
+  GtkWidget *menu4;
+  GtkWidget *quant_a1;
+
+  _menubar = gtk_menu_bar_new ();
+  gtk_widget_show (_menubar);
+  gtk_box_pack_start (GTK_BOX (_vbox), _menubar, FALSE, FALSE, 0);
+
+  menuitem1 = gtk_menu_item_new_with_mnemonic ("File");
+  gtk_widget_show (menuitem1);
+  gtk_container_add (GTK_CONTAINER (_menubar), menuitem1);
+
+  menu1 = gtk_menu_new ();
+  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem1), menu1);
+
+  nou1 = gtk_image_menu_item_new_from_stock ("gtk-new", NULL);
+  gtk_widget_show (nou1);
+  gtk_container_add (GTK_CONTAINER (menu1), nou1);
+
+  obre1 = gtk_image_menu_item_new_from_stock ("gtk-open", NULL);
+  gtk_widget_show (obre1);
+  gtk_container_add (GTK_CONTAINER (menu1), obre1);
+
+  desa1 = gtk_image_menu_item_new_from_stock ("gtk-save", NULL);
+  gtk_widget_show (desa1);
+  gtk_container_add (GTK_CONTAINER (menu1), desa1);
+
+  anomena_i_desa1 = gtk_image_menu_item_new_from_stock ("gtk-save-as", NULL);
+  gtk_widget_show (anomena_i_desa1);
+  gtk_container_add (GTK_CONTAINER (menu1), anomena_i_desa1);
+
+  separatormenuitem1 = gtk_separator_menu_item_new ();
+  gtk_widget_show (separatormenuitem1);
+  gtk_container_add (GTK_CONTAINER (menu1), separatormenuitem1);
+  gtk_widget_set_sensitive (separatormenuitem1, FALSE);
+
+  surt1 = gtk_image_menu_item_new_from_stock ("gtk-quit", NULL);
+  gtk_widget_show (surt1);
+  gtk_container_add (GTK_CONTAINER (menu1), surt1);
+
+  menuitem2 = gtk_menu_item_new_with_label ("Edit");
+  gtk_widget_show (menuitem2);
+  gtk_container_add (GTK_CONTAINER (_menubar), menuitem2);
+
+  menu2 = gtk_menu_new ();
+  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem2), menu2);
+
+  retalla1 = gtk_image_menu_item_new_from_stock ("gtk-cut", NULL);
+  gtk_widget_show (retalla1);
+  gtk_container_add (GTK_CONTAINER (menu2), retalla1);
+
+  copia1 = gtk_image_menu_item_new_from_stock ("gtk-copy", NULL);
+  gtk_widget_show (copia1);
+  gtk_container_add (GTK_CONTAINER (menu2), copia1);
+
+  enganxa1 = gtk_image_menu_item_new_from_stock ("gtk-paste", NULL);
+  gtk_widget_show (enganxa1);
+  gtk_container_add (GTK_CONTAINER (menu2), enganxa1);
+
+  suprimeix1 = gtk_image_menu_item_new_from_stock ("gtk-delete", NULL);
+  gtk_widget_show (suprimeix1);
+  gtk_container_add (GTK_CONTAINER (menu2), suprimeix1);
+
+  menuitem4 = gtk_menu_item_new_with_label ("Help");
+  gtk_widget_show (menuitem4);
+  gtk_container_add (GTK_CONTAINER (_menubar), menuitem4);
+
+  menu4 = gtk_menu_new ();
+  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menu4);
+
+  quant_a1 = gtk_menu_item_new_with_label ("About");
+  gtk_widget_show (quant_a1);
+  gtk_container_add (GTK_CONTAINER (menu4), quant_a1);
+
+/* g_signal_connect ((gpointer) nou1, "activate",
+                    G_CALLBACK (on_nou2_activate),
+                    NULL); */
+  g_signal_connect ((gpointer) obre1, "activate",
+                    G_CALLBACK (&menuitem_openfile_callback),
+                    this);
+ /* g_signal_connect ((gpointer) desa1, "activate",
+                    G_CALLBACK (on_desa1_activate),
+                    NULL);
+  g_signal_connect ((gpointer) anomena_i_desa1, "activate",
+                    G_CALLBACK (on_anomena_i_desa1_activate),
+                    NULL); */
+  g_signal_connect ((gpointer) surt1, "activate",
+                    G_CALLBACK (&menuitem_quit_callback),
+                    this);
+ /* g_signal_connect ((gpointer) retalla1, "activate",
+                    G_CALLBACK (on_retalla1_activate),
+                    NULL);
+  g_signal_connect ((gpointer) copia1, "activate",
+                    G_CALLBACK (on_copia1_activate),
+                    NULL);
+  g_signal_connect ((gpointer) enganxa1, "activate",
+                    G_CALLBACK (on_enganxa2_activate),
+                    NULL);
+  g_signal_connect ((gpointer) suprimeix1, "activate",
+                    G_CALLBACK (on_suprimeix1_activate),
+                    NULL); */
+  g_signal_connect ((gpointer) quant_a1, "activate",
+                    G_CALLBACK (&menuitem_about_callback),
+                    this);
+
+    return true;
+
+}
+
 bool
-GtkGui::createMenu()
+GtkGui::createMenu( )
 {
     GNASH_REPORT_FUNCTION;
 
     _popup_menu = GTK_MENU(gtk_menu_new());
     
+    GtkMenuItem *menuitem_openfile =
+ 	GTK_MENU_ITEM(gtk_menu_item_new_with_label("Open file"));
+    gtk_menu_append(_popup_menu, GTK_WIDGET(menuitem_openfile));
+    gtk_widget_show(GTK_WIDGET(menuitem_openfile));    
     GtkMenuItem *menuitem_play =
  	GTK_MENU_ITEM(gtk_menu_item_new_with_label("Play Movie"));
     gtk_menu_append(_popup_menu, GTK_WIDGET(menuitem_play));
@@ -327,6 +470,14 @@ GtkGui::createMenu()
  	GTK_MENU_ITEM(gtk_menu_item_new_with_label("Quit Gnash"));
     gtk_menu_append(_popup_menu, GTK_WIDGET(menuitem_quit));
     gtk_widget_show(GTK_WIDGET(menuitem_quit));    
+    
+    GtkMenuItem *menuitem_about =
+ 	GTK_MENU_ITEM(gtk_menu_item_new_with_label("About Gnash"));
+    gtk_menu_append(_popup_menu, GTK_WIDGET(menuitem_about));
+    gtk_widget_show(GTK_WIDGET(menuitem_about));    
+
+    g_signal_connect(GTK_OBJECT(menuitem_openfile), "activate",
+                     G_CALLBACK(&menuitem_openfile_callback), this);
     g_signal_connect(GTK_OBJECT(menuitem_play), "activate",
                      G_CALLBACK(&menuitem_play_callback), this);
     g_signal_connect(GTK_OBJECT(menuitem_pause), "activate",
@@ -345,6 +496,8 @@ GtkGui::createMenu()
                      G_CALLBACK(&menuitem_jump_backward_callback), this);
     g_signal_connect(GTK_OBJECT(menuitem_quit), "activate",
                      G_CALLBACK(&menuitem_quit_callback), this);
+    g_signal_connect(GTK_OBJECT(menuitem_about), "activate",
+                     G_CALLBACK(&menuitem_about_callback), this);
     if (get_sound_handler()) {
         g_signal_connect(GTK_OBJECT(menuitem_sound), "activate",
                          G_CALLBACK(&menuitem_sound_callback), this);
@@ -478,6 +631,34 @@ GtkGui::menuitem_restart_callback(GtkMen
 
 /// \brief quit complete, and close the application
 void
+GtkGui::menuitem_openfile_callback(GtkMenuItem* /*menuitem*/, gpointer /*data*/)
+{
+GtkWidget *dialog;
+
+  dbglogfile << "Executant fileselectiondialog! " << endl;
+dialog = gtk_file_chooser_dialog_new ("Open File",
+				      NULL,
+				      GTK_FILE_CHOOSER_ACTION_OPEN,
+				      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+				      GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+				      NULL);
+
+if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
+  {
+    char *filename;
+
+    filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+    dbglogfile << "File to open: " << filename << endl;
+    g_free (filename);
+  }
+
+gtk_widget_destroy (dialog);
+
+//  return filechooserdialog1;
+}
+
+/// \brief quit complete, and close the application
+void
 GtkGui::menuitem_quit_callback(GtkMenuItem* /*menuitem*/, gpointer /*data*/)
 {
 //    GNASH_REPORT_FUNCTION;
@@ -485,6 +666,44 @@ GtkGui::menuitem_quit_callback(GtkMenuIt
     gtk_main_quit();
 }
 
+/// \brief show info about gnash
+void
+GtkGui::menuitem_about_callback(GtkMenuItem* /*menuitem*/, gpointer /*data*/)
+{
+//    GNASH_REPORT_FUNCTION;
+const gchar *documentors[] = { 
+      "Rob Savoye", 
+      "Sandro Santilli", 
+      NULL 
+     };
+
+const gchar *authors[] = { 
+      "Rob Savoye", 
+      "Sandro Santilli", 
+      "Bastiaan Jacques", 
+      "Vitaly Alexeev", 
+      "Thomas Groth", 
+      "Udo Giacomozzi", 
+      "Hannes Mayr", 
+      "Marjus Gothe", 
+      NULL 
+     };
+
+GtkWidget *about = (GtkWidget*) g_object_new (GTK_TYPE_ABOUT_DIALOG,
+                   "name", "GNASH flash movie player", 
+                   "version", VERSION,
+                   "copyright", "(C) 2005-2006 The Free Software Foundation",
+	           "comments", "Gnash is a GNU Flash movie player. Until now it has only been possible to play flash movies with proprietary software. While there are a few other free flash players, none supports anything higher than SWF v4 at best. Gnash is based on GameSWF, and supports many SWF v7 features.",
+                   "authors", authors,
+                   "documenters", documentors,
+                   "translator-credits", "translator-credits",
+                   "logo", NULL,
+                   NULL);
+
+   gtk_widget_show (about);
+
+}
+
 /// \brief Start the movie playing from the current frame.
 void
 GtkGui::menuitem_play_callback(GtkMenuItem* /*menuitem*/, gpointer /*data*/)
Index: gtksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.30
diff -u -p -u -r1.30 gtksup.h
--- gtksup.h	2 Dec 2006 21:03:50 -0000	1.30
+++ gtksup.h	16 Dec 2006 23:46:37 -0000
@@ -59,6 +59,7 @@ class DSOEXPORT GtkGui : public Gui
     virtual bool createWindow(int width, int height);
     virtual bool createWindow(const char *title, int width, int height);
     virtual bool run();    
+    virtual bool createMenuBar();
     virtual bool createMenu();
     virtual bool setupEvents();
     virtual void renderBuffer();
@@ -73,6 +74,8 @@ class DSOEXPORT GtkGui : public Gui
                                    gpointer instance);
     static void menuitem_quit_callback(GtkMenuItem *menuitem,
                                        gpointer instance);
+    static void menuitem_about_callback(GtkMenuItem *menuitem,
+                                       gpointer instance);
     static void menuitem_play_callback(GtkMenuItem *menuitem,
                                        gpointer instance);
     static void menuitem_pause_callback(GtkMenuItem *menuitem,
@@ -87,7 +90,8 @@ class DSOEXPORT GtkGui : public Gui
                                         gpointer instance);
     static void menuitem_jump_backward_callback(GtkMenuItem *menuitem,
                                          gpointer instance);
-
+    static void menuitem_openfile_callback(GtkMenuItem *menuitem,
+    					gpointer instance);
     // GTK Event handlers
     static gboolean unrealize_event(GtkWidget *widget, GdkEvent *event,
                                     gpointer data);
@@ -126,6 +130,8 @@ class DSOEXPORT GtkGui : public Gui
     GdkPixbuf 	*_window_icon_pixbuf;
     GtkWidget   *_drawing_area;    
     GtkMenu     *_popup_menu;
+    GtkWidget   *_menubar;
+    GtkWidget   *_vbox;
 
     geometry::Range2d<int> _drawbounds;
 
Index: gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.41
diff -u -p -u -r1.41 gui.h
--- gui.h	6 Dec 2006 11:10:06 -0000	1.41
+++ gui.h	16 Dec 2006 23:46:38 -0000
@@ -98,6 +98,10 @@ public:
     /// Start main rendering loop.
     virtual bool run() = 0;
 
+    /// Create a menu bar for the application, attach to our window. 
+    //  This should only appear in the standalone player.
+    virtual bool createMenuBar() = 0;
+
     /// Create a menu and attach it to our window.
     virtual bool createMenu() = 0;
 
@@ -166,6 +170,7 @@ public:
      */
     static void menu_restart();
     static void menu_quit();
+    static void menu_about();
     static void menu_play();
     static void menu_pause();
     static void menu_stop();
