gnome-main-menu r528 - in branches/gnome-2-20: . libslab main-menu/src
- From: federico svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-main-menu r528 - in branches/gnome-2-20: . libslab main-menu/src
- Date: Wed, 19 Nov 2008 18:13:48 +0000 (UTC)
Author: federico
Date: Wed Nov 19 18:13:48 2008
New Revision: 528
URL: http://svn.gnome.org/viewvc/gnome-main-menu?rev=528&view=rev
Log:
bnc402256 - Fix various memory leaks when refreshing the recently-used tables
Signed-off-by: Federico Mena Quintero <federico novell com>
Modified:
branches/gnome-2-20/ChangeLog
branches/gnome-2-20/libslab/ChangeLog
branches/gnome-2-20/libslab/bookmark-agent.c
branches/gnome-2-20/libslab/nameplate-tile.c
branches/gnome-2-20/libslab/tile.c
branches/gnome-2-20/main-menu/src/tile-table.c
Modified: branches/gnome-2-20/libslab/bookmark-agent.c
==============================================================================
--- branches/gnome-2-20/libslab/bookmark-agent.c (original)
+++ branches/gnome-2-20/libslab/bookmark-agent.c Wed Nov 19 18:13:48 2008
@@ -1096,8 +1096,14 @@
if (! uri_new)
return;
+ g_free (name);
+
if (libslab_strcmp (uri, uri_new))
g_bookmark_file_move_item (priv->store, uri, uri_new, NULL);
+
+ g_free (uri_new);
+
+ g_free (uri_new);
}
static void
@@ -1183,6 +1189,8 @@
if (uri_new && libslab_strcmp (uri, uri_new))
g_bookmark_file_move_item (priv->store, uri, uri_new, NULL);
+
+ g_free (uri_new);
}
static void
Modified: branches/gnome-2-20/libslab/nameplate-tile.c
==============================================================================
--- branches/gnome-2-20/libslab/nameplate-tile.c (original)
+++ branches/gnome-2-20/libslab/nameplate-tile.c Wed Nov 19 18:13:48 2008
@@ -36,7 +36,6 @@
GtkContainer *image_ctnr;
GtkContainer *header_ctnr;
GtkContainer *subheader_ctnr;
- GtkTooltips *tooltips;
} NameplateTilePrivate;
#define NAMEPLATE_TILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NAMEPLATE_TILE_TYPE, NameplateTilePrivate))
@@ -100,7 +99,6 @@
static void
nameplate_tile_init (NameplateTile * this)
{
- NAMEPLATE_TILE_GET_PRIVATE (this)->tooltips = NULL;
}
static GObject *
@@ -117,6 +115,12 @@
static void
nameplate_tile_finalize (GObject * g_object)
{
+ NameplateTile *np_tile;
+ NameplateTilePrivate *priv;
+
+ np_tile = NAMEPLATE_TILE (g_object);
+ priv = NAMEPLATE_TILE_GET_PRIVATE (np_tile);
+
(*G_OBJECT_CLASS (nameplate_tile_parent_class)->finalize) (g_object);
}
@@ -124,7 +128,7 @@
nameplate_tile_get_property (GObject * g_object, guint prop_id, GValue * value,
GParamSpec * param_spec)
{
- GtkTooltipsData *tooltip;
+ char *tooltip;
NameplateTile *np_tile = NAMEPLATE_TILE (g_object);
switch (prop_id)
@@ -141,8 +145,9 @@
g_value_set_object (value, np_tile->subheader);
break;
case PROP_NAMEPLATE_TOOLTIP:
- tooltip = gtk_tooltips_data_get (GTK_WIDGET (np_tile));
- g_value_set_string (value, tooltip ? tooltip->tip_text : NULL);
+ tooltip = gtk_widget_get_tooltip_text (GTK_WIDGET (np_tile));
+ g_value_set_string (value, tooltip);
+ g_free (tooltip);
break;
default:
@@ -229,17 +234,7 @@
break;
case PROP_NAMEPLATE_TOOLTIP:
- if (tooltip) {
- if (! priv->tooltips)
- priv->tooltips = gtk_tooltips_new ();
-
- gtk_tooltips_set_tip (priv->tooltips, GTK_WIDGET(this), tooltip, tooltip);
- gtk_tooltips_enable(priv->tooltips);
- }
- else
- if (priv->tooltips)
- gtk_tooltips_disable(priv->tooltips);
-
+ gtk_widget_set_tooltip_text (GTK_WIDGET (this), tooltip);
break;
Modified: branches/gnome-2-20/libslab/tile.c
==============================================================================
--- branches/gnome-2-20/libslab/tile.c (original)
+++ branches/gnome-2-20/libslab/tile.c Wed Nov 19 18:13:48 2008
@@ -209,7 +209,7 @@
if (tile->uri)
g_free (tile->uri);
if (tile->context_menu)
- gtk_object_sink (GTK_OBJECT (tile->context_menu));
+ gtk_widget_destroy (GTK_WIDGET (tile->context_menu));
g_object_unref (priv->double_click_detector);
@@ -240,17 +240,34 @@
static void
tile_set_property (GObject * g_obj, guint prop_id, const GValue * value, GParamSpec * param_spec)
{
+ Tile *tile;
+ GtkMenu *menu;
+
if (!IS_TILE (g_obj))
return;
+ tile = TILE (g_obj);
+
switch (prop_id)
{
case PROP_TILE_URI:
- TILE (g_obj)->uri = g_strdup (g_value_get_string (value));
+ tile->uri = g_strdup (g_value_get_string (value));
break;
case PROP_TILE_CONTEXT_MENU:
- TILE (g_obj)->context_menu = g_value_get_object (value);
+ menu = g_value_get_object (value);
+
+ if (menu == tile->context_menu)
+ break;
+
+ if (tile->context_menu)
+ gtk_menu_detach (tile->context_menu);
+
+ tile->context_menu = menu;
+
+ if (tile->context_menu)
+ gtk_menu_attach_to_widget (tile->context_menu, GTK_WIDGET (tile), NULL);
+
break;
default:
Modified: branches/gnome-2-20/main-menu/src/tile-table.c
==============================================================================
--- branches/gnome-2-20/main-menu/src/tile-table.c (original)
+++ branches/gnome-2-20/main-menu/src/tile-table.c Wed Nov 19 18:13:48 2008
@@ -29,6 +29,7 @@
BookmarkAgent *agent;
GList *tiles;
+ GtkSizeGroup *icon_size_group;
GtkBin **bins;
gint n_bins;
@@ -120,8 +121,6 @@
GtkWidget *tile;
gint n_tiles;
- GtkSizeGroup *icon_size_group;
-
GList *node;
gint i;
@@ -144,7 +143,8 @@
priv->tiles = NULL;
- icon_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ if (!priv->icon_size_group)
+ priv->icon_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
for (node = tiles; node; node = node->next) {
tile = GTK_WIDGET (node->data);
@@ -161,7 +161,7 @@
priv->tiles = g_list_append (priv->tiles, tile);
if (IS_NAMEPLATE_TILE (tile))
- gtk_size_group_add_widget (icon_size_group, NAMEPLATE_TILE (tile)->image);
+ gtk_size_group_add_widget (priv->icon_size_group, NAMEPLATE_TILE (tile)->image);
}
g_list_free (tiles);
@@ -341,6 +341,9 @@
{
TileTablePrivate *priv = PRIVATE (g_obj);
+ if (priv->icon_size_group)
+ g_object_unref (priv->icon_size_group);
+
g_free (priv->bins);
G_OBJECT_CLASS (tile_table_parent_class)->finalize (g_obj);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]