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