[Goodies-commits] r1872 - in xfce4-weather-plugin/trunk: . panel-plugin
Nick Schermer
nick at xfce.org
Wed Aug 9 20:48:13 CEST 2006
Author: nick
Date: 2006-08-09 18:48:12 +0000 (Wed, 09 Aug 2006)
New Revision: 1872
Modified:
xfce4-weather-plugin/trunk/ChangeLog
xfce4-weather-plugin/trunk/panel-plugin/config_dialog.c
xfce4-weather-plugin/trunk/panel-plugin/http_client.c
xfce4-weather-plugin/trunk/panel-plugin/parsers.c
xfce4-weather-plugin/trunk/panel-plugin/plugin.c
xfce4-weather-plugin/trunk/panel-plugin/scrollbox.c
xfce4-weather-plugin/trunk/panel-plugin/search_dialog.c
xfce4-weather-plugin/trunk/panel-plugin/search_dialog.h
Log:
* Fix some memory leaks
* Clear dialog data and free the liststore
* Finalize scrollbox widget
* Use panel_slice_new0 and panel_slice_free
Modified: xfce4-weather-plugin/trunk/ChangeLog
===================================================================
--- xfce4-weather-plugin/trunk/ChangeLog 2006-08-09 15:37:33 UTC (rev 1871)
+++ xfce4-weather-plugin/trunk/ChangeLog 2006-08-09 18:48:12 UTC (rev 1872)
@@ -1,99 +1,109 @@
+2006-08-08 23:14 nick
+ * Fix some memory leaks
+ * Clear dialog data and free the liststore
+ * Finalize scrollbox widget
+ * Use panel_slice_new0 and panel_slice_free
+
+2006-08-08 01:30 nick
+ * Changed version: 0.5.90.2
+ * Released 0.5.90.2
+
2006-07-14 10:00 nick
- * Fixed problems with --as-needed
- * Some small mem leaks
- * Added LINGUAS support for translators
- * Raised version to 0.6.0, because i think it's ready for 4.4
- * You need libxfcegui4 from svn (or b2)
- * Added debug code
- * Some cleanups
+ * Fixed problems with --as-needed
+ * Some small mem leaks
+ * Added LINGUAS support for translators
+ * Raised version to 0.6.0, because i think it's ready for 4.4
+ * You need libxfcegui4 from svn (or b2)
+ * Added debug code
+ * Some cleanups
2006-06-11 20:17 nick
- * Reorder the includes a bit
- * Changed titled dialog
- * Added icon for the panel add items dialog
+ * Reorder the includes a bit
+ * Changed titled dialog
+ * Added icon for the panel add items dialog
2006-05-27 18:44 daichi
- * *.po: Updated.
- * *.gmo: Removed.
+ * *.po: Updated.
+ * *.gmo: Removed.
2006-05-22 21:13 nick
- * Make array const
- * Added G_{BEGIN,END}_DECLS
- * Improve Layout
- * Use guint where possible
+ * Make array const
+ * Added G_{BEGIN,END}_DECLS
+ * Improve Layout
+ * Use guint where possible
2006-05-19 14:42 nick
- * A lot if changed in the code to reduce exec. size
- * Fix build
- * Added new xfce dialog (if available)
+ * A lot if changed in the code to reduce exec. size
+ * Fix build
+ * Added new xfce dialog (if available)
2006-05-18 23:44 nick
- * Add refresh button to right click menu for the n00bs
- * Cleanup code layout
- * Free some extra pixbufs
- * Replaced (most) of the debug messages
- * Remove the build and intltool files, they don't belong
- in a repo IMHO
+ * Add refresh button to right click menu for the n00bs
+ * Cleanup code layout
+ * Free some extra pixbufs
+ * Replaced (most) of the debug messages
+ * Remove the build and intltool files, they don't belong
+ in a repo IMHO
2006-05-18 00:10 nick
- * Fix build errors
- * Free a pixbuf with g_object_unref, not with g_free
- * Typo in metric/imperial save
+ * Fix build errors
+ * Free a pixbuf with g_object_unref, not with g_free
+ * Typo in metric/imperial save
2006-05-04 00:37 benny
- * Apply patch from Oliver Lehmann to fix GCC 2.95 compilation.
- Bug #1759
+ * Apply patch from Oliver Lehmann to fix GCC 2.95 compilation.
+ Bug #1759
2006-04-25 22:52 bountykiller
- * update with version from Jasper - now compatible with Xfce-4.4
+ * update with version from Jasper - now compatible with Xfce-4.4
-2003-07-11 15:56 huysmans
-
- * panel-plugin/sample.c: Hmm, chinese translation updates that
- didn't get picked up by my previous commit. Should have been in
- rc1, sorry.
-
-2003-07-11 09:33 huysmans
-
- * ChangeLog: Update ChangeLog's for release
-
-2003-07-10 11:56 huysmans
-
- * ChangeLog: Update ChangeLog's for release
-
-2003-07-06 22:14 huysmans
-
- * ChangeLog: Update ChangeLogs
-
-2003-07-06 15:35 xfce
-
- * Makefile.in, aclocal.m4, config.h.in, configure, ltconfig,
- ltmain.sh, panel-plugin/Makefile.in: libtool update
-
-2003-07-02 12:18 bmeurer
-
- * AUTHORS, COPYING, INSTALL, autogen.sh, config.guess, config.sub,
- ltconfig, ltcf-c.sh, ltmain.sh, Makefile.in, aclocal.m4, compile,
- config.h.in, depcomp, install-sh, missing, mkinstalldirs,
- Makefile.am, README, configure, configure.ac, m4/debug.m4,
- m4/depends.m4, m4/i18n.m4, panel-plugin/Makefile.am,
- panel-plugin/Makefile.in, panel-plugin/sample.c: Initial import of
- the sample panel plugin.
-
-2003-07-02 12:18 bmeurer
-
- * AUTHORS, COPYING, INSTALL, autogen.sh, config.guess, config.sub,
- ltconfig, ltcf-c.sh, ltmain.sh, Makefile.in, aclocal.m4, compile,
- config.h.in, depcomp, install-sh, missing, mkinstalldirs,
- Makefile.am, README, configure, configure.ac, m4/debug.m4,
- m4/depends.m4, m4/i18n.m4, panel-plugin/Makefile.am,
- panel-plugin/Makefile.in, panel-plugin/sample.c: Initial revision
\ No newline at end of file
+2003-07-11 15:56 huysmans
+
+ * panel-plugin/sample.c: Hmm, chinese translation updates that
+ didn't get picked up by my previous commit. Should have been in
+ rc1, sorry.
+
+2003-07-11 09:33 huysmans
+
+ * ChangeLog: Update ChangeLog's for release
+
+2003-07-10 11:56 huysmans
+
+ * ChangeLog: Update ChangeLog's for release
+
+2003-07-06 22:14 huysmans
+
+ * ChangeLog: Update ChangeLogs
+
+2003-07-06 15:35 xfce
+
+ * Makefile.in, aclocal.m4, config.h.in, configure, ltconfig,
+ ltmain.sh, panel-plugin/Makefile.in: libtool update
+
+2003-07-02 12:18 bmeurer
+
+ * AUTHORS, COPYING, INSTALL, autogen.sh, config.guess, config.sub,
+ ltconfig, ltcf-c.sh, ltmain.sh, Makefile.in, aclocal.m4, compile,
+ config.h.in, depcomp, install-sh, missing, mkinstalldirs,
+ Makefile.am, README, configure, configure.ac, m4/debug.m4,
+ m4/depends.m4, m4/i18n.m4, panel-plugin/Makefile.am,
+ panel-plugin/Makefile.in, panel-plugin/sample.c: Initial import of
+ the sample panel plugin.
+
+2003-07-02 12:18 bmeurer
+
+ * AUTHORS, COPYING, INSTALL, autogen.sh, config.guess, config.sub,
+ ltconfig, ltcf-c.sh, ltmain.sh, Makefile.in, aclocal.m4, compile,
+ config.h.in, depcomp, install-sh, missing, mkinstalldirs,
+ Makefile.am, README, configure, configure.ac, m4/debug.m4,
+ m4/depends.m4, m4/i18n.m4, panel-plugin/Makefile.am,
+ panel-plugin/Makefile.in, panel-plugin/sample.c: Initial revision
\ No newline at end of file
Modified: xfce4-weather-plugin/trunk/panel-plugin/config_dialog.c
===================================================================
--- xfce4-weather-plugin/trunk/panel-plugin/config_dialog.c 2006-08-09 15:37:33 UTC (rev 1871)
+++ xfce4-weather-plugin/trunk/panel-plugin/config_dialog.c 2006-08-09 18:48:12 UTC (rev 1872)
@@ -261,7 +261,7 @@
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
- dialog = g_new0(xfceweather_dialog, 1);
+ dialog = panel_slice_new0 (xfceweather_dialog);
dialog->wd = (xfceweather_data *)data;
dialog->dialog = gtk_widget_get_toplevel (vbox);
Modified: xfce4-weather-plugin/trunk/panel-plugin/http_client.c
===================================================================
--- xfce4-weather-plugin/trunk/panel-plugin/http_client.c 2006-08-09 15:37:33 UTC (rev 1871)
+++ xfce4-weather-plugin/trunk/panel-plugin/http_client.c 2006-08-09 18:48:12 UTC (rev 1872)
@@ -31,6 +31,7 @@
#include <glib.h>
#include <libxfce4util/libxfce4util.h>
+#include <libxfce4panel/xfce-panel-macros.h>
#include "http_client.h"
@@ -103,7 +104,7 @@
if (request->fd)
close(request->fd);
- g_free(request);
+ panel_slice_free (struct request_data, request);
}
static void
@@ -257,7 +258,7 @@
CB_TYPE callback,
gpointer data)
{
- struct request_data *request = g_new0(struct request_data, 1);
+ struct request_data *request = panel_slice_new0 (struct request_data);
if (!request)
{
@@ -303,7 +304,7 @@
perror("http_get(): empty request buffer\n");
#endif
close(request->fd);
- g_free(request);
+ panel_slice_free(struct request_data, request);
return FALSE;
}
Modified: xfce4-weather-plugin/trunk/panel-plugin/parsers.c
===================================================================
--- xfce4-weather-plugin/trunk/panel-plugin/parsers.c 2006-08-09 15:37:33 UTC (rev 1871)
+++ xfce4-weather-plugin/trunk/panel-plugin/parsers.c 2006-08-09 18:48:12 UTC (rev 1872)
@@ -20,6 +20,7 @@
#endif
#include "parsers.h"
+#include <libxfce4panel/xfce-panel-macros.h>
xml_weather *
parse_weather (xmlNode *cur_node)
@@ -30,7 +31,7 @@
return NULL;
}
- if ((ret = g_new0(xml_weather, 1)) == NULL)
+ if ((ret = panel_slice_new0 (xml_weather)) == NULL)
return NULL;
for (cur_node = cur_node->children; cur_node; cur_node = cur_node->next)
@@ -70,7 +71,7 @@
{
xml_loc *ret;
- if ((ret = g_new0(xml_loc, 1)) == NULL)
+ if ((ret = panel_slice_new0 (xml_loc)) == NULL)
return NULL;
@@ -95,7 +96,7 @@
{
xml_uv *ret;
- if ((ret = g_new0 (xml_uv, 1)) == NULL)
+ if ((ret = panel_slice_new0 (xml_uv)) == NULL)
return NULL;
for (cur_node = cur_node->children; cur_node; cur_node = cur_node->next)
@@ -117,7 +118,7 @@
{
xml_bar *ret;
- if ((ret = g_new0(xml_bar, 1)) == NULL)
+ if ((ret = panel_slice_new0 (xml_bar)) == NULL)
return NULL;
for (cur_node = cur_node->children; cur_node; cur_node = cur_node->next)
@@ -139,7 +140,7 @@
{
xml_wind *ret;
- if ((ret = g_new (xml_wind, 1)) == NULL)
+ if ((ret = panel_slice_new0 (xml_wind)) == NULL)
return NULL;
for (cur_node = cur_node->children; cur_node; cur_node = cur_node->next)
@@ -165,7 +166,7 @@
{
xml_cc *ret;
- if ((ret = g_new0(xml_cc, 1)) == NULL)
+ if ((ret = panel_slice_new0 (xml_cc)) == NULL)
return NULL;
for (cur_node = cur_node->children; cur_node; cur_node = cur_node->next)
@@ -207,7 +208,7 @@
{
xml_part *ret;
- if ((ret = g_new0(xml_part, 1)) == NULL)
+ if ((ret = panel_slice_new0 (xml_part)) == NULL)
return NULL;
for (cur_node = cur_node->children; cur_node; cur_node = cur_node->next)
@@ -238,7 +239,7 @@
xml_dayf *ret;
gchar *value;
- if ((ret = g_new0(xml_dayf, 1)) == NULL)
+ if ((ret = panel_slice_new0 (xml_dayf)) == NULL)
return NULL;
ret->day = (gchar *) xmlGetProp (cur_node, (const xmlChar *) "t");
@@ -282,6 +283,8 @@
{
CHK_FREE (data->i);
CHK_FREE (data->t);
+
+ panel_slice_free (xml_uv, data);
}
static void
@@ -291,6 +294,8 @@
CHK_FREE (data->gust);
CHK_FREE (data->d);
CHK_FREE (data->t);
+
+ panel_slice_free (xml_wind, data);
}
static void
@@ -298,6 +303,8 @@
{
CHK_FREE (data->r);
CHK_FREE (data->d);
+
+ panel_slice_free (xml_bar, data);
}
static void
@@ -321,6 +328,8 @@
if (data->bar)
xml_bar_free(data->bar);
+
+ panel_slice_free (xml_cc, data);
}
static void
@@ -329,6 +338,8 @@
CHK_FREE (data->dnam);
CHK_FREE (data->sunr);
CHK_FREE (data->suns);
+
+ panel_slice_free (xml_loc, data);
}
static void
@@ -344,6 +355,8 @@
if (data->wind)
xml_wind_free(data->wind);
+
+ panel_slice_free (xml_part, data);
}
static void
@@ -362,6 +375,8 @@
if (data->part[1])
xml_part_free(data->part[1]);
+
+ panel_slice_free (xml_dayf, data);
}
void
@@ -386,5 +401,5 @@
}
- free(data);
+ panel_slice_free (xml_weather, data);
}
Modified: xfce4-weather-plugin/trunk/panel-plugin/plugin.c
===================================================================
--- xfce4-weather-plugin/trunk/panel-plugin/plugin.c 2006-08-09 15:37:33 UTC (rev 1871)
+++ xfce4-weather-plugin/trunk/panel-plugin/plugin.c 2006-08-09 18:48:12 UTC (rev 1872)
@@ -571,8 +571,11 @@
xfceweather_data *data = (xfceweather_data *) dialog->wd;
apply_options (dialog);
-
+
gtk_widget_destroy (dlg);
+ gtk_list_store_clear (dialog->mdl_xmloption);
+ panel_slice_free (xfceweather_dialog, dialog);
+
xfce_panel_plugin_unblock_menu (data->plugin);
xfceweather_write_config (data->plugin, data);
}
@@ -617,7 +620,7 @@
xfceweather_create_control (XfcePanelPlugin *plugin)
{
- xfceweather_data *data = g_new0 (xfceweather_data, 1);
+ xfceweather_data *data = panel_slice_new0 (xfceweather_data);
GtkWidget *vbox, *refresh;
datas lbl;
GdkPixbuf *icon = NULL;
@@ -710,7 +713,7 @@
/* Free Array */
g_array_free (data->labels, TRUE);
- g_free (data);
+ panel_slice_free (xfceweather_data, data);
}
static gboolean
Modified: xfce4-weather-plugin/trunk/panel-plugin/scrollbox.c
===================================================================
--- xfce4-weather-plugin/trunk/panel-plugin/scrollbox.c 2006-08-09 15:37:33 UTC (rev 1871)
+++ xfce4-weather-plugin/trunk/panel-plugin/scrollbox.c 2006-08-09 18:48:12 UTC (rev 1872)
@@ -23,12 +23,15 @@
#include <glib.h>
#include <gtk/gtk.h>
+#include <libxfce4panel/xfce-panel-macros.h>
#include "scrollbox.h"
#define LABEL_REFRESH 3000
#define LABEL_SPEED 25
-struct label {
+typedef struct _Label Label;
+
+struct _Label {
gchar *msg;
GdkPixmap *pixmap;
};
@@ -37,6 +40,8 @@
GTK_SCROLLBOX_ENABLECB = 1
};
+static GObjectClass *parent_class;
+
static gboolean
start_draw_down (GtkScrollbox *self);
@@ -50,12 +55,14 @@
make_pixmap (GtkScrollbox *, gchar *);
static void
-free_label (struct label *lbl)
+free_label (Label *lbl)
{
if (lbl->pixmap)
g_object_unref (G_OBJECT (lbl->pixmap));
if (lbl->msg)
g_free (lbl->msg);
+
+ panel_slice_free (Label, lbl);
}
static gboolean
@@ -104,7 +111,7 @@
start_draw_up (GtkScrollbox *self)
{
gint width, height;
- struct label *lbl;
+ Label *lbl;
static size_t i = 0;
if (self->labels->len == 0)
@@ -113,7 +120,7 @@
if (i >= self->labels->len)
i = 0;
- lbl = (struct label*)g_ptr_array_index(self->labels, i);
+ lbl = (Label *)g_ptr_array_index(self->labels, i);
self->pixmap = lbl->pixmap;
/* If we failed to create a proper pixmap, try again now */
@@ -238,16 +245,16 @@
gint n,
gchar *value)
{
- gboolean append = TRUE;
- GdkPixmap *newpixmap;
- struct label *newlbl;
+ gboolean append = TRUE;
+ GdkPixmap *newpixmap;
+ Label *newlbl;
if (n != -1)
append = FALSE;
if (!append)
{
- struct label *lbl = (struct label*)g_ptr_array_index(self->labels, n);
+ Label *lbl = (Label *)g_ptr_array_index(self->labels, n);
if (lbl)
free_label(lbl);
@@ -256,7 +263,7 @@
}
else
{
- newlbl = g_new0(struct label, 1);
+ newlbl = panel_slice_new0 (Label);
g_ptr_array_add(self->labels, newlbl);
}
@@ -319,13 +326,15 @@
{
for (i = 0; i < self->labels->len; i++)
{
- struct label *lbl = (struct label*)g_ptr_array_index(self->labels, i);
+ Label *lbl = (Label*)g_ptr_array_index(self->labels, i);
g_object_unref (G_OBJECT (lbl->pixmap));
g_free(lbl->msg);
}
g_ptr_array_free(self->labels, TRUE);
}
+
+ G_OBJECT_CLASS (parent_class)->finalize (gobject);
}
static void
@@ -347,7 +356,7 @@
for (i = 0; i < self->labels->len; i++)
{
GdkPixmap *newpixmap;
- struct label *lbl = (struct label*)g_ptr_array_index(self->labels, i);
+ Label *lbl = (Label *)g_ptr_array_index(self->labels, i);
if (!lbl->msg)
continue;
@@ -422,12 +431,14 @@
GObjectClass *gobject_class = G_OBJECT_CLASS(g_class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(g_class);
+
+ parent_class = g_type_class_peek_parent (g_class);
GParamSpec *scrollbox_param_spec;
gobject_class->set_property = gtk_scrollbox_set_property;
gobject_class->get_property = gtk_scrollbox_get_property;
-
+
scrollbox_param_spec = g_param_spec_boolean("enablecb",
"Enable callback",
"Enable or disable the callback",
@@ -476,7 +487,7 @@
while(self->labels->len > 0)
{
- struct label *lbl = (struct label*) g_ptr_array_index(self->labels, 0);
+ Label *lbl = (Label *) g_ptr_array_index(self->labels, 0);
free_label(lbl);
g_ptr_array_remove_index (self->labels, 0);
Modified: xfce4-weather-plugin/trunk/panel-plugin/search_dialog.c
===================================================================
--- xfce4-weather-plugin/trunk/panel-plugin/search_dialog.c 2006-08-09 15:37:33 UTC (rev 1871)
+++ xfce4-weather-plugin/trunk/panel-plugin/search_dialog.c 2006-08-09 18:48:12 UTC (rev 1872)
@@ -163,7 +163,7 @@
GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
search_dialog *dialog;
- dialog = g_new0(search_dialog, 1);
+ dialog = panel_slice_new0 (search_dialog);
dialog->proxy_host = proxy_host;
dialog->proxy_port = proxy_port;
@@ -252,4 +252,6 @@
{
g_free(dialog->result);
gtk_widget_destroy(dialog->dialog);
+
+ panel_slice_free (search_dialog, dialog);
}
Modified: xfce4-weather-plugin/trunk/panel-plugin/search_dialog.h
===================================================================
--- xfce4-weather-plugin/trunk/panel-plugin/search_dialog.h 2006-08-09 15:37:33 UTC (rev 1871)
+++ xfce4-weather-plugin/trunk/panel-plugin/search_dialog.h 2006-08-09 18:48:12 UTC (rev 1872)
@@ -15,14 +15,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
- #include <glib.h>
+#include <glib.h>
#include <gmodule.h>
#include <gtk/gtk.h>
-
-
-
-
#ifndef SEARCH_DIALOG_H
#define SEARCH_DIALOG_H
More information about the Goodies-commits
mailing list