Revision: 1767
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1767&view=rev
Author:   nadvornik
Date:     2009-06-27 20:47:17 +0000 (Sat, 27 Jun 2009)

Log Message:
-----------
use radio buttons for file and dir mode in popup menu

Modified Paths:
--------------
    trunk/src/layout_util.c
    trunk/src/view_dir.c
    trunk/src/view_file.c

Modified: trunk/src/layout_util.c
===================================================================
--- trunk/src/layout_util.c     2009-06-27 20:12:56 UTC (rev 1766)
+++ trunk/src/layout_util.c     2009-06-27 20:47:17 UTC (rev 1767)
@@ -611,7 +611,7 @@
        LayoutWindow *lw = data;
        
        layout_exit_fullscreen(lw);
-       layout_views_set(lw, lw->options.dir_view_type, 
(gtk_radio_action_get_current_value(action) == 1) ? FILEVIEW_ICON : 
FILEVIEW_LIST);
+       layout_views_set(lw, lw->options.dir_view_type, (FileViewType) 
gtk_radio_action_get_current_value(action));
 }
 
 static void layout_menu_view_dir_as_cb(GtkRadioAction *action, GtkRadioAction 
*current, gpointer data)
@@ -1415,8 +1415,8 @@
 };
 
 static GtkRadioActionEntry menu_radio_entries[] = {
-  { "ViewList",                NULL,                   N_("Image _List"),      
                "<control>L",           N_("View Images as List"),              
0 },
-  { "ViewIcons",       NULL,                   N_("I_cons"),                   
        "<control>I",           N_("View Images as Icons"),             1 }
+  { "ViewList",                NULL,                   N_("Image _List"),      
                "<control>L",           N_("View Images as List"),              
FILEVIEW_LIST },
+  { "ViewIcons",       NULL,                   N_("I_cons"),                   
        "<control>I",           N_("View Images as Icons"),             
FILEVIEW_ICON }
 };
 
 static GtkRadioActionEntry menu_view_dir_radio_entries[] = {
@@ -2284,7 +2284,7 @@
        radio_action_set_current_value(GTK_RADIO_ACTION(action), 
lw->split_mode);
 
        action = gtk_action_group_get_action(lw->action_group, "ViewIcons");
-       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), 
lw->options.file_view_type);
+       radio_action_set_current_value(GTK_RADIO_ACTION(action), 
lw->options.file_view_type);
 
        action = gtk_action_group_get_action(lw->action_group, "FloatTools");
        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), 
lw->options.tools_float);

Modified: trunk/src/view_dir.c
===================================================================
--- trunk/src/view_dir.c        2009-06-27 20:12:56 UTC (rev 1766)
+++ trunk/src/view_dir.c        2009-06-27 20:47:17 UTC (rev 1767)
@@ -521,12 +521,11 @@
        file_util_copy_path_to_clipboard(vd->click_fd);
 }
 
-#define VIEW_DIR_AS_SUBMENU_KEY "view_dir_as_submenu"
 static void vd_pop_submenu_dir_view_as_cb(GtkWidget *widget, gpointer data)
 {
        ViewDir *vd = data;
 
-       DirViewType new_type = 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), VIEW_DIR_AS_SUBMENU_KEY));
+       DirViewType new_type = 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "menu_item_radio_data"));
        layout_views_set(vd->layout, new_type, 
vd->layout->options.file_view_type);
 }
 
@@ -674,13 +673,11 @@
        menu_item_add_divider(menu);
 
 
-       item = menu_item_add_check(menu, _("View as _List"), vd->type == 
DIRVIEW_LIST,
+       item = menu_item_add_radio(menu, _("View as _List"), 
GINT_TO_POINTER(DIRVIEW_LIST), vd->type == DIRVIEW_LIST,
                                            
G_CALLBACK(vd_pop_submenu_dir_view_as_cb), vd);
-       g_object_set_data(G_OBJECT(item), VIEW_DIR_AS_SUBMENU_KEY, 
GINT_TO_POINTER(DIRVIEW_LIST));
 
-       item = menu_item_add_check(menu, _("View as _Tree"), vd->type == 
DIRVIEW_TREE,
+       item = menu_item_add_radio(menu, _("View as _Tree"), 
GINT_TO_POINTER(DIRVIEW_TREE), vd->type == DIRVIEW_TREE,
                                            
G_CALLBACK(vd_pop_submenu_dir_view_as_cb), vd);
-       g_object_set_data(G_OBJECT(item), VIEW_DIR_AS_SUBMENU_KEY, 
GINT_TO_POINTER(DIRVIEW_TREE));
 
        menu_item_add_divider(menu);
 

Modified: trunk/src/view_file.c
===================================================================
--- trunk/src/view_file.c       2009-06-27 20:12:56 UTC (rev 1766)
+++ trunk/src/view_file.c       2009-06-27 20:47:17 UTC (rev 1767)
@@ -467,18 +467,10 @@
 static void vf_pop_menu_toggle_view_type_cb(GtkWidget *widget, gpointer data)
 {
        ViewFile *vf = data;
-       
+       FileViewType new_type = 
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "menu_item_radio_data"));
        if (!vf->layout) return;
 
-       switch (vf->type)
-       {
-       case FILEVIEW_LIST:
-               layout_views_set(vf->layout, vf->layout->options.dir_view_type, 
FILEVIEW_ICON);
-               break;
-       case FILEVIEW_ICON:
-               layout_views_set(vf->layout, vf->layout->options.dir_view_type, 
FILEVIEW_LIST);
-               break;
-       }
+       layout_views_set(vf->layout, vf->layout->options.dir_view_type, 
new_type);
 }
 
 static void vf_pop_menu_refresh_cb(GtkWidget *widget, gpointer data)
@@ -611,9 +603,12 @@
        item = menu_item_add(menu, _("_Sort"), NULL, NULL);
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
 
-       menu_item_add_check(menu, _("View as _icons"), (vf->type == 
FILEVIEW_ICON),
-                           G_CALLBACK(vf_pop_menu_toggle_view_type_cb), vf);
+       item = menu_item_add_radio(menu, _("View as _List"), 
GINT_TO_POINTER(FILEVIEW_LIST), vf->type == FILEVIEW_LIST,
+                                           
G_CALLBACK(vf_pop_menu_toggle_view_type_cb), vf);
 
+       item = menu_item_add_radio(menu, _("View as _Icons"), 
GINT_TO_POINTER(FILEVIEW_ICON), vf->type == FILEVIEW_ICON,
+                                           
G_CALLBACK(vf_pop_menu_toggle_view_type_cb), vf);
+
        switch (vf->type)
        {
        case FILEVIEW_LIST:


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to