diff options
author | Robert Manea <gotmor@gmail.com> | 2009-09-07 14:50:05 +0200 |
---|---|---|
committer | Robert Manea <gotmor@gmail.com> | 2009-09-07 14:50:05 +0200 |
commit | 59c99ce1f8c10df88e62936e4ddb1bdc521e599e (patch) | |
tree | 1220f5b9cdadd7dd6d787e5d8bdcb928c31c9f52 /uzbl-core.c | |
parent | e6cdd95b0f08de2a8b71df40f8cfedacbf8c58b5 (diff) |
Added INSTANCE_START, INSTANCE_EXIT events and PID constant
Diffstat (limited to 'uzbl-core.c')
-rw-r--r-- | uzbl-core.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/uzbl-core.c b/uzbl-core.c index d8179df..e843182 100644 --- a/uzbl-core.c +++ b/uzbl-core.c @@ -187,6 +187,7 @@ const struct var_name_to_ptr_t { { "SELECTED_URI", PTR_C_STR(uzbl.state.selected_url, NULL)}, { "MODE", PTR_C_STR(uzbl.gui.sbar.mode_indicator, NULL)}, { "NAME", PTR_C_STR(uzbl.state.instance_name, NULL)}, + { "PID", PTR_C_STR(uzbl.info.pid_str, NULL)}, { NULL, {.ptr.s = NULL, .type = TYPE_INT, .dump = 0, .writeable = 0, .func = NULL}} }; @@ -214,7 +215,9 @@ const char *event_table[LAST_EVENT] = { "NEW_WINDOW" , "SELECTION_CHANGED", "VARIABLE_SET", - "FIFO_SET" + "FIFO_SET", + "INSTANCE_START", + "INSTANCE_EXIT", }; @@ -530,6 +533,8 @@ clean_up(void) { g_free(uzbl.state.keycmd); g_hash_table_destroy(uzbl.bindings); g_hash_table_destroy(uzbl.behave.commands); + + send_event(INSTANCE_EXIT, uzbl.info.pid_str); } /* --- SIGNAL HANDLER --- */ @@ -2963,6 +2968,11 @@ main (int argc, char* argv[]) { if(!uzbl.state.instance_name) uzbl.state.instance_name = itos((int)uzbl.xwin); + GString *tmp = g_string_new(""); + g_string_printf(tmp, "%d", getpid()); + uzbl.info.pid_str = g_string_free(tmp, FALSE); + send_event(INSTANCE_START, uzbl.info.pid_str); + gtk_widget_grab_focus (GTK_WIDGET (uzbl.gui.web_view)); if (uzbl.state.verbose) { |