]> git.sesse.net Git - vlc/blobdiff - modules/gui/gtk/gtk.c
* ALL: removed a bunch of unused add_category_hint().
[vlc] / modules / gui / gtk / gtk.c
index b5cc81679e2544c3d85844da03c0ba6e145e9976..f0e20e22fdc5534ab2d34e7e32c286c467e4098f 100644 (file)
@@ -2,7 +2,7 @@
  * gtk.c : Gtk+ plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: gtk.c,v 1.14 2003/01/31 09:51:57 sam Exp $
+ * $Id: gtk.c,v 1.22 2004/01/25 18:53:07 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -54,10 +54,10 @@ static int  Manage       ( intf_thread_t * );
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-#define TOOLTIPS_TEXT N_("show tooltips")
+#define TOOLTIPS_TEXT N_("Show tooltips")
 #define TOOLTIPS_LONGTEXT N_("Show tooltips for configuration options.")
 
-#define PREFS_MAXH_TEXT N_("maximum height for the configuration windows")
+#define PREFS_MAXH_TEXT N_("Maximum height for the configuration windows")
 #define PREFS_MAXH_LONGTEXT N_( \
     "You can set the maximum height that the configuration windows in the " \
     "preferences menu will occupy.")
@@ -68,13 +68,13 @@ vlc_module_begin();
 #else
     int i = getenv( "DISPLAY" ) == NULL ? 10 : 90;
 #endif
-    add_category_hint( N_("Gtk+"), NULL );
+    set_description( _("Gtk+ interface") );
+
     add_bool( "gtk-tooltips", 1, E_(GtkHideTooltips),
-              TOOLTIPS_TEXT, TOOLTIPS_LONGTEXT );
+              TOOLTIPS_TEXT, TOOLTIPS_LONGTEXT, VLC_FALSE );
     add_integer( "gtk-prefs-maxh", 480, NULL,
-                 PREFS_MAXH_TEXT, PREFS_MAXH_LONGTEXT );
+                 PREFS_MAXH_TEXT, PREFS_MAXH_LONGTEXT, VLC_TRUE );
 
-    set_description( _("Gtk+ interface module") );
     set_capability( "interface", i );
     set_callbacks( Open, Close );
     add_shortcut( "gtk" );
@@ -97,7 +97,7 @@ static int Open( vlc_object_t *p_this )
     }
 
 #ifdef NEED_GTK_MAIN
-    p_intf->p_sys->p_gtk_main = module_Need( p_this, "gtk_main", "gtk" );
+    p_intf->p_sys->p_gtk_main = module_Need( p_this, "gui-helper", "gtk" );
     if( p_intf->p_sys->p_gtk_main == NULL )
     {
         free( p_intf->p_sys );
@@ -180,7 +180,7 @@ static void Run( intf_thread_t *p_intf )
 #else
     /* gtk_init needs to know the command line. We don't care, so we
      * give it an empty one */
-    char  *p_args[] = { "" };
+    char  *p_args[] = { "", NULL };
     char **pp_args  = p_args;
     int    i_args   = 1;
     int    i_dummy;
@@ -258,6 +258,12 @@ static void Run( intf_thread_t *p_intf )
 
     gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_popup),
                          "p_intf", p_intf );
+    gtk_object_set_data( GTK_OBJECT( gtk_object_get_data(
+                             GTK_OBJECT(p_intf->p_sys->p_popup),
+                             "popup_audio" ) ), "p_intf", p_intf );
+    gtk_object_set_data( GTK_OBJECT( gtk_object_get_data(
+                             GTK_OBJECT(p_intf->p_sys->p_popup),
+                             "popup_video" ) ), "p_intf", p_intf );
 
     gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_playwin ),
                          "p_intf", p_intf );
@@ -389,6 +395,15 @@ static int Manage( intf_thread_t *p_intf )
         p_intf->p_sys->p_sub->i_start = i_start;
         vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock );
 
+        /* If the messages list becomes too big, just clean half of it. */
+        if( gtk_text_get_length( p_intf->p_sys->p_messages_text ) >
+            VLC_MSG_QSIZE * 1000 )
+        {
+            gtk_text_set_point( p_intf->p_sys->p_messages_text, 0 );
+            gtk_text_forward_delete( p_intf->p_sys->p_messages_text,
+                gtk_text_get_length( p_intf->p_sys->p_messages_text ) / 2 );
+        }
+
         gtk_text_set_point( p_intf->p_sys->p_messages_text,
                     gtk_text_get_length( p_intf->p_sys->p_messages_text ) );
     }
@@ -449,14 +464,17 @@ static int Manage( intf_thread_t *p_intf )
                  * finished dragging the slider.
                  * Beware, the hack below is needed by the dvdplay plugin! */
                 else if( p_intf->p_sys->b_slider_free
-                /* hack -> */ && (p_intf->p_sys->f_adj_oldvalue <= 100.) )
+                /* hack -> */ && (p_intf->p_sys->f_adj_oldvalue < 100.) )
                 {
-                    off_t i_seek = ( newvalue * p_area->i_size ) / 100;
-
-                    /* release the lock to be able to seek */
-                    vlc_mutex_unlock( &p_input->stream.stream_lock );
-                    input_Seek( p_input, i_seek, INPUT_SEEK_SET );
-                    vlc_mutex_lock( &p_input->stream.stream_lock );
+                    if( newvalue >= 0. && newvalue < 100. )
+                    {
+                        off_t i_seek = ( newvalue * p_area->i_size ) / 100;
+
+                        /* release the lock to be able to seek */
+                        vlc_mutex_unlock( &p_input->stream.stream_lock );
+                        input_Seek( p_input, i_seek, INPUT_SEEK_SET );
+                        vlc_mutex_lock( &p_input->stream.stream_lock );
+                    }
 
                     /* Update the old value */
                     p_intf->p_sys->f_adj_oldvalue = newvalue;