diff --git a/ChangeLog b/ChangeLog index 77cbf50e9e..de38247809 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Sun Dec 7 03:19:02 1997 Tim Janik + + * gtkfilesel.c: applied jamesa-971010-0 for stability. + * gtkrc.c: applied jamesa-971010-2 for a small optimization. + * gtkcheckmenuitem.h: + * gtkcheckmenuitem.c: + * gtkradiomenuitem.c: + * testgtk.c: applied johannes-971113-0 which adds + gtk_check_menu_item_set_show_toggle() to change the way check + menu items and radio menu items look. + Fri Dec 5 1997 Elliot Lee * gdk/gdk.c: clean up warnings, remove some un-ifdef'd debugging printing, DnD is Bug Free now, etc. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 77cbf50e9e..de38247809 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,14 @@ +Sun Dec 7 03:19:02 1997 Tim Janik + + * gtkfilesel.c: applied jamesa-971010-0 for stability. + * gtkrc.c: applied jamesa-971010-2 for a small optimization. + * gtkcheckmenuitem.h: + * gtkcheckmenuitem.c: + * gtkradiomenuitem.c: + * testgtk.c: applied johannes-971113-0 which adds + gtk_check_menu_item_set_show_toggle() to change the way check + menu items and radio menu items look. + Fri Dec 5 1997 Elliot Lee * gdk/gdk.c: clean up warnings, remove some un-ifdef'd debugging printing, DnD is Bug Free now, etc. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 77cbf50e9e..de38247809 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +Sun Dec 7 03:19:02 1997 Tim Janik + + * gtkfilesel.c: applied jamesa-971010-0 for stability. + * gtkrc.c: applied jamesa-971010-2 for a small optimization. + * gtkcheckmenuitem.h: + * gtkcheckmenuitem.c: + * gtkradiomenuitem.c: + * testgtk.c: applied johannes-971113-0 which adds + gtk_check_menu_item_set_show_toggle() to change the way check + menu items and radio menu items look. + Fri Dec 5 1997 Elliot Lee * gdk/gdk.c: clean up warnings, remove some un-ifdef'd debugging printing, DnD is Bug Free now, etc. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 77cbf50e9e..de38247809 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,14 @@ +Sun Dec 7 03:19:02 1997 Tim Janik + + * gtkfilesel.c: applied jamesa-971010-0 for stability. + * gtkrc.c: applied jamesa-971010-2 for a small optimization. + * gtkcheckmenuitem.h: + * gtkcheckmenuitem.c: + * gtkradiomenuitem.c: + * testgtk.c: applied johannes-971113-0 which adds + gtk_check_menu_item_set_show_toggle() to change the way check + menu items and radio menu items look. + Fri Dec 5 1997 Elliot Lee * gdk/gdk.c: clean up warnings, remove some un-ifdef'd debugging printing, DnD is Bug Free now, etc. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 77cbf50e9e..de38247809 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,14 @@ +Sun Dec 7 03:19:02 1997 Tim Janik + + * gtkfilesel.c: applied jamesa-971010-0 for stability. + * gtkrc.c: applied jamesa-971010-2 for a small optimization. + * gtkcheckmenuitem.h: + * gtkcheckmenuitem.c: + * gtkradiomenuitem.c: + * testgtk.c: applied johannes-971113-0 which adds + gtk_check_menu_item_set_show_toggle() to change the way check + menu items and radio menu items look. + Fri Dec 5 1997 Elliot Lee * gdk/gdk.c: clean up warnings, remove some un-ifdef'd debugging printing, DnD is Bug Free now, etc. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 77cbf50e9e..de38247809 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +Sun Dec 7 03:19:02 1997 Tim Janik + + * gtkfilesel.c: applied jamesa-971010-0 for stability. + * gtkrc.c: applied jamesa-971010-2 for a small optimization. + * gtkcheckmenuitem.h: + * gtkcheckmenuitem.c: + * gtkradiomenuitem.c: + * testgtk.c: applied johannes-971113-0 which adds + gtk_check_menu_item_set_show_toggle() to change the way check + menu items and radio menu items look. + Fri Dec 5 1997 Elliot Lee * gdk/gdk.c: clean up warnings, remove some un-ifdef'd debugging printing, DnD is Bug Free now, etc. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 77cbf50e9e..de38247809 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +Sun Dec 7 03:19:02 1997 Tim Janik + + * gtkfilesel.c: applied jamesa-971010-0 for stability. + * gtkrc.c: applied jamesa-971010-2 for a small optimization. + * gtkcheckmenuitem.h: + * gtkcheckmenuitem.c: + * gtkradiomenuitem.c: + * testgtk.c: applied johannes-971113-0 which adds + gtk_check_menu_item_set_show_toggle() to change the way check + menu items and radio menu items look. + Fri Dec 5 1997 Elliot Lee * gdk/gdk.c: clean up warnings, remove some un-ifdef'd debugging printing, DnD is Bug Free now, etc. diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c index a36dfa75a0..bf5aa04c17 100644 --- a/gtk/gtkcheckmenuitem.c +++ b/gtk/gtkcheckmenuitem.c @@ -102,13 +102,22 @@ gtk_check_menu_item_set_state (GtkCheckMenuItem *check_menu_item, gtk_menu_item_activate (GTK_MENU_ITEM (check_menu_item)); } +void +gtk_check_menu_item_set_show_toggle (GtkCheckMenuItem *menu_item, + gboolean always) +{ + g_return_if_fail (menu_item != NULL); + g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (menu_item)); + + menu_item->always_show_toggle = always != FALSE; +} + void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item) { gtk_signal_emit (GTK_OBJECT (check_menu_item), check_menu_item_signals[TOGGLED]); } - static void gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass) { @@ -146,6 +155,7 @@ static void gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item) { check_menu_item->active = FALSE; + check_menu_item->always_show_toggle = FALSE; } static void @@ -231,14 +241,25 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item, gdk_window_clear_area (widget->window, x, y, width, height); if (check_menu_item->active || + check_menu_item->always_show_toggle || (GTK_WIDGET_STATE (check_menu_item) == GTK_STATE_PRELIGHT)) { state_type = GTK_WIDGET_STATE (widget); - - shadow_type = GTK_SHADOW_IN; - if (check_menu_item->active && (state_type == GTK_STATE_PRELIGHT)) - shadow_type = GTK_SHADOW_OUT; - + + if (check_menu_item->always_show_toggle) + { + shadow_type = GTK_SHADOW_OUT; + if (check_menu_item->active) + shadow_type = GTK_SHADOW_IN; + } + else + { + shadow_type = GTK_SHADOW_IN; + if (check_menu_item->active && + (state_type == GTK_STATE_PRELIGHT)) + shadow_type = GTK_SHADOW_OUT; + } + gdk_draw_rectangle (widget->window, widget->style->bg_gc[state_type], TRUE, x, y, width, height); diff --git a/gtk/gtkcheckmenuitem.h b/gtk/gtkcheckmenuitem.h index 1dc816c7c7..e2b195dcfd 100644 --- a/gtk/gtkcheckmenuitem.h +++ b/gtk/gtkcheckmenuitem.h @@ -41,6 +41,7 @@ struct _GtkCheckMenuItem GtkMenuItem menu_item; guint active : 1; + guint always_show_toggle : 1; }; struct _GtkCheckMenuItemClass @@ -58,6 +59,8 @@ GtkWidget* gtk_check_menu_item_new (void); GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label); void gtk_check_menu_item_set_state (GtkCheckMenuItem *check_menu_item, gint state); +void gtk_check_menu_item_set_show_toggle(GtkCheckMenuItem *menu_item, + gboolean always); void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item); diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c index 77f83a87a3..3c8745083c 100644 --- a/gtk/gtkfilesel.c +++ b/gtk/gtkfilesel.c @@ -1180,6 +1180,7 @@ prune_memory_usage(CompletionState *cmpl_state) cdsl->next = NULL; } + cmpl_state->directory_storage = NULL; while (cdl) { if (cdl->data == cmpl_state->reference_dir) cmpl_state->directory_storage = g_list_prepend(NULL, cdl->data); @@ -1577,7 +1578,7 @@ correct_dir_fullname(CompletionDir* cmpl_dir) return FALSE; } - cmpl_dir->fullname[length - 3] = 0; + cmpl_dir->fullname[length - 2] = 0; if(!correct_parent(cmpl_dir, &sbuf)) return FALSE; @@ -1597,7 +1598,7 @@ correct_dir_fullname(CompletionDir* cmpl_dir) return FALSE; } - cmpl_dir->fullname[length - 4] = 0; + cmpl_dir->fullname[length - 3] = 0; if(!correct_parent(cmpl_dir, &sbuf)) return FALSE; @@ -1621,7 +1622,7 @@ correct_parent(CompletionDir* cmpl_dir, struct stat *sbuf) g_assert(last_slash); if(last_slash != cmpl_dir->fullname) - last_slash[0] = 0; + { /* last_slash[0] = 0; */ } else { c = last_slash[1]; @@ -1640,8 +1641,8 @@ correct_parent(CompletionDir* cmpl_dir, struct stat *sbuf) if(c) last_slash[1] = c; - else - last_slash[0] = '/'; + /* else + last_slash[0] = '/'; */ /* it was a link, have to figure it out the hard way */ diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c index edfcff6733..edb8d63e7b 100644 --- a/gtk/gtkradiomenuitem.c +++ b/gtk/gtkradiomenuitem.c @@ -215,10 +215,15 @@ gtk_radio_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item, gdk_window_clear_area (widget->window, x, y, width, height); if (check_menu_item->active || + check_menu_item->always_show_toggle || (GTK_WIDGET_STATE (check_menu_item) == GTK_STATE_PRELIGHT)) { state_type = GTK_WIDGET_STATE (widget); - shadow_type = GTK_SHADOW_IN; + if (check_menu_item->active || + !check_menu_item->always_show_toggle) + shadow_type = GTK_SHADOW_IN; + else + shadow_type = GTK_SHADOW_OUT; pts[0].x = x + width / 2; pts[0].y = y; diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c index 86bc20121b..131dd0b0fb 100644 --- a/gtk/gtkrc.c +++ b/gtk/gtkrc.c @@ -1257,41 +1257,41 @@ gtk_rc_parse_pixmap_path () return PARSE_OK; } -static void gtk_rc_parse_pixmap_path_string(gchar *pix_path) +static void +gtk_rc_parse_pixmap_path_string (gchar *pix_path) { gchar *buf; gint end_offset; gint start_offset = 0; gint path_len; gint path_num; - + /* free the old one, or just add to the old one ? */ for (path_num=0; pixmap_path[path_num]; path_num++) { - g_free(pixmap_path[path_num]); + g_free (pixmap_path[path_num]); pixmap_path[path_num] = NULL; } - + path_num = 0; + + path_len = strlen (pix_path); + + buf = g_strdup (pix_path); - path_len = strlen(pix_path); - - buf = g_strdup(pix_path); - - for(end_offset = 0; end_offset <= path_len; end_offset++) + for (end_offset = 0; end_offset <= path_len; end_offset++) { - if ( (buf[end_offset] == ':') || (end_offset == path_len) ) + if ((buf[end_offset] == ':') || + (end_offset == path_len)) { buf[end_offset] = '\0'; - pixmap_path[path_num] = g_strdup(buf + start_offset); + pixmap_path[path_num] = g_strdup (buf + start_offset); path_num++; pixmap_path[path_num] = NULL; start_offset = end_offset + 1; - g_free(buf); - buf = g_strdup(pix_path); } } - g_free(buf); + g_free (buf); } static gint diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 842dd0b83c..1a54d439f7 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -859,6 +859,8 @@ create_menu (int depth) sprintf (buf, "item %2d - %d", depth, j); menuitem = gtk_radio_menu_item_new_with_label (group, buf); group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem)); + if (depth % 2) + gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menuitem), TRUE); gtk_menu_append (GTK_MENU (menu), menuitem); gtk_widget_show (menuitem); diff --git a/tests/testgtk.c b/tests/testgtk.c index 842dd0b83c..1a54d439f7 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -859,6 +859,8 @@ create_menu (int depth) sprintf (buf, "item %2d - %d", depth, j); menuitem = gtk_radio_menu_item_new_with_label (group, buf); group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem)); + if (depth % 2) + gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menuitem), TRUE); gtk_menu_append (GTK_MENU (menu), menuitem); gtk_widget_show (menuitem);