⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gnome.c

📁 video linux conference
💻 C
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************** * gnome.c : Gnome plugin for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN * $Id: gnome.c 10101 2005-03-02 16:47:31Z robux4 $ * * Authors: Samuel Hocevar <sam@zoy.org> * * 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 * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA. *****************************************************************************//***************************************************************************** * Preamble *****************************************************************************/#include <stdlib.h>                                      /* malloc(), free() */#include <errno.h>                                                 /* ENOMEM */#include <string.h>                                            /* strerror() */#include <stdio.h>#include <vlc/vlc.h>#include <vlc/intf.h>#include <gnome.h>#include "gnome_callbacks.h"#include "gnome_interface.h"#include "gnome_support.h"#include "display.h"#include "common.h"/***************************************************************************** * Local prototypes. *****************************************************************************/static int  Open         ( vlc_object_t * );static void Close        ( vlc_object_t * );static void Run          ( intf_thread_t * );static void Manage       ( intf_thread_t * );/***************************************************************************** * Module descriptor *****************************************************************************/#define TOOLTIPS_TEXT N_("Show tooltips")#define TOOLTIPS_LONGTEXT N_("Show tooltips for configuration options.")#define TOOLBAR_TEXT N_("Show text on toolbar buttons")#define TOOLBAR_LONGTEXT N_("Show the text below icons on the toolbar.")#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.")#define PATH_TEXT N_("Interface default search path")#define PATH_LONGTEXT N_( \    "This option allows you to set the default path that the interface will " \    "open when looking for a file.")vlc_module_begin();#ifdef WIN32    int i = 90;#else    int i = getenv( "DISPLAY" ) == NULL ? 15 : 100;#endif    set_description( _("GNOME interface") );    set_category( CAT_INTERFACE );    set_subcategory( SUBCAT_INTERFACE_GENERAL );    add_bool( "gnome-tooltips", 1, E_(GtkHideTooltips),              TOOLTIPS_TEXT, TOOLTIPS_LONGTEXT, VLC_FALSE );    add_bool( "gnome-toolbartext", 1, GtkHideToolbarText, TOOLBAR_TEXT,              TOOLBAR_LONGTEXT, VLC_FALSE );    add_integer( "gnome-prefs-maxh", 480, NULL,                 PREFS_MAXH_TEXT, PREFS_MAXH_LONGTEXT, VLC_TRUE );    add_directory( "gnome-search-path", NULL, NULL, PATH_TEXT,                   PATH_LONGTEXT, VLC_TRUE );    set_capability( "interface", i );    set_callbacks( Open, Close );    set_program( "gnome-vlc" );vlc_module_end();/***************************************************************************** * Open: initialize and create window *****************************************************************************/static int Open( vlc_object_t *p_this ){    intf_thread_t *p_intf = (intf_thread_t *)p_this;    /* Allocate instance and initialize some members */    p_intf->p_sys = malloc( sizeof( intf_sys_t ) );    if( p_intf->p_sys == NULL )    {        msg_Err( p_intf, "out of memory" );        return VLC_ENOMEM;    }    p_intf->p_sys->p_gtk_main =        module_Need( p_this, "gui-helper", "gnome", VLC_TRUE );    if( p_intf->p_sys->p_gtk_main == NULL )    {        free( p_intf->p_sys );        return VLC_ENOMOD;    }    p_intf->pf_run = Run;    p_intf->p_sys->p_sub = msg_Subscribe( p_intf );    /* Initialize Gnome thread */    p_intf->p_sys->b_playing = VLC_FALSE;    p_intf->p_sys->b_deinterlace_update = VLC_FALSE;    p_intf->p_sys->b_aout_update = VLC_FALSE;    p_intf->p_sys->b_vout_update = VLC_FALSE;    p_intf->p_sys->b_popup_changed = VLC_FALSE;    p_intf->p_sys->b_window_changed = VLC_FALSE;    p_intf->p_sys->b_playlist_changed = VLC_FALSE;    p_intf->p_sys->b_program_update = VLC_FALSE;    p_intf->p_sys->b_title_update = VLC_FALSE;    p_intf->p_sys->b_chapter_update = VLC_FALSE;    p_intf->p_sys->b_spu_update = VLC_FALSE;    p_intf->p_sys->b_audio_update = VLC_FALSE;    p_intf->p_sys->p_input = NULL;    p_intf->p_sys->i_playing = -1;    p_intf->p_sys->b_slider_free = VLC_TRUE;    p_intf->p_sys->i_part = 0;    p_intf->p_sys->b_mute = VLC_FALSE;    return VLC_SUCCESS;}/***************************************************************************** * Close: destroy interface window *****************************************************************************/static void Close( vlc_object_t *p_this ){    intf_thread_t *p_intf = (intf_thread_t *)p_this;    if( p_intf->p_sys->p_input )    {        vlc_object_release( p_intf->p_sys->p_input );    }    msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );    module_Unneed( p_intf, p_intf->p_sys->p_gtk_main );    /* Destroy structure */    free( p_intf->p_sys );}/***************************************************************************** * Run: Gnome thread ***************************************************************************** * this part of the interface is in a separate thread so that we can call * gtk_main() from within it without annoying the rest of the program. * XXX: the approach may look kludgy, and probably is, but I could not find * a better way to dynamically load a Gnome interface at runtime. *****************************************************************************/static void Run( intf_thread_t *p_intf ){    /* The data types we are allowed to receive */    static GtkTargetEntry target_table[] =    {        { "STRING", 0, DROP_ACCEPT_STRING },        { "text/uri-list", 0, DROP_ACCEPT_TEXT_URI_LIST },        { "text/plain",    0, DROP_ACCEPT_TEXT_PLAIN }    };    char *psz_sout;    GString *       p_target;    gdk_threads_enter();    /* Create some useful widgets that will certainly be used */    p_intf->p_sys->p_window = create_intf_window( );    p_intf->p_sys->p_popup = create_intf_popup( );    p_intf->p_sys->p_playwin = create_intf_playlist();    p_intf->p_sys->p_messages = create_intf_messages();    p_intf->p_sys->p_tooltips = gtk_tooltips_new();    p_intf->p_sys->p_sout = create_intf_sout();    /* Set the title of the main window */    gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),                          VOUT_TITLE " (Gnome interface)");    /* Accept file drops on the main window */    gtk_drag_dest_set( GTK_WIDGET( p_intf->p_sys->p_window ),                       GTK_DEST_DEFAULT_ALL, target_table,                       DROP_ACCEPT_END, GDK_ACTION_COPY );    /* Accept file drops on the playlist window */    gtk_drag_dest_set( GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(                            p_intf->p_sys->p_playwin ), "playlist_clist") ),                       GTK_DEST_DEFAULT_ALL, target_table,                       DROP_ACCEPT_END, GDK_ACTION_COPY );    /* 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" );    p_intf->p_sys->p_label_chapter = P_LABEL( "chapter_label" );    #undef P_LABEL    /* Connect the date display to the slider */    #define P_SLIDER GTK_RANGE( gtk_object_get_data( \                         GTK_OBJECT( p_intf->p_sys->p_window ), "slider" ) )    p_intf->p_sys->p_adj = gtk_range_get_adjustment( P_SLIDER );    gtk_signal_connect ( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed",                         GTK_SIGNAL_FUNC( E_(GtkDisplayDate) ), NULL );    p_intf->p_sys->f_adj_oldvalue = 0;    #undef P_SLIDER    /* We don't create these ones yet because we perhaps won't need them */    p_intf->p_sys->p_about = NULL;    p_intf->p_sys->p_modules = NULL;    p_intf->p_sys->p_open = NULL;    p_intf->p_sys->p_jump = NULL;    /* Hide tooltips if the option is set */    if( !config_GetInt( p_intf, "gnome-tooltips" ) )    {        gtk_tooltips_disable( p_intf->p_sys->p_tooltips );    }    /* Hide toolbar text of the option is set */    if( !config_GetInt( p_intf, "gnome-toolbartext" ) )    {        gtk_toolbar_set_style(            GTK_TOOLBAR(lookup_widget( p_intf->p_sys->p_window, "toolbar" )),            GTK_TOOLBAR_ICONS );    }    /* Store p_intf to keep an eye on it */    gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),                         "p_intf", 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 );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -