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

📄 preferences.c

📁 video linux conference
💻 C
📖 第 1 页 / 共 4 页
字号:
                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 );                /* set the size of the scrolled window to the size of the                 * child widget */                gtk_widget_show_all( _vbox );                gtk_widget_size_request( _vbox, &_requisition );                if( _requisition.height > category_max_height )                    gtk_widget_set_usize( _scrolled_window, -1,                                          category_max_height );                else                    gtk_widget_set_usize( _scrolled_window, -1,                                          _requisition.height );            }            /*             * Now we can start taking care of the new category             */            if( p_item->i_type != CONFIG_HINT_END )            {                /* 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 */                if( p_item->i_type == CONFIG_HINT_CATEGORY )                    category_label = gtk_label_new( p_item->psz_text );                else                    category_label = gtk_label_new( p_parser->psz_longname );            }        }        switch( p_item->i_type )        {        case CONFIG_ITEM_MODULE:            item_frame = gtk_frame_new( p_item->psz_text );            gtk_table_resize( GTK_TABLE(category_table), ++rows, 2 );            gtk_table_attach_defaults( GTK_TABLE(category_table), item_frame,                                       0, 2, rows - 1, rows );            item_vbox = gtk_vbox_new( FALSE, 4 );            gtk_container_add( GTK_CONTAINER(item_frame), item_vbox );            /* create a new clist widget */            {                gchar * titles[] = { N_("Name"), N_("Description") };                titles[0] = _(titles[0]);                titles[1] = _(titles[1]);                module_clist = gtk_clist_new_with_titles( 2, titles );            }            gtk_object_set_data( GTK_OBJECT(module_clist), "p_intf", p_intf );            gtk_clist_column_titles_passive( GTK_CLIST(module_clist) );            gtk_clist_set_selection_mode( GTK_CLIST(module_clist),                                          GTK_SELECTION_SINGLE);            gtk_container_add( GTK_CONTAINER(item_vbox), module_clist );            /* build a list of available modules */            {                gchar * entry[2];                for( i_index = 0; i_index < p_list->i_count; i_index++ )                {                    p_parser = (module_t *)p_list->p_values[i_index].p_object ;                    if( !strcmp( p_parser->psz_capability,                                 p_item->psz_type ) )                    {                        entry[0] = p_parser->psz_object_name;                        entry[1] = p_parser->psz_longname;                        gtk_clist_append( GTK_CLIST(module_clist), entry );                    }                }            }            gtk_clist_set_column_auto_resize( GTK_CLIST(module_clist),                                              0, TRUE );            gtk_clist_set_column_auto_resize( GTK_CLIST(module_clist),                                              1, TRUE );            /* connect signals to the modules list */            gtk_signal_connect( GTK_OBJECT(module_clist), "select_row",                                GTK_SIGNAL_FUNC(GtkModuleHighlighted),                                NULL );            /* hbox holding the "select" and "configure" buttons */            item_hbox = gtk_hbox_new( FALSE, 4 );            gtk_container_add( GTK_CONTAINER(item_vbox), item_hbox);            /* add configure button */            module_config_button =                gtk_button_new_with_label( _("Configure") );            gtk_widget_set_sensitive( module_config_button, FALSE );            gtk_container_add( GTK_CONTAINER(item_hbox),                               module_config_button );            gtk_object_set_data( GTK_OBJECT(module_config_button),                                 "p_intf", p_intf );            gtk_object_set_data( GTK_OBJECT(module_clist),                                 "config_button", module_config_button );            /* add select button */            module_select_button =                gtk_button_new_with_label( _("Select") );            gtk_container_add( GTK_CONTAINER(item_hbox),                               module_select_button );            /* add a tooltip on mouseover */            gtk_tooltips_set_tip( p_intf->p_sys->p_tooltips,                                  module_select_button,                                  p_item->psz_longtext, "" );            /* hbox holding the "selected" label and text input */            item_hbox = gtk_hbox_new( FALSE, 4 );            gtk_container_add( GTK_CONTAINER(item_vbox), item_hbox);            /* add new label */            item_label = gtk_label_new( _("Selected:") );            gtk_container_add( GTK_CONTAINER(item_hbox), item_label );            /* add input box with default value */            string_entry = gtk_entry_new();            gtk_object_set_data( GTK_OBJECT(module_clist),                                 "module_entry", string_entry );            gtk_container_add( GTK_CONTAINER(item_hbox), string_entry );            vlc_mutex_lock( p_item->p_lock );            gtk_entry_set_text( GTK_ENTRY(string_entry),                                p_item->psz_value ? p_item->psz_value : "" );            vlc_mutex_unlock( p_item->p_lock );            /* add a tooltip on mouseover */            gtk_tooltips_set_tip( p_intf->p_sys->p_tooltips,                                  string_entry, p_item->psz_longtext, "" );            /* connect signals to the buttons */            gtk_signal_connect( GTK_OBJECT(module_config_button), "clicked",                                GTK_SIGNAL_FUNC(GtkModuleConfigure),                                (gpointer)module_clist );            gtk_signal_connect( GTK_OBJECT(module_select_button), "clicked",                                GTK_SIGNAL_FUNC(GtkModuleSelected),                                (gpointer)module_clist );            /* connect signal to track changes in the text box */            gtk_object_set_data( GTK_OBJECT(string_entry), "config_option",                                 p_item->psz_name );            gtk_signal_connect( GTK_OBJECT(string_entry), "changed",                                GTK_SIGNAL_FUNC(GtkStringChanged),                                (gpointer)config_dialog );            break;        case CONFIG_ITEM_STRING:        case CONFIG_ITEM_FILE:        case CONFIG_ITEM_DIRECTORY:            if( !p_item->ppsz_list )            {                /* add input box with default value */                item_combo = string_entry = gtk_entry_new();            }            else            {                /* add combo box with default value */                GList *items = NULL;                int i;                for( i=0; p_item->ppsz_list[i]; i++ )                    items = g_list_append( items, p_item->ppsz_list[i] );                item_combo = gtk_combo_new();                string_entry = GTK_COMBO(item_combo)->entry;                gtk_combo_set_popdown_strings( GTK_COMBO(item_combo),                                               items );            }            vlc_mutex_lock( p_item->p_lock );            gtk_entry_set_text( GTK_ENTRY(string_entry),                                p_item->psz_value ? p_item->psz_value : "" );            vlc_mutex_unlock( p_item->p_lock );            /* connect signal to track changes in the text box */            gtk_object_set_data( GTK_OBJECT(string_entry), "config_option",                                 p_item->psz_name );            gtk_signal_connect( GTK_OBJECT(string_entry), "changed",                                GTK_SIGNAL_FUNC(GtkStringChanged),                                (gpointer)config_dialog );            LABEL_AND_WIDGET( p_item->psz_text,                              item_combo, p_item->psz_longtext );            break;        case CONFIG_ITEM_INTEGER:            if (( p_item->i_max == 0) && ( p_item->i_min == 0))            {                /* add input box with default value */                item_adj = gtk_adjustment_new( p_item->i_value,                                               -1, 99999, 1, 10, 10 );                integer_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT(item_adj), 1, 0 );                /* connect signal to track changes in the spinbutton value */                gtk_object_set_data( GTK_OBJECT(integer_spinbutton),                                     "config_option", p_item->psz_name );                gtk_signal_connect( GTK_OBJECT(integer_spinbutton), "changed",                                    GTK_SIGNAL_FUNC(GtkIntChanged),                                    (gpointer)config_dialog );                LABEL_AND_WIDGET( p_item->psz_text,                                  integer_spinbutton, p_item->psz_longtext );            }            else /* use i_min and i_max */            {                item_adj = gtk_adjustment_new( p_item->i_value, p_item->i_min,                                               p_item->i_max, 1, 1, 0 );                integer_slider = gtk_hscale_new( GTK_ADJUSTMENT(item_adj));                gtk_scale_set_digits (GTK_SCALE(integer_slider), 0);                                                                /* connect signal to track changes in the spinbutton value */                gtk_object_set_data( GTK_OBJECT(item_adj),                                     "config_option", p_item->psz_name );                gtk_signal_connect( GTK_OBJECT(item_adj), "value-changed",                                    GTK_SIGNAL_FUNC(GtkIntRangedChanged),                                    (gpointer)config_dialog );                LABEL_AND_WIDGET( p_item->psz_text,                                  integer_slider, p_item->psz_longtext );            }            break;        case CONFIG_ITEM_FLOAT:            if (( p_item->f_max == 0.0) && ( p_item->f_min == 0.0))            {                /* add input box with default value */                item_adj = gtk_adjustment_new( p_item->f_value,                                               0, 99999, 0.01, 10, 10 );                float_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT(item_adj),                                                        0.01, 2 );                /* connect signal to track changes in the spinbutton value */                gtk_object_set_data( GTK_OBJECT(float_spinbutton),                                     "config_option", p_item->psz_name );                gtk_signal_connect( GTK_OBJECT(float_spinbutton), "changed",                                    GTK_SIGNAL_FUNC(GtkFloatChanged),                                    (gpointer)config_dialog );                LABEL_AND_WIDGET( p_item->psz_text,                                  float_spinbutton, p_item->psz_longtext );            }            else /* use f_min and f_max */            {                item_adj = gtk_adjustment_new( p_item->f_value, p_item->f_min,                                               p_item->f_max, 0.01, 0.01, 0 );                float_slider = gtk_hscale_new( GTK_ADJUSTMENT(item_adj));                gtk_scale_set_digits (GTK_SCALE(float_slider), 2);                                                                /* connect signal to track changes in the spinbutton value */                gtk_object_set_data( GTK_OBJECT(item_adj),                                     "config_option", p_item->psz_name );                gtk_signal_connect( GTK_OBJECT(item_adj), "value-changed",                                    GTK_SIGNAL_FUNC(GtkFloatRangedChanged),                                    (gpointer)config_dialog );                LABEL_AND_WIDGET( p_item->psz_text,                                  float_slider, p_item->psz_longtext );            }            break;

⌨️ 快捷键说明

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