* ./plugins/*: interface plugins set p_vlc->b_die to quit vlc, but check
authorSam Hocevar <sam@videolan.org>
Mon, 15 Jul 2002 20:09:31 +0000 (20:09 +0000)
committerSam Hocevar <sam@videolan.org>
Mon, 15 Jul 2002 20:09:31 +0000 (20:09 +0000)
    for p_intf->b_die to know when they are supposed to terminate p_intf. This
    will allow to spawn interface plugins on the fly.

20 files changed:
plugins/beos/InterfaceWindow.cpp
plugins/beos/intf_beos.cpp
plugins/dummy/intf_dummy.c
plugins/gtk/gnome.c
plugins/gtk/gnome.glade
plugins/gtk/gnome_interface.c
plugins/gtk/gtk.c
plugins/gtk/gtk.glade
plugins/gtk/gtk_callbacks.c
plugins/gtk/gtk_callbacks.h
plugins/gtk/gtk_interface.c
plugins/kde/kde_interface.cpp
plugins/lirc/lirc.c
plugins/macosx/intf_macosx.m
plugins/macosx/vout_macosx.m
plugins/text/logger.c
plugins/text/ncurses.c
plugins/text/rc.c
plugins/win32/intf_win32.cpp
plugins/win32/mainframe.cpp

index d7faeff..06e3fb8 100644 (file)
@@ -2,7 +2,7 @@
  * InterfaceWindow.cpp: beos interface
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.cpp,v 1.18 2002/06/01 12:31:58 sam Exp $
+ * $Id: InterfaceWindow.cpp,v 1.19 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -565,7 +565,7 @@ void InterfaceWindow::updateInterface()
  *****************************************************************************/
 bool InterfaceWindow::QuitRequested()
 {
-    p_intf->p_vlc->b_die = 1;
+    p_intf->p_vlc->b_die = VLC_TRUE;
 
     return( true );
 }
index 3f78cf4..b32b8da 100644 (file)
@@ -2,7 +2,7 @@
  * intf_beos.cpp: beos interface
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: intf_beos.cpp,v 1.40 2002/06/01 17:09:25 sam Exp $
+ * $Id: intf_beos.cpp,v 1.41 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -124,7 +124,7 @@ static void intf_Close( intf_thread_t *p_intf )
  *****************************************************************************/
 static void intf_Run( intf_thread_t *p_intf )
 {
-    while( !p_intf->p_vlc->b_die )
+    while( !p_intf->b_die )
     {
         /* Manage the slider */
         if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL
index db171b4..8033bb9 100644 (file)
@@ -2,7 +2,7 @@
  * intf_dummy.c: dummy interface plugin
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: intf_dummy.c,v 1.19 2002/06/01 16:45:34 sam Exp $
+ * $Id: intf_dummy.c,v 1.20 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -96,7 +96,7 @@ static void intf_Close( intf_thread_t *p_intf )
  *****************************************************************************/
 static void intf_Run( intf_thread_t *p_intf )
 {
-    while( !p_intf->p_vlc->b_die )
+    while( !p_intf->b_die )
     {
         /* Wait a bit */
         msleep( INTF_IDLE_SLEEP );
index 284c4d0..97b18d4 100644 (file)
@@ -2,7 +2,7 @@
  * gnome.c : Gnome plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: gnome.c,v 1.29 2002/07/11 19:28:13 sam Exp $
+ * $Id: gnome.c,v 1.30 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -500,13 +500,13 @@ static gint GnomeManage( gpointer p_data )
 
         vlc_mutex_unlock( &p_input->stream.stream_lock );
     }
-    else if( p_intf->p_sys->b_playing && !p_intf->p_vlc->b_die )
+    else if( p_intf->p_sys->b_playing && !p_intf->b_die )
     {
         GtkModeManage( p_intf );
         p_intf->p_sys->b_playing = 0;
     }
 
-    if( p_intf->p_vlc->b_die )
+    if( p_intf->b_die )
     {
         vlc_mutex_unlock( &p_intf->change_lock );
 
index 1b5cb40..1d101e1 100644 (file)
              <right_justify>False</right_justify>
            </widget>
 
+           <widget>
+             <class>GtkPixmapMenuItem</class>
+             <name>menubar_close</name>
+             <signal>
+               <name>activate</name>
+               <handler>GtkClose</handler>
+               <last_modification_time>Mon, 15 Jul 2002 09:14:55 GMT</last_modification_time>
+             </signal>
+             <stock_item>GNOMEUIINFO_MENU_CLOSE_ITEM</stock_item>
+           </widget>
+
            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>menubar_exit</name>
index 3f5d460..eb6182e 100644 (file)
@@ -45,6 +45,7 @@ static GnomeUIInfo menubar_file_menu_uiinfo[] =
     0, (GdkModifierType) 0, NULL
   },
   GNOMEUIINFO_SEPARATOR,
+  GNOMEUIINFO_MENU_CLOSE_ITEM (GtkClose, NULL),
   GNOMEUIINFO_MENU_EXIT_ITEM (GtkExit, NULL),
   GNOMEUIINFO_END
 };
@@ -247,10 +248,15 @@ create_intf_window (void)
                             (GtkDestroyNotify) gtk_widget_unref);
 
   gtk_widget_ref (menubar_file_menu_uiinfo[6].widget);
-  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_exit",
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_close",
                             menubar_file_menu_uiinfo[6].widget,
                             (GtkDestroyNotify) gtk_widget_unref);
 
+  gtk_widget_ref (menubar_file_menu_uiinfo[7].widget);
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_exit",
+                            menubar_file_menu_uiinfo[7].widget,
+                            (GtkDestroyNotify) gtk_widget_unref);
+
   gtk_widget_ref (menubar_uiinfo[1].widget);
   gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_view",
                             menubar_uiinfo[1].widget,
index bc20d52..19c0ac8 100644 (file)
@@ -2,7 +2,7 @@
  * gtk.c : Gtk+ plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: gtk.c,v 1.29 2002/07/11 19:28:13 sam Exp $
+ * $Id: gtk.c,v 1.30 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -483,13 +483,13 @@ static gint GtkManage( gpointer p_data )
 
         vlc_mutex_unlock( &p_input->stream.stream_lock );
     }
-    else if( p_intf->p_sys->b_playing && !p_intf->p_vlc->b_die )
+    else if( p_intf->p_sys->b_playing && !p_intf->b_die )
     {
         GtkModeManage( p_intf );
         p_intf->p_sys->b_playing = 0;
     }
 
-    if( p_intf->p_vlc->b_die )
+    if( p_intf->b_die )
     {
         vlc_mutex_unlock( &p_intf->change_lock );
 
index ab5b3b7..2e11ce7 100644 (file)
              <right_justify>False</right_justify>
            </widget>
 
+           <widget>
+             <class>GtkMenuItem</class>
+             <name>menubar_close</name>
+             <tooltip>Close the window</tooltip>
+             <accelerator>
+               <modifiers>GDK_CONTROL_MASK</modifiers>
+               <key>GDK_W</key>
+               <signal>activate</signal>
+             </accelerator>
+             <signal>
+               <name>activate</name>
+               <handler>GtkClose</handler>
+               <last_modification_time>Mon, 15 Jul 2002 08:55:26 GMT</last_modification_time>
+             </signal>
+             <label>_Close</label>
+             <right_justify>False</right_justify>
+           </widget>
+
            <widget>
              <class>GtkMenuItem</class>
              <name>menubar_exit</name>
index 9c9b362..0388710 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_callbacks.c : Callbacks for the Gtk+ plugin.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: gtk_callbacks.c,v 1.48 2002/07/11 19:28:13 sam Exp $
+ * $Id: gtk_callbacks.c,v 1.49 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          St├ęphane Borel <stef@via.ecp.fr>
@@ -94,12 +94,19 @@ gboolean GtkExit( GtkWidget       *widget,
     intf_thread_t *p_intf = GtkGetIntf( widget );
 
     vlc_mutex_lock( &p_intf->change_lock );
-    p_intf->p_vlc->b_die = 1;
+    p_intf->p_vlc->b_die = VLC_TRUE;
     vlc_mutex_unlock( &p_intf->change_lock );
 
     return TRUE;
 }
 
+void GtkClose( GtkMenuItem     *menuitem,
+               gpointer         user_data )
+{
+    intf_thread_t *p_intf = GtkGetIntf( menuitem );
+    p_intf->b_die = VLC_TRUE;
+}
+
 gboolean GtkWindowDelete( GtkWidget       *widget,
                           GdkEvent        *event,
                           gpointer         user_data )
@@ -571,3 +578,4 @@ GtkOpenNotebookChanged                 (GtkNotebook     *notebook,
 {
     GtkOpenChanged( GTK_WIDGET( notebook ), user_data );
 }
+
index 1b45d2e..5949385 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_callbacks.h : Callbacks for the gtk plugin.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: gtk_callbacks.h,v 1.21 2002/07/11 19:28:13 sam Exp $
+ * $Id: gtk_callbacks.h,v 1.22 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          St├ęphane Borel <stef@via.ecp.fr>
@@ -145,3 +145,7 @@ GtkFileOk                              (GtkButton       *button,
 void
 GtkFileCancel                          (GtkButton       *button,
                                         gpointer         user_data);
+
+void
+GtkClose                               (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
index 851a52a..09c162f 100644 (file)
@@ -31,6 +31,7 @@ create_intf_window (void)
   GtkWidget *separator4;
   GtkWidget *menubar_eject;
   GtkWidget *separator14;
+  GtkWidget *menubar_close;
   GtkWidget *menubar_exit;
   GtkWidget *menubar_view;
   GtkWidget *menubar_view_menu;
@@ -221,6 +222,21 @@ create_intf_window (void)
   gtk_container_add (GTK_CONTAINER (menubar_file_menu), separator14);
   gtk_widget_set_sensitive (separator14, FALSE);
 
+  menubar_close = gtk_menu_item_new_with_label ("");
+  tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_close)->child),
+                                   _("_Close"));
+  gtk_widget_add_accelerator (menubar_close, "activate_item", menubar_file_menu_accels,
+                              tmp_key, 0, 0);
+  gtk_widget_ref (menubar_close);
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_close", menubar_close,
+                            (GtkDestroyNotify) gtk_widget_unref);
+  gtk_widget_show (menubar_close);
+  gtk_container_add (GTK_CONTAINER (menubar_file_menu), menubar_close);
+  gtk_tooltips_set_tip (tooltips, menubar_close, _("Close the window"), NULL);
+  gtk_widget_add_accelerator (menubar_close, "activate", accel_group,
+                              GDK_W, GDK_CONTROL_MASK,
+                              GTK_ACCEL_VISIBLE);
+
   menubar_exit = gtk_menu_item_new_with_label ("");
   tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_exit)->child),
                                    _("E_xit"));
@@ -834,6 +850,9 @@ create_intf_window (void)
   gtk_signal_connect (GTK_OBJECT (menubar_eject), "activate",
                       GTK_SIGNAL_FUNC (GtkDiscEject),
                       NULL);
+  gtk_signal_connect (GTK_OBJECT (menubar_close), "activate",
+                      GTK_SIGNAL_FUNC (GtkClose),
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_exit), "activate",
                       GTK_SIGNAL_FUNC (GtkExit),
                       NULL);
index 14a3ff3..9b1f220 100644 (file)
@@ -176,7 +176,7 @@ void KInterface::slotFileClose()
 void KInterface::slotFileQuit()
 {
     slotStatusMsg(i18n("Exiting..."));
-    p_intf->p_vlc->b_die = 1;
+    p_intf->p_vlc->b_die = VLC_TRUE;
     slotStatusMsg(i18n("Ready."));
 }
 
index 7df3ccd..4c60495 100644 (file)
@@ -2,7 +2,7 @@
  * lirc.c : lirc plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: lirc.c,v 1.12 2002/07/01 17:40:27 sam Exp $
+ * $Id: lirc.c,v 1.13 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *
@@ -149,7 +149,7 @@ static void intf_Run( intf_thread_t *p_intf )
     playlist_t *p_playlist;
     input_thread_t *p_input;
 
-    while( !p_intf->p_vlc->b_die )
+    while( !p_intf->b_die )
     {
         /* Sleep a bit */
         msleep( INTF_IDLE_SLEEP );
@@ -177,13 +177,13 @@ static void intf_Run( intf_thread_t *p_intf )
             continue;
         }
 
-        while( !p_intf->p_vlc->b_die 
+        while( !p_intf->b_die 
                 && lirc_code2char( p_intf->p_sys->config, code, &c ) == 0
                 && c != NULL )
         {
             if( !strcmp( c, "QUIT" ) )
             {
-                p_intf->p_vlc->b_die = 1;
+                p_intf->p_vlc->b_die = VLC_TRUE;
                 continue;
             }
 
index 4d438ab..0d832a6 100644 (file)
@@ -2,7 +2,7 @@
  * intf_macosx.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: intf_macosx.m,v 1.6 2002/07/15 01:54:03 jlj Exp $
+ * $Id: intf_macosx.m,v 1.7 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -165,7 +165,7 @@ static void intf_Run( intf_thread_t *p_intf )
 
 - (void)terminate:(id)sender
 {
-    [self getIntf]->p_vlc->b_die = 1;
+    [self getIntf]->p_vlc->b_die = VLC_TRUE;
 }
 
 @end
@@ -268,7 +268,7 @@ static void intf_Run( intf_thread_t *p_intf )
     intf_thread_t * p_intf = [NSApp getIntf];
     NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
 
-    while( !p_intf->p_vlc->b_die )
+    while( !p_intf->b_die )
     {
         int i_start, i_stop;
 
@@ -312,7 +312,7 @@ static void intf_Run( intf_thread_t *p_intf )
 
             vlc_mutex_unlock( &p_input->stream.stream_lock );
         }
-        else if( p_intf->p_sys->b_playing && !p_intf->p_vlc->b_die )
+        else if( p_intf->p_sys->b_playing && !p_intf->b_die )
         {
             [self manageMode];
             p_intf->p_sys->b_playing = 0;
index bc8c3a7..ff24fc0 100644 (file)
@@ -2,7 +2,7 @@
  * vout_macosx.m: MacOS X video output plugin
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: vout_macosx.m,v 1.10 2002/07/15 19:04:12 jlj Exp $
+ * $Id: vout_macosx.m,v 1.11 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -774,7 +774,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
             break;
 
         case 'q': case 'Q':
-            p_vout->p_vlc->b_die = 1;
+            p_vout->p_vlc->b_die = VLC_TRUE;
             break;
 
         case ' ':
index e6c3a31..4bac6e2 100644 (file)
@@ -2,7 +2,7 @@
  * logger.c : file logging plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: logger.c,v 1.11 2002/06/01 18:04:49 sam Exp $
+ * $Id: logger.c,v 1.12 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -245,7 +245,7 @@ static void intf_Close( intf_thread_t *p_intf )
  *****************************************************************************/
 static void intf_Run( intf_thread_t *p_intf )
 {
-    while( !p_intf->p_vlc->b_die )
+    while( !p_intf->b_die )
     {
         FlushQueue( p_intf->p_sys->p_sub, p_intf->p_sys->p_file,
                     p_intf->p_sys->i_mode );
index ffc08e1..3bcf766 100644 (file)
@@ -2,7 +2,7 @@
  * ncurses.c : NCurses plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: ncurses.c,v 1.17 2002/06/01 18:04:49 sam Exp $
+ * $Id: ncurses.c,v 1.18 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *      
@@ -159,7 +159,7 @@ static void intf_Run( intf_thread_t *p_intf )
      */
     t_last_refresh = ( time( 0 ) - 1);
 
-    while( !p_intf->p_vlc->b_die )
+    while( !p_intf->b_die )
     {
         p_intf->pf_manage( p_intf );
 
index 51d806d..9d12209 100644 (file)
@@ -2,7 +2,7 @@
  * rc.c : remote control stdin/stdout plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: rc.c,v 1.20 2002/06/27 19:05:17 sam Exp $
+ * $Id: rc.c,v 1.21 2002/07/15 20:09:31 sam Exp $
  *
  * Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
  *
@@ -290,7 +290,7 @@ static void intf_Run( intf_thread_t *p_intf )
 
             case 'q':
             case 'Q':
-                p_intf->p_vlc->b_die = 1;
+                p_intf->p_vlc->b_die = VLC_TRUE;
                 break;
 
             case 'r':
index 41307e4..430e3f2 100644 (file)
@@ -223,13 +223,13 @@ int Win32Manage( intf_thread_t *p_intf )
 \r
         vlc_mutex_unlock( &p_input->stream.stream_lock );\r
     }\r
-    else if( p_intf->p_sys->b_playing && !p_intf->p_vlc->b_die )\r
+    else if( p_intf->p_sys->b_playing && !p_intf->b_die )\r
     {\r
         p_intf->p_sys->p_window->ModeManage();\r
         p_intf->p_sys->b_playing = 0;\r
     }\r
 \r
-    if( p_intf->p_vlc->b_die )\r
+    if( p_intf->b_die )\r
     {\r
         vlc_mutex_unlock( &p_intf->change_lock );\r
 \r
index 64553d9..7a8f6a2 100644 (file)
@@ -115,7 +115,7 @@ void __fastcall TMainFrameDlg::FormClose( TObject *Sender,
     intf_thread_t *p_intf = p_intfGlobal;\r
 \r
     vlc_mutex_lock( &p_intf->change_lock );\r
-    p_intf->p_vlc->b_die = 1;\r
+    p_intf->p_vlc->b_die = VLC_TRUE;\r
     vlc_mutex_unlock( &p_intf->change_lock );\r
 \r
     /* we don't destroy the form immediatly */\r