]> granicus.if.org Git - transmission/commitdiff
(trunk gtk) #2895 "'Set Location' doesn't tell the user when it fails" -- fixed in...
authorCharles Kerr <charles@transmissionbt.com>
Thu, 11 Feb 2010 17:44:11 +0000 (17:44 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Thu, 11 Feb 2010 17:44:11 +0000 (17:44 +0000)
gtk/relocate.c

index fd649b8e9599b744ad5081f4305ab58ada190645..f0df5f97a93eac7476373dc38ca3687f589d0406 100644 (file)
@@ -25,6 +25,7 @@ static char * previousLocation = NULL;
 struct UpdateData
 {
     GtkDialog * dialog;
+    GtkDialog * moving_dialog;
     int done;
 };
 
@@ -34,11 +35,24 @@ static gboolean
 onTimer( gpointer gdata )
 {
     struct UpdateData * data = gdata;
-    const tr_bool done = data->done;
+    const int done = data->done;
 
-    if( done != TR_LOC_MOVING )
+    if( done == TR_LOC_ERROR )
     {
-        gtk_widget_destroy( GTK_WIDGET( data->dialog ) );
+        const int flags = GTK_DIALOG_MODAL
+                        | GTK_DIALOG_DESTROY_WITH_PARENT;
+        GtkWidget * w = gtk_message_dialog_new( GTK_WINDOW( data->moving_dialog ),
+                                                flags,
+                                                GTK_MESSAGE_ERROR,
+                                                GTK_BUTTONS_CLOSE,
+                                                "%s",
+                                                _( "Couldn't move torrent" ) );
+        gtk_dialog_run( GTK_DIALOG( w ) );
+        gtk_widget_destroy( GTK_WIDGET( data->moving_dialog ) );
+    }
+    else if( done != TR_LOC_MOVING )
+    {
+        gtk_widget_destroy( GTK_WIDGET( data->moving_dialog ) );
         g_free( data );
     }
 
@@ -74,6 +88,7 @@ onResponse( GtkDialog * dialog, int response, gpointer unused UNUSED )
         /* start the move and periodically check its status */
         updateData = g_new( struct UpdateData, 1 );
         updateData->dialog = dialog;
+        updateData->moving_dialog = GTK_DIALOG( w );
         updateData->done = FALSE;
         tr_torrentSetLocation( tor, location, do_move, NULL, &updateData->done );
         gtr_timeout_add_seconds( 1, onTimer, updateData );