2005-10-10 [colin] 1.9.15cvs28
[claws.git] / src / gtk / colorlabel.c
index c560ab006886faa210beca59f68ff01bd0a63fe9..4a8ce9d0679553acc115e7e532259da73b32c734 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "colorlabel.h"
 #include "utils.h"
+#include "gtkutils.h"
 
 static gchar *labels[] = {
        N_("Orange"),
@@ -129,15 +130,15 @@ static gboolean colorlabel_drawing_area_expose_event_cb
        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;
 }
 
@@ -262,6 +263,19 @@ GtkWidget *colorlabel_create_check_color_menu_item(gint color_index)
        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)
@@ -313,7 +327,9 @@ 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;