1. mackx
  2. dr1000-hackx

Commits

mackx  committed 3c51512

Restructure extra items of ctb menu

  • Participants
  • Parent commits 28e3ffe
  • Branches default

Comments (0)

Files changed (1)

File ctb/src/menu.c

View file
 
 static const char *GROUP_ACTIONS            = "ctb_actions";
 static const char *GROUP_EXTRA              = "ctb_extra";
+
+static const char *GROUP_TOOLS              = "ctb_tools";
+static const char *GROUP_TOOLS2             = "ctb_tools2";
+static const char *GROUP_TOOLS_ACTIONS      = "ctb_tools_actions";
+
                                             
 // menu items                               
 //   group "Views"                          
 static const char *ITEM_ACTION_SHORTCUT     = "create_shortcut";
 #endif
 static const char *ITEM_ACTION_DELETE       = "delete_mode";
-static const char *ITEM_ACTION_PROPERTIES   = "properties";
-static const char *ITEM_ACTION_STARTPAGE    = "startpage";
-                                            
+
+//   group "Tools"
+static const char *ITEM_TOOLS_PROPERTIES    = "properties";
+static const char *ITEM_TOOLS_STARTPAGE     = "startpage";
+
 // item states                              
 static const char *STATE_NORMAL             = "normal";
 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW
 {
     g_sort_item = g_string_new("");
 
-    // add groups
+    // add groups                                      gr:name; item:icon
     const char *group = GROUP_VIEWS;
     ipc_menu_add_group( group,                  "",    "folder"          );
     ipc_menu_add_item ( ITEM_VIEW_ICON,         group, "view_small"      );
 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW
-    ipc_menu_add_item ( ITEM_VIEW_DETAIL,         group, "view_detail"     );
+    ipc_menu_add_item ( ITEM_VIEW_DETAIL,       group, "view_detail"     );
 #endif
     ipc_menu_add_item ( ITEM_VIEW_CONTENT,      group, "view_content"     );
 
     ipc_menu_add_item ( ITEM_ACTION_SHORTCUT,   group, "create_shortcut" );
 #endif
     ipc_menu_add_item ( ITEM_ACTION_DELETE,     group, "delete"          );
-    ipc_menu_add_item ( ITEM_ACTION_PROPERTIES, group, "properties"      );
-    ipc_menu_add_item ( ITEM_ACTION_STARTPAGE,  group, "startpage"       );
+
+    group = GROUP_TOOLS;
+    ipc_menu_add_group( group,                  "",    "folder"          );
+    ipc_menu_add_group( GROUP_TOOLS2,           group, "folder"          );
+    ipc_menu_add_group( GROUP_TOOLS_ACTIONS,    GROUP_TOOLS2, "folder"          );
+    ipc_menu_add_item ( ITEM_TOOLS_PROPERTIES,  GROUP_TOOLS_ACTIONS, "view_bookinfo"   );
+    ipc_menu_add_item ( ITEM_TOOLS_STARTPAGE,   group, "startpage"       );
 
     group = GROUP_EXTRA;
     ipc_menu_add_group( group,                  "",    "folder"          );
-    ipc_menu_add_item ( ITEM_ACTION_STARTPAGE,  group, "startpage"       );
+    ipc_menu_add_item ( ITEM_TOOLS_STARTPAGE,   group, "startpage"       );
 
     // add menus
-    ipc_menu_add_menu(MENU_CONTENT_MEDIA,       GROUP_VIEWS,   GROUP_SORT,    GROUP_ACTIONS);
-    ipc_menu_add_menu(MENU_CONTENT,             GROUP_VIEWS,   GROUP_EXTRA,   NULL);
-    ipc_menu_add_menu(MENU_CONTENT_DELETE_MODE, GROUP_ACTIONS, NULL,          NULL);
-    ipc_menu_add_menu(MENU_CONTENT_RECENT_MODE, GROUP_VIEWS,   GROUP_ACTIONS, NULL);
+    ipc_menu_add_menu(MENU_CONTENT_MEDIA,       GROUP_VIEWS,   GROUP_SORT,    GROUP_TOOLS,   GROUP_ACTIONS);
+    ipc_menu_add_menu(MENU_CONTENT,             GROUP_VIEWS,   GROUP_EXTRA,   NULL,          NULL);
+    ipc_menu_add_menu(MENU_CONTENT_DELETE_MODE, GROUP_TOOLS,   GROUP_ACTIONS, NULL,          NULL);
+    ipc_menu_add_menu(MENU_CONTENT_RECENT_MODE, GROUP_VIEWS,   GROUP_TOOLS,   GROUP_ACTIONS, NULL);
 
     ipc_menu_set_item_state(BACK_TO_LIBRARY, SYSTEM_TOP, STATE_NORMAL);
 
 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW
     ipc_menu_set_item_label ( ITEM_ACTION_SHORTCUT,   group, _("Add Shortcut")      );
 #endif
-    ipc_menu_set_item_label ( ITEM_ACTION_PROPERTIES, group, _("Properties")        );
-    ipc_menu_set_item_label ( ITEM_ACTION_STARTPAGE,  group, _("Set as StartPage")  );
+    //
+    group = GROUP_TOOLS_ACTIONS;
+    ipc_menu_set_group_label( GROUP_TOOLS2,                  _("Tools")             );
+    ipc_menu_set_item_label ( ITEM_TOOLS_PROPERTIES,  group, _("Properties...")     );
+    ipc_menu_set_item_label ( ITEM_TOOLS_STARTPAGE,   group, _("Set as StartPage")  );
     //
     group = GROUP_EXTRA;
-    ipc_menu_set_item_label ( ITEM_ACTION_STARTPAGE,  group, _("Set as StartPage")  );
+    ipc_menu_set_item_label ( ITEM_TOOLS_STARTPAGE,   group, _("Set as StartPage")  );
 
 
     update_viewmode_text();
                 fileview_create_shortcut();
             }
 #endif
-            else if ( strcmp(item, ITEM_ACTION_PROPERTIES  ) == 0 )
+            else
+            {
+                WARNPRINTF("unexpected menu item [%s] in group [%s]", item, group);
+                ok = FALSE;
+            }
+        }
+        else
+        {
+            WARNPRINTF("ignore state [%s] item [%s][%s]", state, item, group);
+        }
+    }
+    else if ( strcmp(group, GROUP_TOOLS_ACTIONS) == 0 )
+    {
+        if ( strcmp(state, STATE_NORMAL) == 0 )
+        {
+            if ( strcmp(item, ITEM_TOOLS_PROPERTIES  ) == 0 )
             {
                 fileview_edit_properties();
             }
-            else if ( strcmp(item, ITEM_ACTION_STARTPAGE  ) == 0 )
+            else if ( strcmp(item, ITEM_TOOLS_STARTPAGE  ) == 0 )
             {
                 fileview_set_as_startup_view();
             }
     {
         if ( strcmp(state, STATE_NORMAL) == 0 )
         {
-            if ( strcmp(item, ITEM_ACTION_STARTPAGE  ) == 0 )
+            if ( strcmp(item, ITEM_TOOLS_STARTPAGE  ) == 0 )
             {
                 fileview_set_as_startup_view();
             }