[Goodies-commits] r3394 - in xfce4-places-plugin/trunk: . panel-plugin
Diego Ongaro
ongardie at xfce.org
Tue Oct 16 22:40:34 CEST 2007
Author: ongardie
Date: 2007-10-16 20:40:34 +0000 (Tue, 16 Oct 2007)
New Revision: 3394
Modified:
xfce4-places-plugin/trunk/ChangeLog
xfce4-places-plugin/trunk/panel-plugin/model.c
xfce4-places-plugin/trunk/panel-plugin/model.h
xfce4-places-plugin/trunk/panel-plugin/model_system.c
xfce4-places-plugin/trunk/panel-plugin/model_user.c
xfce4-places-plugin/trunk/panel-plugin/model_volumes.c
Log:
2007-10-16 Diego Ongaro <ongardie at gmail.com>
* model*.c: Use places_bookmark_create() as counterpart to
places_bookmark_free()
Modified: xfce4-places-plugin/trunk/ChangeLog
===================================================================
--- xfce4-places-plugin/trunk/ChangeLog 2007-10-16 20:13:23 UTC (rev 3393)
+++ xfce4-places-plugin/trunk/ChangeLog 2007-10-16 20:40:34 UTC (rev 3394)
@@ -2,6 +2,8 @@
* model_user.c: Don't always return TRUE in changed() when
~/.gtk-bookmarks is missing (resulted in menu "blinking")
+ * model*.c: Use places_bookmark_create() as counterpart to
+ places_bookmark_free()
2007-10-15 Diego Ongaro <ongardie at gmail.com>
Modified: xfce4-places-plugin/trunk/panel-plugin/model.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/model.c 2007-10-16 20:13:23 UTC (rev 3393)
+++ xfce4-places-plugin/trunk/panel-plugin/model.c 2007-10-16 20:40:34 UTC (rev 3394)
@@ -58,11 +58,32 @@
g_list_free(actions);
}
+#if defined(DEBUG) && (DEBUG > 0)
+static int bookmarks = 0;
+#endif
+
+inline PlacesBookmark*
+places_bookmark_create(gchar *label)
+{
+ PlacesBookmark *bookmark;
+
+ g_assert(label != NULL);
+
+ bookmark = g_new0(PlacesBookmark, 1);
+ bookmark->label = label;
+
+ DBG("bookmarks: %02d %x %s", bookmarks++, (gint) bookmark, label);
+
+ return bookmark;
+}
+
inline void
places_bookmark_free(PlacesBookmark *bookmark)
{
g_assert(bookmark != NULL);
+ DBG("bookmarks: %02d %x %s", --bookmarks, (gint) bookmark, bookmark->label);
+
if(bookmark->primary_action != NULL){
/* don't double-free */
Modified: xfce4-places-plugin/trunk/panel-plugin/model.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/model.h 2007-10-16 20:13:23 UTC (rev 3393)
+++ xfce4-places-plugin/trunk/panel-plugin/model.h 2007-10-16 20:40:34 UTC (rev 3394)
@@ -64,6 +64,9 @@
void (*free) (PlacesBookmark *self);
};
+inline PlacesBookmark*
+places_bookmark_create(gchar *label);
+
inline void
places_bookmark_free(PlacesBookmark *bookmark);
Modified: xfce4-places-plugin/trunk/panel-plugin/model_system.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/model_system.c 2007-10-16 20:13:23 UTC (rev 3393)
+++ xfce4-places-plugin/trunk/panel-plugin/model_system.c 2007-10-16 20:40:34 UTC (rev 3394)
@@ -86,8 +86,7 @@
/* These icon names are consistent with Thunar. */
/* Home */
- bookmark = g_new0(PlacesBookmark, 1);
- bookmark->label = (gchar*) g_get_user_name();
+ bookmark = places_bookmark_create((gchar*) g_get_user_name());
bookmark->uri = (gchar*) home_dir;
bookmark->icon = "gnome-fs-home";
@@ -100,8 +99,7 @@
bookmarks = g_list_append(bookmarks, bookmark);
/* Trash */
- bookmark = g_new0(PlacesBookmark, 1);
- bookmark->label = _("Trash");
+ bookmark = places_bookmark_create(_("Trash"));
bookmark->uri = "trash:///";
bookmark->uri_scheme = PLACES_URI_SCHEME_TRASH;
bookmark->free = pbsys_free_trash_bookmark;;
@@ -125,8 +123,7 @@
bookmarks = g_list_append(bookmarks, bookmark);
/* Desktop */
- bookmark = g_new0(PlacesBookmark, 1);
- bookmark->label = _("Desktop");
+ bookmark = places_bookmark_create(_("Desktop"));
bookmark->uri = g_build_filename(home_dir, "Desktop", NULL);
bookmark->icon = "gnome-fs-desktop";
bookmark->free = pbsys_free_desktop_bookmark;
@@ -150,8 +147,7 @@
}
/* File System (/) */
- bookmark = g_new0(PlacesBookmark, 1);
- bookmark->label = _("File System");
+ bookmark = places_bookmark_create(_("File System"));
bookmark->uri = "/";
bookmark->icon = "gnome-dev-harddisk";
Modified: xfce4-places-plugin/trunk/panel-plugin/model_user.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/model_user.c 2007-10-16 20:13:23 UTC (rev 3393)
+++ xfce4-places-plugin/trunk/panel-plugin/model_user.c 2007-10-16 20:40:34 UTC (rev 3394)
@@ -157,9 +157,8 @@
}
/* create the BookmarkInfo container */
- bookmark = g_new0(PlacesBookmark, 1);
- bookmark->uri = path; /* needs to be freed */
- bookmark->label = name; /* needs to be freed */
+ bookmark = places_bookmark_create(name); /* label needs to be freed */
+ bookmark->uri = path; /* uri needs to be freed */
bookmark->icon = "gnome-fs-directory";
bookmark->priv = (gpointer) pbuser_dir_exists(path);
bookmark->free = pbuser_free_bookmark;
@@ -200,10 +199,9 @@
orig = (PlacesBookmark*) orig_ls->data;
- clone = g_new0(PlacesBookmark, 1);
+ clone = places_bookmark_create(g_strdup(orig->label));
clone->uri = g_strdup(orig->uri);
clone->uri_scheme = orig->uri_scheme;
- clone->label = g_strdup(orig->label);
clone->icon = orig->icon;
clone->free = pbuser_free_bookmark;
Modified: xfce4-places-plugin/trunk/panel-plugin/model_volumes.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/model_volumes.c 2007-10-16 20:13:23 UTC (rev 3393)
+++ xfce4-places-plugin/trunk/panel-plugin/model_volumes.c 2007-10-16 20:40:34 UTC (rev 3394)
@@ -160,8 +160,7 @@
if(pbvol_show_volume(volume)){
- bookmark = g_new0(PlacesBookmark, 1);
- bookmark->label = (gchar*) thunar_vfs_volume_get_name(volume);
+ bookmark = places_bookmark_create((gchar*) thunar_vfs_volume_get_name(volume));
if(thunar_vfs_volume_is_mounted(volume))
bookmark->uri = thunar_vfs_path_dup_uri(thunar_vfs_volume_get_mount_point(volume));
else
More information about the Goodies-commits
mailing list