forked from PsychoticNinja/irssi
Input lines are now never destroyed and they're associated to statusbar
name, so scripts can now do any statusbar changes without input line being cleared. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2643 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
32815dfbcb
commit
40bdfc4d70
@ -344,12 +344,13 @@ static void item_input(SBAR_ITEM_REC *item, int get_size_only)
|
|||||||
{
|
{
|
||||||
GUI_ENTRY_REC *rec;
|
GUI_ENTRY_REC *rec;
|
||||||
|
|
||||||
rec = g_hash_table_lookup(input_entries, item->bar);
|
rec = g_hash_table_lookup(input_entries, item->bar->config->name);
|
||||||
if (rec == NULL) {
|
if (rec == NULL) {
|
||||||
rec = gui_entry_create(item->xpos, item->bar->real_ypos,
|
rec = gui_entry_create(item->xpos, item->bar->real_ypos,
|
||||||
item->size, term_type == TERM_TYPE_UTF8);
|
item->size, term_type == TERM_TYPE_UTF8);
|
||||||
gui_entry_set_active(rec);
|
gui_entry_set_active(rec);
|
||||||
g_hash_table_insert(input_entries, item->bar, rec);
|
g_hash_table_insert(input_entries,
|
||||||
|
g_strdup(item->bar->config->name), rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_size_only) {
|
if (get_size_only) {
|
||||||
@ -363,17 +364,6 @@ static void item_input(SBAR_ITEM_REC *item, int get_size_only)
|
|||||||
gui_entry_redraw(rec); /* FIXME: this is only necessary with ^L.. */
|
gui_entry_redraw(rec); /* FIXME: this is only necessary with ^L.. */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_statusbar_destroyed(STATUSBAR_REC *bar)
|
|
||||||
{
|
|
||||||
GUI_ENTRY_REC *rec;
|
|
||||||
|
|
||||||
rec = g_hash_table_lookup(input_entries, bar);
|
|
||||||
if (rec != NULL) {
|
|
||||||
gui_entry_destroy(rec);
|
|
||||||
g_hash_table_remove(input_entries, bar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void read_settings(void)
|
static void read_settings(void)
|
||||||
{
|
{
|
||||||
if (active_entry != NULL)
|
if (active_entry != NULL)
|
||||||
@ -418,9 +408,8 @@ void statusbar_items_init(void)
|
|||||||
lag_timeout_tag = g_timeout_add(5000, (GSourceFunc) sig_lag_timeout, NULL);
|
lag_timeout_tag = g_timeout_add(5000, (GSourceFunc) sig_lag_timeout, NULL);
|
||||||
|
|
||||||
/* input */
|
/* input */
|
||||||
input_entries = g_hash_table_new((GHashFunc) g_direct_hash,
|
input_entries = g_hash_table_new((GHashFunc) g_str_hash,
|
||||||
(GCompareFunc) g_direct_equal);
|
(GCompareFunc) g_str_equal);
|
||||||
signal_add("statusbar destroyed", (SIGNAL_FUNC) sig_statusbar_destroyed);
|
|
||||||
|
|
||||||
read_settings();
|
read_settings();
|
||||||
signal_add_last("setup changed", (SIGNAL_FUNC) read_settings);
|
signal_add_last("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
@ -450,8 +439,8 @@ void statusbar_items_deinit(void)
|
|||||||
g_source_remove(lag_timeout_tag);
|
g_source_remove(lag_timeout_tag);
|
||||||
|
|
||||||
/* input */
|
/* input */
|
||||||
signal_remove("statusbar destroyed", (SIGNAL_FUNC) sig_statusbar_destroyed);
|
g_hash_table_foreach(input_entries, (GHFunc) g_free, NULL);
|
||||||
g_hash_table_destroy(input_entries);
|
g_hash_table_destroy(input_entries);
|
||||||
|
|
||||||
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user