summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlessio Treglia <alessio@debian.org>2012-06-02 13:25:34 +0200
committerAlessio Treglia <alessio@debian.org>2012-06-02 13:25:34 +0200
commit5927940f774494d20baf7fc501326c2b084e3846 (patch)
tree26d6fb77280492534c4414f8855e8b5ca2cd97a9 /src
parent73be72d722eef532bea958e875204412ebaa4658 (diff)
Imported Upstream version 3.2.3
Diffstat (limited to 'src')
-rw-r--r--src/audacious/Makefile2
-rw-r--r--src/audacious/credits.c1
-rw-r--r--src/audacious/main.c5
-rw-r--r--src/audacious/playlist-api.h3
-rw-r--r--src/audacious/playlist-new.c4
-rw-r--r--src/audacious/plugin-view.c5
-rw-r--r--src/audacious/ui_preferences.c4
-rw-r--r--src/libaudgui/ui_jumptotrack.c8
-rw-r--r--src/libaudgui/ui_jumptotrack_cache.c60
9 files changed, 48 insertions, 44 deletions
diff --git a/src/audacious/Makefile b/src/audacious/Makefile
index ea95c85..22dad64 100644
--- a/src/audacious/Makefile
+++ b/src/audacious/Makefile
@@ -99,6 +99,7 @@ pre-depend: ${DBUS_BINDINGS}
CPPFLAGS := -I.. -I../.. \
${CPPFLAGS} \
${GLIB_CFLAGS} \
+ ${GMODULE_LIBS} \
${GTHREAD_CFLAGS} \
${GTK_CFLAGS} \
${AUDACIOUS_DEFINES} \
@@ -119,6 +120,7 @@ LIBS := -L../libaudcore -laudcore \
${LIBINTL} \
${EGGSM_LIBS} \
${GLIB_LIBS} \
+ ${GMODULE_LIBS} \
${GTHREAD_LIBS} \
${GTK_LIBS} \
${DBUS_LIBS} \
diff --git a/src/audacious/credits.c b/src/audacious/credits.c
index 883de89..185fe4f 100644
--- a/src/audacious/credits.c
+++ b/src/audacious/credits.c
@@ -267,6 +267,7 @@ static const char * const translators_text[] = {
NULL,
N_("Japanese:"),
"Dai",
+ "Shuuji Takahashi",
NULL,
N_("Korean:"),
"DongCheon Park",
diff --git a/src/audacious/main.c b/src/audacious/main.c
index d67860a..47883fc 100644
--- a/src/audacious/main.c
+++ b/src/audacious/main.c
@@ -470,9 +470,6 @@ static void init_two (int * p_argc, char * * * p_argv)
if (! headless)
{
g_thread_init (NULL);
- gdk_threads_init ();
- gdk_threads_enter ();
-
gtk_rc_add_default_file (aud_paths[AUD_PATH_GTKRC_FILE]);
gtk_init (p_argc, p_argv);
}
@@ -550,8 +547,6 @@ static void shut_down (void)
eq_cleanup ();
strpool_shutdown ();
-
- gdk_threads_leave ();
}
bool_t do_autosave (void)
diff --git a/src/audacious/playlist-api.h b/src/audacious/playlist-api.h
index b1886e5..c3777b3 100644
--- a/src/audacious/playlist-api.h
+++ b/src/audacious/playlist-api.h
@@ -159,7 +159,8 @@ AUD_FUNC3 (Tuple *, playlist_entry_get_tuple, int, playlist, int, entry,
/* Returns a formatted title string for an entry. This may include information
* such as the filename, song title, and/or artist. If <fast> is nonzero,
- * returns the entry's filename if metadata for the entry has not yet been read. */
+ * returns a "best guess" based on the entry's filename if metadata for the
+ * entry has not yet been read. */
AUD_FUNC3 (char *, playlist_entry_get_title, int, playlist, int, entry,
bool_t, fast)
diff --git a/src/audacious/playlist-new.c b/src/audacious/playlist-new.c
index af674df..6407f64 100644
--- a/src/audacious/playlist-new.c
+++ b/src/audacious/playlist-new.c
@@ -1195,7 +1195,7 @@ char * playlist_entry_get_title (int playlist_num, int entry_num, bool_t fast)
ENTER;
Entry * entry = get_entry (playlist_num, entry_num, FALSE, ! fast);
- char * title = entry ? str_ref (entry->formatted ? entry->formatted : entry->filename) : NULL;
+ char * title = entry ? str_ref (entry->formatted ? entry->formatted : entry->title) : NULL;
LEAVE_RET (title);
}
@@ -2202,7 +2202,7 @@ char * playback_entry_get_title (void)
Entry * entry = get_playback_entry (FALSE, TRUE);
char * title = entry ? str_ref (entry->formatted ? entry->formatted :
- entry->filename) : NULL;
+ entry->title) : NULL;
LEAVE_RET (title);
}
diff --git a/src/audacious/plugin-view.c b/src/audacious/plugin-view.c
index f8a88f2..4fbdeaa 100644
--- a/src/audacious/plugin-view.c
+++ b/src/audacious/plugin-view.c
@@ -44,6 +44,11 @@ static PluginHandle * get_selected_plugin (GtkTreeView * tree)
Node * n = NULL;
GtkTreeSelection * sel = gtk_tree_view_get_selection (tree);
+
+ /* the treeview may not have a model yet */
+ if (! sel)
+ return NULL;
+
GtkTreeModel * model;
GtkTreeIter iter;
if (gtk_tree_selection_get_selected (sel, & model, & iter))
diff --git a/src/audacious/ui_preferences.c b/src/audacious/ui_preferences.c
index ec905ed..5eed800 100644
--- a/src/audacious/ui_preferences.c
+++ b/src/audacious/ui_preferences.c
@@ -1290,14 +1290,14 @@ create_titlestring_tag_menu(void)
static void show_numbers_cb (GtkToggleButton * numbers, void * unused)
{
set_bool (NULL, "show_numbers_in_pl", gtk_toggle_button_get_active (numbers));
-
+ playlist_reformat_titles ();
hook_call ("title change", NULL);
}
static void leading_zero_cb (GtkToggleButton * leading)
{
set_bool (NULL, "leading_zero", gtk_toggle_button_get_active (leading));
-
+ playlist_reformat_titles ();
hook_call ("title change", NULL);
}
diff --git a/src/libaudgui/ui_jumptotrack.c b/src/libaudgui/ui_jumptotrack.c
index 10b46ed..e3f348d 100644
--- a/src/libaudgui/ui_jumptotrack.c
+++ b/src/libaudgui/ui_jumptotrack.c
@@ -164,6 +164,14 @@ static void fill_list (void)
audgui_list_delete_rows (treeview, 0, audgui_list_row_count (treeview));
audgui_list_insert_rows (treeview, 0, search_matches->len);
+
+ if (search_matches->len >= 1)
+ {
+ GtkTreeSelection * sel = gtk_tree_view_get_selection ((GtkTreeView *) treeview);
+ GtkTreePath * path = gtk_tree_path_new_from_indices (0, -1);
+ gtk_tree_selection_select_path (sel, path);
+ gtk_tree_path_free (path);
+ }
}
static void clear_cb (GtkWidget * widget)
diff --git a/src/libaudgui/ui_jumptotrack_cache.c b/src/libaudgui/ui_jumptotrack_cache.c
index 6bc0279..5c124b1 100644
--- a/src/libaudgui/ui_jumptotrack_cache.c
+++ b/src/libaudgui/ui_jumptotrack_cache.c
@@ -29,6 +29,7 @@
#include <audacious/debug.h>
#include <audacious/playlist.h>
+#include <libaudcore/audstrings.h>
#include "config.h"
#include "ui_jumptotrack_cache.h"
@@ -38,7 +39,7 @@
typedef struct
{
GArray * entries; // int
- GArray * titles, * artists, * albums, * paths, * filenames; // char *
+ GArray * titles, * artists, * albums, * paths; // char *
} KeywordMatches;
static void ui_jump_to_track_cache_init (JumpToTrackCache * cache);
@@ -51,7 +52,6 @@ static KeywordMatches * keyword_matches_new (void)
k->artists = g_array_new (FALSE, FALSE, sizeof (char *));
k->albums = g_array_new (FALSE, FALSE, sizeof (char *));
k->paths = g_array_new (FALSE, FALSE, sizeof (char *));
- k->filenames = g_array_new (FALSE, FALSE, sizeof (char *));
return k;
}
@@ -62,7 +62,6 @@ static void keyword_matches_free (KeywordMatches * k)
g_array_free (k->artists, TRUE);
g_array_free (k->albums, TRUE);
g_array_free (k->paths, TRUE);
- g_array_free (k->filenames, TRUE);
g_free (k);
}
@@ -172,15 +171,13 @@ ui_jump_to_track_cache_match_keyword(JumpToTrackCache* cache,
char * artist = g_array_index (search_space->artists, char *, i);
char * album = g_array_index (search_space->albums, char *, i);
char * path = g_array_index (search_space->paths, char *, i);
- char * filename = g_array_index (search_space->filenames, char *, i);
bool_t match;
if (regex_list != NULL)
match = ui_jump_to_track_match (title, regex_list)
|| ui_jump_to_track_match (artist, regex_list)
|| ui_jump_to_track_match (album, regex_list)
- || ui_jump_to_track_match (path, regex_list)
- || ui_jump_to_track_match (filename, regex_list);
+ || ui_jump_to_track_match (path, regex_list);
else
match = TRUE;
@@ -190,7 +187,6 @@ ui_jump_to_track_cache_match_keyword(JumpToTrackCache* cache,
g_array_append_val (k->artists, artist);
g_array_append_val (k->albums, album);
g_array_append_val (k->paths, path);
- g_array_append_val (k->filenames, filename);
}
}
@@ -200,28 +196,26 @@ ui_jump_to_track_cache_match_keyword(JumpToTrackCache* cache,
return k->entries;
}
-/**
- * Normalizes the search string to be more suitable for searches.
- *
- * Basically this does Unicode NFKD normalization to for example match
- * half-width and full-width characters and case folding mainly to match
- * upper- and lowercase letters.
- *
- * String returned by this function should be freed manually.
- */
-
/* calls str_unref() on <string> */
-static char * normalize_search_string (char * string)
+/* returned string must be freed */
+static char * process_string (char * string, bool_t decode)
{
if (! string)
return NULL;
- char* normalized_string = g_utf8_normalize(string, -1, G_NORMALIZE_NFKD);
- char* folded_string = g_utf8_casefold(normalized_string, -1);
- g_free(normalized_string);
- str_unref (string);
+ char * normal;
- return folded_string;
+ if (decode)
+ {
+ char temp[strlen (string) + 1];
+ str_decode_percent (string, -1, temp);
+ normal = g_utf8_casefold (temp, -1);
+ }
+ else
+ normal = g_utf8_casefold (string, -1);
+
+ str_unref (string);
+ return normal;
}
/**
@@ -236,7 +230,6 @@ ui_jump_to_track_cache_free_keywordmatch_data(KeywordMatches* match_entry)
g_free (g_array_index (match_entry->artists, char *, i));
g_free (g_array_index (match_entry->albums, char *, i));
g_free (g_array_index (match_entry->paths, char *, i));
- g_free (g_array_index (match_entry->filenames, char *, i));
}
}
@@ -296,21 +289,20 @@ static void ui_jump_to_track_cache_init (JumpToTrackCache * cache)
for (int entry = 0; entry < entries; entry ++)
{
- Tuple * tuple = aud_playlist_entry_get_tuple (playlist, entry, TRUE);
- char * title = normalize_search_string (tuple ? tuple_get_str (tuple, FIELD_TITLE, NULL) : NULL);
- char * artist = normalize_search_string (tuple ? tuple_get_str (tuple, FIELD_ARTIST, NULL) : NULL);
- char * album = normalize_search_string (tuple ? tuple_get_str (tuple, FIELD_ALBUM, NULL) : NULL);
- char * path = normalize_search_string (tuple ? tuple_get_str (tuple, FIELD_FILE_PATH, NULL) : NULL);
- char * filename = normalize_search_string (tuple ? tuple_get_str (tuple, FIELD_FILE_NAME, NULL) : NULL);
- if (tuple)
- tuple_unref (tuple);
+ char * title, * artist, * album, * path;
+ aud_playlist_entry_describe (playlist, entry, & title, & artist, & album, TRUE);
+ path = aud_playlist_entry_get_filename (playlist, entry);
+
+ title = process_string (title, FALSE);
+ artist = process_string (artist, FALSE);
+ album = process_string (album, FALSE);
+ path = process_string (path, TRUE);
g_array_append_val (k->entries, entry);
g_array_append_val (k->titles, title);
g_array_append_val (k->artists, artist);
g_array_append_val (k->albums, album);
g_array_append_val (k->paths, path);
- g_array_append_val (k->filenames, filename);
}
// Finally insert all titles into cache into an empty key "" so that
@@ -373,7 +365,7 @@ static void ui_jump_to_track_cache_init (JumpToTrackCache * cache)
const GArray * ui_jump_to_track_cache_search (JumpToTrackCache * cache, const
char * keyword)
{
- char * normalized_keyword = normalize_search_string (str_get (keyword));
+ char * normalized_keyword = g_utf8_casefold (keyword, -1);
GString* keyword_string = g_string_new(normalized_keyword);
GString* match_string = g_string_new(normalized_keyword);
int match_string_length = keyword_string->len;