#include "colorlabel.h"
#include "utils.h"
+#include "gtkutils.h"
static gchar *labels[] = {
N_("Orange"),
gc = gdk_gc_new(drawable);
gdk_gc_set_foreground(gc, &color);
- gdk_draw_rectangle(drawable, gc,
- TRUE, 0, 0, widget->allocation.width - 1,
- widget->allocation.height - 1);
gdk_draw_rectangle(drawable, widget->style->black_gc,
FALSE, 0, 0, widget->allocation.width - 1,
widget->allocation.height - 1);
+ gdk_draw_rectangle(drawable, gc,
+ TRUE, 1, 1, widget->allocation.width - 2,
+ widget->allocation.height - 2);
gdk_gc_unref(gc);
-
+
return FALSE;
}
return item;
}
+/* Work around a gtk bug (?): without that, the selected menu item's
+ * colored rectangle is drawn at 0,0 in the window...
+ */
+static void refresh_menu (GtkWidget *menushell, gpointer data)
+{
+ GtkMenu *menu = (GtkMenu *)data;
+ GtkWidget *widget = gtk_menu_get_attach_widget(menu);
+ gtk_widget_hide_all(widget);
+ gtk_widget_unrealize(widget);
+ gtk_widget_show_all(widget);
+ gtk_widget_queue_draw(widget);
+}
+
/* colorlabel_create_color_menu() - creates a color menu without
* checkitems, probably for use in combo items */
GtkWidget *colorlabel_create_color_menu(void)
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
gtk_widget_show(item);
}
-
+
+ g_signal_connect(G_OBJECT(menu), "selection-done",
+ G_CALLBACK(refresh_menu), menu);
gtk_widget_show(menu);
return menu;