NLS/colormap weirdness
- From: Allin Cottrell <cottrell wfu edu>
- To: gtk-app-devel-list gnome org
- Subject: NLS/colormap weirdness
- Date: Thu, 9 May 2002 16:28:54 -0400 (EDT)
I'm trying to internationalize my (gtk-1.2) app, and I'm running into
the strange problem of the locale setting interfering with the
colormap.  I wonder if there's some known stupid thing that I'm doing
wrong.
I'm including below a small test case.  I compile this with
`gtk-config --cflags` and `gtk-config --libs`.  When I run the program
with LANG=en_US I see a little red Acrobat logo on the toolbar
button.  When I do 'LANG=french ./prog' the button appears blank: no
red design.  This happens with other icons too: red is lost, and
sometimes other colors.
#include <stdio.h>
#include <gettext.h>
#include <locale.h>
#include <gtk/gtk.h>
static char *mini_pdf_xpm[] = {
"16 16 2 1",
"     c None s None",
"o    c red",
"                ",
"      o         ",
"     o o        ",
"     ooo        ",
"      oo        ",
"      oo        ",
"      o o       ",
"     o   ooooo  ",
"     o  oooo  o ",
"     oooo   oo  ",
"    oo          ",
"   oo           ",
" ooo            ",
" o o            ",
" oo             ",
"                "};
static void dummy_func (void)
{
    fprintf(stderr, "Pressed button\n");
}
static void make_toolbar (GtkWidget *w)
{
    GtkWidget *toolbar;
    GtkWidget *iconwid;
    GdkPixmap *icon;
    GdkBitmap *mask;
    GdkColormap *cmap;
    cmap = gdk_colormap_get_system();
    toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,
                              GTK_TOOLBAR_ICONS);
    gtk_container_add(GTK_CONTAINER(w), toolbar);
    icon = gdk_pixmap_colormap_create_from_xpm_d(NULL, cmap, &mask,
                                                 NULL, mini_pdf_xpm);
    iconwid = gtk_pixmap_new(icon, mask);
    gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
                            NULL, NULL, NULL,
                            iconwid, dummy_func, NULL);
}
int main (void)
{
    GtkWidget *w;
    setlocale (LC_ALL, "");
#ifdef notdef /* this bit doesn't seem to make any difference */
    bindtextdomain ("gretl", "/opt/esl/share/locale");
    textdomain ("gretl");
#endif
    gtk_init(NULL, NULL);
    w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_signal_connect(GTK_OBJECT(w), "delete_event",
                       gtk_main_quit, NULL);
    make_toolbar(w);
    gtk_widget_show_all(w);
    gtk_main();
    return 0;
}
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]