2008-10-07 [colin] 3.6.0cvs12
[claws.git] / src / gtk / colorlabel.c
index f8d84036b4bc4bfb8dbc4573d28be3e38cef59f0..1b48baaf1cb482a7eac1f18bee3c7e343f456a32 100644 (file)
@@ -4,7 +4,7 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -13,8 +13,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 /* (alfons) - based on a contribution by Satoshi Nagayasu; revised for colorful 
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkdrawingarea.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "colorlabel.h"
 #include "utils.h"
@@ -218,7 +208,7 @@ static gboolean colorlabel_drawing_area_expose_event_cb
                           TRUE, 1, 1, widget->allocation.width - 2,
                           widget->allocation.height - 2);
 
-       gdk_gc_unref(gc);                          
+       g_object_unref(gc);                        
        
        return FALSE;
 }
@@ -339,12 +329,19 @@ GtkWidget *colorlabel_create_check_color_menu_item(gint color_index, gboolean fo
        gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 4);
        if (color_index < 9) {
-               accel = g_strdup_printf("Ctrl+%c", '1'+color_index);
+               accel = gtk_accelerator_get_label(GDK_1+color_index, GDK_CONTROL_MASK);
                label = gtk_label_new(accel);
                gtk_widget_show(label);
                gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
                g_free(accel);
                gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 4);
+               g_object_set_data(G_OBJECT(item), "accel_label", label);
+       } else {
+               label = gtk_label_new("");
+               gtk_widget_show(label);
+               gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
+               gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 4);
+               g_object_set_data(G_OBJECT(item), "accel_label", label);
        }
        return item;
 }