/soc/2013/ankitkv/gobjectification: 7141a2166848: Refactored gnt...
Ankit Vani
a at nevitus.org
Thu Aug 1 07:31:18 EDT 2013
Changeset: 7141a216684893a5b4c5ab167dc0100b832fe2a4
Author: Ankit Vani <a at nevitus.org>
Date: 2013-08-01 16:56 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/7141a2166848
Description:
Refactored gntplugin to use the initial GObject plugin API.
For now, I have disabled the 'Install plugin' button that allowed installing plugins from paths outside the search paths.
diffstat:
finch/gntplugin.c | 32 ++++++++++++++++++++++----------
1 files changed, 22 insertions(+), 10 deletions(-)
diffs (99 lines):
diff --git a/finch/gntplugin.c b/finch/gntplugin.c
--- a/finch/gntplugin.c
+++ b/finch/gntplugin.c
@@ -170,9 +170,10 @@ selection_changed(GntWidget *widget, gpo
* I probably mean 'plugin developers' by 'users' here. */
list = g_object_get_data(G_OBJECT(widget), "seen-list");
if (list)
- iter = g_list_find_custom(list, plugin->path, (GCompareFunc)strcmp);
+ iter = g_list_find_custom(list, gplugin_plugin_get_filename(plugin),
+ (GCompareFunc)strcmp);
if (!iter) {
- list = g_list_prepend(list, g_strdup(plugin->path));
+ list = g_list_prepend(list, g_strdup(gplugin_plugin_get_filename(plugin)));
g_object_set_data(G_OBJECT(widget), "seen-list", list);
}
@@ -311,6 +312,7 @@ configure_plugin_cb(GntWidget *button, g
g_object_unref(info);
}
+#if 0
static void
install_selected_file_cb(gpointer handle, const char *filename)
{
@@ -397,11 +399,12 @@ install_plugin_cb(GntWidget *w, gpointer
NULL, NULL, NULL, &handle);
g_signal_connect_swapped(G_OBJECT(w), "destroy", G_CALLBACK(purple_request_close_with_handle), &handle);
}
+#endif
-void finch_plugins_show_all()
+void finch_plugins_show_all(void)
{
GntWidget *window, *tree, *box, *aboot, *button;
- GList *iter;
+ GList *plugin_list, *iter;
GList *seen;
if (plugins.window) {
@@ -409,8 +412,6 @@ void finch_plugins_show_all()
return;
}
- purple_plugins_probe(G_MODULE_SUFFIX);
-
plugins.window = window = gnt_vbox_new(FALSE);
gnt_box_set_toplevel(GNT_BOX(window), TRUE);
gnt_box_set_title(GNT_BOX(window), _("Plugins"));
@@ -438,10 +439,12 @@ void finch_plugins_show_all()
gnt_box_add_widget(GNT_BOX(box), aboot);
seen = purple_prefs_get_path_list("/finch/plugins/seen");
- for (iter = purple_plugins_get_all(); iter; iter = iter->next)
+
+ plugin_list = purple_plugins_find_all();
+ for (iter = plugin_list; iter; iter = iter->next)
{
GPluginPlugin *plug = iter->data;
-
+#if 0
if (plug->info->type == PURPLE_PLUGIN_LOADER) {
GList *cur;
for (cur = PURPLE_PLUGIN_LOADER_INFO(plug)->exts; cur != NULL;
@@ -454,13 +457,20 @@ void finch_plugins_show_all()
(plug->info->flags & PURPLE_PLUGIN_FLAG_INVISIBLE) ||
plug->error)
continue;
+#endif
+ GPluginPluginInfo *info = gplugin_plugin_get_info(plug);
gnt_tree_add_choice(GNT_TREE(tree), plug,
- gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL);
+ gnt_tree_create_row(GNT_TREE(tree), gplugin_plugin_info_get_name(info)), NULL, NULL);
gnt_tree_set_choice(GNT_TREE(tree), plug, purple_plugin_is_loaded(plug));
- if (!g_list_find_custom(seen, plug->path, (GCompareFunc)strcmp))
+ if (!g_list_find_custom(seen, gplugin_plugin_get_filename(plug),
+ (GCompareFunc)strcmp))
gnt_tree_set_row_flags(GNT_TREE(tree), plug, GNT_TEXT_FLAG_BOLD);
+
+ g_object_unref(info);
}
+ purple_plugins_free_found_list(plugin_list);
+
gnt_tree_set_col_width(GNT_TREE(tree), 0, 30);
g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL);
g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL);
@@ -469,10 +479,12 @@ void finch_plugins_show_all()
box = gnt_hbox_new(FALSE);
gnt_box_add_widget(GNT_BOX(window), box);
+#if 0
button = gnt_button_new(_("Install Plugin..."));
gnt_box_add_widget(GNT_BOX(box), button);
gnt_util_set_trigger_widget(GNT_WIDGET(tree), GNT_KEY_INS, button);
g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(install_plugin_cb), NULL);
+#endif
button = gnt_button_new(_("Close"));
gnt_box_add_widget(GNT_BOX(box), button);
More information about the Commits
mailing list