如何使用MSYS2 / GTK3

时间:2016-09-04 20:11:25

标签: gtk gtk3 msys2

static void open_file_chooser_button(GtkWidget *widget, gpointer user_data)
{
    static gint count;
    gchar *folder_path;

    count += 1;
    folder_path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(widget));

    g_print("count : %i, path : %s\n", count, folder_path);
}

这是我的回调功能。我使用下一个代码来调用它。

g_signal_connect(file_chooser_button, "file-set", G_CALLBACK(open_file_chooser_button), NULL);

我构建并执行一个程序。然后我按下文件选择按钮'并选择文件。

但首先是失败。

count : 1, path : (NULL)

再试一次。

count : 2, path : C:\msys32\home\ga\Project

gtk_file_chooser_get_current_folder()没有返回当前文件夹路径。它返回了私密的文件夹路径。

我想要当前的文件夹路径。如何获取当前文件夹路径?

0 个答案:

没有答案
相关问题