static void plugingui_unload (GtkWidget * wid, gpointer unused) { char *modname, *file, *buf; GtkTreeView *view; GtkTreeIter iter; view = g_object_get_data (G_OBJECT (plugin_window), "view"); if (!gtkutil_treeview_get_selected (view, &iter, NAME_COLUMN, &modname, FILE_COLUMN, &file, -1)) return; if (g_str_has_suffix (file, "."G_MODULE_SUFFIX)) { if (plugin_kill (modname, FALSE) == 2) fe_message (_("That plugin is refusing to unload.\n"), FE_MSG_ERROR); } else { /* let python.so or perl.so handle it */ buf = malloc (strlen (file) + 10); if (strchr (file, ' ')) sprintf (buf, "UNLOAD \"%s\"", file); else sprintf (buf, "UNLOAD %s", file); handle_command (current_sess, buf, FALSE); free (buf); } g_free (modname); g_free (file); }
static void plugingui_unload (GtkWidget * wid, gpointer unused) { int len; char *modname, *file, *buf; GtkTreeView *view; GtkTreeIter iter; view = g_object_get_data (G_OBJECT (plugin_window), "view"); if (!gtkutil_treeview_get_selected (view, &iter, NAME_COLUMN, &modname, FILE_COLUMN, &file, -1)) return; len = strlen (file); #ifdef WIN32 if (len > 4 && g_ascii_strcasecmp (file + len - 4, ".dll") == 0) #else #if defined(__hpux) if (len > 3 && g_ascii_strcasecmp (file + len - 3, ".sl") == 0) #else if (len > 3 && g_ascii_strcasecmp (file + len - 3, ".so") == 0) #endif #endif { if (plugin_kill (modname, FALSE) == 2) fe_message (_("That plugin is refusing to unload.\n"), FE_MSG_ERROR); } else { /* let python.so or perl.so handle it */ buf = malloc (strlen (file) + 10); if (strchr (file, ' ')) sprintf (buf, "UNLOAD \"%s\"", file); else sprintf (buf, "UNLOAD %s", file); handle_command (current_sess, buf, FALSE); free (buf); } g_free (modname); g_free (file); }