+/** @brief Pop up an error message */
+void fpopup_msg(GtkMessageType mt, const char *fmt, ...) {
+ va_list ap;
+ char *msg;
+
+ va_start(ap, fmt);
+ byte_xvasprintf(&msg, fmt, ap);
+ va_end(ap);
+ popup_msg(mt, msg);
+}
+
+/** @brief Create a button with an icon in it
+ * @param path (relative) path to image
+ * @param tip Tooltip or NULL to not set one
+ * @return Button
+ */
+GtkWidget *iconbutton(const char *path, const char *tip) {
+ GtkWidget *button, *content;
+ GdkPixbuf *pb;
+
+ NW(button);
+ button = gtk_button_new();
+ if((pb = find_image(path))) {
+ NW(image);
+ content = gtk_image_new_from_pixbuf(pb);
+ } else {
+ NW(label);
+ content = gtk_label_new(path);
+ }
+ gtk_widget_set_style(button, tool_style);
+ gtk_widget_set_style(content, tool_style);
+ gtk_container_add(GTK_CONTAINER(button), content);
+ if(tip)
+ gtk_tooltips_set_tip(tips, button, tip, "");
+ return button;
+}
+
+/** @brief Create buttons and pack them into a box, which is returned */
+GtkWidget *create_buttons_box(struct button *buttons,
+ size_t nbuttons,
+ GtkWidget *box) {
+ size_t n;
+
+ for(n = 0; n < nbuttons; ++n) {
+ buttons[n].widget = gtk_button_new_from_stock(buttons[n].stock);
+ gtk_widget_set_style(buttons[n].widget, tool_style);
+ g_signal_connect(G_OBJECT(buttons[n].widget), "clicked",
+ G_CALLBACK(buttons[n].clicked), 0);
+ gtk_box_pack_start(GTK_BOX(box), buttons[n].widget, FALSE, FALSE, 1);
+ gtk_tooltips_set_tip(tips, buttons[n].widget, buttons[n].tip, "");
+ }
+ return box;
+}
+
+/** @brief Create buttons and pack them into an hbox */
+GtkWidget *create_buttons(struct button *buttons,
+ size_t nbuttons) {
+ return create_buttons_box(buttons, nbuttons,
+ gtk_hbox_new(FALSE, 1));
+}
+
+
+