diff options
author | jstebbins <[email protected]> | 2011-09-19 16:54:09 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-09-19 16:54:09 +0000 |
commit | 425fbc1171959cf2257e71933d87e2a88589016d (patch) | |
tree | 7f7fa22cb13ff40846662553de997683711a914e /gtk/src | |
parent | 243f77efd0bede0ea44f63e309b8fcb3b29b5cbc (diff) |
LinGui: add source type filter to source dialog
Lets you filter down the list to just the files you are interested
in seeing.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4234 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r-- | gtk/src/ghb.ui | 26 | ||||
-rw-r--r-- | gtk/src/main.c | 96 |
2 files changed, 122 insertions, 0 deletions
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index ce8425bb2..e43fb7b17 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -298,6 +298,32 @@ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="stock">gtk-add</property> </object> + <object class="GtkFileFilter" id="SourceFilterAll"> + </object> + <object class="GtkFileFilter" id="SourceFilterTS"> + </object> + <object class="GtkFileFilter" id="SourceFilterMPG"> + </object> + <object class="GtkFileFilter" id="SourceFilterEVO"> + </object> + <object class="GtkFileFilter" id="SourceFilterVOB"> + </object> + <object class="GtkFileFilter" id="SourceFilterMKV"> + </object> + <object class="GtkFileFilter" id="SourceFilterAVI"> + </object> + <object class="GtkFileFilter" id="SourceFilterMP4"> + </object> + <object class="GtkFileFilter" id="SourceFilterMOV"> + </object> + <object class="GtkFileFilter" id="SourceFilterOGG"> + </object> + <object class="GtkFileFilter" id="SourceFilterFLV"> + </object> + <object class="GtkFileFilter" id="SourceFilterWMV"> + </object> + <object class="GtkFileFilter" id="SourceFilterVideo"> + </object> <object class="GtkUIManager" id="uimanager1"> <child> <object class="GtkActionGroup" id="actiongroup1"> diff --git a/gtk/src/main.c b/gtk/src/main.c index 3c49e8766..3c771aedc 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -997,6 +997,102 @@ main (int argc, char *argv[]) gtk_window_resize(GTK_WINDOW(widget), width, height); gtk_widget_show(widget); + /* + * Filter objects in GtkBuilder xml + * Unfortunately, GtkFilter is poorly supported by GtkBuilder, + * so a lot of the setup must happen in code. + SourceFilterAll + SourceFilterVideo + SourceFilterTS + SourceFilterMPG + SourceFilterEVO + SourceFilterVOB + SourceFilterMKV + SourceFilterMP4 + SourceFilterAVI + SourceFilterMOV + SourceFilterOGG + SourceFilterFLV + SourceFilterWMV + */ + // Add filters to source chooser + GtkFileFilter *filter; + GtkFileChooser *chooser; + chooser = GTK_FILE_CHOOSER(GHB_WIDGET(ud->builder, "source_dialog")); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterAll")); + gtk_file_filter_set_name(filter, "All"); + gtk_file_filter_add_pattern(filter, "*"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterVideo")); + gtk_file_filter_set_name(filter, "Video"); + gtk_file_filter_add_mime_type(filter, "video/*"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterTS")); + gtk_file_filter_set_name(filter, "TS"); + gtk_file_filter_add_pattern(filter, "*.ts"); + gtk_file_filter_add_pattern(filter, "*.TS"); + gtk_file_filter_add_pattern(filter, "*.m2ts"); + gtk_file_filter_add_pattern(filter, "*.M2TS"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMPG")); + gtk_file_filter_set_name(filter, "MPG"); + gtk_file_filter_add_pattern(filter, "*.mpg"); + gtk_file_filter_add_pattern(filter, "*.MPG"); + gtk_file_filter_add_pattern(filter, "*.mepg"); + gtk_file_filter_add_pattern(filter, "*.MEPG"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterEVO")); + gtk_file_filter_set_name(filter, "EVO"); + gtk_file_filter_add_pattern(filter, "*.evo"); + gtk_file_filter_add_pattern(filter, "*.EVO"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterVOB")); + gtk_file_filter_set_name(filter, "VOB"); + gtk_file_filter_add_pattern(filter, "*.vob"); + gtk_file_filter_add_pattern(filter, "*.VOB"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMKV")); + gtk_file_filter_set_name(filter, "MKV"); + gtk_file_filter_add_pattern(filter, "*.mkv"); + gtk_file_filter_add_pattern(filter, "*.MKV"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMP4")); + gtk_file_filter_set_name(filter, "MP4"); + gtk_file_filter_add_pattern(filter, "*.mp4"); + gtk_file_filter_add_pattern(filter, "*.MP4"); + gtk_file_filter_add_pattern(filter, "*.m4v"); + gtk_file_filter_add_pattern(filter, "*.M4V"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMOV")); + gtk_file_filter_set_name(filter, "MOV"); + gtk_file_filter_add_pattern(filter, "*.mov"); + gtk_file_filter_add_pattern(filter, "*.MOV"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterAVI")); + gtk_file_filter_set_name(filter, "AVI"); + gtk_file_filter_add_pattern(filter, "*.avi"); + gtk_file_filter_add_pattern(filter, "*.AVI"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterOGG")); + gtk_file_filter_set_name(filter, "OGG"); + gtk_file_filter_add_pattern(filter, "*.ogg"); + gtk_file_filter_add_pattern(filter, "*.OGG"); + gtk_file_filter_add_pattern(filter, "*.ogv"); + gtk_file_filter_add_pattern(filter, "*.OGV"); + gtk_file_filter_add_pattern(filter, "*.ogm"); + gtk_file_filter_add_pattern(filter, "*.OGM"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterFLV")); + gtk_file_filter_set_name(filter, "FLV"); + gtk_file_filter_add_pattern(filter, "*.flv"); + gtk_file_filter_add_pattern(filter, "*.FLV"); + gtk_file_chooser_add_filter(chooser, filter); + filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterWMV")); + gtk_file_filter_set_name(filter, "WMV"); + gtk_file_filter_add_pattern(filter, "*.wmv"); + gtk_file_filter_add_pattern(filter, "*.WMV"); + gtk_file_chooser_add_filter(chooser, filter); + // Everything should be go-to-go. Lets rock! gtk_main (); |