在终端中打开 Gedit 时出现 Gtk 警告

del*_*phi 5 gedit gtk

以前,我需要清除文档历史记录,所以我用谷歌搜索并找到了这个:

http://www.watchingthenet.com/ubuntu-tip-clear-disable-recent-documents.html

我做了这一步,然后当我在 root 终端中打开 gedit 时,我得到了这个:

root@dellph1-desktop:/# gedit

(gedit:8224): GLib-CRITICAL **: g_bookmark_file_load_from_data: assertion `length != 0' failed

(gedit:8224): Gtk-WARNING **: Attempting to store changes into `/root/.recently-used.xbel', but failed: Failed to rename file '/root/.recently-used.xbel.FP7PPV' to '/root/.recently-used.xbel': g_rename() failed: Operation not permitted

(gedit:8224): Gtk-WARNING **: Attempting to set the permissions of `/root/.recently-used.xbel', but failed: Operation not permitted
root@dellph1-desktop:/# 
Run Code Online (Sandbox Code Playgroud)

它发生在用户终端:

dellph1@dellph1-desktop:~$ gedit

(gedit:9408): Gtk-CRITICAL **: gtk_accel_label_set_accel_closure: assertion `gtk_accel_group_from_accel_closure (accel_closure) != NULL' failed
dellph1@dellph1-desktop:~$ 
Run Code Online (Sandbox Code Playgroud)

我真的希望有人在这种情况下提供帮助,谢谢。

小智 2

用这个

(nohup gedit 2>/dev/null &)
Run Code Online (Sandbox Code Playgroud)

gedit它在后台的子 shell 中运行,扩展名为nohup. 因此,错误消息由 处理nohup,关闭终端不会影响gedit。一个更简单的方法是:

gedit &> /dev/null
Run Code Online (Sandbox Code Playgroud)

这只会丢弃来自 的任何错误消息gedit

  • 欢迎询问 Ubuntu!我建议编辑这个答案来解释它的作用。 (4认同)

Mar*_*mo- 1

我建议您不要通过 root 用户使用 gedit。尝试通过 sudo 使用 gedit。

重新安装 gedit 不会有帮助,我相信您需要按照指南来消除造成的损坏。