[Glade-devel] [Glade-3] A tiny patch to delete catalogs when exiting[
- From: chastamar yahoo com (Chas)
- Subject: [Glade-devel] [Glade-3] A tiny patch to delete catalogs when exiting[
- Date: Sat, 31 Jul 2004 12:06:14 -0700 (PDT)
--0-1721231198-1091300774=:52864
Content-Type: text/plain; charset=us-ascii
Content-Id:
Content-Disposition: inline
Hi,
I've noticed that the widget catalogs are loaded but
never deleted (and glade_catalog_delete() is never
used).
This patch tries to fix this nicely by:
1) Making glade_catalog_delete a static function.
2) Exporting a new function instead:
glade_catalog_delete_all(), which deletes all of the
loaded catalogs.
3) Saving the catalog list as a local in main() and
having glade_init() initialize it.
4) Having main() call glade_catalog_delete_all() on
exit.
I'm aware that this isn't really an important thing
:-) Anyway, I hope this patch is okay.
Cheers,
Chas
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
--0-1721231198-1091300774=:52864
Content-Type: text/x-patch; name="delete_catalogs.patch"
Content-Description: delete_catalogs.patch
Content-Disposition: inline; filename="delete_catalogs.patch"
diff -rau src/glade-catalog.c /home/itamar/orig/glade3/src/glade-catalog.c
--- src/glade-catalog.c 2004-07-31 19:38:14.294066512 +0000
+++ /home/itamar/orig/glade3/src/glade-catalog.c 2004-05-01 22:05:31.000000000 +0000
@@ -37,8 +37,9 @@
#define GLADE_TAG_PALETTE "GladePalette"
-static void
-glade_catalog_delete (GladeCatalog *catalog, gpointer user_data)
+
+void
+glade_catalog_delete (GladeCatalog *catalog)
{
GList *list;
@@ -52,13 +53,6 @@
g_free (catalog);
}
-void
-glade_catalog_delete_all (GList *catalogs)
-{
- g_list_foreach (catalogs, (GFunc) glade_catalog_delete, NULL);
- g_list_free (catalogs);
-}
-
static GladeCatalog *
glade_catalog_load (const char *base_catalog_filename)
{
diff -rau src/glade-catalog.h /home/itamar/orig/glade3/src/glade-catalog.h
--- src/glade-catalog.h 2004-07-31 19:39:47.389913792 +0000
+++ /home/itamar/orig/glade3/src/glade-catalog.h 2003-11-09 15:16:41.000000000 +0000
@@ -20,9 +20,10 @@
GList *widget_classes; /* list of widget classes contained on this catalog */
};
-GList *glade_catalog_load_all (void);
-void glade_catalog_delete_all (GList *catalogs);
+void glade_catalog_delete (GladeCatalog *catalog);
+
+GList *glade_catalog_load_all (void);
const char *glade_catalog_get_title (GladeCatalog *catalog);
diff -rau src/main.c /home/itamar/orig/glade3/src/main.c
--- src/main.c 2004-07-31 19:39:56.127585464 +0000
+++ /home/itamar/orig/glade3/src/main.c 2004-04-29 21:03:18.000000000 +0000
@@ -92,9 +92,10 @@
#endif
static gint
-glade_init (GList **catalogs)
+glade_init ()
{
GladeProjectWindow *project_window;
+ GList *catalogs;
if (!g_module_supported ())
{
@@ -113,11 +114,11 @@
*/
glade_cursor_init ();
- *catalogs = glade_catalog_load_all ();
- if (! *catalogs)
+ catalogs = glade_catalog_load_all ();
+ if (!catalogs)
return FALSE;
- project_window = glade_project_window_new (*catalogs);
+ project_window = glade_project_window_new (catalogs);
return TRUE;
}
@@ -126,7 +127,6 @@
main (int argc, char *argv[])
{
GList *files = NULL;
- GList *catalogs = NULL;
#ifdef G_OS_UNIX
poptContext popt_context;
#endif
@@ -150,7 +150,7 @@
glade_setup_log_handlers ();
- if (!glade_init (&catalogs))
+ if (!glade_init ())
return -1;
if (widget_name != NULL)
@@ -174,8 +174,6 @@
gtk_main ();
- glade_catalog_delete_all (catalogs);
-
return 0;
}
--0-1721231198-1091300774=:52864--
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]