1
|
1 /*
|
|
2 * gaim
|
|
3 *
|
|
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
|
|
5 *
|
|
6 * This program is free software; you can redistribute it and/or modify
|
|
7 * it under the terms of the GNU General Public License as published by
|
|
8 * the Free Software Foundation; either version 2 of the License, or
|
|
9 * (at your option) any later version.
|
|
10 *
|
|
11 * This program is distributed in the hope that it will be useful,
|
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 * GNU General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU General Public License
|
|
17 * along with this program; if not, write to the Free Software
|
|
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 *
|
|
20 * ----------------
|
|
21 * The Plug-in plug
|
|
22 *
|
|
23 * Plugin support is currently being maintained by Mike Saraf
|
|
24 * msaraf@dwc.edu
|
|
25 *
|
|
26 */
|
|
27
|
|
28 #include <string.h>
|
|
29 #include <sys/time.h>
|
|
30
|
|
31 #include <sys/types.h>
|
|
32 #include <sys/stat.h>
|
|
33
|
|
34 #include <unistd.h>
|
|
35 #include <stdio.h>
|
|
36 #include <stdlib.h>
|
|
37 #include <gtk/gtk.h>
|
|
38 #include "gaim.h"
|
|
39
|
|
40 /* ------------------ Local Variables -------------------------*/
|
|
41
|
|
42 static GtkWidget *plugins=NULL;
|
|
43
|
|
44 /* --------------- Function Declarations -------------------- */
|
|
45
|
|
46 static void destroy_plugins();
|
|
47 void do_plugins(GtkWidget *, void *);
|
|
48 /* ------------------ Code Below ---------------------------- */
|
|
49
|
|
50 void show_plugins()
|
|
51 {
|
|
52 char *buf = g_malloc(BUF_LEN);
|
|
53
|
|
54 if (!plugins)
|
|
55 {
|
|
56 plugins = gtk_file_selection_new("Gaim - Plugin List");
|
|
57
|
|
58 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(plugins));
|
|
59
|
|
60 if(getenv("PLUGIN_DIR") == NULL)
|
|
61 {
|
|
62 g_snprintf(buf, BUF_LEN - 1, "%s/", getenv("HOME"));
|
|
63 }
|
|
64 else
|
|
65 {
|
|
66 g_snprintf(buf, BUF_LEN - 1, "%s/", getenv("PLUGIN_DIR"));
|
|
67 }
|
|
68
|
|
69 gtk_file_selection_set_filename(GTK_FILE_SELECTION(plugins), buf);
|
|
70 gtk_signal_connect(GTK_OBJECT(plugins), "destroy",
|
|
71 GTK_SIGNAL_FUNC(destroy_plugins), plugins);
|
|
72
|
|
73 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugins)->ok_button),
|
|
74 "clicked", GTK_SIGNAL_FUNC(do_plugins), NULL);
|
|
75
|
|
76 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugins)->cancel_button),
|
|
77 "clicked", GTK_SIGNAL_FUNC(destroy_plugins),plugins );
|
|
78
|
|
79 }
|
|
80
|
|
81 gtk_widget_show(plugins);
|
|
82 gdk_window_raise(plugins->window);
|
|
83 }
|
|
84
|
|
85 void do_plugins(GtkWidget *w, void *dummy)
|
|
86 {
|
|
87 }
|
|
88
|
|
89 static void destroy_plugins()
|
|
90 {
|
|
91 if (plugins)
|
|
92 gtk_widget_destroy(plugins);
|
|
93
|
|
94 plugins = NULL;
|
|
95 }
|