[gwget] Don't add download from gconf if url is null.



commit 052d66de456dcde9900416cde81d0c455afad757
Author: David Sedeño <david alderia com>
Date:   Sat Jul 4 14:09:50 2009 +0200

    Don't add download from gconf if url is null.

 ChangeLog         |    7 ++++-
 src/main_window.c |   58 +++++++++++++++++++++++++++-------------------------
 2 files changed, 35 insertions(+), 30 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5bb6283..be04c0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
 2009-07-04  David Sedeño <david alderia com>
 
-	* src/main_window.c: Fix drag'n'drop freeze. 
-	Thansk to Artur Rona <ari-tczew tlen pl> for the bugreport.
+	
+	* src/main_window.c: 
+		- Fix drag'n'drop freeze. Thansk to Artur Rona <ari-tczew tlen pl> 
+		for the bugreport.
+		- Don't add download from gconf if url is null.
 
 2009-06-30  David Sedeño <david alderia com>
 
diff --git a/src/main_window.c b/src/main_window.c
index 46e1f10..bacc980 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -291,47 +291,49 @@ gwget_get_defaults_from_gconf(void)
 		url=gconf_client_get_string(gconf_client,key,NULL);
 		key=g_strdup_printf("/apps/gwget2/downloads_data/%d/dir",i);
 		dir=gconf_client_get_string(gconf_client,key,NULL);
+
+		if (url!=NULL) {
+			data=gwget_data_create(url,dir);
 		
-		data=gwget_data_create(url,dir);
-		
-		key=g_strdup_printf("/apps/gwget2/downloads_data/%d/filename",i);
-		name=gconf_client_get_string(gconf_client,key,NULL);
-		gwget_data_set_filename(data,name);
+			key=g_strdup_printf("/apps/gwget2/downloads_data/%d/filename",i);
+			name=gconf_client_get_string(gconf_client,key,NULL);
+			gwget_data_set_filename(data,name);
 		
-		key=g_strdup_printf("/apps/gwget2/downloads_data/%d/state",i);
-		state=gconf_client_get_int(gconf_client,key,NULL); 
+			key=g_strdup_printf("/apps/gwget2/downloads_data/%d/state",i);
+			state=gconf_client_get_int(gconf_client,key,NULL); 
 		
-		key=g_strdup_printf("/apps/gwget2/downloads_data/%d/file_size",i);
-		total_size = atoll(gconf_client_get_string (gconf_client, key, &error));
-		if (!error) {		
-			gwget_data_set_total_size (data, total_size);
-		} else { 
-			gwget_data_set_total_size (data, 0);
-		}
+			key=g_strdup_printf("/apps/gwget2/downloads_data/%d/file_size",i);
+			total_size = atoll(gconf_client_get_string (gconf_client, key, &error));
+			if (!error) {		
+				gwget_data_set_total_size (data, total_size);
+			} else { 
+				gwget_data_set_total_size (data, 0);
+			}
 
-		if ( state != DL_COMPLETED ) {
+			if ( state != DL_COMPLETED ) {
 			/*
 			 * If the download is not completed - add it , no questions
 			 */	
-			new_download(data);
-		} else {
+				new_download(data);
+			} else {
 			/* 
 			 * If the download is completed , then:
 			 * if the file we want to write to is missing , the user
 			 * has (re)moved it , so quietly forget download , otherwise
 			 * add it
 		 	 */
-			if ( !gwget_destination_file_exists(data) ) {
-				/*
-				 * We do not add download, the gwget_remember_downloads
-				 * call after the cycle will flush gconf
-				 */
-				continue;
-			} else {
-				there_are_completed_on_startup = TRUE;
-				new_download(data);
-				gwget_data_set_state_no_sync(data,DL_COMPLETED);
-				continue;
+				if ( !gwget_destination_file_exists(data) ) {
+					/*
+					 * We do not add download, the gwget_remember_downloads
+					 * call after the cycle will flush gconf
+					 */
+					continue;
+				} else {
+					there_are_completed_on_startup = TRUE;
+					new_download(data);
+					gwget_data_set_state_no_sync(data,DL_COMPLETED);
+					continue;
+				}
 			}
 		}
 		    		



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]