Call g_getenv only one at startup.
This commit is contained in:
parent
94f6ed428f
commit
8d71f04b58
|
@ -29,6 +29,8 @@ typedef struct search_panel_info {
|
||||||
enum overlay_mode mode;
|
enum overlay_mode mode;
|
||||||
} search_panel_info;
|
} search_panel_info;
|
||||||
|
|
||||||
|
static const gchar *browser_cmd[3] = { NULL };
|
||||||
|
|
||||||
static gboolean add_to_list_store(char *key,
|
static gboolean add_to_list_store(char *key,
|
||||||
__attribute__((unused)) void *value,
|
__attribute__((unused)) void *value,
|
||||||
GtkListStore *store) {
|
GtkListStore *store) {
|
||||||
|
@ -199,8 +201,8 @@ static char *check_match(VteTerminal *vte, int event_x, int event_y) {
|
||||||
static gboolean button_press_cb(VteTerminal *vte, GdkEventButton *event) {
|
static gboolean button_press_cb(VteTerminal *vte, GdkEventButton *event) {
|
||||||
char *match = check_match(vte, (int)event->x, (int)event->y);
|
char *match = check_match(vte, (int)event->x, (int)event->y);
|
||||||
if (event->button == 1 && event->type == GDK_BUTTON_PRESS && match != NULL) {
|
if (event->button == 1 && event->type == GDK_BUTTON_PRESS && match != NULL) {
|
||||||
char *argv[] = URL_COMMAND(match);
|
browser_cmd[1] = match;
|
||||||
g_spawn_async(NULL, argv, NULL, (GSpawnFlags)0, NULL, NULL, NULL, NULL);
|
g_spawn_async(NULL, (gchar **)browser_cmd, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
|
||||||
g_free(match);
|
g_free(match);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -414,6 +416,9 @@ int main(int argc, char **argv) {
|
||||||
command_argv = default_argv;
|
command_argv = default_argv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
browser_cmd[0] = g_getenv("BROWSER");
|
||||||
|
if (!browser_cmd[0]) browser_cmd[0] = default_browser;
|
||||||
|
|
||||||
VtePty *pty = vte_terminal_pty_new(VTE_TERMINAL(vte), VTE_PTY_DEFAULT, &error);
|
VtePty *pty = vte_terminal_pty_new(VTE_TERMINAL(vte), VTE_PTY_DEFAULT, &error);
|
||||||
|
|
||||||
if (!pty) {
|
if (!pty) {
|
||||||
|
|
Loading…
Reference in New Issue