]> git.sesse.net Git - vlc/commitdiff
Added a menu in the GTK and gnome interfaces to change the current program
authorJohan Bilien <jobi@videolan.org>
Sun, 24 Feb 2002 21:36:20 +0000 (21:36 +0000)
committerJohan Bilien <jobi@videolan.org>
Sun, 24 Feb 2002 21:36:20 +0000 (21:36 +0000)
in multi-program streams (such as ones provided by a DVB-S card).

include/common.h
include/input_ext-intf.h
plugins/gtk/gnome.glade
plugins/gtk/gnome_interface.c
plugins/gtk/gtk.glade
plugins/gtk/gtk_common.h
plugins/gtk/gtk_display.c
plugins/gtk/gtk_interface.c
plugins/gtk/gtk_menu.c
src/input/input_ext-intf.c
src/misc/modules_plugin.h

index 368cb635456935239248e2b9d577d4d313c72615..84063a1dccc4c0566761d32cfa1b1f3c0cb52106 100644 (file)
@@ -3,7 +3,7 @@
  * Collection of useful common types and macros definitions
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: common.h,v 1.76 2002/02/24 20:51:09 gbazin Exp $
+ * $Id: common.h,v 1.77 2002/02/24 21:36:20 jobi Exp $
  *
  * Authors: Samuel Hocevar <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -488,6 +488,7 @@ typedef struct module_symbols_s
                                       struct es_descriptor_s *, boolean_t );
     int  ( * input_ChangeArea )     ( struct input_thread_s *,
                                       struct input_area_s * );
+    int  ( * input_ChangeProgram )  ( struct input_thread_s *, u16 );
     struct es_descriptor_s * ( * input_FindES ) ( struct input_thread_s *,
                                                   u16 );
     struct es_descriptor_s * ( * input_AddES ) ( struct input_thread_s *,
index 0154b6e82e26034dc67a1c503b285c28733d9568..6be18d24de6df7ee1bdefe34ad776f98a3d5f9b0 100644 (file)
@@ -4,7 +4,7 @@
  * control the pace of reading. 
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.59 2002/02/15 13:32:52 sam Exp $
+ * $Id: input_ext-intf.h,v 1.60 2002/02/24 21:36:20 jobi Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -351,6 +351,7 @@ int    input_ChangeES       ( struct input_thread_s *,
 int    input_ToggleES       ( struct input_thread_s *,
                               struct es_descriptor_s *, boolean_t );
 int    input_ChangeArea     ( struct input_thread_s *, struct input_area_s * );
+int    input_ChangeProgram  ( struct input_thread_s *, u16 );
 int    input_ToggleGrayscale( struct input_thread_s * );
 int    input_ToggleMute     ( struct input_thread_s * );
 int    input_SetSMP         ( struct input_thread_s *, int );
@@ -362,5 +363,6 @@ int    input_SetSMP         ( struct input_thread_s *, int );
 #   define input_ChangeES       p_symbols->input_ChangeES
 #   define input_ToggleES       p_symbols->input_ToggleES
 #   define input_ChangeArea     p_symbols->input_ChangeArea
+#   define input_ChangeProgram  p_symbols->input_ChangeProgram
 #endif
 
index c9f24d48890078f3d2f7a0404fbfc1ee75b2dd3b..f89935665f1f87d7a8bfe8f7059fe94023496ade 100644 (file)
              <right_justify>False</right_justify>
            </widget>
 
+           <widget>
+             <class>GtkMenuItem</class>
+             <name>menubar_program</name>
+             <sensitive>False</sensitive>
+             <tooltip>Choose the program</tooltip>
+             <label>Progr_am</label>
+             <right_justify>False</right_justify>
+           </widget>
+
            <widget>
              <class>GtkMenuItem</class>
              <name>menubar_title</name>
index f2e2790002709a80eca5419c6c3fc09e996838ed..c8d077841ca6a56bd368ec2c982a656f0de2d05c 100644 (file)
@@ -66,6 +66,13 @@ static GnomeUIInfo menubar_view_menu_uiinfo[] =
     0, (GdkModifierType) 0, NULL
   },
   GNOMEUIINFO_SEPARATOR,
+  {
+    GNOME_APP_UI_ITEM, N_("Progr_am"),
+    N_("Choose the program"),
+    (gpointer) NULL, NULL, NULL,
+    GNOME_APP_PIXMAP_NONE, NULL,
+    0, (GdkModifierType) 0, NULL
+  },
   {
     GNOME_APP_UI_ITEM, N_("_Title"),
     N_("Choose title"),
@@ -271,43 +278,49 @@ create_intf_window (void)
                             (GtkDestroyNotify) gtk_widget_unref);
 
   gtk_widget_ref (menubar_view_menu_uiinfo[3].widget);
-  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_title",
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_program",
                             menubar_view_menu_uiinfo[3].widget,
                             (GtkDestroyNotify) gtk_widget_unref);
   gtk_widget_set_sensitive (menubar_view_menu_uiinfo[3].widget, FALSE);
 
   gtk_widget_ref (menubar_view_menu_uiinfo[4].widget);
-  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_chapter",
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_title",
                             menubar_view_menu_uiinfo[4].widget,
                             (GtkDestroyNotify) gtk_widget_unref);
   gtk_widget_set_sensitive (menubar_view_menu_uiinfo[4].widget, FALSE);
 
   gtk_widget_ref (menubar_view_menu_uiinfo[5].widget);
-  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_angle",
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_chapter",
                             menubar_view_menu_uiinfo[5].widget,
                             (GtkDestroyNotify) gtk_widget_unref);
   gtk_widget_set_sensitive (menubar_view_menu_uiinfo[5].widget, FALSE);
 
   gtk_widget_ref (menubar_view_menu_uiinfo[6].widget);
-  gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator7",
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_angle",
                             menubar_view_menu_uiinfo[6].widget,
                             (GtkDestroyNotify) gtk_widget_unref);
+  gtk_widget_set_sensitive (menubar_view_menu_uiinfo[6].widget, FALSE);
 
   gtk_widget_ref (menubar_view_menu_uiinfo[7].widget);
-  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_playlist",
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator7",
                             menubar_view_menu_uiinfo[7].widget,
                             (GtkDestroyNotify) gtk_widget_unref);
 
   gtk_widget_ref (menubar_view_menu_uiinfo[8].widget);
-  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_modules",
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_playlist",
                             menubar_view_menu_uiinfo[8].widget,
                             (GtkDestroyNotify) gtk_widget_unref);
-  gtk_widget_set_sensitive (menubar_view_menu_uiinfo[8].widget, FALSE);
 
   gtk_widget_ref (menubar_view_menu_uiinfo[9].widget);
-  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_messages",
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_modules",
                             menubar_view_menu_uiinfo[9].widget,
                             (GtkDestroyNotify) gtk_widget_unref);
+  gtk_widget_set_sensitive (menubar_view_menu_uiinfo[9].widget, FALSE);
+
+  gtk_widget_ref (menubar_view_menu_uiinfo[10].widget);
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_messages",
+                            menubar_view_menu_uiinfo[10].widget,
+                            (GtkDestroyNotify) gtk_widget_unref);
 
   gtk_widget_ref (menubar_uiinfo[2].widget);
   gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_settings",
index c40cf76d3f06bdca7c470e712ff5736c7732a6d7..0bc885aa801c231858efa8efc9a40ec12d16b7a6 100644 (file)
@@ -89,7 +89,6 @@
              <signal>
                <name>activate</name>
                <handler>GtkFileOpenActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Mon, 14 May 2001 21:27:36 GMT</last_modification_time>
              </signal>
              <label>_Open File...</label>
              <signal>
                <name>activate</name>
                <handler>GtkDiscOpenActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Mon, 14 May 2001 21:27:47 GMT</last_modification_time>
              </signal>
              <label>Open _Disc...</label>
              <signal>
                <name>activate</name>
                <handler>GtkNetworkOpenActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Mon, 14 May 2001 21:28:06 GMT</last_modification_time>
              </signal>
              <label>_Network Stream...</label>
              <signal>
                <name>activate</name>
                <handler>GtkEjectDiscActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Fri, 21 Dec 2001 12:51:34 GMT</last_modification_time>
              </signal>
              <label>_Eject Disc</label>
              <signal>
                <name>activate</name>
                <handler>GtkExitActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Mon, 14 May 2001 21:28:20 GMT</last_modification_time>
              </signal>
              <label>E_xit</label>
              <signal>
                <name>activate</name>
                <handler>GtkWindowToggleActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Mon, 14 May 2001 21:32:49 GMT</last_modification_time>
              </signal>
              <label>_Hide interface</label>
              <signal>
                <name>activate</name>
                <handler>GtkFullscreenActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Mon, 14 May 2001 21:29:21 GMT</last_modification_time>
              </signal>
              <label>_Fullscreen</label>
              <right_justify>False</right_justify>
            </widget>
 
+           <widget>
+             <class>GtkMenuItem</class>
+             <name>menubar_program</name>
+             <sensitive>False</sensitive>
+             <tooltip>Choose the program</tooltip>
+             <label>Progr_am</label>
+             <right_justify>False</right_justify>
+           </widget>
+
            <widget>
              <class>GtkMenuItem</class>
              <name>menubar_title</name>
              <signal>
                <name>activate</name>
                <handler>GtkPlaylistActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Mon, 14 May 2001 21:29:34 GMT</last_modification_time>
              </signal>
              <label>_Playlist...</label>
              <signal>
                <name>activate</name>
                <handler>GtkModulesActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Mon, 14 May 2001 21:29:44 GMT</last_modification_time>
              </signal>
              <label>_Modules...</label>
              <signal>
                <name>activate</name>
                <handler>GtkMessagesActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Tue, 19 Feb 2002 02:03:47 GMT</last_modification_time>
              </signal>
              <label>Messages...</label>
              <signal>
                <name>activate</name>
                <handler>GtkPreferencesActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Mon, 14 May 2001 21:30:02 GMT</last_modification_time>
              </signal>
              <label>_Preferences...</label>
              <signal>
                <name>activate</name>
                <handler>GtkAboutActivate</handler>
-               <data>&quot;intf_window&quot;</data>
                <last_modification_time>Mon, 14 May 2001 21:30:15 GMT</last_modification_time>
              </signal>
              <label>_About...</label>
index a6c5dd3eb1d553e6f26a95aec186fb12d0a541b6..8dc0af983e4eda17f541ca62514d817f273b0c27 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_common.h: private Gtk+ interface description
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: gtk_common.h,v 1.2 2002/02/19 03:54:55 sam Exp $
+ * $Id: gtk_common.h,v 1.3 2002/02/24 21:36:20 jobi Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -52,6 +52,8 @@ typedef struct intf_sys_s
     boolean_t           b_slider_free;                      /* slider status */
 
     /* menus handlers */
+    boolean_t           b_program_update;   /* do we need to update programs 
+                                                                        menu */
     boolean_t           b_title_update;  /* do we need to update title menus */
     boolean_t           b_chapter_update;            /* do we need to update
                                                                chapter menus */
index 813d5b73d2bcd862b47a04fa441159226f3d2aaa..9b265bc672840ba013ea869db79d71c4d5fff62f 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_display.c: Gtk+ tools for main interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: gtk_display.c,v 1.14 2002/02/24 20:51:10 gbazin Exp $
+ * $Id: gtk_display.c,v 1.15 2002/02/24 21:36:20 jobi Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -181,6 +181,7 @@ gint GtkModeManage( intf_thread_t * p_intf )
         b_control = p_input_bank->pp_input[0]->stream.b_pace_control;
 
         /* get ready for menu regeneration */
+        p_intf->p_sys->b_program_update = 1;
         p_intf->p_sys->b_title_update = 1;
         p_intf->p_sys->b_chapter_update = 1;
         p_intf->p_sys->b_angle_update = 1;
@@ -211,6 +212,8 @@ gint GtkModeManage( intf_thread_t * p_intf )
             gtk_widget_show( GTK_WIDGET( p_file_box ) );
 
             /* unsensitize menus */
+            gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_program"),
+                    FALSE );
             gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_title"), FALSE );
             gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_chapter"),
                                       FALSE );
index ca2d5fa6cdaa265bbec2ebc37fd7cc4538fe7881..5d54614457c4b9e0218f59acc63a2ff7a4f00585 100644 (file)
@@ -38,6 +38,7 @@ create_intf_window (void)
   GtkWidget *menubar_interface_hide;
   GtkWidget *menubar_fullscreen;
   GtkWidget *separator13;
+  GtkWidget *menubar_program;
   GtkWidget *menubar_title;
   GtkWidget *menubar_chapter;
   GtkWidget *menubar_angle;
@@ -284,6 +285,19 @@ create_intf_window (void)
   gtk_container_add (GTK_CONTAINER (menubar_view_menu), separator13);
   gtk_widget_set_sensitive (separator13, FALSE);
 
+  menubar_program = gtk_menu_item_new_with_label ("");
+  tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_program)->child),
+                                   _("Progr_am"));
+  gtk_widget_add_accelerator (menubar_program, "activate_item", menubar_view_menu_accels,
+                              tmp_key, 0, 0);
+  gtk_widget_ref (menubar_program);
+  gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_program", menubar_program,
+                            (GtkDestroyNotify) gtk_widget_unref);
+  gtk_widget_show (menubar_program);
+  gtk_container_add (GTK_CONTAINER (menubar_view_menu), menubar_program);
+  gtk_widget_set_sensitive (menubar_program, FALSE);
+  gtk_tooltips_set_tip (tooltips, menubar_program, _("Choose the program"), NULL);
+
   menubar_title = gtk_menu_item_new_with_label ("");
   tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_title)->child),
                                    _("_Title"));
@@ -812,40 +826,40 @@ create_intf_window (void)
                       "intf_window");
   gtk_signal_connect (GTK_OBJECT (menubar_open), "activate",
                       GTK_SIGNAL_FUNC (GtkFileOpenActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_disc), "activate",
                       GTK_SIGNAL_FUNC (GtkDiscOpenActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_network), "activate",
                       GTK_SIGNAL_FUNC (GtkNetworkOpenActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_eject), "activate",
                       GTK_SIGNAL_FUNC (GtkEjectDiscActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_exit), "activate",
                       GTK_SIGNAL_FUNC (GtkExitActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_interface_hide), "activate",
                       GTK_SIGNAL_FUNC (GtkWindowToggleActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_fullscreen), "activate",
                       GTK_SIGNAL_FUNC (GtkFullscreenActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_playlist), "activate",
                       GTK_SIGNAL_FUNC (GtkPlaylistActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_modules), "activate",
                       GTK_SIGNAL_FUNC (GtkModulesActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_messages), "activate",
                       GTK_SIGNAL_FUNC (GtkMessagesActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_preferences), "activate",
                       GTK_SIGNAL_FUNC (GtkPreferencesActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (menubar_about), "activate",
                       GTK_SIGNAL_FUNC (GtkAboutActivate),
-                      "intf_window");
+                      NULL);
   gtk_signal_connect (GTK_OBJECT (toolbar_open), "button_press_event",
                       GTK_SIGNAL_FUNC (GtkFileOpenShow),
                       "intf_window");
index ba0d81d15a84b970e52c2e6cc2612c410a5bcb52..04ba12298c4ff99c6bf142fa0f373640dce17f72 100644 (file)
@@ -2,10 +2,11 @@
  * gtk_menu.c : functions to handle menu items.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: gtk_menu.c,v 1.18 2002/01/07 02:12:29 sam Exp $
+ * $Id: gtk_menu.c,v 1.19 2002/02/24 21:36:20 jobi Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
+ *          Johan Bilien <jobi@via.ecp.fr>
  *      
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -179,6 +180,34 @@ void GtkPopupNavigationToggle( GtkCheckMenuItem * menuitem,
     }
 }
 
+/*
+ * Program
+ */
+
+void GtkMenubarProgramToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
+{
+    intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
+
+    if( menuitem->active && !p_intf->p_sys->b_program_update )
+    {
+        u16 i_program_id = (u16)user_data;
+        
+        input_ChangeProgram( p_input_bank->pp_input[0], i_program_id );
+        
+        p_intf->p_sys->b_program_update = 1;
+        
+        vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
+        GtkSetupMenus( p_intf );
+        vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
+        
+        p_intf->p_sys->b_title_update = 0;
+
+        input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
+
+    }
+}
+
+
 /*
  * Title
  */
@@ -406,6 +435,104 @@ static gint GtkRadioMenu( intf_thread_t * p_intf,
     return TRUE;
 }
 
+/*****************************************************************************
+ * GtkProgramMenu: update the programs menu of the interface 
+ *****************************************************************************
+ * Builds the program menu according to what have been found in the PAT 
+ * by the input. Usefull for multi-programs streams such as DVB ones.
+ *****************************************************************************/
+static gint GtkProgramMenu( gpointer          p_data,
+                                GtkWidget *       p_root,
+                          void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) )
+{
+    intf_thread_t *     p_intf;
+    GtkWidget *         p_menu;
+    GtkWidget *         p_item;
+    GtkWidget *         p_item_active;
+    GSList *            p_group;
+    char                psz_name[ GTK_MENU_LABEL_SIZE ];
+    gint                i_item;
+    gint                i;
+
+    /* cast */
+    p_intf = (intf_thread_t *)p_data;
+
+    /* temporary hack to avoid blank menu when an open menu is removed */
+    if( GTK_MENU_ITEM(p_root)->submenu != NULL )
+    {
+        gtk_menu_popdown( GTK_MENU( GTK_MENU_ITEM(p_root)->submenu ) );
+    }
+    /* removes previous menu */
+    gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_root ) );
+    gtk_widget_set_sensitive( p_root, FALSE );
+
+    p_group = NULL;
+
+    /* menu container */
+    p_menu = gtk_menu_new();
+
+    p_item_active = NULL;
+    i_item = 0;
+
+    /* create a set of program buttons and append them to the container */
+    for( i = 0 ; i < p_input_bank->pp_input[0]->stream.i_pgrm_number ; i++ )
+    {
+        i_item++;
+        snprintf( psz_name, GTK_MENU_LABEL_SIZE, "id %x",
+            p_input_bank->pp_input[0]->stream.pp_programs[i]->i_number );
+            
+        if( psz_name[0] == '\0' )
+        {
+            snprintf( psz_name, GTK_MENU_LABEL_SIZE,
+                      "Program %d", i_item );
+            psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
+        }
+
+        p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name );
+        p_group =
+            gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) );
+
+        if( p_input_bank->pp_input[0]->stream.p_new_program ==
+                p_input_bank->pp_input[0]->stream.pp_programs[i] ||
+                p_input_bank->pp_input[0]->stream.p_selected_program == 
+                p_input_bank->pp_input[0]->stream.pp_programs[i] )
+        {
+            /* don't lose p_item when we append into menu */
+            p_item_active = p_item;
+        }
+
+        gtk_widget_show( p_item );
+
+        /* setup signal hanling */
+        gtk_signal_connect( GTK_OBJECT( p_item ), "toggled",
+                        GTK_SIGNAL_FUNC( pf_toggle ),
+                        (gpointer)( p_input_bank->pp_input[0]->
+                        stream.pp_programs[i]->i_number ) );
+
+        gtk_menu_append( GTK_MENU( p_menu ), p_item );
+    }
+
+    /* link the new menu to the menubar item */
+    gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
+
+    /* activation will call signals so we can only do it
+     * when submenu is attached to menu - to get intf_window 
+     * We have to release the lock since input_ToggleES needs it */
+    if( p_item_active != NULL )
+    {
+        gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
+                                        TRUE );
+    }
+
+    /* be sure that menu is sensitive if more than 1 program */
+    if( i_item > 1 )
+    {
+        gtk_widget_set_sensitive( p_root, TRUE );
+    }
+
+    return TRUE;
+}
+
 /*****************************************************************************
  * GtkLanguageMenus: update interactive menus of the interface
  *****************************************************************************
@@ -785,6 +912,7 @@ gint GtkSetupMenus( intf_thread_t * p_intf )
     GtkWidget *         p_popup_menu;
     gint                i;
 
+    p_intf->p_sys->b_title_update |= p_intf->p_sys->b_program_update;
     p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update;
     p_intf->p_sys->b_angle_update |= p_intf->p_sys->b_title_update;
     p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update;
@@ -792,6 +920,16 @@ gint GtkSetupMenus( intf_thread_t * p_intf )
 
 //    vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
 
+    if( p_intf->p_sys->b_program_update )
+    { 
+        p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( 
+                            p_intf->p_sys->p_window ), "menubar_program" ) );
+        
+        GtkProgramMenu( p_intf, p_menubar_menu, GtkMenubarProgramToggle );
+        
+        p_intf->p_sys->b_program_update = 0;
+    }
+    
     if( p_intf->p_sys->b_title_update )
     { 
         char            psz_title[5];
index cd97bf33622b4456345ff01b9fa57c1852196570..761a74d86470c59f1ede9007f70eb0b2a13882a1 100644 (file)
@@ -2,7 +2,7 @@
  * input_ext-intf.c: services to the interface
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ext-intf.c,v 1.33 2002/01/10 04:11:25 sam Exp $
+ * $Id: input_ext-intf.c,v 1.34 2002/02/24 21:36:20 jobi Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -328,15 +328,25 @@ int input_ChangeArea( input_thread_t * p_input, input_area_t * p_area )
 }
 
 /****************************************************************************
- * input_ChangeProgram: interface request an area change
+ * input_ChangeProgram: interface request a program change
  ****************************************************************************/
 int input_ChangeProgram( input_thread_t * p_input, 
-            pgrm_descriptor_t * p_program )
+             u16 i_program_number )
 {
+    pgrm_descriptor_t *       p_program;
+    
     vlc_mutex_lock( &p_input->stream.stream_lock );
 
-    p_input->stream.p_new_program = p_program;
+    p_program = input_FindProgram( p_input, i_program_number );
 
+    if ( p_program == NULL )
+    {
+        intf_ErrMsg("input: Could not find selected program");
+        return -1;
+    }
+
+    p_input->stream.p_new_program = p_program;
+    
     vlc_mutex_unlock( &p_input->stream.stream_lock );
 
     return 0;
index 8f8156c9030ba01a31372d5de69e6104e693c9f3..8acfb6730e102d71f8bec1c2cb3bb8b11d1ccc38 100644 (file)
@@ -2,7 +2,7 @@
  * modules_plugin.h : Plugin management functions used by the core application.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules_plugin.h,v 1.11 2002/02/24 20:51:10 gbazin Exp $
+ * $Id: modules_plugin.h,v 1.12 2002/02/24 21:36:20 jobi Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -189,6 +189,7 @@ module_error( void )
     (p_symbols)->input_OffsetToTime = input_OffsetToTime; \
     (p_symbols)->input_ChangeES = input_ChangeES; \
     (p_symbols)->input_ToggleES = input_ToggleES; \
+    (p_symbols)->input_ChangeProgram = input_ChangeProgram; \
     (p_symbols)->input_ChangeArea = input_ChangeArea; \
     (p_symbols)->input_FindES = input_FindES; \
     (p_symbols)->input_AddES = input_AddES; \