| 61 static GtkWidget *plugtext; |
61 static GtkWidget *plugtext; |
| 62 static GtkWidget *plugwindow; |
62 static GtkWidget *plugwindow; |
| 63 |
63 |
| 64 static GtkWidget *config = NULL; |
64 static GtkWidget *config = NULL; |
| 65 static guint confighandle = 0; |
65 static guint confighandle = 0; |
| |
66 static char *last_dir = NULL; |
| 66 |
67 |
| 67 /* --------------- Function Declarations --------------------- */ |
68 /* --------------- Function Declarations --------------------- */ |
| 68 |
69 |
| 69 void show_plugins (GtkWidget *, gpointer); |
70 void show_plugins (GtkWidget *, gpointer); |
| 70 void load_plugin (char *); |
71 void load_plugin (char *); |
| 103 plugin_dialog = gtk_file_selection_new(_("Gaim - Plugin List")); |
103 plugin_dialog = gtk_file_selection_new(_("Gaim - Plugin List")); |
| 104 |
104 |
| 105 gtk_file_selection_hide_fileop_buttons( |
105 gtk_file_selection_hide_fileop_buttons( |
| 106 GTK_FILE_SELECTION(plugin_dialog)); |
106 GTK_FILE_SELECTION(plugin_dialog)); |
| 107 |
107 |
| 108 buf = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, PLUGIN_DIR, NULL); |
108 if (!last_dir) |
| 109 fd = fopen(buf, "r"); |
109 /* someone fix me please, how do we get the dir from configure? */ |
| 110 if (!fd) |
110 buf = g_strdup("/usr/local/lib/gaim/"); |
| 111 mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR); |
|
| 112 else |
111 else |
| 113 fclose(fd); |
112 buf = g_strconcat(last_dir, G_DIR_SEPARATOR_S, NULL); |
| 114 |
113 |
| 115 gtk_file_selection_set_filename(GTK_FILE_SELECTION(plugin_dialog), buf); |
114 gtk_file_selection_set_filename(GTK_FILE_SELECTION(plugin_dialog), buf); |
| 116 gtk_file_selection_complete(GTK_FILE_SELECTION(plugin_dialog), "*.so"); |
115 gtk_file_selection_complete(GTK_FILE_SELECTION(plugin_dialog), "*.so"); |
| 117 gtk_signal_connect(GTK_OBJECT(plugin_dialog), "destroy", |
116 gtk_signal_connect(GTK_OBJECT(plugin_dialog), "destroy", |
| 118 GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog); |
117 GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog); |
| 161 if (!g_path_is_absolute(filename)) |
160 if (!g_path_is_absolute(filename)) |
| 162 plug->filename = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, |
161 plug->filename = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, |
| 163 PLUGIN_DIR, filename, NULL); |
162 PLUGIN_DIR, filename, NULL); |
| 164 else |
163 else |
| 165 plug->filename = g_strdup(filename); |
164 plug->filename = g_strdup(filename); |
| |
165 |
| |
166 if (last_dir) |
| |
167 g_free(last_dir); |
| |
168 last_dir = g_dirname(plug->filename); |
| 166 |
169 |
| 167 debug_printf("Loading %s\n", filename); |
170 debug_printf("Loading %s\n", filename); |
| 168 /* do NOT `OR' with RTLD_GLOBAL, otherwise plugins may conflict |
171 /* do NOT `OR' with RTLD_GLOBAL, otherwise plugins may conflict |
| 169 * (it's really just a way to work around other people's bad |
172 * (it's really just a way to work around other people's bad |
| 170 * programming, by not using RTLD_GLOBAL :P ) */ |
173 * programming, by not using RTLD_GLOBAL :P ) */ |