[gq-commit] gq/src dt_binary.c,1.13,1.14 input.c,1.66,1.67
Status: Beta
Brought to you by:
sur5r
From: <sta...@us...> - 2003-10-12 05:48:24
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv6861 Modified Files: dt_binary.c input.c Log Message: * Fixed color/style handling in gtk2 Index: dt_binary.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_binary.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dt_binary.c 8 Oct 2003 22:58:46 -0000 1.13 --- dt_binary.c 12 Oct 2003 05:48:20 -0000 1.14 *************** *** 84,88 **** --- 84,92 ---- }; + #if GTK_MAJOR < 2 static GtkStyle *fixed_style = NULL; + #else + static PangoFontDescription *fixed_font = NULL; + #endif display_type_handler *dt_binary_get_handler() { *************** *** 321,333 **** gtk_widget_show(widget); gtk_text_set_editable(GTK_TEXT(widget), TRUE); ! if (!fixed_style) { ! fixed_style = gtk_style_new(); #if GTK_MAJOR >= 2 ! gtk_style_set_font(fixed_style, gdk_font_load("fixed")); #else fixed_style->font = gdk_font_load("fixed"); - #endif } gtk_widget_set_style(widget, fixed_style); } if (newtype & DT_BINARY_ENTRY) { --- 325,341 ---- gtk_widget_show(widget); gtk_text_set_editable(GTK_TEXT(widget), TRUE); ! #if GTK_MAJOR >= 2 ! if (!fixed_font) { ! fixed_font = pango_font_description_from_string("fixed"); ! } ! gtk_widget_modify_font(widget, fixed_font); #else + if (!fixed_style) { + fixed_style = gtk_style_new(); fixed_style->font = gdk_font_load("fixed"); } gtk_widget_set_style(widget, fixed_style); + #endif } if (newtype & DT_BINARY_ENTRY) { Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** input.c 11 Oct 2003 21:35:29 -0000 1.66 --- input.c 12 Oct 2003 05:48:20 -0000 1.67 *************** *** 636,645 **** { GList *values, *formlist, *widgetList; ! GdkColor red = { 0, 0xffff, 0x0000, 0x0000 }; GdkColor mustcol = { 0, 0x5c00, 0x3800, 0xffff }; GdkColor delcol = { 0, 0xd600, 0xa000, 0x0000 }; GdkColor extensible_col = { 0, 0xffff, 0x0000, 0xffff }; GtkStyle *not_in_schema, *must_in_schema, *del_schema, *extensible_attr; GtkWidget *inputbox, *arrowbutton, *vbox; GtkWidget *widget = NULL, *align; --- 636,647 ---- { GList *values, *formlist, *widgetList; ! GdkColor notcol = { 0, 0xffff, 0x0000, 0x0000 }; GdkColor mustcol = { 0, 0x5c00, 0x3800, 0xffff }; GdkColor delcol = { 0, 0xd600, 0xa000, 0x0000 }; GdkColor extensible_col = { 0, 0xffff, 0x0000, 0xffff }; + #if GTK_MAJOR < 2 GtkStyle *not_in_schema, *must_in_schema, *del_schema, *extensible_attr; + #endif GtkWidget *inputbox, *arrowbutton, *vbox; GtkWidget *widget = NULL, *align; *************** *** 653,671 **** GByteArray *gb; ! gdk_colormap_alloc_color(gdk_colormap_get_system(), &red, FALSE, TRUE); not_in_schema = gtk_style_copy(gtk_widget_get_default_style()); ! not_in_schema->fg[GTK_STATE_NORMAL] = red; - gdk_colormap_alloc_color(gdk_colormap_get_system(), &mustcol, FALSE, TRUE); must_in_schema = gtk_style_copy(gtk_widget_get_default_style()); must_in_schema->fg[GTK_STATE_NORMAL] = mustcol; - gdk_colormap_alloc_color(gdk_colormap_get_system(), &delcol, FALSE, TRUE); del_schema = gtk_style_copy(gtk_widget_get_default_style()); del_schema->fg[GTK_STATE_NORMAL] = delcol; - extensible_attr = gtk_style_copy(gtk_widget_get_default_style()); extensible_attr->fg[GTK_STATE_NORMAL] = extensible_col; /* mind form->num_inputfields and len(GList * values) may not --- 655,677 ---- GByteArray *gb; ! gdk_colormap_alloc_color(gdk_colormap_get_system(), ¬col, FALSE, TRUE); ! gdk_colormap_alloc_color(gdk_colormap_get_system(), &mustcol, FALSE,TRUE); ! gdk_colormap_alloc_color(gdk_colormap_get_system(), &delcol, FALSE, TRUE); ! gdk_colormap_alloc_color(gdk_colormap_get_system(), &extensible_col, ! FALSE, TRUE); ! ! #if GTK_MAJOR < 2 not_in_schema = gtk_style_copy(gtk_widget_get_default_style()); ! not_in_schema->fg[GTK_STATE_NORMAL] = cotcol; must_in_schema = gtk_style_copy(gtk_widget_get_default_style()); must_in_schema->fg[GTK_STATE_NORMAL] = mustcol; del_schema = gtk_style_copy(gtk_widget_get_default_style()); del_schema->fg[GTK_STATE_NORMAL] = delcol; extensible_attr = gtk_style_copy(gtk_widget_get_default_style()); extensible_attr->fg[GTK_STATE_NORMAL] = extensible_col; + #endif /* mind form->num_inputfields and len(GList * values) may not *************** *** 678,682 **** --- 684,693 ---- GtkWidget *label = gtk_label_new("dn"); gtk_misc_set_alignment(GTK_MISC(label), LABEL_JUSTIFICATION, .5); + + #if GTK_MAJOR >= 2 + gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &mustcol); + #else gtk_widget_set_style(label, must_in_schema); + #endif gtk_widget_show(label); gtk_table_attach(GTK_TABLE(iform->table), label, 0, 1, 0, 1, *************** *** 758,769 **** gtk_widget_restore_default_style(ff->label); ! if(ff->flags & FLAG_NOT_IN_SCHEMA) gtk_widget_set_style(ff->label, not_in_schema); ! if(ff->flags & FLAG_MUST_IN_SCHEMA) gtk_widget_set_style(ff->label, must_in_schema); ! if(ff->flags & FLAG_DEL_ME) gtk_widget_set_style(ff->label, del_schema); ! if(ff->flags & FLAG_EXTENSIBLE_OBJECT_ATTR) gtk_widget_set_style(ff->label, extensible_attr); currcnt = ff->widgetList ? g_list_length(ff->widgetList) : 0; --- 769,800 ---- gtk_widget_restore_default_style(ff->label); ! #if GTK_MAJOR >= 2 ! if(ff->flags & FLAG_NOT_IN_SCHEMA) { ! gtk_widget_modify_fg(ff->label, GTK_STATE_NORMAL, ¬col); ! } ! if(ff->flags & FLAG_MUST_IN_SCHEMA) { ! gtk_widget_modify_fg(ff->label, GTK_STATE_NORMAL, &mustcol); ! } ! if(ff->flags & FLAG_DEL_ME) { ! gtk_widget_modify_fg(ff->label, GTK_STATE_NORMAL, &delcol); ! } ! if(ff->flags & FLAG_EXTENSIBLE_OBJECT_ATTR) { ! gtk_widget_modify_fg(ff->label, GTK_STATE_NORMAL, ! &extensible_col); ! } ! #else ! if(ff->flags & FLAG_NOT_IN_SCHEMA) { gtk_widget_set_style(ff->label, not_in_schema); ! } ! if(ff->flags & FLAG_MUST_IN_SCHEMA) { gtk_widget_set_style(ff->label, must_in_schema); ! } ! if(ff->flags & FLAG_DEL_ME) { gtk_widget_set_style(ff->label, del_schema); ! } ! if(ff->flags & FLAG_EXTENSIBLE_OBJECT_ATTR) { gtk_widget_set_style(ff->label, extensible_attr); + } + #endif currcnt = ff->widgetList ? g_list_length(ff->widgetList) : 0; *************** *** 844,851 **** } g_free(decode_buf); ! gtk_style_unref(not_in_schema); gtk_style_unref(must_in_schema); gtk_style_unref(del_schema); /* restore the hide-status from a previous LDAP object... */ --- 875,884 ---- } g_free(decode_buf); ! #if GTK_MAJOR < 2 gtk_style_unref(not_in_schema); gtk_style_unref(must_in_schema); gtk_style_unref(del_schema); + gtk_style_unref(extensible_attr); + #endif /* restore the hide-status from a previous LDAP object... */ |