created Files and Folders submenu
authorVladimir Nadvornik <nadvornik@suse.cz>
Sat, 27 Jun 2009 17:54:31 +0000 (17:54 +0000)
committerVladimir Nadvornik <nadvornik@suse.cz>
Sat, 27 Jun 2009 17:54:31 +0000 (17:54 +0000)
src/layout_util.c
src/view_dir.c
src/view_dir.h

index 0d8bff2..08dd183 100644 (file)
@@ -667,7 +667,7 @@ static void layout_menu_overlay_cb(GtkToggleAction *action, gpointer data)
                {
                OsdShowFlags flags = image_osd_get(lw->image);
                
-               if (flags | OSD_SHOW_INFO | OSD_SHOW_STATUS != flags)
+               if ((flags | OSD_SHOW_INFO | OSD_SHOW_STATUS) != flags)
                        image_osd_set(lw->image, flags | OSD_SHOW_INFO | OSD_SHOW_STATUS);
                }
        else
@@ -1291,7 +1291,7 @@ static GtkActionEntry menu_entries[] = {
   { "OrientationMenu", NULL,                   N_("_Orientation"),                     NULL,                   NULL,                                   NULL },
   { "ExternalMenu",    NULL,                   N_("E_xternal Editors"),                NULL,                   NULL,                                   NULL },
   { "ViewMenu",                NULL,                   N_("_View"),                            NULL,                   NULL,                                   NULL },
-  { "DirMenu",          NULL,                  N_("_View Directory as"),               NULL,                   NULL,                                   NULL },
+  { "FileDirMenu",     NULL,                   N_("_Files and Folders"),               NULL,                   NULL,                                   NULL },
   { "ZoomMenu",                NULL,                   N_("_Zoom"),                            NULL,                   NULL,                                   NULL },
   { "ColorMenu",       NULL,                   N_("Color _Management"),                NULL,                   NULL,                                   NULL },
   { "ConnectZoomMenu", NULL,                   N_("_Connected Zoom"),                  NULL,                   NULL,                                   NULL },
@@ -1415,8 +1415,13 @@ static GtkToggleActionEntry menu_toggle_entries[] = {
 };
 
 static GtkRadioActionEntry menu_radio_entries[] = {
-  { "ViewList",                NULL,                   N_("View Images as _List"),             "<control>L",           N_("View Images as List"),              0 },
-  { "ViewIcons",       NULL,                   N_("View Images as I_cons"),            "<control>I",           N_("View Images as Icons"),             1 }
+  { "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 }
+};
+
+static GtkRadioActionEntry menu_view_dir_radio_entries[] = {
+  { "FolderList",      NULL,                   N_("Folder _List"),                     "<meta>L",              N_("View Folders as List"),             DIRVIEW_LIST },
+  { "FolderTree",      NULL,                   N_("Folder _Tree"),                     "<control>T",           N_("View Folders as Tree"),             DIRVIEW_TREE },
 };
 
 static GtkRadioActionEntry menu_split_radio_entries[] = {
@@ -1448,6 +1453,7 @@ static GtkRadioActionEntry menu_histogram_mode[] = {
   { "HistogramModeLog",        NULL,                   N_("Lo_g Histogram"),                   NULL,                   N_("Log Histogram"),            1 },
 };
 
+
 #undef CB
 
 static const gchar *menu_ui_description =
@@ -1581,14 +1587,19 @@ static const gchar *menu_ui_description =
 "        <menuitem action='SplitSingle'/>"
 "      </menu>"
 "      <separator/>"
-"      <menuitem action='ViewList'/>"
-"      <menuitem action='ViewIcons'/>"
-"      <menuitem action='Thumbnails'/>"
-"      <placeholder name='ListSection'/>"
-"      <separator/>"
-"      <menu action='DirMenu'>"
+"      <menu action='FileDirMenu'>"
 "        <menuitem action='FolderList'/>"
 "        <menuitem action='FolderTree'/>"
+"        <placeholder name='FolderSection'/>"
+"        <separator/>"
+"        <menuitem action='ViewList'/>"
+"        <menuitem action='ViewIcons'/>"
+"        <menuitem action='Thumbnails'/>"
+"        <placeholder name='ListSection'/>"
+"        <separator/>"
+"        <menuitem action='FloatTools'/>"
+"        <menuitem action='HideTools'/>"
+"        <menuitem action='HideToolbar'/>"
 "      </menu>"
 "      <placeholder name='DirSection'/>"
 "      <separator/>"
@@ -1611,9 +1622,6 @@ static const gchar *menu_ui_description =
 "      <menuitem action='FullScreen'/>"
 "      <placeholder name='OverlaySection'/>"
 "      <separator/>"
-"      <menuitem action='FloatTools'/>"
-"      <menuitem action='HideTools'/>"
-"      <menuitem action='HideToolbar'/>"
 "      <menuitem action='ShowInfoPixel'/>"
 "      <placeholder name='ToolsSection'/>"
 "      <separator/>"
index 7c9e2ae..d861618 100644 (file)
@@ -66,11 +66,6 @@ static void folder_icons_free(PixmapFolders *pf)
 
 static void vd_notify_cb(FileData *fd, NotifyType type, gpointer data);
 
-GtkRadioActionEntry menu_view_dir_radio_entries[] = {
-  { "FolderList",      NULL,           N_("_List"),            "<meta>L",      NULL, DIRVIEW_LIST },
-  { "FolderTree",      NULL,           N_("_Tree"),            "<control>T",   NULL, DIRVIEW_TREE },
-};
-
 static void vd_destroy_cb(GtkWidget *widget, gpointer data)
 {
        ViewDir *vd = data;
@@ -101,8 +96,6 @@ static void vd_destroy_cb(GtkWidget *widget, gpointer data)
 
 ViewDir *vd_new(DirViewType type, FileData *dir_fd)
 {
-       g_assert(VIEW_DIR_TYPES_COUNT <= G_N_ELEMENTS(menu_view_dir_radio_entries));
-
        ViewDir *vd = g_new0(ViewDir, 1);
 
        vd->widget = gtk_scrolled_window_new(NULL, NULL);
@@ -611,12 +604,10 @@ static void vd_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
 GtkWidget *vd_pop_menu(ViewDir *vd, FileData *fd)
 {
        GtkWidget *menu;
-       GtkWidget *submenu;
        GtkWidget *item;
        gboolean active;
        gboolean rename_delete_active = FALSE;
        gboolean new_folder_active = FALSE;
-       gint i;
 
        active = (fd != NULL);
        switch (vd->type)
@@ -682,17 +673,16 @@ GtkWidget *vd_pop_menu(ViewDir *vd, FileData *fd)
 
        menu_item_add_divider(menu);
 
-       item = menu_item_add(menu, _("_View as"), NULL, NULL);
-       submenu = gtk_menu_new();
-       gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
 
-       for (i = 0; i < VIEW_DIR_TYPES_COUNT; i++)
-               {
-               item = menu_item_add_check(submenu, _(menu_view_dir_radio_entries[i].label),
-                                          ((gint) vd->type == menu_view_dir_radio_entries[i].value),
-                                          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(menu_view_dir_radio_entries[i].value));
-               }
+       item = menu_item_add_check(menu, _("View as _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,
+                                           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);
 
        menu_item_add_check(menu, _("Show _hidden files"), options->file_filter.show_hidden_files,
                            G_CALLBACK(vd_toggle_show_hidden_files_cb), vd);
index 9520a92..27895e4 100644 (file)
@@ -22,7 +22,6 @@ enum {
 };
 
 #define VIEW_DIR_TYPES_COUNT 2
-extern GtkRadioActionEntry menu_view_dir_radio_entries[VIEW_DIR_TYPES_COUNT];
 
 ViewDir *vd_new(DirViewType type, FileData *dir_fd);