diff options
author | TingPing <tingping@tingping.se> | 2013-08-04 04:36:10 -0400 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2013-08-04 04:36:10 -0400 |
commit | e8456beadc9c065b52291ebdc552564d0a1d9069 (patch) | |
tree | 4a48b30b0f7e88d67b24c046b7e18370eeaae3d6 /src/fe-gtk | |
parent | bdc814a4a410610d8aee2211b13a3a86fe477dd3 (diff) |
Add reload command for plugins and add to gui
Diffstat (limited to 'src/fe-gtk')
-rw-r--r-- | src/fe-gtk/plugingui.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/fe-gtk/plugingui.c b/src/fe-gtk/plugingui.c index c7193837..ed093404 100644 --- a/src/fe-gtk/plugingui.c +++ b/src/fe-gtk/plugingui.c @@ -72,6 +72,31 @@ plugingui_treeview_new (GtkWidget *box) return view; } +static char * +plugingui_getfilename (GtkTreeView *view) +{ + GtkTreeModel *model; + GtkTreeSelection *sel; + GtkTreeIter iter; + GValue file; + char *str; + + memset (&file, 0, sizeof (file)); + + sel = gtk_tree_view_get_selection (view); + if (gtk_tree_selection_get_selected (sel, &model, &iter)) + { + gtk_tree_model_get_value (model, &iter, FILE_COLUMN, &file); + + str = g_value_dup_string (&file); + g_value_unset (&file); + + return str; + } + + return NULL; +} + static void plugingui_close (GtkWidget * wid, gpointer a) { @@ -193,6 +218,25 @@ plugingui_unload (GtkWidget * wid, gpointer unused) g_free (file); } +static void +plugingui_reloadbutton_cb (GtkWidget *wid, GtkTreeView *view) +{ + char *file = plugingui_getfilename(view); + + if (file) + { + char *buf = malloc (strlen (file) + 9); + + if (strchr (file, ' ')) + sprintf (buf, "RELOAD \"%s\"", file); + else + sprintf (buf, "RELOAD %s", file); + handle_command (current_sess, buf, FALSE); + free (buf); + g_free (file); + } +} + void plugingui_open (void) { @@ -225,6 +269,9 @@ plugingui_open (void) gtkutil_button (hbox, GTK_STOCK_DELETE, NULL, plugingui_unload, NULL, _("_UnLoad")); + gtkutil_button (hbox, NULL, NULL, + plugingui_reloadbutton_cb, view, _("_Reload...")); + fe_pluginlist_update (); gtk_widget_show_all (plugin_window); |