Mercurial > pidgin.yaz
annotate console/gntplugin.c @ 14141:5f656a0a82b7
[gaim-migrate @ 16783]
Whitespace and warning fixes:
gtkaccount.c: In function ¡Æicon_select_cb¡Ç:
gtkaccount.c:289: warning: passing argument 1 of
¡Ægaim_gtk_buddy_icon_chooser_new¡Ç from incompatible pointer type
gtkaccount.c:289: warning: passing argument 2 of
¡Ægaim_gtk_buddy_icon_chooser_new¡Ç from incompatible pointer type
gtkstatusbox.c: In function ¡Æicon_box_press_cb¡Ç:
gtkstatusbox.c:951: warning: passing argument 2 of
¡Ægaim_gtk_buddy_icon_chooser_new¡Ç from incompatible pointer type
gtkstatusbox.c:951: warning: ISO C90 forbids mixed declarations and code
gtkstatusbox.c: In function ¡Æicon_box_enter_cb¡Ç:
gtkstatusbox.c:960: warning: passing argument 1 of ¡Ægtk_image_set_from_pixbuf¡Ç
from incompatible pointer type
gtkstatusbox.c: In function ¡Æicon_box_leave_cb¡Ç:
gtkstatusbox.c:968: warning: passing argument 1 of ¡Ægtk_image_set_from_pixbuf¡Ç
from incompatible pointer type
gtkstatusbox.c: In function ¡Ægtk_gaim_status_box_size_allocate¡Ç:
gtkstatusbox.c:1183: warning: passing argument 1 of ¡Ægtk_image_set_from_pixbuf¡Ç
from incompatible pointer type
gtkstatusbox.c: In function ¡Ægtk_gaim_status_box_set_buddy_icon¡Ç:
gtkstatusbox.c:1338: warning: passing argument 1 of ¡Ægtk_image_set_from_pixbuf¡Ç
from incompatible pointer type
gtkutils.c: In function ¡Ægaim_gtk_convert_buddy_icon¡Ç:
gtkutils.c:2463: warning: ISO C90 forbids mixed declarations and code
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 16 Aug 2006 06:31:59 +0000 |
parents | 44ec6c7cbc76 |
children | 5b9daf111b42 |
rev | line source |
---|---|
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include <gnt.h> |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 #include <gntbox.h> |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
3 #include <gntbutton.h> |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 #include <gntlabel.h> |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 #include <gntline.h> |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 #include <gnttree.h> |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 #include "notify.h" |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 #include "gntgaim.h" |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 #include "gntplugin.h" |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 static struct |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 GntWidget *tree; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 GntWidget *window; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 GntWidget *aboot; |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
18 GntWidget *conf; |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 } plugins; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 static void |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
22 decide_conf_button(GaimPlugin *plugin) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
23 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
24 if (gaim_plugin_is_loaded(plugin) && |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
25 ((GAIM_IS_GNT_PLUGIN(plugin) && |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
26 GAIM_GNT_PLUGIN_UI_INFO(plugin) != NULL) || |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
27 (plugin->info->prefs_info && |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
28 plugin->info->prefs_info->get_plugin_pref_frame))) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
29 gnt_widget_set_visible(plugins.conf, TRUE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
30 else |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
31 gnt_widget_set_visible(plugins.conf, FALSE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
32 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
33 gnt_box_readjust(GNT_BOX(plugins.window)); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
34 gnt_widget_draw(plugins.window); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
35 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
36 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
37 static void |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 plugin_toggled_cb(GntWidget *tree, GaimPlugin *plugin, gpointer null) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 if (gnt_tree_get_choice(GNT_TREE(tree), plugin)) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 if(!gaim_plugin_load(plugin)) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 gaim_notify_error(NULL, "ERROR", "loading plugin failed", NULL); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 else |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 if (!gaim_plugin_unload(plugin)) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 gaim_notify_error(NULL, "ERROR", "unloading plugin failed", NULL); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 } |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
50 decide_conf_button(plugin); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 gg_plugins_save_loaded(); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 /* Xerox */ |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 void |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 gg_plugins_save_loaded(void) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 GList *pl; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 GList *files = NULL; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 GaimPlugin *p; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 for (pl = gaim_plugins_get_loaded(); pl != NULL; pl = pl->next) { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 p = pl->data; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 if (p->info->type != GAIM_PLUGIN_PROTOCOL && |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 p->info->type != GAIM_PLUGIN_LOADER) { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 files = g_list_append(files, p->path); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 gaim_prefs_set_string_list("/gaim/gnt/plugins/loaded", files); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 g_list_free(files); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 static void |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 GaimPlugin *plugin = current; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 char *text; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 /* XXX: Use formatting and stuff */ |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot)); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 text = g_strdup_printf(_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n"), |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 plugin->info->name, plugin->info->version, plugin->info->description, |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 plugin->info->author, plugin->info->homepage, plugin->path); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot), |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 text, GNT_TEXT_FLAG_NORMAL); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0); |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
90 g_free(text); |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
91 decide_conf_button(plugin); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
94 static void |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
95 reset_plugin_window(GntWidget *window, gpointer null) |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
96 { |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
97 plugins.window = NULL; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
98 plugins.tree = NULL; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
99 plugins.aboot = NULL; |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
100 } |
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
101 |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
102 static int |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
103 plugin_compare(GaimPlugin *p1, GaimPlugin *p2) |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
104 { |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
105 char *s1 = g_utf8_strup(p1->info->name, -1); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
106 char *s2 = g_utf8_strup(p2->info->name, -1); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
107 int ret = g_utf8_collate(s1, s2); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
108 g_free(s1); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
109 g_free(s2); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
110 return ret; |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
111 } |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
112 |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
113 static void |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
114 configure_plugin_cb(GntWidget *button, gpointer null) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
115 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
116 GaimPlugin *plugin; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
117 GGPluginFrame callback; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
118 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
119 g_return_if_fail(plugins.tree != NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
120 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
121 plugin = gnt_tree_get_selection_data(GNT_TREE(plugins.tree)); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
122 if (!gaim_plugin_is_loaded(plugin)) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
123 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
124 gaim_notify_error(plugin, _("Error"), |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
125 _("Plugin need to be loaded before you can configure it."), NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
126 return; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
127 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
128 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
129 if (GAIM_IS_GNT_PLUGIN(plugin) && |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
130 (callback = GAIM_GNT_PLUGIN_UI_INFO(plugin)) != NULL) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
131 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
132 GntWidget *window = gnt_vbox_new(FALSE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
133 GntWidget *box, *button; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
134 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
135 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
136 gnt_box_set_title(GNT_BOX(window), plugin->info->name); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
137 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
138 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
139 box = callback(); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
140 gnt_box_add_widget(GNT_BOX(window), box); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
141 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
142 box = gnt_hbox_new(FALSE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
143 gnt_box_add_widget(GNT_BOX(window), box); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
144 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
145 button = gnt_button_new(_("Close")); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
146 gnt_box_add_widget(GNT_BOX(box), button); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
147 g_signal_connect_swapped(G_OBJECT(button), "activate", |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
148 G_CALLBACK(gnt_widget_destroy), window); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
149 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
150 gnt_widget_show(window); /* XXX: This window needs to be closed when the plugin is unloaded */ |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
151 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
152 else if (plugin->info->prefs_info && |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
153 plugin->info->prefs_info->get_plugin_pref_frame) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
154 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
155 gaim_notify_info(plugin, _("..."), |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
156 _("Still need to do something about this."), NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
157 return; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
158 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
159 else |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
160 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
161 gaim_notify_info(plugin, _("Error"), |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
162 _("No configuration options for this plugin."), NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
163 return; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
164 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
165 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
166 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 void gg_plugins_show_all() |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
168 { |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
169 GntWidget *window, *tree, *box, *aboot, *button; |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 GList *iter; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 if (plugins.window) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
172 return; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 gaim_plugins_probe(G_MODULE_SUFFIX); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 plugins.window = window = gnt_vbox_new(FALSE); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 gnt_box_set_title(GNT_BOX(window), _("Plugins")); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 gnt_box_set_pad(GNT_BOX(window), 0); |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
180 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 gnt_box_add_widget(GNT_BOX(window), |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 gnt_label_new(_("You can (un)load plugins from the following list."))); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 box = gnt_hbox_new(FALSE); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 gnt_box_add_widget(GNT_BOX(window), box); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 gnt_box_set_pad(GNT_BOX(box), 0); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 plugins.tree = tree = gnt_tree_new(); |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
192 gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)plugin_compare); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 gnt_box_add_widget(GNT_BOX(box), tree); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 gnt_box_add_widget(GNT_BOX(box), gnt_vline_new()); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 plugins.aboot = aboot = gnt_text_view_new(); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 gnt_widget_set_size(aboot, 40, 20); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 gnt_box_add_widget(GNT_BOX(box), aboot); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 for (iter = gaim_plugins_get_all(); iter; iter = iter->next) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 GaimPlugin *plug = iter->data; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 if (plug->info->type != GAIM_PLUGIN_STANDARD || |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE) || |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 plug->error) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 continue; |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 gnt_tree_add_choice(GNT_TREE(tree), plug, |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
211 gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
212 gnt_tree_set_choice(GNT_TREE(tree), plug, gaim_plugin_is_loaded(plug)); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
214 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
215 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
216 g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL); |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
217 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
218 box = gnt_hbox_new(FALSE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
219 gnt_box_add_widget(GNT_BOX(window), box); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
220 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
221 button = gnt_button_new(_("Close")); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
222 gnt_box_add_widget(GNT_BOX(box), button); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
223 g_signal_connect_swapped(G_OBJECT(button), "activate", |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
224 G_CALLBACK(gnt_widget_destroy), window); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
225 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
226 plugins.conf = button = gnt_button_new(_("Configure Plugin")); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
227 gnt_box_add_widget(GNT_BOX(box), button); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
228 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(configure_plugin_cb), NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
229 |
14024
7109e6397a31
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
230 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(reset_plugin_window), NULL); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
231 |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
232 gnt_widget_show(window); |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
233 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
234 decide_conf_button(gnt_tree_get_selection_data(GNT_TREE(tree))); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
235 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
236 |