diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-07-21 15:29:07 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-07-21 15:29:07 +0200 |
commit | 7515bc1dd374c706871368ed585eb9794fa3fc4f (patch) | |
tree | d27ed9016ed68115c6502ebe4d5363e9f0900e19 /src/backend-dbus/actions.c | |
parent | 38c55222f00059864ff42b392797c4a17bfea8d8 (diff) | |
download | ayatana-indicator-session-7515bc1dd374c706871368ed585eb9794fa3fc4f.tar.gz ayatana-indicator-session-7515bc1dd374c706871368ed585eb9794fa3fc4f.tar.bz2 ayatana-indicator-session-7515bc1dd374c706871368ed585eb9794fa3fc4f.zip |
my_distro_help(): Be less Debian-centric and detect other browser, if x-www-browser does not exist.
Diffstat (limited to 'src/backend-dbus/actions.c')
-rw-r--r-- | src/backend-dbus/actions.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/backend-dbus/actions.c b/src/backend-dbus/actions.c index 1836d94..9169b5d 100644 --- a/src/backend-dbus/actions.c +++ b/src/backend-dbus/actions.c @@ -922,10 +922,47 @@ my_desktop_help (IndicatorSessionActions * self G_GNUC_UNUSED) run_outside_app ("yelp"); } +static char * +find_browser () +{ + static char * browser_path = NULL; + char* tmp_browser_path; + gchar **browser_names; + + int i; + + if (browser_path == NULL) + { + + browser_names = g_strsplit ("x-www-browser,google-chrome,firefox,chromium", ",", 0); + + for (i = 0; browser_names[i]; ++i) { + + tmp_browser_path = g_find_program_in_path (browser_names[i]); + + if (tmp_browser_path) { + browser_path = g_strdup (tmp_browser_path); + g_free (tmp_browser_path); + g_strfreev (browser_names); + break; + } + } + } + + return browser_path; + +} + static void my_distro_help (IndicatorSessionActions * self G_GNUC_UNUSED) { - run_outside_app(g_strdup_printf("x-www-browser '%s'", get_distro_url())); + static char * browser = NULL; + + if (browser == NULL) + browser = find_browser(); + + if (browser != NULL) + run_outside_app(g_strdup_printf("%s '%s'", browser, get_distro_url())); } |