diff src/menu.c @ 113:55166d93498d

Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net> * configure.in: Add test for lcms (little cms). * Makefile.am: Add color-man.[ch]: * color-man.[ch]: New files for color management support. * globals.c, gqview.h, main.c, rcfile.c, typedefs.h: Add color profile variables and option saving. * image.[ch]: Add color profile functions. * layout.c, layout_image.[ch]: Add color profile icon, popup menu, and fix sort menu to use radio buttons. * menu.c: Use radio buttons for sort menu when appropriate. * preferences.c: Add color profile options to preferences. * ui_menu.[ch]: Add menu_item_add_radio() for radio item menus. * ui_misc.c: Fix gtk_table_attach() arg for vertical expansion. * view_file_icon.c, view_file_list.c: Check for active state in sort menu callbacks. * README: Add info about lcms, and how to disable.
author gqview
date Sat, 25 Nov 2006 03:00:33 +0000
parents a4c1b7014e6e
children f0ecfb80be38
line wrap: on
line diff
--- a/src/menu.c	Sat Nov 18 00:12:22 2006 +0000
+++ b/src/menu.c	Sat Nov 25 03:00:33 2006 +0000
@@ -135,19 +135,25 @@
 	return "";
 }
 
-static void submenu_add_sort_item(GtkWidget *menu, GCallback func, SortType type,
-				  gint show_current, SortType show_type)
+static GtkWidget *submenu_add_sort_item(GtkWidget *menu, GtkWidget *parent,
+					GCallback func, SortType type,
+					gint show_current, SortType show_type)
 {
+	GtkWidget *item;
+
 	if (show_current)
 		{
-		menu_item_add_check(menu, sort_type_get_text(type), (type == show_type),
-				    func, GINT_TO_POINTER((gint)type));
+		item = menu_item_add_radio(menu, parent,
+					   sort_type_get_text(type), (type == show_type),
+					   func, GINT_TO_POINTER((gint)type));
 		}
 	else
 		{
-		menu_item_add(menu, sort_type_get_text(type),
-			      func, GINT_TO_POINTER((gint)type));
+		item = menu_item_add(menu, sort_type_get_text(type),
+			 	     func, GINT_TO_POINTER((gint)type));
 		}
+
+	return item;
 }
 
 GtkWidget *submenu_add_sort(GtkWidget *menu, GCallback func, gpointer data,
@@ -155,18 +161,19 @@
 			    gint show_current, SortType type)
 {
 	GtkWidget *submenu;
+	GtkWidget *parent;
 
 	submenu = gtk_menu_new();
 	g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
 
-	submenu_add_sort_item(submenu, func, SORT_NAME, show_current, type);
+	parent = submenu_add_sort_item(submenu, NULL, func, SORT_NAME, show_current, type);
 #ifdef HAVE_STRVERSCMP
-	submenu_add_sort_item(submenu, func, SORT_NUMBER, show_current, type);
+	submenu_add_sort_item(submenu, parent, func, SORT_NUMBER, show_current, type);
 #endif
-	submenu_add_sort_item(submenu, func, SORT_TIME, show_current, type);
-	submenu_add_sort_item(submenu, func, SORT_SIZE, show_current, type);
-	if (include_path) submenu_add_sort_item(submenu, func, SORT_PATH, show_current, type);
-	if (include_none) submenu_add_sort_item(submenu, func, SORT_NONE, show_current, type);
+	submenu_add_sort_item(submenu, parent, func, SORT_TIME, show_current, type);
+	submenu_add_sort_item(submenu, parent, func, SORT_SIZE, show_current, type);
+	if (include_path) submenu_add_sort_item(submenu, parent, func, SORT_PATH, show_current, type);
+	if (include_none) submenu_add_sort_item(submenu, parent, func, SORT_NONE, show_current, type);
 
 	if (menu)
 		{