打开文件选择器对话框时出现Glib-GIO-ERROR [英] Glib-GIO-ERROR when opening an file chooser dialog
问题描述
我在Windows 7中使用GTK3,codeblcks IDE,glade3 ...
I use GTK3 , codeblcks IDE, glade3 in windows 7...
在我的应用程序中,我有一个按钮,单击该按钮应打开gtk_file_chooser_dialog ... 但是却给出了填充错误..
In my application i have a button which when clicked should open a gtk_file_chooser_dialog... But gives the fillowing error..
Glib-GIO-ERROR ** :系统上未安装GSettings模式
static void on_save_clicked(GtkWidget *widget,gpointer data)
{
GtkWidget *dialog;
//dialog=gtk_file_chooser_dialog_new("Save it",GTK_WINDOW(gtk_builder_get_object(builder,"mainwindow")),GTK_FILE_CHOOSER_ACTION_SAVE,GTK_STOCK_OK,GTK_RESPONSE_OK,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL);
//dialog=GTK_FILE_CHOOSER_DIALOG(gtk_builder_get_object(builder,"filechooserdialog"));
gtk_widget_show_all(dialog);
gint resp=gtk_dialog_run(GTK_DIALOG(dialog));
if(resp==GTK_RESPONSE_OK)
g_print("%s\n",gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)));
}
单击按钮时,我使用g_signal_connect(...)调用此函数...
I use g_signal_connect(...) to call this function when the button is clicked...
我听不懂这个问题...
I cannot understand the problem...
推荐答案
尝试打开FileChooserDialog时,我遇到了同样的错误.
I got the very same error when trying to open a FileChooserDialog.
(lancer_ihm.py:1047004): GLib-GIO-CRITICAL **: g_settings_schema_source_lookup: assertion 'source != NULL' failed
(lancer_ihm.py:1047004): GLib-GIO-ERROR **: No GSettings schemas are installed on the system
Trace/breakpoint trap (core dumped)
我在Linux上使用python3运行Gtk3接口. Gtk3及其所有依赖项都是从源代码安装的.
I 'm running a Gtk3 interface with python3 on Linux. Gtk3 and all its dependencies were installed from the sources.
我在此论坛上找到了解决方案 http://forum.tinycorelinux.net/index .php?topic = 13699.0
I found the solution on this forum http://forum.tinycorelinux.net/index.php?topic=13699.0
我只是将XDG_DATA_DIRS变量设置为gtk模式文件所在的路径,并且它可以工作.
I just set XDG_DATA_DIRS variable with the path to where the gtk schema files are located and it works.
$ ls /home/user1/ctcils/dusserm/applications/gtk/3.12.1/share/glib-2.0/schemas/
gschemas.compiled org.gtk.exampleapp.gschema.xml org.gtk.Settings.FileChooser.gschema.xml
org.gtk.Demo.gschema.xml org.gtk.Settings.ColorChooser.gschema.xml
$ export XDG_DATA_DIRS=/Produits/publics/x86_64.Linux.RH6/glib/2.40.0/share/:/home/user1/ctcils/dusserm/applications/gtk/3.12.1/share/
这篇关于打开文件选择器对话框时出现Glib-GIO-ERROR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!