diff options
author | Jason Leach <leach@wam.umd.edu> | 2004-01-27 05:44:53 +0000 |
---|---|---|
committer | Jacob Leach <jleach@src.gnome.org> | 2004-01-27 05:44:53 +0000 |
commit | 241bbd10709e308dc3b7759e955d473c0dd5d8ea (patch) | |
tree | 0f654129bc6338e1110cc0fa53d404c6f0d2fe0c /cut-n-paste-code | |
parent | d4e464685ca06b2422aba23f42cd2af3df802f94 (diff) | |
download | nautilus-241bbd10709e308dc3b7759e955d473c0dd5d8ea.tar.gz |
Sync these files with their latest copies from libegg so as to include any
2004-01-27 Jason Leach <leach@wam.umd.edu>
* cut-n-paste-code/libegg/egg-recent-item.c:
* cut-n-paste-code/libegg/egg-recent-item.h:
* cut-n-paste-code/libegg/egg-recent-model.c:
* cut-n-paste-code/libegg/eggtreemultidnd.c:
Sync these files with their latest copies from libegg so as to
include any bugfixes since 2003-04-16, the previous sync.
(#121455, Laurent Vivier)
Diffstat (limited to 'cut-n-paste-code')
-rw-r--r-- | cut-n-paste-code/libegg/egg-recent-item.c | 7 | ||||
-rw-r--r-- | cut-n-paste-code/libegg/egg-recent-item.h | 4 | ||||
-rw-r--r-- | cut-n-paste-code/libegg/egg-recent-model.c | 20 | ||||
-rw-r--r-- | cut-n-paste-code/libegg/eggtreemultidnd.c | 2 |
4 files changed, 27 insertions, 6 deletions
diff --git a/cut-n-paste-code/libegg/egg-recent-item.c b/cut-n-paste-code/libegg/egg-recent-item.c index ee4a248ad..139b637e1 100644 --- a/cut-n-paste-code/libegg/egg-recent-item.c +++ b/cut-n-paste-code/libegg/egg-recent-item.c @@ -63,13 +63,14 @@ egg_recent_item_free (EggRecentItem *item) g_free (item); } -void +EggRecentItem * egg_recent_item_ref (EggRecentItem *item) { item->refcount++; + return item; } -void +EggRecentItem * egg_recent_item_unref (EggRecentItem *item) { item->refcount--; @@ -77,6 +78,8 @@ egg_recent_item_unref (EggRecentItem *item) if (item->refcount == 0) { egg_recent_item_free (item); } + + return item; } diff --git a/cut-n-paste-code/libegg/egg-recent-item.h b/cut-n-paste-code/libegg/egg-recent-item.h index 74cb097a3..556c31e2b 100644 --- a/cut-n-paste-code/libegg/egg-recent-item.h +++ b/cut-n-paste-code/libegg/egg-recent-item.h @@ -34,8 +34,8 @@ GType egg_recent_item_get_type (void) G_GNUC_CONST; /* constructors */ EggRecentItem * egg_recent_item_new (void); -void egg_recent_item_ref (EggRecentItem *item); -void egg_recent_item_unref (EggRecentItem *item); +EggRecentItem * egg_recent_item_ref (EggRecentItem *item); +EggRecentItem * egg_recent_item_unref (EggRecentItem *item); /* automatically fetches the mime type, etc */ EggRecentItem * egg_recent_item_new_from_uri (const gchar *uri); diff --git a/cut-n-paste-code/libegg/egg-recent-model.c b/cut-n-paste-code/libegg/egg-recent-model.c index fa4f3d862..169ee8db1 100644 --- a/cut-n-paste-code/libegg/egg-recent-model.c +++ b/cut-n-paste-code/libegg/egg-recent-model.c @@ -282,7 +282,7 @@ egg_recent_model_read_raw (EggRecentModel *model, FILE *file) rewind (file); - string = g_string_new (""); + string = g_string_new (NULL); while (fgets (buf, EGG_RECENT_MODEL_BUFFER_SIZE, file)) { string = g_string_append (string, buf); } @@ -875,11 +875,27 @@ static gboolean egg_recent_model_lock_file (FILE *file) { int fd; + gboolean locked = FALSE; + gint try = 4; rewind (file); fd = fileno (file); - return lockf (fd, F_LOCK, 0) == 0 ? TRUE : FALSE; + /* Attempt to lock the file 4 times, + * waiting 1 second in between attempts. + * We should really be doing asynchronous + * locking, but requires substantially larger + * changes. + */ + + while (try-- > 0) + { + if ((locked = lockf (fd, F_TLOCK, 0)) == 0); + break; + sleep (1); + } + + return locked; } static gboolean diff --git a/cut-n-paste-code/libegg/eggtreemultidnd.c b/cut-n-paste-code/libegg/eggtreemultidnd.c index ae7a4d5aa..3a7da919c 100644 --- a/cut-n-paste-code/libegg/eggtreemultidnd.c +++ b/cut-n-paste-code/libegg/eggtreemultidnd.c @@ -391,6 +391,8 @@ egg_tree_multi_drag_button_press_event (GtkWidget *widget, priv_data->drag_data_get_handler = g_signal_connect (G_OBJECT (tree_view), "drag_data_get", G_CALLBACK (egg_tree_multi_drag_drag_data_get), NULL); } + + gtk_tree_path_free (path); return TRUE; } |