From a53ff165ced4c13b8f274cf2b7de2fbf23e4bef4 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 20 Feb 2002 05:56:18 +0000 Subject: [PATCH] * ./plugins/gtk/gtk.c: the log window is now black with colourful text. * ./plugins/gtk/gnome.c: ported the log window to the GNOME interface. * ./src/interface/intf_msg.c: messages are sent to the queue even if -vvvv* wasn't specified. --- plugins/gtk/gnome.c | 67 ++++++++++++++++++++- plugins/gtk/gnome.glade | 108 ++++++++++++++++++++++++++++++++++ plugins/gtk/gnome_callbacks.c | 9 +++ plugins/gtk/gnome_callbacks.h | 4 ++ plugins/gtk/gnome_interface.c | 74 +++++++++++++++++++++++ plugins/gtk/gnome_interface.h | 1 + plugins/gtk/gtk.c | 55 ++++++++++++----- plugins/gtk/gtk_callbacks.c | 14 ++++- plugins/gtk/gtk_interface.c | 14 ++--- plugins/gtk/gtk_support.h | 4 +- plugins/lirc/lirc.c | 4 +- plugins/text/logger.c | 27 +++++---- src/interface/intf_msg.c | 37 ++++++------ 13 files changed, 354 insertions(+), 64 deletions(-) diff --git a/plugins/gtk/gnome.c b/plugins/gtk/gnome.c index 4ecaeffe97..3a5008dd85 100644 --- a/plugins/gtk/gnome.c +++ b/plugins/gtk/gnome.c @@ -2,7 +2,7 @@ * gnome.c : Gnome plugin for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: gnome.c,v 1.10 2002/02/19 00:50:19 sam Exp $ + * $Id: gnome.c,v 1.11 2002/02/20 05:56:17 sam Exp $ * * Authors: Samuel Hocevar * @@ -141,6 +141,8 @@ static int intf_Open( intf_thread_t *p_intf ) return( 1 ); } + p_intf->p_sys->p_sub = intf_MsgSub(); + /* Initialize Gnome thread */ p_intf->p_sys->b_playing = 0; p_intf->p_sys->b_popup_changed = 0; @@ -160,6 +162,8 @@ static int intf_Open( intf_thread_t *p_intf ) *****************************************************************************/ static void intf_Close( intf_thread_t *p_intf ) { + intf_MsgUnsub( p_intf->p_sys->p_sub ); + /* Destroy structure */ free( p_intf->p_sys ); } @@ -195,6 +199,7 @@ static void intf_Run( intf_thread_t *p_intf ) p_intf->p_sys->p_window = create_intf_window( ); p_intf->p_sys->p_popup = create_intf_popup( ); p_intf->p_sys->p_playlist = create_intf_playlist(); + p_intf->p_sys->p_messages = create_intf_messages(); /* Set the title of the main window */ gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window), @@ -210,9 +215,17 @@ static void intf_Run( intf_thread_t *p_intf ) GTK_DEST_DEFAULT_ALL, target_table, 1, GDK_ACTION_COPY ); - /* Get the interface labels */ + /* Get the slider object */ p_intf->p_sys->p_slider_frame = gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_window ), "slider_frame" ); + + /* Configure the log window */ + p_intf->p_sys->p_messages_text = GTK_TEXT( gtk_object_get_data( + GTK_OBJECT(p_intf->p_sys->p_messages ), "messages_textbox" ) ); + gtk_text_set_line_wrap( p_intf->p_sys->p_messages_text, TRUE); + gtk_text_set_word_wrap( p_intf->p_sys->p_messages_text, FALSE); + + /* Get the interface labels */ #define P_LABEL( name ) GTK_LABEL( gtk_object_get_data( \ GTK_OBJECT( p_intf->p_sys->p_window ), name ) ) p_intf->p_sys->p_label_title = P_LABEL( "title_label" ); @@ -248,6 +261,9 @@ static void intf_Run( intf_thread_t *p_intf ) gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_playlist ), "p_intf", p_intf ); + gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_messages ), + "p_intf", p_intf ); + gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_adj), "p_intf", p_intf ); @@ -284,6 +300,12 @@ static void intf_Run( intf_thread_t *p_intf ) static gint GnomeManage( gpointer p_data ) { #define p_intf ((intf_thread_t *)p_data) + static GdkColor white = { 0, 0xffff, 0xffff, 0xffff }; + static GdkColor red = { 0, 0xffff, 0x6666, 0x6666 }; + static GdkColor gray = { 0, 0xaaaa, 0xaaaa, 0xaaaa }; + GdkColor *p_color; + + int i_start, i_stop; vlc_mutex_lock( &p_intf->change_lock ); @@ -302,7 +324,46 @@ static gint GnomeManage( gpointer p_data ) p_intf->b_menu_change = 0; } - /* update the playlist */ + /* Update the log window */ + vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock ); + i_stop = *p_intf->p_sys->p_sub->pi_stop; + vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock ); + + if( p_intf->p_sys->p_sub->i_start != i_stop ) + { + for( i_start = p_intf->p_sys->p_sub->i_start; + i_start != i_stop; + i_start = (i_start+1) % INTF_MSG_QSIZE ) + { + /* Append all messages to log window */ + switch( p_intf->p_sys->p_sub->p_msg[i_start].i_type ) + { + case INTF_MSG_ERR: + p_color = &red; + break; + case INTF_MSG_WARN: + p_color = &gray; + break; + default: + p_color = &white; + break; + } + + gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, p_color, + NULL, p_intf->p_sys->p_sub->p_msg[i_start].psz_msg, -1 ); + gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, p_color, + NULL, "\n", -1 ); + } + + vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock ); + p_intf->p_sys->p_sub->i_start = i_start; + vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock ); + + gtk_text_set_point( p_intf->p_sys->p_messages_text, + gtk_text_get_length( p_intf->p_sys->p_messages_text ) ); + } + + /* Update the playlist */ GtkPlayListManage( p_intf ); if( p_input_bank->pp_input[0] != NULL && !p_intf->b_die ) diff --git a/plugins/gtk/gnome.glade b/plugins/gtk/gnome.glade index c094a3e46a..c9f24d4889 100644 --- a/plugins/gtk/gnome.glade +++ b/plugins/gtk/gnome.glade @@ -267,6 +267,19 @@ False GNOME_STOCK_MENU_ATTACH + + + GtkMenuItem + menubar_messages + Open the messages window + + activate + GnomeMenubarMessagesActivate + Wed, 20 Feb 2002 05:43:55 GMT + + + False + @@ -5366,4 +5379,99 @@ Stereo + + GnomeDialog + intf_messages + + destroy + gtk_widget_hide + "intf_playlist" + Wed, 20 Feb 2002 05:11:27 GMT + + + delete_event + gtk_widget_hide + "intf_playlist" + Wed, 20 Feb 2002 05:11:27 GMT + + Messages + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + True + False + False + True + + + GtkVBox + GnomeDialog:vbox + dialog-vbox6 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area6 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + messages_ok + True + True + + clicked + GtkMessagesOk + "intf_messages" + Wed, 20 Feb 2002 05:12:11 GMT + + GNOME_STOCK_BUTTON_OK + + + + + GtkScrolledWindow + scrolledwindow1 + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkText + messages_textbox + 600 + 400 + True + False + + + + + + diff --git a/plugins/gtk/gnome_callbacks.c b/plugins/gtk/gnome_callbacks.c index 56473f8dc3..e9c0825419 100644 --- a/plugins/gtk/gnome_callbacks.c +++ b/plugins/gtk/gnome_callbacks.c @@ -265,3 +265,12 @@ GnomePopupJumpActivate (GtkMenuItem *menuitem, { GtkJumpShow( GTK_WIDGET( menuitem ), NULL, "intf_popup" ); } + + +void +GnomeMenubarMessagesActivate (GtkMenuItem *menuitem, + gpointer user_data) +{ + GtkMessagesShow( GTK_WIDGET( menuitem ), NULL, "intf_window" ); +} + diff --git a/plugins/gtk/gnome_callbacks.h b/plugins/gtk/gnome_callbacks.h index bbf1089f47..50be245a71 100644 --- a/plugins/gtk/gnome_callbacks.h +++ b/plugins/gtk/gnome_callbacks.h @@ -146,3 +146,7 @@ void GtkNetworkOpenChannel (GtkToggleButton *togglebutton, gpointer user_data); + +void +GnomeMenubarMessagesActivate (GtkMenuItem *menuitem, + gpointer user_data); diff --git a/plugins/gtk/gnome_interface.c b/plugins/gtk/gnome_interface.c index 22aec155ff..f2e2790002 100644 --- a/plugins/gtk/gnome_interface.c +++ b/plugins/gtk/gnome_interface.c @@ -102,6 +102,13 @@ static GnomeUIInfo menubar_view_menu_uiinfo[] = GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ATTACH, 0, (GdkModifierType) 0, NULL }, + { + GNOME_APP_UI_ITEM, N_("Messages..."), + N_("Open the messages window"), + (gpointer) GnomeMenubarMessagesActivate, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, GNOMEUIINFO_END }; @@ -297,6 +304,11 @@ create_intf_window (void) (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", + menubar_view_menu_uiinfo[9].widget, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_ref (menubar_uiinfo[2].widget); gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_settings", menubar_uiinfo[2].widget, @@ -3494,3 +3506,65 @@ create_intf_open (void) return intf_open; } +GtkWidget* +create_intf_messages (void) +{ + GtkWidget *intf_messages; + GtkWidget *dialog_vbox6; + GtkWidget *scrolledwindow1; + GtkWidget *messages_textbox; + GtkWidget *dialog_action_area6; + GtkWidget *messages_ok; + + intf_messages = gnome_dialog_new (_("Messages"), NULL); + gtk_object_set_data (GTK_OBJECT (intf_messages), "intf_messages", intf_messages); + gtk_window_set_policy (GTK_WINDOW (intf_messages), TRUE, TRUE, FALSE); + gnome_dialog_close_hides (GNOME_DIALOG (intf_messages), TRUE); + + dialog_vbox6 = GNOME_DIALOG (intf_messages)->vbox; + gtk_object_set_data (GTK_OBJECT (intf_messages), "dialog_vbox6", dialog_vbox6); + gtk_widget_show (dialog_vbox6); + + scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_ref (scrolledwindow1); + gtk_object_set_data_full (GTK_OBJECT (intf_messages), "scrolledwindow1", scrolledwindow1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (scrolledwindow1); + gtk_box_pack_start (GTK_BOX (dialog_vbox6), scrolledwindow1, TRUE, TRUE, 0); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); + + messages_textbox = gtk_text_new (NULL, NULL); + gtk_widget_ref (messages_textbox); + gtk_object_set_data_full (GTK_OBJECT (intf_messages), "messages_textbox", messages_textbox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (messages_textbox); + gtk_container_add (GTK_CONTAINER (scrolledwindow1), messages_textbox); + gtk_widget_set_usize (messages_textbox, 600, 400); + + dialog_action_area6 = GNOME_DIALOG (intf_messages)->action_area; + gtk_object_set_data (GTK_OBJECT (intf_messages), "dialog_action_area6", dialog_action_area6); + gtk_widget_show (dialog_action_area6); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area6), GTK_BUTTONBOX_END); + gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area6), 8); + + gnome_dialog_append_button (GNOME_DIALOG (intf_messages), GNOME_STOCK_BUTTON_OK); + messages_ok = GTK_WIDGET (g_list_last (GNOME_DIALOG (intf_messages)->buttons)->data); + gtk_widget_ref (messages_ok); + gtk_object_set_data_full (GTK_OBJECT (intf_messages), "messages_ok", messages_ok, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (messages_ok); + GTK_WIDGET_SET_FLAGS (messages_ok, GTK_CAN_DEFAULT); + + gtk_signal_connect (GTK_OBJECT (intf_messages), "destroy", + GTK_SIGNAL_FUNC (gtk_widget_hide), + "intf_playlist"); + gtk_signal_connect (GTK_OBJECT (intf_messages), "delete_event", + GTK_SIGNAL_FUNC (gtk_widget_hide), + "intf_playlist"); + gtk_signal_connect (GTK_OBJECT (messages_ok), "clicked", + GTK_SIGNAL_FUNC (GtkMessagesOk), + "intf_messages"); + + return intf_messages; +} + diff --git a/plugins/gtk/gnome_interface.h b/plugins/gtk/gnome_interface.h index f9d1ea0845..8c368a9d00 100644 --- a/plugins/gtk/gnome_interface.h +++ b/plugins/gtk/gnome_interface.h @@ -13,3 +13,4 @@ GtkWidget* create_intf_playlist (void); GtkWidget* create_intf_jump (void); GtkWidget* create_intf_preferences (void); GtkWidget* create_intf_open (void); +GtkWidget* create_intf_messages (void); diff --git a/plugins/gtk/gtk.c b/plugins/gtk/gtk.c index 19f0ade7a0..bf1464d080 100644 --- a/plugins/gtk/gtk.c +++ b/plugins/gtk/gtk.c @@ -2,7 +2,7 @@ * gtk.c : Gtk+ plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: gtk.c,v 1.12 2002/02/19 03:54:55 sam Exp $ + * $Id: gtk.c,v 1.13 2002/02/20 05:56:17 sam Exp $ * * Authors: Samuel Hocevar * @@ -218,13 +218,15 @@ static void intf_Run( intf_thread_t *p_intf ) GTK_DEST_DEFAULT_ALL, target_table, 1, GDK_ACTION_COPY ); + /* Get the slider object */ p_intf->p_sys->p_slider_frame = GTK_FRAME( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_window ), "slider_frame" ) ); + /* Configure the log window */ p_intf->p_sys->p_messages_text = GTK_TEXT( gtk_object_get_data( GTK_OBJECT(p_intf->p_sys->p_messages ), "messages_textbox" ) ); gtk_text_set_line_wrap( p_intf->p_sys->p_messages_text, TRUE); - gtk_text_set_word_wrap( p_intf->p_sys->p_messages_text, TRUE); + gtk_text_set_word_wrap( p_intf->p_sys->p_messages_text, FALSE); /* Get the interface labels */ #define P_LABEL( name ) GTK_LABEL( gtk_object_get_data( \ @@ -301,6 +303,11 @@ static void intf_Run( intf_thread_t *p_intf ) static gint GtkManage( gpointer p_data ) { #define p_intf ((intf_thread_t *)p_data) + static GdkColor white = { 0, 0xffff, 0xffff, 0xffff }; + static GdkColor red = { 0, 0xffff, 0x6666, 0x6666 }; + static GdkColor gray = { 0, 0xaaaa, 0xaaaa, 0xaaaa }; + GdkColor *p_color; + int i_start, i_stop; vlc_mutex_lock( &p_intf->change_lock ); @@ -324,23 +331,39 @@ static gint GtkManage( gpointer p_data ) i_stop = *p_intf->p_sys->p_sub->pi_stop; vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock ); - for( i_start = p_intf->p_sys->p_sub->i_start; - i_start != i_stop; - i_start = (i_start+1) % INTF_MSG_QSIZE ) + if( p_intf->p_sys->p_sub->i_start != i_stop ) { - /* Append all messages to log window */ - gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, NULL, NULL, - p_intf->p_sys->p_sub->p_msg[i_start].psz_msg, -1 ); - gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, NULL, NULL, - "\n", -1 ); - } + for( i_start = p_intf->p_sys->p_sub->i_start; + i_start != i_stop; + i_start = (i_start+1) % INTF_MSG_QSIZE ) + { + /* Append all messages to log window */ + switch( p_intf->p_sys->p_sub->p_msg[i_start].i_type ) + { + case INTF_MSG_ERR: + p_color = &red; + break; + case INTF_MSG_WARN: + p_color = &gray; + break; + default: + p_color = &white; + break; + } - vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock ); - p_intf->p_sys->p_sub->i_start = i_start; - vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock ); + gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, p_color, + NULL, p_intf->p_sys->p_sub->p_msg[i_start].psz_msg, -1 ); + gtk_text_insert( p_intf->p_sys->p_messages_text, NULL, p_color, + NULL, "\n", -1 ); + } - gtk_text_set_point( p_intf->p_sys->p_messages_text, - gtk_text_get_length( p_intf->p_sys->p_messages_text ) ); + vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock ); + p_intf->p_sys->p_sub->i_start = i_start; + vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock ); + + gtk_text_set_point( p_intf->p_sys->p_messages_text, + gtk_text_get_length( p_intf->p_sys->p_messages_text ) ); + } /* Update the playlist */ GtkPlayListManage( p_data ); diff --git a/plugins/gtk/gtk_callbacks.c b/plugins/gtk/gtk_callbacks.c index b92c8f9ce6..27efe70ed1 100644 --- a/plugins/gtk/gtk_callbacks.c +++ b/plugins/gtk/gtk_callbacks.c @@ -2,7 +2,7 @@ * gtk_callbacks.c : Callbacks for the Gtk+ plugin. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gtk_callbacks.c,v 1.32 2002/02/19 03:54:55 sam Exp $ + * $Id: gtk_callbacks.c,v 1.33 2002/02/20 05:56:17 sam Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -532,9 +532,21 @@ gboolean GtkMessagesShow( GtkWidget *widget, GdkEventButton *event, gpointer user_data) { + static GdkColor black = { 0, 0x0000, 0x0000, 0x0000 }; + static GdkColormap *colormap; intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data ); + gtk_widget_show( p_intf->p_sys->p_messages ); + colormap = gdk_colormap_get_system (); + gdk_color_alloc( colormap, &black ); + gdk_window_set_background( p_intf->p_sys->p_messages_text->text_area, + &black ); + gdk_window_raise( p_intf->p_sys->p_messages->window ); + + gtk_text_set_point( p_intf->p_sys->p_messages_text, + gtk_text_get_length( p_intf->p_sys->p_messages_text ) ); + return TRUE; } diff --git a/plugins/gtk/gtk_interface.c b/plugins/gtk/gtk_interface.c index b649de5d9a..ca2d5fa6cd 100644 --- a/plugins/gtk/gtk_interface.c +++ b/plugins/gtk/gtk_interface.c @@ -1,10 +1,6 @@ -/* - * DO NOT EDIT THIS FILE - it is generated by Glade. - */ +/* This file was created automatically by glade and fixed by fixfiles.sh */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include #include @@ -1585,7 +1581,7 @@ create_intf_disc (void) (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (disc_name); gtk_box_pack_start (GTK_BOX (hbox2), disc_name, TRUE, TRUE, 0); - gtk_entry_set_text (GTK_ENTRY (disc_name), _("/dev/dvd")); + gtk_entry_set_text (GTK_ENTRY (disc_name), DVD_DEVICE); dialog_action_area1 = GTK_DIALOG (intf_disc)->action_area; gtk_object_set_data (GTK_OBJECT (intf_disc), "dialog_action_area1", dialog_action_area1); @@ -2531,7 +2527,7 @@ create_intf_preferences (void) gtk_table_attach (GTK_TABLE (preferences_disc_table), preferences_disc_dvd_combo, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND), 0, 0); - preferences_disc_dvd_combo_items = g_list_append (preferences_disc_dvd_combo_items, (gpointer) _("/dev/dvd")); + preferences_disc_dvd_combo_items = g_list_append (preferences_disc_dvd_combo_items, (gpointer) DVD_DEVICE); gtk_combo_set_popdown_strings (GTK_COMBO (preferences_disc_dvd_combo), preferences_disc_dvd_combo_items); g_list_free (preferences_disc_dvd_combo_items); @@ -2540,7 +2536,7 @@ create_intf_preferences (void) gtk_object_set_data_full (GTK_OBJECT (intf_preferences), "preferences_disc_dvd_entry", preferences_disc_dvd_entry, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (preferences_disc_dvd_entry); - gtk_entry_set_text (GTK_ENTRY (preferences_disc_dvd_entry), _("/dev/dvd")); + gtk_entry_set_text (GTK_ENTRY (preferences_disc_dvd_entry), DVD_DEVICE); preferences_disc_vcd_combo = gtk_combo_new (); gtk_widget_ref (preferences_disc_vcd_combo); diff --git a/plugins/gtk/gtk_support.h b/plugins/gtk/gtk_support.h index 931bc5ad04..17b71ecdec 100644 --- a/plugins/gtk/gtk_support.h +++ b/plugins/gtk/gtk_support.h @@ -1,5 +1,5 @@ /* - * DO NOT EDIT THIS FILE - it is generated by Glade. + * This file was created automatically by glade and fixed by fixfiles.sh */ #ifdef HAVE_CONFIG_H @@ -11,7 +11,7 @@ /* * Standard gettext macros. */ -#ifdef ENABLE_NLS +#if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT ) # include # undef _ # define _(String) dgettext (PACKAGE, String) diff --git a/plugins/lirc/lirc.c b/plugins/lirc/lirc.c index fe5c45de26..9ae8593431 100644 --- a/plugins/lirc/lirc.c +++ b/plugins/lirc/lirc.c @@ -2,7 +2,7 @@ * lirc.c : lirc plugin for vlc ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: lirc.c,v 1.5 2002/02/20 01:47:01 sam Exp $ + * $Id: lirc.c,v 1.6 2002/02/20 05:56:18 sam Exp $ * * Authors: Sigmund Augdal * @@ -145,7 +145,6 @@ static void intf_Run( intf_thread_t *p_intf ) while( !p_intf->b_die && lirc_nextcode(&code) == 0 ) { -printf("code\n"); if( code == NULL ) { continue; @@ -270,6 +269,5 @@ printf("code\n"); /* Manage core vlc functions through the callback */ p_intf->pf_manage( p_intf ); } -printf("end of intf\n"); } diff --git a/plugins/text/logger.c b/plugins/text/logger.c index dbec1b56d8..ab04952f28 100644 --- a/plugins/text/logger.c +++ b/plugins/text/logger.c @@ -2,7 +2,7 @@ * logger.c : file logging plugin for vlc ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: logger.c,v 1.2 2002/02/19 03:54:56 sam Exp $ + * $Id: logger.c,v 1.3 2002/02/20 05:56:18 sam Exp $ * * Authors: Samuel Hocevar * @@ -187,18 +187,21 @@ static void FlushQueue( intf_subscription_t *p_sub, FILE *p_file ) i_stop = *p_sub->pi_stop; vlc_mutex_unlock( p_sub->p_lock ); - /* Append all messages to log file */ - for( i_start = p_sub->i_start; - i_start != i_stop; - i_start = (i_start+1) % INTF_MSG_QSIZE ) + if( p_sub->i_start != i_stop ) { - psz_msg = p_sub->p_msg[i_start].psz_msg; - LOG_STRING( psz_msg, p_file ); - LOG_STRING( "\n", p_file ); + /* Append all messages to log file */ + for( i_start = p_sub->i_start; + i_start != i_stop; + i_start = (i_start+1) % INTF_MSG_QSIZE ) + { + psz_msg = p_sub->p_msg[i_start].psz_msg; + LOG_STRING( psz_msg, p_file ); + LOG_STRING( "\n", p_file ); + } + + vlc_mutex_lock( p_sub->p_lock ); + p_sub->i_start = i_start; + vlc_mutex_unlock( p_sub->p_lock ); } - - vlc_mutex_lock( p_sub->p_lock ); - p_sub->i_start = i_start; - vlc_mutex_unlock( p_sub->p_lock ); } diff --git a/src/interface/intf_msg.c b/src/interface/intf_msg.c index e2d57c2d3c..0ce5ed0b8d 100644 --- a/src/interface/intf_msg.c +++ b/src/interface/intf_msg.c @@ -4,7 +4,7 @@ * interface, such as message output. See config.h for output configuration. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: intf_msg.c,v 1.44 2002/02/19 03:54:56 sam Exp $ + * $Id: intf_msg.c,v 1.45 2002/02/20 05:56:18 sam Exp $ * * Authors: Vincent Seguin * @@ -69,8 +69,8 @@ msg_bank_t msg_bank; /***************************************************************************** * Local prototypes *****************************************************************************/ -static void QueueMsg ( int, char *, va_list ); -static void FlushLockedMsg ( void ); +static void QueueMsg ( int, int, char *, va_list ); +static void FlushMsg ( void ); #if defined( WIN32 ) static char *ConvertPrintfFormatString ( char *psz_format ); @@ -111,7 +111,7 @@ void intf_MsgDestroy( void ) } /* Free remaining messages */ - FlushLockedMsg( ); + FlushMsg( ); } /***************************************************************************** @@ -190,7 +190,7 @@ void intf_Msg( char *psz_format, ... ) va_list ap; va_start( ap, psz_format ); - QueueMsg( INTF_MSG_STD, psz_format, ap ); + QueueMsg( INTF_MSG_STD, 0, psz_format, ap ); va_end( ap ); } @@ -205,7 +205,7 @@ void intf_ErrMsg( char *psz_format, ... ) va_list ap; va_start( ap, psz_format ); - QueueMsg( INTF_MSG_ERR, psz_format, ap ); + QueueMsg( INTF_MSG_ERR, 0, psz_format, ap ); va_end( ap ); } @@ -219,12 +219,9 @@ void intf_WarnMsg( int i_level, char *psz_format, ... ) { va_list ap; - if( i_level <= p_main->i_warning_level ) - { - va_start( ap, psz_format ); - QueueMsg( INTF_MSG_WARN, psz_format, ap ); - va_end( ap ); - } + va_start( ap, psz_format ); + QueueMsg( INTF_MSG_WARN, i_level, psz_format, ap ); + va_end( ap ); } /***************************************************************************** @@ -240,7 +237,7 @@ void intf_StatMsg( char *psz_format, ... ) if( p_main->b_stats ) { va_start( ap, psz_format ); - QueueMsg( INTF_MSG_STAT, psz_format, ap ); + QueueMsg( INTF_MSG_STAT, 0, psz_format, ap ); va_end( ap ); } } @@ -292,7 +289,7 @@ void intf_WarnHexDump( int i_level, void *p_data, int i_size ) * is full. If the message can't be converted to string in memory, it exit the * program. If the queue is not used, it prints the message immediately. *****************************************************************************/ -static void QueueMsg( int i_type, char *psz_format, va_list ap ) +static void QueueMsg( int i_type, int i_level, char *psz_format, va_list ap ) { char * psz_str; /* formatted message string */ msg_item_t * p_item; /* pointer to message */ @@ -332,11 +329,15 @@ static void QueueMsg( int i_type, char *psz_format, va_list ap ) vlc_mutex_lock( &msg_bank.lock ); /* Send the message to stderr */ - fprintf( stderr, "%s\n", psz_str ); + if( i_level <= p_main->i_warning_level ) + { + fprintf( stderr, "%s\n", psz_str ); + } + /* Put the message in the queue if there is room for it */ if( ((msg_bank.i_stop - msg_bank.i_start + 1) % INTF_MSG_QSIZE) == 0 ) { - FlushLockedMsg( ); + FlushMsg( ); if( ((msg_bank.i_stop - msg_bank.i_start + 1) % INTF_MSG_QSIZE) == 0 ) { @@ -357,12 +358,12 @@ static void QueueMsg( int i_type, char *psz_format, va_list ap ) } /***************************************************************************** - * FlushLockedMsg (ok ?) + * FlushMsg ***************************************************************************** * Print all messages remaining in queue. MESSAGE QUEUE MUST BE LOCKED, since * this function does not check the lock. *****************************************************************************/ -static void FlushLockedMsg ( void ) +static void FlushMsg ( void ) { int i_index, i_start, i_stop; -- 2.39.5