mm calls EDs new switch-gui script
[pandora-libraries.git] / minimenu / mmui.c
index b922800..6b80599 100644 (file)
@@ -1214,13 +1214,12 @@ void ui_process_input ( unsigned char block_p ) {
          "Cache previews to SD now",
          "Run xfce4 from Minimenu",
          "Run a terminal/console",
-         "Exit and run xfce4",
-         "Exit and run pmenu",
+         "Switch preferred GUI",
          "Quit (<- beware)",
          "Select a Minimenu skin",
          "About Minimenu"
        };
-       int sel = ui_modal_single_menu ( opts, 11, "Minimenu", "Enter to select; other to return." );
+       int sel = ui_modal_single_menu ( opts, 10, "Minimenu", "Enter to select; other to return." );
 
        char buffer [ 100 ];
        if ( sel == 0 ) {
@@ -1238,6 +1237,9 @@ void ui_process_input ( unsigned char block_p ) {
          // reset view
          ui_selected = NULL;
          ui_rows_scrolled_down = 0;
+         // set back to first tab, to be safe
+         ui_category = 0;
+         ui_catshift = 0;
        } else if ( sel == 3 ) {
          // cache preview to SD now
          extern pnd_box_handle g_active_apps;
@@ -1277,29 +1279,17 @@ void ui_process_input ( unsigned char block_p ) {
          }
 
        } else if ( sel == 6 ) {
-         // set env to xfce
-         sprintf ( buffer, "echo startxfce4 > /tmp/gui.load" );
-         system ( buffer );
+         char buffer [ PATH_MAX ];
+         sprintf ( buffer, "%s %s\n", MM_RUN, "/usr/pandora/scripts/op_switchgui.sh" );
          emit_and_quit ( buffer );
-         //sprintf ( buffer, "sudo poweroff" );
-         //system ( buffer );
-         exit ( 0 );
        } else if ( sel == 7 ) {
-         // set env to pmenu
-         sprintf ( buffer, "echo pmenu > /tmp/gui.load" );
-         system ( buffer );
-         emit_and_quit ( buffer );
-         //sprintf ( buffer, "sudo poweroff" );
-         //system ( buffer );
-         exit ( 0 );
-       } else if ( sel == 8 ) {
          emit_and_quit ( MM_QUIT );
-       } else if ( sel == 9 ) {
+       } else if ( sel == 8 ) {
          // select skin
          if ( ui_pick_skin() ) {
            emit_and_quit ( MM_RESTART );
          }
-       } else if ( sel == 10 ) {
+       } else if ( sel == 9 ) {
          // about
        }
 
@@ -1623,6 +1613,8 @@ void ui_push_exec ( void ) {
 
 void ui_push_ltrigger ( void ) {
   unsigned char oldcat = ui_category;
+  unsigned int screen_width = pnd_conf_get_as_int_d ( g_conf, "display.screen_width", 800 );
+  unsigned int tab_width = pnd_conf_get_as_int ( g_conf, "tabs.tab_width" );
 
   if ( ui_category > 0 ) {
     ui_category--;
@@ -1630,6 +1622,10 @@ void ui_push_ltrigger ( void ) {
   } else {
     if ( pnd_conf_get_as_int_d ( g_conf, "tabs.wraparound", 0 ) > 0 ) {
       ui_category = g_categorycount - 1;
+      ui_catshift = 0;
+      if ( ui_category >= ( screen_width / tab_width ) ) {
+       ui_catshift = ui_category - ( screen_width / tab_width ) + 1;
+      }
       category_fs_restock ( &(g_categories [ ui_category ]) );
     }
   }
@@ -1664,6 +1660,7 @@ void ui_push_rtrigger ( void ) {
   } else {
     if ( pnd_conf_get_as_int_d ( g_conf, "tabs.wraparound", 0 ) > 0 ) {
       ui_category = 0;
+      ui_catshift = 0;
       category_fs_restock ( &(g_categories [ ui_category ]) );
     }
   }