Merge pull request #17 from vodik/config-file

Add browser settings.
This commit is contained in:
Daniel Micay 2012-06-07 17:19:58 -07:00
commit 671b3d7a0e
1 changed files with 11 additions and 2 deletions

View File

@ -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;
} }
@ -289,6 +291,13 @@ static void load_config(GtkWindow *window, VteTerminal *vte,
if (get_config_boolean(config, "options", "clickable_url", &cfgbool)) if (get_config_boolean(config, "options", "clickable_url", &cfgbool))
*clickable_url = cfgbool; *clickable_url = cfgbool;
if (get_config_string(config, "options", "browser", &cfgstr)) {
browser_cmd[0] = cfgstr;
} else {
browser_cmd[0] = g_getenv("BROWSER");
if (!browser_cmd[0]) *clickable_url = false;
}
if (get_config_string(config, "options", "font", &cfgstr)) { if (get_config_string(config, "options", "font", &cfgstr)) {
vte_terminal_set_font_from_string(vte, cfgstr); vte_terminal_set_font_from_string(vte, cfgstr);
g_free(cfgstr); g_free(cfgstr);