about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-03-01 00:03:11 +0000
committerJames Booth <boothj5@gmail.com>2016-03-01 00:03:11 +0000
commit7fdf50eb31f5cb9f15082c9ebb1e4e421756d4a2 (patch)
treed9925dad2479e198a3923e6d4dd88f5d38dd854a /src
parentda7e59bc86668083270b31574886d3a5e2549eee (diff)
downloadprofani-tty-7fdf50eb31f5cb9f15082c9ebb1e4e421756d4a2.tar.gz
Add plugin wins to /win and /close autocompletion
Diffstat (limited to 'src')
-rw-r--r--src/ui/window.c2
-rw-r--r--src/window_list.c20
2 files changed, 18 insertions, 4 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 585c0b21..05eaf586 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -350,7 +350,7 @@ win_get_string(ProfWin *window)
         {
             ProfPluginWin *pluginwin = (ProfPluginWin*)window;
             GString *gstring = g_string_new("");
-            g_string_append_printf(gstring, "%s plugin", pluginwin->tag);
+            g_string_append_printf(gstring, "Plugin: %s", pluginwin->tag);
             char *res = gstring->str;
             g_string_free(gstring, FALSE);
             return res;
diff --git a/src/window_list.c b/src/window_list.c
index 35f49fdd..5fab7ba0 100644
--- a/src/window_list.c
+++ b/src/window_list.c
@@ -389,6 +389,11 @@ wins_get_by_string(char *str)
         return (ProfWin*)privwin;
     }
 
+    ProfPluginWin *pluginwin = wins_get_plugin(str);
+    if (pluginwin) {
+        return (ProfWin*)pluginwin;
+    }
+
     return NULL;
 }
 
@@ -539,6 +544,13 @@ wins_close_by_num(int i)
                 autocomplete_remove(wins_close_ac, "xmlconsole");
                 break;
             }
+            case WIN_PLUGIN:
+            {
+                ProfPluginWin *pluginwin = (ProfPluginWin*)window;
+                autocomplete_remove(wins_ac, pluginwin->tag);
+                autocomplete_remove(wins_close_ac, pluginwin->tag);
+                break;
+            }
             case WIN_MUC_CONFIG:
             default:
                 break;
@@ -640,10 +652,12 @@ wins_new_plugin(const char * const tag)
 {
     GList *keys = g_hash_table_get_keys(windows);
     int result = get_next_available_win_num(keys);
-    ProfWin *new = win_create_plugin(tag);
-    g_hash_table_insert(windows, GINT_TO_POINTER(result), new);
     g_list_free(keys);
-    return new;
+    ProfWin *newwin = win_create_plugin(tag);
+    g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
+    autocomplete_add(wins_ac, tag);
+    autocomplete_add(wins_close_ac, tag);
+    return newwin;
 }
 
 gboolean