• R/O
  • SSH
  • HTTPS

mmaid: Commit


Commit MetaInfo

Revision144 (tree)
Time2013-06-25 22:46:41
Authoriwm

Log Message

delete root directory check

Change Summary

Incremental Difference

--- mmaid/trunk/src/mmaid.c (revision 143)
+++ mmaid/trunk/src/mmaid.c (revision 144)
@@ -94,15 +94,15 @@
9494 ArgumentExit arg_g, arg_v;
9595 ArgumentHelp arg_q;
9696 ArgumentList arg_opts[] = {
97-{"history", 'h', "NUM", N_("History"), ARGUMENT_TYPE_VALUE, &arg_h},
98-{"new", 'n', "ON/OFF", N_("New File"), ARGUMENT_TYPE_BOOL, &arg_n},
99-{"profile", 'p', "ON/OFF", N_("Profile"), ARGUMENT_TYPE_BOOL, &arg_p},
100-{"size", 's', "WIDTH,HEIGHT", N_("Window Size"), ARGUMENT_TYPE_ARRAY, &arg_s},
101-{"second", 'x', "ON/OFF", N_("Open Window"), ARGUMENT_TYPE_BOOL, &arg_x},
97+{"history", 'h', "NUM", N_("History"), ARGUMENT_TYPE_VALUE, &arg_h},
98+{"new", 'n', "ON/OFF", N_("New File"), ARGUMENT_TYPE_BOOL, &arg_n},
99+{"profile", 'p', "ON/OFF", N_("Profile"), ARGUMENT_TYPE_BOOL, &arg_p},
100+{"size", 's', "WIDTH,HEIGHT", N_("Window Size"), ARGUMENT_TYPE_ARRAY, &arg_s},
101+{"second", 'x', "ON/OFF", N_("Open Window"), ARGUMENT_TYPE_BOOL, &arg_x},
102102 {"license", 'g', NULL, N_("GNU GENERAL PUBLIC LICENSE"), ARGUMENT_TYPE_EXIT, &arg_g},
103-{"version", 'v', NULL, N_("About"), ARGUMENT_TYPE_EXIT, &arg_v},
104-{"help", '?', NULL, N_("Help"), ARGUMENT_TYPE_HELP, &arg_q},
105-{NULL, '\0', NULL, NULL, 0, NULL}};
103+{"version", 'v', NULL, N_("About"), ARGUMENT_TYPE_EXIT, &arg_v},
104+{"help", '?', NULL, N_("Help"), ARGUMENT_TYPE_HELP, &arg_q},
105+{NULL, '\0', NULL, NULL, 0, NULL}};
106106
107107 /* 初期化 */
108108 #ifdef G_OS_WIN32
--- mmaid/trunk/src/mmaid.h (revision 143)
+++ mmaid/trunk/src/mmaid.h (revision 144)
@@ -1,6 +1,6 @@
11 /*
22 Melody maid
3- copyright (c) 1998-2012 Kazuki Iwamoto http://www.maid.org/ iwm@maid.org
3+ copyright (c) 1998-2013 Kazuki Iwamoto http://www.maid.org/ iwm@maid.org
44
55 This program is free software: you can redistribute it and/or modify
66 it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@
3030
3131
3232 #define MMAID_VERSION_NOTICE "Melody maid "VERSION" ("BUILD_ENVIRONMENT")"
33-#define MMAID_COPYRIGHT_NOTICE "Copyright (C) 1998-2012 Kazuki Iwamoto"
33+#define MMAID_COPYRIGHT_NOTICE "Copyright (C) 1998-2013 Kazuki Iwamoto"
3434
3535
3636 #define PLAYLIST_RELATIVE 0
--- mmaid/trunk/src/command.c (revision 143)
+++ mmaid/trunk/src/command.c (revision 144)
@@ -1,6 +1,6 @@
11 /*
22 Melody maid
3- copyright (c) 1998-2012 Kazuki Iwamoto http://www.maid.org/ iwm@maid.org
3+ copyright (c) 1998-2013 Kazuki Iwamoto http://www.maid.org/ iwm@maid.org
44
55 This program is free software: you can redistribute it and/or modify
66 it under the terms of the GNU General Public License as published by
@@ -128,42 +128,21 @@
128128 command_save (GtkWidget *widget,
129129 gpointer user_data)
130130 {
131- gchar *root = NULL, *tmp;
132- const gchar *file;
133- gint i = G_MAXINT, page_num;
134- MmaidWindow *mmaid;
131+ gint page_num;
135132
136133 page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (mdi));
137- mmaid = orz_mdi_get_data (ORZ_MDI (mdi), page_num);
138- file = orz_mdi_get_file (ORZ_MDI (mdi), page_num);
139- tmp = g_path_get_dirname (file);
140- root = g_strconcat (tmp, G_DIR_SEPARATOR_S, NULL);
141- g_free (tmp);
142- if (!orz_mdi_get_created (ORZ_MDI (mdi), page_num))
134+ if (orz_mdi_get_created (ORZ_MDI (mdi), page_num))
143135 {
144- gchar *path;
145- gint leng;
146-
147- path = g_filename_display_name (root);
148- leng = g_strlen (path);
149- for (i = mm_list_length (MM_LIST (mmaid->list)) - 1; i >= 0; i--)
150- {
151- const ID3Tag *id3tag;
152-
153- id3tag = mm_list_get_nth (MM_LIST (mmaid->list), i);
154- if (g_strfilencmp (id3tag->file, path, leng))
155- break;
156- }
157- g_free (path);
158- }
159- if (i >= 0)
160- {
161136 command_saveas (widget, user_data);
162137 }
163138 else
164139 {
165140 gboolean result = TRUE;
141+ const gchar *file;
142+ MmaidWindow *mmaid;
166143
144+ file = orz_mdi_get_file (ORZ_MDI (mdi), page_num);
145+ mmaid = orz_mdi_get_data (ORZ_MDI (mdi), page_num);
167146 if (g_file_test (file, G_FILE_TEST_EXISTS))
168147 {
169148 gchar *utf8str;
@@ -180,8 +159,8 @@
180159 result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES;
181160 gtk_widget_destroy (dialog);
182161 }
183- if (result && (mmaid->filetype == FILE_TYPE_DB
184- ? file_save_db (file, mmaid, root, mmaid->charset)
162+ if (result && (mmaid->filetype == FILE_TYPE_DB
163+ ? file_save_db (file, mmaid, mmaid->charset)
185164 : file_save_list (file, mmaid, mmaid->charset,
186165 mmaid->playlist, mmaid->separator, mmaid->crlf, mmaid->header))
187166 && (mmaid->filetype == FILE_TYPE_DB
@@ -188,7 +167,6 @@
188167 || mmaid->playlist != PLAYLIST_BASENAME))
189168 orz_mdi_set_edited (ORZ_MDI (mdi), page_num, FALSE);
190169 }
191- g_free (root);
192170 }
193171
194172
@@ -199,7 +177,6 @@
199177 GtkWidget *frame_sep, *radio_slash, *radio_yen;
200178 GtkWidget *check_header;
201179 GtkWidget *combo_encoding, *radio_crlf, *radio_cr, *radio_lf;
202- GtkWidget *label_root, *combo_root;
203180 } SaveDialog;
204181
205182
@@ -219,8 +196,6 @@
219196 gtk_widget_set_sensitive (savedlg->radio_cr, !active);
220197 gtk_widget_set_sensitive (savedlg->radio_lf, !active);
221198 gtk_widget_set_sensitive (savedlg->check_header, !active);
222- gtk_widget_set_sensitive (savedlg->label_root, active);
223- gtk_widget_set_sensitive (savedlg->combo_root, active);
224199 }
225200
226201
@@ -236,45 +211,6 @@
236211
237212 /* ja:コンボボックスが変更された */
238213 static void
239-command_save_changed (GtkWidget *widget,
240- GtkWidget *dialog)
241-{
242- gchar *root, *utf8str;
243-
244-#if GTK_CHECK_VERSION(2,4,0)
245-# if GTK_CHECK_VERSION(2,24,0)
246- utf8str = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (widget));
247-# elif GTK_CHECK_VERSION(2,6,0)
248- utf8str = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
249-# else /* not GTK_CHECK_VERSION(2,6,0) */
250- GtkTreeIter iter;
251-
252- if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter))
253- gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (widget)),
254- &iter, 0, &utf8str, -1);
255-# endif /* not GTK_CHECK_VERSION(2,6,0) */
256- root = g_filename_from_utf8 (utf8str, -1, NULL, NULL, NULL);
257- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), root);
258- g_free (root);
259- g_free (utf8str);
260-#else /* not GTK_CHECK_VERSION(2,4,0) */
261- gchar *file, *name, *root;
262-
263- name = g_path_get_basename (gtk_file_selection_get_filename
264- (GTK_FILE_SELECTION (dialog)));
265- root = g_filename_from_utf8
266- (gtk_entry_get_text (GTK_ENTRY (widget)), -1, NULL, NULL, NULL);
267- file = g_strconcat (root, name, NULL);
268- gtk_file_selection_set_filename (GTK_FILE_SELECTION (dialog), file);
269- g_free (file);
270- g_free (name);
271- g_free (root);
272-#endif /* not GTK_CHECK_VERSION(2,4,0) */
273-}
274-
275-
276-/* ja:コンボボックスが変更された */
277-static void
278214 command_save_edited (GtkWidget *widget,
279215 GtkWidget *dialog)
280216 {
@@ -292,10 +228,9 @@
292228 gpointer user_data)
293229 {
294230 gboolean header;
295- gchar *file, *root = NULL, *charset, *path, **ary, *title;
296- gint i, playlist, separator, crlf, page_num;
231+ gchar *file, *charset, *title;
232+ gint playlist, separator, crlf, page_num;
297233 guint filetype;
298- GList *gl, *glist = NULL;
299234 GtkStockItem stock_item;
300235 GtkWidget *dialog, *frame, *hbox, *vbox;
301236 GtkWidget *label_path, *label_sep, *label_encoding;
@@ -304,75 +239,6 @@
304239
305240 page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (mdi));
306241 mmaid = orz_mdi_get_data (ORZ_MDI (mdi), page_num);
307- /* ja:共通のルートを求める */
308- for (i = mm_list_length (MM_LIST (mmaid->list)) - 1; i >= 0; i--)
309- {
310- const ID3Tag *id3tag;
311-
312- id3tag = mm_list_get_nth (MM_LIST (mmaid->list), i);
313- if (root)
314- {
315- gint j;
316-
317- for (j = 0; root[j] != '\0'; j++)
318- if (root[j] != id3tag->file[j])
319- break;
320- root[j] = '\0';
321- }
322- else
323- {
324- root = g_strdup (id3tag->file);
325- }
326- }
327- path = g_strrchr (root, G_DIR_SEPARATOR);
328- if (!path)
329- {
330- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
331- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
332- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
333- _("Root Directory Error"));
334- g_signal_connect (G_OBJECT (dialog), "key-press-event",
335- G_CALLBACK (misc_dialog_key_press), NULL);
336- gtk_dialog_run (GTK_DIALOG (dialog));
337- gtk_widget_destroy (dialog);
338- return;
339- }
340- *path = '\0';
341-#ifdef G_OS_WIN32
342- if (G_IS_DIR_SEPARATOR (root[0]) && G_IS_DIR_SEPARATOR (root[1]))
343- {
344- ary = g_strsplit (root + 2, G_DIR_SEPARATOR_S, 0);
345- path = g_strdup (G_DIR_SEPARATOR_S G_DIR_SEPARATOR_S);
346- }
347- else
348- {
349- ary = g_strsplit (root, G_DIR_SEPARATOR_S, 0);
350- path = NULL;
351- }
352-#else /* not G_OS_WIN32 */
353- ary = g_strsplit (root, G_DIR_SEPARATOR_S, 0);
354- path = NULL;
355-#endif /* not G_OS_WIN32 */
356- g_free (root);
357- root = NULL;
358- for (i = 0; ary[i]; i++)
359- {
360- path = path ? g_strconcat (path, ary[i], G_DIR_SEPARATOR_S, NULL)
361- : g_strconcat ( ary[i], G_DIR_SEPARATOR_S, NULL);
362- glist = g_list_append (glist, path);
363- }
364- g_strfreev (ary);
365- if (save_path)
366- {
367- gchar *utf8str;
368-
369- utf8str = g_filename_to_utf8 (save_path, -1, NULL, NULL, NULL);
370- if (g_strfilencmp (utf8str, path, g_strlen (utf8str)) == 0)
371- root = g_strconcat (save_path, G_DIR_SEPARATOR_S, NULL);
372- g_free (utf8str);
373- }
374- if (!root)
375- root = g_filename_from_utf8 (path, -1, NULL, NULL, NULL);
376242 /* ja:ダイアログ */
377243 gtk_stock_lookup (GTK_STOCK_SAVE_AS, &stock_item);
378244 title = misc_mnemonic_to_text (stock_item.label);
@@ -460,42 +326,6 @@
460326 mmaid->charset);
461327 g_signal_connect (G_OBJECT (savedlg.combo_encoding), "edited",
462328 G_CALLBACK (command_save_edited), dialog);
463- /* ja:コンボボックス */
464-#if GTK_CHECK_VERSION(2,24,0)
465- savedlg.combo_root = gtk_combo_box_text_new ();
466- for (gl = g_list_first (glist); gl; gl = g_list_next (gl))
467- {
468- gtk_combo_box_text_prepend_text (GTK_COMBO_BOX_TEXT (savedlg.combo_root),
469- gl->data);
470- if (g_strfilecmp (gl->data, root) == 0)
471- gtk_combo_box_set_active (GTK_COMBO_BOX (savedlg.combo_root), 0);
472- }
473- g_signal_connect (G_OBJECT (savedlg.combo_root), "changed",
474- G_CALLBACK (command_save_changed), dialog);
475-#elif GTK_CHECK_VERSION(2,4,0)
476- savedlg.combo_root = gtk_combo_box_new_text ();
477- for (gl = g_list_first (glist); gl; gl = g_list_next (gl))
478- {
479- gtk_combo_box_prepend_text (GTK_COMBO_BOX (savedlg.combo_root),
480- gl->data);
481- if (g_strfilecmp (gl->data, root) == 0)
482- gtk_combo_box_set_active (GTK_COMBO_BOX (savedlg.combo_root), 0);
483- }
484- g_signal_connect (G_OBJECT (savedlg.combo_root), "changed",
485- G_CALLBACK (command_save_changed), dialog);
486-#else /* not GTK_CHECK_VERSION(2,4,0) */
487- savedlg.combo_root = gtk_combo_new ();
488- gtk_combo_set_popdown_strings (GTK_COMBO (savedlg.combo_root), glist);
489- gtk_combo_set_value_in_list (GTK_COMBO (savedlg.combo_root), FALSE, FALSE);
490- gtk_combo_set_case_sensitive (GTK_COMBO (savedlg.combo_root), TRUE);
491- gtk_editable_set_editable
492- (GTK_EDITABLE (GTK_COMBO (savedlg.combo_root)->entry), FALSE);
493- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (savedlg.combo_root)->entry), root);
494- g_signal_connect (G_OBJECT (GTK_COMBO (savedlg.combo_root)->entry),
495- "changed", G_CALLBACK (command_save_changed), dialog);
496-#endif /* not GTK_CHECK_VERSION(2,4,0) */
497- g_list_foreach (glist, (GFunc)g_free, NULL);
498- g_list_free (glist);
499329 /* ja:ラベル */
500330 label_path = gtk_label_new_with_mnemonic (_("_Path"));
501331 gtk_label_set_mnemonic_widget (GTK_LABEL (label_path),
@@ -505,14 +335,6 @@
505335 label_encoding = gtk_label_new_with_mnemonic (_("Character _Encoding"));
506336 gtk_label_set_mnemonic_widget (GTK_LABEL (label_encoding),
507337 savedlg.combo_encoding);
508- savedlg.label_root = gtk_label_new_with_mnemonic (_("_Root"));
509-#if GTK_CHECK_VERSION(2,4,0)
510- gtk_label_set_mnemonic_widget (GTK_LABEL (savedlg.label_root),
511- savedlg.combo_root);
512-#else /* not GTK_CHECK_VERSION(2,4,0) */
513- gtk_label_set_mnemonic_widget (GTK_LABEL (savedlg.label_root),
514- GTK_COMBO (savedlg.combo_root)->entry);
515-#endif /* not GTK_CHECK_VERSION(2,4,0) */
516338 /* ja:フレームとボックス */
517339 vbox = gtk_vbox_new (FALSE, SPACING);
518340 gtk_container_set_border_width (GTK_CONTAINER (vbox), SPACING);
@@ -548,10 +370,6 @@
548370 gtk_box_pack_start (GTK_BOX (hbox), savedlg.radio_lf, FALSE, FALSE, 0);
549371 gtk_container_add (GTK_CONTAINER (frame), hbox);
550372 gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
551- hbox = gtk_hbox_new (FALSE, SPACING);
552- gtk_box_pack_start (GTK_BOX (hbox), savedlg.label_root, FALSE, FALSE, 0);
553- gtk_box_pack_start (GTK_BOX (hbox), savedlg.combo_root, TRUE, TRUE, 0);
554- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
555373 /* ja:表示 */
556374 command_save_toggled_radio_db (savedlg.radio_db, &savedlg);
557375 gtk_widget_show_all (vbox);
@@ -567,23 +385,13 @@
567385 # endif /* not GTK_CHECK_VERSION(2,6,0) */
568386
569387 file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
570-# if GTK_CHECK_VERSION(2,24,0)
571- root = gtk_combo_box_text_get_active_text
572- (GTK_COMBO_BOX_TEXT (savedlg.combo_root));
573-# elif GTK_CHECK_VERSION(2,6,0)
574- root = gtk_combo_box_get_active_text
575- (GTK_COMBO_BOX (savedlg.combo_root));
576-# else /* not GTK_CHECK_VERSION(2,6,0) */
577- if (gtk_combo_box_get_active_iter
578- (GTK_COMBO_BOX (savedlg.combo_root), &iter))
579- gtk_tree_model_get (gtk_combo_box_get_model
580- (GTK_COMBO_BOX (savedlg.combo_root)), &iter, 0, &root, -1);
581-# endif /* not GTK_CHECK_VERSION(2,6,0) */
582388 #else /* not GTK_CHECK_VERSION(2,4,0) */
583389 gtk_box_pack_end (GTK_BOX (GTK_FILE_SELECTION (dialog)->main_vbox),
584390 vbox, FALSE, FALSE, 0);
585391 if (save_path)
586392 {
393+ gchar *path;
394+
587395 path = g_strconcat (save_path, G_SEARCHPATH_SEPARATOR_S, NULL);
588396 gtk_file_selection_set_filename (GTK_FILE_SELECTION (dialog), path);
589397 g_free (path);
@@ -593,8 +401,6 @@
593401 {
594402 file = g_strdup (gtk_file_selection_get_filename
595403 (GTK_FILE_SELECTION (dialog)));
596- root = g_strdup (gtk_entry_get_text
597- (GTK_ENTRY (GTK_COMBO (savedlg.combo_root)->entry)));
598404 #endif /* not GTK_CHECK_VERSION(2,4,0) */
599405 charset = orz_charset_get_charset (ORZ_CHARSET (savedlg.combo_encoding));
600406 filetype = gtk_toggle_button_get_active
@@ -622,7 +428,7 @@
622428 }
623429 else
624430 {
625- file = root = charset = NULL;
431+ file = charset = NULL;
626432 filetype = FILE_TYPE_DB;
627433 playlist = PLAYLIST_RELATIVE;
628434 separator = G_DIR_SEPARATOR;
@@ -634,7 +440,7 @@
634440 header = TRUE;
635441 }
636442 gtk_widget_destroy (dialog);
637- if (file && root && charset)
443+ if (file && charset)
638444 {
639445 gboolean result = TRUE;
640446
@@ -654,10 +460,12 @@
654460 gtk_widget_destroy (dialog);
655461 }
656462 if (result && (filetype == FILE_TYPE_DB
657- ? file_save_db (file, mmaid, root, charset)
463+ ? file_save_db (file, mmaid, charset)
658464 : file_save_list (file, mmaid, charset,
659465 playlist, separator, crlf, header)))
660466 {
467+ gchar *path;
468+
661469 g_free (save_path);
662470 path = fileio_get_full_path (file);
663471 save_path = g_path_get_dirname (path);
@@ -684,7 +492,6 @@
684492 }
685493 }
686494 g_free (file);
687- g_free (root);
688495 g_free (charset);
689496 }
690497
--- mmaid/trunk/src/file.c (revision 143)
+++ mmaid/trunk/src/file.c (revision 144)
@@ -1,6 +1,6 @@
11 /*
22 Melody maid
3- copyright (c) 1998-2012 Kazuki Iwamoto http://www.maid.org/ iwm@maid.org
3+ copyright (c) 1998-2013 Kazuki Iwamoto http://www.maid.org/ iwm@maid.org
44
55 This program is free software: you can redistribute it and/or modify
66 it under the terms of the GNU General Public License as published by
@@ -420,17 +420,17 @@
420420 || (entries = GINT32_FROM_LE (*(gint32 *)(header + 0x0040))) > 10240)
421421 entries = 0;/* ja:ヘッタにエラーがある */
422422 /* ja:ヘッタのPaddingをチェック */
423- if (entries)
424- for (i = 0x0042; i <= 0x007F; i++)
425- if (header[i])
423+ if (entries > 0)
424+ for (i = 0x0042; i <= 0x007f; i++)
425+ if (header[i] > 0)
426426 {
427427 entries = 0;
428428 break;
429429 }
430430 /* ja:ヘッタのオフセットのない部分をチェック */
431- if (entries)
431+ if (entries > 0)
432432 for (i = entries * sizeof (guint32) + 0x0080; i <= 0xa07f; i++)
433- if (header[i])
433+ if (header[i] > 0)
434434 {
435435 entries = 0;
436436 break;
@@ -463,7 +463,7 @@
463463 offset += mi_r[i].len[j];
464464 }
465465 }
466- if (entries)
466+ if (entries > 0)
467467 entries = i;
468468 if (fio)
469469 fileio_close (fio);
@@ -949,15 +949,14 @@
949949 /* ja:dbファイルを保存する
950950 file,ファイル名
951951 mmaid,ウインドウ情報
952- root,ルート
953952 charset,キャラクターセット
954953 RET,TRUE:正常終了,FALSE:エラー */
955954 gboolean
956955 file_save_db (const gchar *file,
957956 MmaidWindow *mmaid,
958- const gchar *root,
959957 const gchar *charset)
960958 {
959+ gchar *root, *tmp;
961960 guint8 *buf;
962961 gint i, count, length;
963962 goffset offset = 0xa0c0;
@@ -970,6 +969,11 @@
970969 gtk_grab_add (dialog);
971970 /* ja:変数 */
972971 count = MIN (mm_list_length (MM_LIST (mmaid->list)), 10240);
972+ root = fileio_get_full_path (file);
973+ tmp = g_path_get_dirname (root);
974+ g_free (root);
975+ root = g_strconcat (tmp, G_DIR_SEPARATOR_S, NULL);
976+ g_free (tmp);
973977 length = g_strlen (root);
974978 buf = g_malloc0 ((gsize)offset);
975979 g_memmove (buf, irivdb_header0, sizeof (irivdb_header0));
@@ -978,28 +982,43 @@
978982 /* ja:タグ */
979983 for (i = 0; userbreak && i < count; i++)
980984 {
981- gchar *file = NULL, *title, *artist, *album, *genre, **ary, *tmp;
982- gint j;
985+ gchar *file = NULL, *title, *artist, *album, *genre;
983986 const ID3Tag *id3tag;
984987
985988 while (gtk_events_pending ())
986989 gtk_main_iteration ();
987990 id3tag = mm_list_get_nth (MM_LIST (mmaid->list), i);
988- ary = g_strsplit (id3tag->file + length, G_DIR_SEPARATOR_S, 0);
989- for (j = 0; ary[j]; j++)
991+ if (g_strfilencmp (id3tag->file, root, length) == 0)
990992 {
991- tmp = g_convert (ary[j], -1, charset, "UTF-8", NULL, NULL, NULL);
992- if (!tmp)
993+ gchar **ary;
994+ gint j;
995+
996+ ary = g_strsplit (id3tag->file + length, G_DIR_SEPARATOR_S, 0);
997+ for (j = 0; ary[j]; j++)
993998 {
994- g_free (file);
995- file = NULL;
996- break;
999+ gchar *str;
1000+
1001+ str = g_convert (ary[j], -1, charset, "UTF-8", NULL, NULL, NULL);
1002+ if (!str)
1003+ {
1004+ g_free (file);
1005+ file = NULL;
1006+ break;
1007+ }
1008+ if (file)
1009+ {
1010+ tmp = g_strconcat (file, "\\", str, NULL);
1011+ g_free (file);
1012+ }
1013+ else
1014+ {
1015+ tmp = g_strconcat ("\\", str, NULL);
1016+ }
1017+ g_free (str);
1018+ file = tmp;
9971019 }
998- file = file ? g_strconcat (file, "\\", tmp, NULL)
999- : g_strconcat ( "\\", tmp, NULL);
1000- g_free (tmp);
1020+ g_strfreev (ary);
10011021 }
1002- g_strfreev (ary);
10031022 title = id3tag->title ? g_convert (id3tag->title, -1,
10041023 charset, "UTF-8", NULL, NULL, NULL)
10051024 : g_malloc0 (sizeof (gchar));
@@ -1017,6 +1036,7 @@
10171036 guint8 *p;
10181037 guint16 len[5];
10191038 gsize leng[5], size = sizeof (len);
1039+ gint j;
10201040
10211041 leng[0] = g_strlen (file) + 1;
10221042 leng[1] = g_strlen (title) + 1;
@@ -1096,6 +1116,7 @@
10961116 g_free (album);
10971117 g_free (genre);
10981118 }
1119+ g_free (root);
10991120 fio = userbreak ? fileio_open (file,
11001121 FILEIO_ACCESS_READ | FILEIO_ACCESS_WRITE,
11011122 FILEIO_SHARE_READ, FILEIO_MODE_CREATE_ALWAYS) : NULL;
@@ -1160,8 +1181,8 @@
11601181 FILEIO_SHARE_READ, FILEIO_MODE_CREATE_ALWAYS);
11611182 if (fio)
11621183 {
1163- char *root;
1164- const char *sep, *newline;
1184+ gchar *root;
1185+ const gchar *sep, *newline;
11651186 gint i, count;
11661187 GtkWidget *dialog;
11671188
--- mmaid/trunk/src/file.h (revision 143)
+++ mmaid/trunk/src/file.h (revision 144)
@@ -1,6 +1,6 @@
11 /*
22 Melody maid
3- copyright (c) 1998-2012 Kazuki Iwamoto http://www.maid.org/ iwm@maid.org
3+ copyright (c) 1998-2013 Kazuki Iwamoto http://www.maid.org/ iwm@maid.org
44
55 This program is free software: you can redistribute it and/or modify
66 it under the terms of the GNU General Public License as published by
@@ -109,13 +109,11 @@
109109 /* ja:dbファイルを保存する
110110 file,ファイル名
111111 mmaid,ウインドウ情報
112- root,ルート
113112 charset,キャラクターセット
114113 RET,TRUE:正常終了,FALSE:エラー */
115114 gboolean
116115 file_save_db (const gchar *file,
117116 MmaidWindow *mmaid,
118- const gchar *root,
119117 const gchar *charset);
120118
121119
--- mmaid/trunk/ChangeLog (revision 143)
+++ mmaid/trunk/ChangeLog (revision 144)
@@ -2,6 +2,12 @@
22
33 * version 0.4.3
44
5+2013-06-25 Kazuki Iwamoto <iwm@maid.org>
6+
7+ * src/command.c
8+ * src/file.[ch]
9+ * src/mmaid.[ch]: delete root directory check
10+
511 2013-06-02 Kazuki Iwamoto <iwm@maid.org>
612
713 * Makefile.msc.in
Show on old repository browser