[Goodies-commits] r4087 - ristretto/trunk/src
Stephan Arts
stephan at xfce.org
Fri Mar 21 23:35:02 CET 2008
Author: stephan
Date: 2008-03-21 22:35:02 +0000 (Fri, 21 Mar 2008)
New Revision: 4087
Modified:
ristretto/trunk/src/main.c
ristretto/trunk/src/main_window.c
ristretto/trunk/src/navigator.c
Log:
Ok, really fixed it now
Modified: ristretto/trunk/src/main.c
===================================================================
--- ristretto/trunk/src/main.c 2008-03-21 21:02:04 UTC (rev 4086)
+++ ristretto/trunk/src/main.c 2008-03-21 22:35:02 UTC (rev 4087)
@@ -412,11 +412,7 @@
{
gchar *path_dir = NULL;
RsttoNavigator *navigator = rof->navigator;
- g_object_ref(navigator);
- g_object_ref(rof->main_window);
- rstto_navigator_set_busy(navigator, TRUE);
-
if (g_slist_length(rof->files) >= 1)
{
GSList *_iter = rof->files;
@@ -456,9 +452,6 @@
if (g_slist_length(rof->files) > 1)
rstto_navigator_jump_first(navigator);
}
- rstto_navigator_set_busy(navigator, FALSE);
- g_object_unref(rof->main_window);
- g_object_unref(navigator);
return FALSE;
}
Modified: ristretto/trunk/src/main_window.c
===================================================================
--- ristretto/trunk/src/main_window.c 2008-03-21 21:02:04 UTC (rev 4086)
+++ ristretto/trunk/src/main_window.c 2008-03-21 22:35:02 UTC (rev 4087)
@@ -1441,11 +1441,16 @@
gint response = gtk_dialog_run(GTK_DIALOG(dialog));
if(response == GTK_RESPONSE_OK)
{
+ gtk_widget_hide(dialog);
const gchar *dir_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
- rstto_navigator_set_busy(window->priv->navigator, TRUE);
- rstto_navigator_open_folder(window->priv->navigator, dir_name, TRUE, NULL);
- rstto_navigator_jump_first(window->priv->navigator);
- rstto_navigator_set_busy(window->priv->navigator, FALSE);
+
+ RsttoNavigator *navigator = window->priv->navigator;
+ g_object_ref(navigator);
+ if(rstto_navigator_open_folder(navigator, dir_name, TRUE, NULL) == TRUE)
+ {
+ rstto_navigator_jump_first(navigator);
+ }
+ g_object_unref(navigator);
}
gtk_widget_destroy(dialog);
}
@@ -1462,10 +1467,11 @@
{
if(g_file_test(path, G_FILE_TEST_IS_DIR))
{
- rstto_navigator_set_busy(window->priv->navigator, TRUE);
- rstto_navigator_open_folder(window->priv->navigator, path, TRUE, NULL);
- rstto_navigator_jump_first(window->priv->navigator);
- rstto_navigator_set_busy(window->priv->navigator, FALSE);
+ RsttoNavigator *navigator = window->priv->navigator;
+ if(rstto_navigator_open_folder(navigator, path, TRUE, NULL) == TRUE)
+ {
+ rstto_navigator_jump_first(navigator);
+ }
}
else
{
Modified: ristretto/trunk/src/navigator.c
===================================================================
--- ristretto/trunk/src/navigator.c 2008-03-21 21:02:04 UTC (rev 4086)
+++ ristretto/trunk/src/navigator.c 2008-03-21 22:35:02 UTC (rev 4087)
@@ -1471,7 +1471,9 @@
gchar *dir_path = NULL;
gchar *dir_uri = NULL;
+ rstto_navigator_set_busy(navigator, TRUE);
+
if (vfs_path == NULL)
{
return FALSE;
@@ -1497,6 +1499,9 @@
}
dir_path = thunar_vfs_path_dup_string(vfs_path);
+
+ g_object_add_weak_pointer(G_OBJECT(navigator), (gpointer *)&navigator);
+
dir = g_dir_open(dir_path, 0, NULL);
dir_uri = thunar_vfs_path_dup_uri(vfs_path);
@@ -1525,6 +1530,13 @@
file_vfs_info = thunar_vfs_info_new_for_path(file_vfs_path, NULL);
file_media = thunar_vfs_mime_info_get_media(file_vfs_info->mime_info);
+ if (navigator == NULL)
+ {
+ g_free(file_media);
+ thunar_vfs_path_unref(file_vfs_path);
+ return FALSE;
+ }
+
if(!strcmp(file_media, "image"))
{
RsttoNavigatorEntry *entry = rstto_navigator_entry_new(navigator, file_vfs_info);
@@ -1544,6 +1556,8 @@
}
g_free(dir_uri);
+ g_object_remove_weak_pointer(G_OBJECT(navigator), (gpointer *)&navigator);
+ rstto_navigator_set_busy(navigator, FALSE);
return TRUE;
}
More information about the Goodies-commits
mailing list