Commit b8b9974f authored by Gildas Bazin's avatar Gildas Bazin

* You can now set a maximum height for the configuration windows in the gtk
    and gnome plugins. This patch _doesn't change_ the look of the interface
    unless this interface tries to use more space than allowed, in which case
    scrollbars are added to make the navigation easy.
    Note that this setting only affects the default size the interface will
    use, the user is then free to change the size of the window as he wants.

* Tooltips are now triggered only in specific places. This is a lot less
   intrusive and annoying for the users.
parent ce40baa1
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gnome.c : Gnome plugin for vlc * gnome.c : Gnome plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* $Id: gnome.c,v 1.15 2002/03/27 18:43:30 lool Exp $ * $Id: gnome.c,v 1.16 2002/03/31 22:35:44 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -61,10 +61,20 @@ static gint GnomeManage ( gpointer p_data ); ...@@ -61,10 +61,20 @@ static gint GnomeManage ( gpointer p_data );
/***************************************************************************** /*****************************************************************************
* Building configuration tree * Building configuration tree
*****************************************************************************/ *****************************************************************************/
#define TOOLTIPS_TEXT "hide tooltips"
#define TOOLTIPS_LONGTEXT "Do not show tooltips for configuration options"
#define PREFS_MAXH_TEXT "maximum height for the configuration windows"
#define PREFS_MAXH_LONGTEXT "You can set the maximum height that the " \
"configuration windows in the prefences menu " \
"will take"
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( "Misc Options", NULL ) ADD_CATEGORY_HINT( "Misc Options", NULL )
ADD_BOOL ( "gnome_hide_tooltips", NULL, "hide tooltips", "Do not show" \ ADD_BOOL ( "gnome_hide_tooltips", NULL, TOOLTIPS_TEXT,
" tooltips for configuration options" ) TOOLTIPS_LONGTEXT )
ADD_INTEGER ( "gnome_prefs_maxh", 480, NULL, PREFS_MAXH_TEXT,
PREFS_MAXH_LONGTEXT )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk.c : Gtk+ plugin for vlc * gtk.c : Gtk+ plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: gtk.c,v 1.17 2002/03/27 18:43:30 lool Exp $ * $Id: gtk.c,v 1.18 2002/03/31 22:35:44 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -62,10 +62,19 @@ static gint GtkManage ( gpointer p_data ); ...@@ -62,10 +62,19 @@ static gint GtkManage ( gpointer p_data );
/***************************************************************************** /*****************************************************************************
* Building configuration tree * Building configuration tree
*****************************************************************************/ *****************************************************************************/
#define TOOLTIPS_TEXT "hide tooltips"
#define TOOLTIPS_LONGTEXT "Do not show tooltips for configuration options"
#define PREFS_MAXH_TEXT "maximum height for the configuration windows"
#define PREFS_MAXH_LONGTEXT "You can set the maximum height that the " \
"configuration windows in the prefences menu " \
"will take"
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( "Misc Options", NULL ) ADD_CATEGORY_HINT( "Misc Options", NULL )
ADD_BOOL ( "gtk_hide_tooltips", NULL, "hide tooltips", "Do not show" \ ADD_BOOL ( "gtk_hide_tooltips", NULL, TOOLTIPS_TEXT, TOOLTIPS_LONGTEXT )
" tooltips for configuration options" ) ADD_INTEGER ( "gtk_prefs_maxh", 480, NULL, PREFS_MAXH_TEXT,
PREFS_MAXH_LONGTEXT )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_preferences.c: functions to handle the preferences dialog box. * gtk_preferences.c: functions to handle the preferences dialog box.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_preferences.c,v 1.19 2002/03/27 21:01:29 lool Exp $ * $Id: gtk_preferences.c,v 1.20 2002/03/31 22:35:44 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* Loc Minier <lool@via.ecp.fr> * Loc Minier <lool@via.ecp.fr>
...@@ -95,9 +95,8 @@ void GtkPreferencesActivate( GtkMenuItem * menuitem, gpointer user_data ) ...@@ -95,9 +95,8 @@ void GtkPreferencesActivate( GtkMenuItem * menuitem, gpointer user_data )
/* create an event box to catch some events */ \ /* create an event box to catch some events */ \
item_event_box = gtk_event_box_new(); \ item_event_box = gtk_event_box_new(); \
/* add a tooltip on mouseover */ \ /* add a tooltip on mouseover */ \
/* FIXME: have a different text for the private text */ \
gtk_tooltips_set_tip( p_intf->p_sys->p_tooltips, \ gtk_tooltips_set_tip( p_intf->p_sys->p_tooltips, \
item_event_box, text, text ); \ item_event_box, text, "" ); \
gtk_container_set_border_width( GTK_CONTAINER(item_event_box), 4 ); gtk_container_set_border_width( GTK_CONTAINER(item_event_box), 4 );
/* draws a right aligned label in side of a widget */ /* draws a right aligned label in side of a widget */
...@@ -106,9 +105,7 @@ void GtkPreferencesActivate( GtkMenuItem * menuitem, gpointer user_data ) ...@@ -106,9 +105,7 @@ void GtkPreferencesActivate( GtkMenuItem * menuitem, gpointer user_data )
item_align = gtk_alignment_new( 1, .5, 0, 0 ); \ item_align = gtk_alignment_new( 1, .5, 0, 0 ); \
item_label = gtk_label_new( label_text ); \ item_label = gtk_label_new( label_text ); \
gtk_container_add( GTK_CONTAINER(item_align), item_label ); \ gtk_container_add( GTK_CONTAINER(item_align), item_label ); \
TOOLTIP(tooltip) \ gtk_table_attach_defaults( GTK_TABLE(category_table), item_align, \
gtk_container_add( GTK_CONTAINER(item_event_box), item_align ); \
gtk_table_attach_defaults( GTK_TABLE(category_table), item_event_box, \
0, 1, rows - 1, rows ); \ 0, 1, rows - 1, rows ); \
item_align = gtk_alignment_new( 0, .5, .5, 0 ); \ item_align = gtk_alignment_new( 0, .5, .5, 0 ); \
gtk_container_add( GTK_CONTAINER(item_align), widget ); \ gtk_container_add( GTK_CONTAINER(item_align), widget ); \
...@@ -132,8 +129,9 @@ static void GtkCreateConfigDialog( char *psz_module_name, ...@@ -132,8 +129,9 @@ static void GtkCreateConfigDialog( char *psz_module_name,
GtkWidget *config_dialog; GtkWidget *config_dialog;
GtkWidget *config_dialog_vbox; GtkWidget *config_dialog_vbox;
GtkWidget *config_notebook; GtkWidget *config_notebook;
GtkWidget *category_table = NULL; GtkWidget *category_table = NULL;
GtkWidget *category_vbox = NULL; GtkWidget *category_label = NULL;
#ifndef MODULE_NAME_IS_gnome #ifndef MODULE_NAME_IS_gnome
GtkWidget *dialog_action_area; GtkWidget *dialog_action_area;
...@@ -215,23 +213,72 @@ static void GtkCreateConfigDialog( char *psz_module_name, ...@@ -215,23 +213,72 @@ static void GtkCreateConfigDialog( char *psz_module_name,
switch( p_module->p_config[i].i_type ) switch( p_module->p_config[i].i_type )
{ {
case MODULE_CONFIG_HINT_CATEGORY: case MODULE_CONFIG_HINT_CATEGORY:
case MODULE_CONFIG_HINT_END:
/* add a new table for right-left alignment */ /*
category_table = gtk_table_new( 0, 0, FALSE ); * Before we start building the interface for the new category, we
gtk_table_set_col_spacings( GTK_TABLE(category_table), 4 ); * must close/finish the previous one we were generating.
rows = 0; */
/* the vbox serves only EXPAND / FILL issues in the notebook */ if( category_table )
category_vbox = gtk_vbox_new( FALSE, 0 ); {
gtk_box_pack_start( GTK_BOX(category_vbox), category_table, GtkWidget *_scrolled_window;
GtkWidget *_viewport;
GtkWidget *_vbox;
GtkRequisition _requisition;
gint height =
#ifdef MODULE_NAME_IS_gnome
config_GetIntVariable( "gnome_prefs_maxh" );
#else
config_GetIntVariable( "gtk_prefs_maxh" );
#endif
/* create a vbox to deal with EXPAND/FILL issues in the
* notebook page, and pack it with the previously generated
* category_table */
_vbox = gtk_vbox_new( FALSE, 0 );
gtk_container_set_border_width( GTK_CONTAINER(_vbox), 4 );
gtk_box_pack_start( GTK_BOX(_vbox), category_table,
FALSE, FALSE, 0 ); FALSE, FALSE, 0 );
gtk_container_set_border_width( GTK_CONTAINER(category_vbox), 4 );
/* add category vbox as a notebook page */ /* create a new scrolled window that will contain all of the
item_label = gtk_label_new( p_module->p_config[i].psz_text ); * above. */
_scrolled_window = gtk_scrolled_window_new( NULL, NULL );
gtk_scrolled_window_set_policy(
GTK_SCROLLED_WINDOW(_scrolled_window), GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC );
/* add scrolled window as a notebook page */
gtk_notebook_append_page( GTK_NOTEBOOK(config_notebook), gtk_notebook_append_page( GTK_NOTEBOOK(config_notebook),
category_vbox, item_label ); _scrolled_window, category_label );
/* pack the vbox into the scrolled window */
_viewport = gtk_viewport_new( NULL, NULL );
gtk_viewport_set_shadow_type( GTK_VIEWPORT(_viewport),
GTK_SHADOW_NONE );
gtk_container_add( GTK_CONTAINER(_viewport), _vbox );
gtk_container_add( GTK_CONTAINER(_scrolled_window),
_viewport );
gtk_widget_show_all( _vbox );
gtk_widget_size_request( _vbox, &_requisition );
if( _requisition.height < height )
height = _requisition.height;
gtk_widget_set_usize( _scrolled_window, -1, height );
}
if( p_module->p_config[i].i_type == MODULE_CONFIG_HINT_END ) break;
/*
* Now we can start taking care of the new category
*/
/* create a new table for right-left alignment of children */
category_table = gtk_table_new( 0, 0, FALSE );
gtk_table_set_col_spacings( GTK_TABLE(category_table), 4 );
rows = 0;
/* create a new category label */
category_label = gtk_label_new( p_module->p_config[i].psz_text );
break; break;
...@@ -243,11 +290,8 @@ static void GtkCreateConfigDialog( char *psz_module_name, ...@@ -243,11 +290,8 @@ static void GtkCreateConfigDialog( char *psz_module_name,
gtk_table_attach_defaults( GTK_TABLE(category_table), item_frame, gtk_table_attach_defaults( GTK_TABLE(category_table), item_frame,
0, 2, rows - 1, rows ); 0, 2, rows - 1, rows );
TOOLTIP( p_module->p_config[i].psz_longtext )
gtk_container_add( GTK_CONTAINER(item_frame), item_event_box );
item_vbox = gtk_vbox_new( FALSE, 4 ); item_vbox = gtk_vbox_new( FALSE, 4 );
gtk_container_add( GTK_CONTAINER(item_event_box), item_vbox ); gtk_container_add( GTK_CONTAINER(item_frame), item_vbox );
/* create a new clist widget */ /* create a new clist widget */
{ {
...@@ -309,6 +353,10 @@ static void GtkCreateConfigDialog( char *psz_module_name, ...@@ -309,6 +353,10 @@ static void GtkCreateConfigDialog( char *psz_module_name,
gtk_button_new_with_label( _("Select") ); gtk_button_new_with_label( _("Select") );
gtk_container_add( GTK_CONTAINER(item_hbox), gtk_container_add( GTK_CONTAINER(item_hbox),
plugin_select_button ); plugin_select_button );
/* add a tooltip on mouseover */
gtk_tooltips_set_tip( p_intf->p_sys->p_tooltips,
plugin_select_button,
p_module->p_config[i].psz_longtext, "" );
/* hbox holding the "selected" label and text input */ /* hbox holding the "selected" label and text input */
item_hbox = gtk_hbox_new( FALSE, 4 ); item_hbox = gtk_hbox_new( FALSE, 4 );
...@@ -327,6 +375,10 @@ static void GtkCreateConfigDialog( char *psz_module_name, ...@@ -327,6 +375,10 @@ static void GtkCreateConfigDialog( char *psz_module_name,
p_module->p_config[i].psz_value ? p_module->p_config[i].psz_value ?
p_module->p_config[i].psz_value : "" ); p_module->p_config[i].psz_value : "" );
vlc_mutex_unlock( p_module->p_config[i].p_lock ); vlc_mutex_unlock( p_module->p_config[i].p_lock );
/* add a tooltip on mouseover */
gtk_tooltips_set_tip( p_intf->p_sys->p_tooltips,
string_entry,
p_module->p_config[i].psz_longtext, "" );
/* connect signals to the buttons */ /* connect signals to the buttons */
gtk_signal_connect( GTK_OBJECT(plugin_config_button), "clicked", gtk_signal_connect( GTK_OBJECT(plugin_config_button), "clicked",
...@@ -406,6 +458,7 @@ static void GtkCreateConfigDialog( char *psz_module_name, ...@@ -406,6 +458,7 @@ static void GtkCreateConfigDialog( char *psz_module_name,
bool_checkbutton, bool_checkbutton,
p_module->p_config[i].psz_longtext ); p_module->p_config[i].psz_longtext );
break; break;
} }
} }
...@@ -491,9 +544,7 @@ static void GtkCreateConfigDialog( char *psz_module_name, ...@@ -491,9 +544,7 @@ static void GtkCreateConfigDialog( char *psz_module_name,
gtk_widget_show_all( config_dialog ); gtk_widget_show_all( config_dialog );
} }
#undef FRAME #undef LABEL_AND_WIDGET
#undef SCROLLED_WINDOW
#undef LABEL
#undef TOOLTIP #undef TOOLTIP
/**************************************************************************** /****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment