当我尝试运行以下程序时:
#include <stdio.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include <unistd.h>
static void construct(XfcePanelPlugin *);
static void show_prefs(XfcePanelPlugin *);
XFCE_PANEL_PLUGIN_REGISTER(construct);
static void construct(XfcePanelPlugin *plugin) {
// Construct a simple gtk eventbox on the panel
// and add a appropriate sized icon
GtkWidget *ebox = gtk_event_box_new();
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size("/usr/share/pixmaps/idea.png", 16, 16, NULL);
GtkWidget *icon = gtk_image_new_from_pixbuf(pixbuf);
// display the previously constructed GTK widgets on the panel
gtk_container_add(GTK_CONTAINER(plugin), ebox);
gtk_container_add(GTK_CONTAINER(ebox), icon);
gtk_widget_show_all(ebox);
xfce_panel_plugin_set_expand(XFCE_PANEL_PLUGIN(plugin), TRUE);
xfce_panel_plugin_menu_show_configure(plugin);
g_signal_connect(plugin, "configure-plugin", G_CALLBACK(show_prefs), ebox);
}
static void show_prefs(XfcePanelPlugin *plugin) {
fputs("initializing config dialog...\n", stderr);
GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(win), 300, 200);
gtk_window_set_title(GTK_WINDOW(win), "Twittle Preferences");
GtkWidget *grid = gtk_grid_new();
gtk_widget_show_all(win);
}
对gtk_grid_new()
的调用会导致错误
(wrapper-1.0:26288): GLib-GObject-WARNING **: cannot register existing type 'GtkWidget'
有人能指出我正确的方向吗?
makefile可在https://gist.github.com/fasseg/953c6615e2b0c50ea62c#file-source-L31
的要点中找到