1 #include "../cache.h" 2 #include "../debug.h" 3 4 5 void setup_browser(bool fallback_to_pager) 6 { 7 if (!isatty(1) || dump_trace) 8 use_browser = 0; 9 10 /* default to TUI */ 11 if (use_browser < 0) 12 use_browser = 1; 13 14 switch (use_browser) { 15 case 2: 16 if (perf_gtk__init() == 0) 17 break; 18 /* fall through */ 19 case 1: 20 use_browser = 1; 21 if (ui__init() == 0) 22 break; 23 /* fall through */ 24 default: 25 use_browser = 0; 26 if (fallback_to_pager) 27 setup_pager(); 28 break; 29 } 30 } 31 32 void exit_browser(bool wait_for_ok) 33 { 34 switch (use_browser) { 35 case 2: 36 perf_gtk__exit(wait_for_ok); 37 break; 38 39 case 1: 40 ui__exit(wait_for_ok); 41 break; 42 43 default: 44 break; 45 } 46 } 47