diary/Kojima/2009-08-07
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[diary/Kojima]]
・file-roller のデバッグ(その2)
ちとフライング気味だけど、コメント欄だとまとまった文章は...
file-roller が日本語のファイルを扱わない問題、引数として...
引数の処理回りを中心に調べてみた。
結論としては、引数の処理をしているのは、main.c の prepare...
else { /* Open each archive in a window */
const char *filename = NULL;
int i = 0;
while ((filename = remaining_args[i++]) != NULL) {
GtkWidget *window;
GFile *file;
char *uri;
window = fr_window_new ();
gtk_widget_show (window);
file = g_file_new_for_commandline_arg (filename);
uri = g_file_get_uri (file);
fr_window_archive_open (FR_WINDOW (window), uri, GTK_...
g_free (uri);
g_object_unref (file);
}
}
の部分で、remaining_args[] として参照しているファイル名が...
この remaining_args[] は、getopt で処理した argv[] の残り...
同じ main.c の
static const GOptionEntry options[] = {
{ "add-to", 'a', 0, G_OPTION_ARG_STRING, &add_to,
N_("Add files to the specified archive and quit the p...
N_("ARCHIVE") },
{ "add", 'd', 0, G_OPTION_ARG_NONE, &add,
N_("Add files asking the name of the archive and quit...
NULL },
....
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &...
NULL,
NULL },
{ NULL }
};
というところで処理した残りの部分らしいことが分かった。こ...
GOption をキーワードに Google を調べてみたら、Glib マニュ...
If an option is declared to be of type string or filenam...
the right encoding; strings are returned in UTF-8, filen...
Note that this only works if setlocale() has been called...
ということで、GOption の機能を使うと、引数として与えた文...
GFile の basename はローカルのコーディングを指定しないと...
file-roller 側でファイル名のコーディングを戻してやればい...
ということで、g_file_new_for_commandline_arg() にあたえる...
gchar *locale_filename = g_locale_from_utf8(filename, -1...
file = g_file_new_for_commandline_arg (locale_filename);
一応、この修正で引数として指定した日本語のファイルも展開...
日本語のファイルを処理できるようになった。
細かく見ると、展開しているファイルの名称はUTF-8化したdisp...
とりあえず日本語の書庫ファイルも開けるようになったので、f...
#comment
終了行:
[[diary/Kojima]]
・file-roller のデバッグ(その2)
ちとフライング気味だけど、コメント欄だとまとまった文章は...
file-roller が日本語のファイルを扱わない問題、引数として...
引数の処理回りを中心に調べてみた。
結論としては、引数の処理をしているのは、main.c の prepare...
else { /* Open each archive in a window */
const char *filename = NULL;
int i = 0;
while ((filename = remaining_args[i++]) != NULL) {
GtkWidget *window;
GFile *file;
char *uri;
window = fr_window_new ();
gtk_widget_show (window);
file = g_file_new_for_commandline_arg (filename);
uri = g_file_get_uri (file);
fr_window_archive_open (FR_WINDOW (window), uri, GTK_...
g_free (uri);
g_object_unref (file);
}
}
の部分で、remaining_args[] として参照しているファイル名が...
この remaining_args[] は、getopt で処理した argv[] の残り...
同じ main.c の
static const GOptionEntry options[] = {
{ "add-to", 'a', 0, G_OPTION_ARG_STRING, &add_to,
N_("Add files to the specified archive and quit the p...
N_("ARCHIVE") },
{ "add", 'd', 0, G_OPTION_ARG_NONE, &add,
N_("Add files asking the name of the archive and quit...
NULL },
....
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &...
NULL,
NULL },
{ NULL }
};
というところで処理した残りの部分らしいことが分かった。こ...
GOption をキーワードに Google を調べてみたら、Glib マニュ...
If an option is declared to be of type string or filenam...
the right encoding; strings are returned in UTF-8, filen...
Note that this only works if setlocale() has been called...
ということで、GOption の機能を使うと、引数として与えた文...
GFile の basename はローカルのコーディングを指定しないと...
file-roller 側でファイル名のコーディングを戻してやればい...
ということで、g_file_new_for_commandline_arg() にあたえる...
gchar *locale_filename = g_locale_from_utf8(filename, -1...
file = g_file_new_for_commandline_arg (locale_filename);
一応、この修正で引数として指定した日本語のファイルも展開...
日本語のファイルを処理できるようになった。
細かく見ると、展開しているファイルの名称はUTF-8化したdisp...
とりあえず日本語の書庫ファイルも開けるようになったので、f...
#comment
ページ名: