Mercurial > audlegacy
changeset 1429:a360afd8df52 trunk
[svn] Make annoying recursion that consistently returns wrong art, optional.
author | nemo |
---|---|
date | Mon, 24 Jul 2006 16:20:05 -0700 |
parents | f71e7b09a43f |
children | 740c08db08d9 |
files | ChangeLog audacious/glade/prefswin.glade audacious/main.c audacious/main.h audacious/prefswin.c audacious/ui_fileinfo.c |
diffstat | 6 files changed, 158 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Jul 21 10:24:28 2006 -0700 +++ b/ChangeLog Mon Jul 24 16:20:05 2006 -0700 @@ -1,3 +1,12 @@ +2006-07-21 17:24:28 +0000 William Pitcock <nenolod@nenolod.net> + revision [1770] + - add translators list + + + Changes: Modified: + +8 -0 trunk/AUTHORS + + 2006-07-21 16:48:46 +0000 William Pitcock <nenolod@nenolod.net> revision [1768] - update documentation
--- a/audacious/glade/prefswin.glade Fri Jul 21 10:24:28 2006 -0700 +++ b/audacious/glade/prefswin.glade Mon Jul 24 16:20:05 2006 -0700 @@ -4329,8 +4329,97 @@ <property name="fill">False</property> </packing> </child> + <child> + <widget class="GtkAlignment" id="alignment80"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkCheckButton" id="recurse_for_cover"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Recursively search for cover</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + </child> + </widget> + </child> <child> + <widget class="GtkAlignment" id="alignment22"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">45</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkHBox" id="recurse_for_cover_depth_box"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label41"> + <property name="visible">True</property> + <property name="label" translatable="yes">Search depth: </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">4</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + </child> + + <child> + <widget class="GtkSpinButton" id="recurse_for_cover_depth"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="climb_rate">1</property> + <property name="digits">0</property> + <property name="numeric">False</property> + <property name="update_policy">GTK_UPDATE_ALWAYS</property> + <property name="snap_to_ticks">False</property> + <property name="wrap">False</property> + <property name="adjustment">2 0 100 1 10 10</property> + <signal name="realize" handler="on_recurse_for_cover_depth_realize" after="yes" last_modification_time="Mon, 24 Jul 2004 23:36:20 GMT"/> + <signal name="value_changed" handler="on_recurse_for_cover_depth_changed" last_modification_time="Mon, 24 Jul 2004 23:36:20 GMT"/> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + <child> <widget class="GtkHButtonBox" id="hbuttonbox10"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property>
--- a/audacious/main.c Fri Jul 21 10:24:28 2006 -0700 +++ b/audacious/main.c Mon Jul 24 16:20:05 2006 -0700 @@ -297,6 +297,7 @@ {"resume_playback_on_startup", &cfg.resume_playback_on_startup, TRUE}, {"playlist_detect", &cfg.playlist_detect, TRUE}, {"show_filepopup_for_tuple", &cfg.show_filepopup_for_tuple, TRUE}, + {"recurse_for_cover", &cfg.recurse_for_cover, TRUE} }; static gint ncfgbent = G_N_ELEMENTS(bmp_boolents); @@ -327,6 +328,7 @@ {"titlestring_preset", &cfg.titlestring_preset, TRUE}, {"resume_playback_on_startup_time", &cfg.resume_playback_on_startup_time, TRUE}, {"output_buffer_size", &cfg.output_buffer_size, TRUE}, + {"recurse_for_cover_depth", &cfg.recurse_for_cover_depth, TRUE} }; static gint ncfgient = G_N_ELEMENTS(bmp_numents);
--- a/audacious/main.h Fri Jul 21 10:24:28 2006 -0700 +++ b/audacious/main.h Mon Jul 24 16:20:05 2006 -0700 @@ -113,6 +113,8 @@ gboolean playlist_detect; gboolean show_filepopup_for_tuple; gchar *cover_name_include, *cover_name_exclude; + gboolean recurse_for_cover; + gint recurse_for_cover_depth; }; typedef struct _BmpConfig BmpConfig;
--- a/audacious/prefswin.c Fri Jul 21 10:24:28 2006 -0700 +++ b/audacious/prefswin.c Mon Jul 24 16:20:05 2006 -0700 @@ -2049,6 +2049,38 @@ } static void +on_recurse_for_cover_depth_realize(GtkSpinButton * button, + gpointer data) +{ + gtk_spin_button_set_value(button, cfg.recurse_for_cover_depth); +} + +static void +on_recurse_for_cover_depth_changed(GtkSpinButton * button, + gpointer data) +{ + cfg.recurse_for_cover_depth = gtk_spin_button_get_value_as_int(button); +} + +static void +on_recurse_for_cover_realize(GtkToggleButton * button, + gpointer data) +{ + gboolean state = cfg.recurse_for_cover; + gtk_toggle_button_set_active(button, state); + gtk_widget_set_sensitive(GTK_WIDGET(data), state); +} + +static void +on_recurse_for_cover_toggled(GtkToggleButton * button, + gpointer data) +{ + gboolean state = gtk_toggle_button_get_active(button); + cfg.recurse_for_cover = state; + gtk_widget_set_sensitive(GTK_WIDGET(data), state); +} + +static void on_filepopup_settings_ok_clicked(GtkButton *button, gpointer data) { GladeXML *xml = prefswin_get_xml(); @@ -2144,6 +2176,8 @@ FUNC_MAP_ENTRY(on_audio_format_det_cb_realize) FUNC_MAP_ENTRY(on_show_filepopup_for_tuple_realize) FUNC_MAP_ENTRY(on_show_filepopup_for_tuple_toggled) + FUNC_MAP_ENTRY(on_recurse_for_cover_depth_realize) + FUNC_MAP_ENTRY(on_recurse_for_cover_depth_changed) FUNC_MAP_ENTRY(on_filepopup_for_tuple_settings_clicked) FUNC_MAP_ENTRY(on_continue_playback_on_startup_realize) FUNC_MAP_ENTRY(on_continue_playback_on_startup_toggled) @@ -2378,6 +2412,14 @@ /* Create window for filepopup settings */ filepopup_settings = glade_xml_get_widget(xml, "filepopup_for_tuple_settings"); gtk_window_set_transient_for(GTK_WINDOW(filepopup_settings), GTK_WINDOW(prefswin)); + widget = glade_xml_get_widget(xml, "recurse_for_cover_depth_box"); + widget2 = glade_xml_get_widget(xml, "recurse_for_cover"); + g_signal_connect_after(G_OBJECT(widget2), "realize", + G_CALLBACK(on_recurse_for_cover_realize), + widget); + g_signal_connect(G_OBJECT(widget2), "toggled", + G_CALLBACK(on_recurse_for_cover_toggled), + widget); } void
--- a/audacious/ui_fileinfo.c Fri Jul 21 10:24:28 2006 -0700 +++ b/audacious/ui_fileinfo.c Mon Jul 24 16:20:05 2006 -0700 @@ -403,7 +403,7 @@ { GDir *d; - if(depth > 3) + if (cfg.recurse_for_cover && depth > cfg.recurse_for_cover_depth) return NULL; d = g_dir_open(path, 0, NULL); @@ -425,21 +425,20 @@ } else { - /* File/directory wasn't suitable, try and recurse into it. - * This should either return a filename for a image file, - * or NULL if there was no suitable file, or 'f' wasn't a dir. - */ - gchar *tmp = fileinfo_recursive_get_image(newpath, depth+1); - - if(tmp) + f = g_dir_read_name(d); + if (cfg.recurse_for_cover) { - g_free(newpath); - return tmp; - } - else - { - /* Not got anything, move onto the next item in the directory */ - f = g_dir_read_name(d); + /* File/directory wasn't suitable, try and recurse into it. + * This should either return a filename for a image file, + * or NULL if there was no suitable file, or 'f' wasn't a dir. + */ + gchar *tmp = fileinfo_recursive_get_image(newpath, depth+1); + + if(tmp) + { + g_free(newpath); + return tmp; + } } } }