comparison src/plugins.c @ 1025:84a5d80e52f1

[gaim-migrate @ 1035] remember which directory you got the last plugin from and default to /usr/local/lib/gaim/ which is where they get installed by default (please fix this, it needs to be $libdir but i don't know how to get that from configure) committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 26 Oct 2000 02:12:34 +0000
parents 91b7377e7b45
children 80a47e3b1bca
comparison
equal deleted inserted replaced
1024:66481301d972 1025:84a5d80e52f1
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 *);
90 } 91 }
91 92
92 static void load_file(GtkWidget *w, gpointer data) 93 static void load_file(GtkWidget *w, gpointer data)
93 { 94 {
94 gchar *buf; 95 gchar *buf;
95 FILE *fd;
96 96
97 if (plugin_dialog) { 97 if (plugin_dialog) {
98 gtk_widget_show(plugin_dialog); 98 gtk_widget_show(plugin_dialog);
99 gdk_window_raise(plugin_dialog->window); 99 gdk_window_raise(plugin_dialog->window);
100 return; 100 return;
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 ) */