gedit r6231 - branches/jessevdk-plugins/gedit
- From: jessevdk svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit r6231 - branches/jessevdk-plugins/gedit
- Date: Sun, 6 Apr 2008 23:27:16 +0100 (BST)
Author: jessevdk
Date: Sun Apr 6 23:27:16 2008
New Revision: 6231
URL: http://svn.gnome.org/viewvc/gedit?rev=6231&view=rev
Log:
* gedit/gedit-plugin-info.c:
* gedit/gedit-plugin-info.h:
* gedit/gedit-plugin-info-priv.h:
Added _copy and _free functions. Added get_plugin and get_module_name
functions to be used for instance in python plugins
* gedit/gedit-plugin-manager.c: Fixed problems with never free'ing the
retrieved GeditPluginInfo's. References were off the charts
Modified:
branches/jessevdk-plugins/gedit/gedit-plugin-info-priv.h
branches/jessevdk-plugins/gedit/gedit-plugin-info.c
branches/jessevdk-plugins/gedit/gedit-plugin-info.h
branches/jessevdk-plugins/gedit/gedit-plugin-manager.c
Modified: branches/jessevdk-plugins/gedit/gedit-plugin-info-priv.h
==============================================================================
--- branches/jessevdk-plugins/gedit/gedit-plugin-info-priv.h (original)
+++ branches/jessevdk-plugins/gedit/gedit-plugin-info-priv.h Sun Apr 6 23:27:16 2008
@@ -70,8 +70,6 @@
};
GeditPluginInfo *_gedit_plugin_info_new (const gchar *file);
-void _gedit_plugin_info_ref (GeditPluginInfo *info);
-void _gedit_plugin_info_unref (GeditPluginInfo *info);
#endif /* __GEDIT_PLUGIN_INFO_PRIV_H__ */
Modified: branches/jessevdk-plugins/gedit/gedit-plugin-info.c
==============================================================================
--- branches/jessevdk-plugins/gedit/gedit-plugin-info.c (original)
+++ branches/jessevdk-plugins/gedit/gedit-plugin-info.c Sun Apr 6 23:27:16 2008
@@ -48,13 +48,6 @@
g_atomic_int_inc (&info->refcount);
}
-static GeditPluginInfo *
-gedit_plugin_info_copy (GeditPluginInfo *info)
-{
- _gedit_plugin_info_ref (info);
- return info;
-}
-
void
_gedit_plugin_info_unref (GeditPluginInfo *info)
{
@@ -101,7 +94,7 @@
the_type = g_boxed_type_register_static (
"GeditPluginInfo",
(GBoxedCopyFunc) gedit_plugin_info_copy,
- (GBoxedFreeFunc) _gedit_plugin_info_unref);
+ (GBoxedFreeFunc) gedit_plugin_info_free);
return the_type;
}
@@ -325,6 +318,14 @@
}
const gchar *
+gedit_plugin_info_get_module_name (GeditPluginInfo *info)
+{
+ g_return_val_if_fail (info != NULL, NULL);
+
+ return info->module_name;
+}
+
+const gchar *
gedit_plugin_info_get_description (GeditPluginInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
@@ -370,3 +371,27 @@
return info->copyright;
}
+
+GeditPlugin *
+gedit_plugin_info_get_plugin (GeditPluginInfo *info)
+{
+ g_return_val_if_fail (info != NULL, NULL);
+
+ if (!info->active || !info->available)
+ return NULL;
+
+ return info->plugin;
+}
+
+GeditPluginInfo *
+gedit_plugin_info_copy (GeditPluginInfo *info)
+{
+ _gedit_plugin_info_ref (info);
+ return info;
+}
+
+void
+gedit_plugin_info_free (GeditPluginInfo *info)
+{
+ _gedit_plugin_info_unref (info);
+}
Modified: branches/jessevdk-plugins/gedit/gedit-plugin-info.h
==============================================================================
--- branches/jessevdk-plugins/gedit/gedit-plugin-info.h (original)
+++ branches/jessevdk-plugins/gedit/gedit-plugin-info.h Sun Apr 6 23:27:16 2008
@@ -33,6 +33,7 @@
#define __GEDIT_PLUGIN_INFO_H__
#include <glib-object.h>
+#include "gedit-plugin.h"
G_BEGIN_DECLS
@@ -48,11 +49,16 @@
gboolean gedit_plugin_info_is_configurable (GeditPluginInfo *info);
const gchar *gedit_plugin_info_get_name (GeditPluginInfo *info);
+const gchar *gedit_plugin_info_get_module_name (GeditPluginInfo *info);
const gchar *gedit_plugin_info_get_description (GeditPluginInfo *info);
const gchar *gedit_plugin_info_get_icon_name (GeditPluginInfo *info);
const gchar **gedit_plugin_info_get_authors (GeditPluginInfo *info);
const gchar *gedit_plugin_info_get_website (GeditPluginInfo *info);
const gchar *gedit_plugin_info_get_copyright (GeditPluginInfo *info);
+GeditPlugin *gedit_plugin_info_get_plugin (GeditPluginInfo *info);
+
+GeditPluginInfo *gedit_plugin_info_copy (GeditPluginInfo *info);
+void gedit_plugin_info_free (GeditPluginInfo *info);
G_END_DECLS
Modified: branches/jessevdk-plugins/gedit/gedit-plugin-manager.c
==============================================================================
--- branches/jessevdk-plugins/gedit/gedit-plugin-manager.c (original)
+++ branches/jessevdk-plugins/gedit/gedit-plugin-manager.c Sun Apr 6 23:27:16 2008
@@ -127,6 +127,7 @@
gtk_window_set_transient_for (GTK_WINDOW (pm->priv->about),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET(pm))));
gtk_widget_show (pm->priv->about);
+ gedit_plugin_info_free(info);
}
static void
@@ -150,6 +151,7 @@
gedit_plugins_engine_configure_plugin (pm->priv->engine,
info, toplevel);
+ gedit_plugin_info_free(info);
gedit_debug_message (DEBUG_PLUGINS, "Done");
}
@@ -179,6 +181,7 @@
"sensitive", gedit_plugin_info_is_available (info),
NULL);
+ gedit_plugin_info_free(info);
g_free (text);
}
@@ -203,6 +206,7 @@
"icon-name", gedit_plugin_info_get_icon_name (info),
"sensitive", gedit_plugin_info_is_available (info),
NULL);
+ gedit_plugin_info_free(info);
}
@@ -246,6 +250,8 @@
gtk_widget_set_sensitive (GTK_WIDGET (pm->priv->configure_button),
(info != NULL) &&
gedit_plugin_info_is_configurable (info));
+
+ gedit_plugin_info_free(info);
}
static void
@@ -314,6 +320,7 @@
gtk_widget_set_sensitive (GTK_WIDGET (pm->priv->configure_button),
gedit_plugin_info_is_configurable (info));
+ gedit_plugin_info_free(info);
}
}
@@ -352,6 +359,8 @@
res = FALSE;
}
}
+
+ gedit_plugin_info_free(info);
return res;
}
@@ -453,6 +462,8 @@
g_free (normalized_string);
g_free (case_normalized_key);
g_free (case_normalized_string);
+
+ gedit_plugin_info_free(info);
return retval;
}
@@ -541,6 +552,8 @@
gtk_widget_show_all (menu);
+ gedit_plugin_info_free(info);
+
return menu;
}
@@ -629,12 +642,18 @@
gpointer user_data)
{
GeditPluginInfo *info1, *info2;
+ gint ret;
gtk_tree_model_get (model, iter1, INFO_COLUMN, &info1, -1);
gtk_tree_model_get (model, iter2, INFO_COLUMN, &info2, -1);
- return g_utf8_collate (gedit_plugin_info_get_name (info1),
- gedit_plugin_info_get_name (info2));
+ ret = g_utf8_collate (gedit_plugin_info_get_name (info1),
+ gedit_plugin_info_get_name (info2));
+
+ gedit_plugin_info_free(info1);
+ gedit_plugin_info_free(info2);
+
+ return ret;
}
static void
@@ -751,6 +770,8 @@
GeditPluginInfo *tinfo;
gtk_tree_model_get (model, &iter, INFO_COLUMN, &tinfo, -1);
info_found = info == tinfo;
+
+ gedit_plugin_info_free(tinfo);
}
if (!info_found)
@@ -762,6 +783,9 @@
GeditPluginInfo *tinfo;
gtk_tree_model_get (model, &iter, INFO_COLUMN, &tinfo, -1);
info_found = info == tinfo;
+
+ gedit_plugin_info_free(tinfo);
+
}
while (!info_found && gtk_tree_model_iter_next (model, &iter));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]