diff options
author | TingPing <tingping@tingping.se> | 2013-08-10 19:44:38 -0400 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2013-08-10 19:44:38 -0400 |
commit | 0b95c1c444fd87583ae87ea3c59e883b5bfbbd0e (patch) | |
tree | 6efeb9871254fa3a5c6071558c061a820287b83c /src/fe-gtk | |
parent | 41c0c345cd45f01ec313de05aac7a1715ebd4476 (diff) | |
parent | 2917a83d7b5c8660d6eb518eb3d781faff32c3d3 (diff) |
Merge branch 'pluginreload'
Diffstat (limited to 'src/fe-gtk')
-rw-r--r-- | src/fe-gtk/plugingui.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/fe-gtk/plugingui.c b/src/fe-gtk/plugingui.c index c7193837..745c6d83 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) { @@ -223,7 +267,10 @@ plugingui_open (void) plugingui_loadbutton_cb, NULL, _("_Load...")); gtkutil_button (hbox, GTK_STOCK_DELETE, NULL, - plugingui_unload, NULL, _("_UnLoad")); + plugingui_unload, NULL, _("_Unload")); + + gtkutil_button (hbox, GTK_STOCK_REFRESH, NULL, + plugingui_reloadbutton_cb, view, _("_Reload")); fe_pluginlist_update (); |