1 diff -Naur gwget-1.0.4.orig/src/gwget-application.c gwget-1.0.4/src/gwget-application.c
2 --- gwget-1.0.4.orig/src/gwget-application.c 2018-01-19 11:03:01.897778000 +0100
3 +++ gwget-1.0.4/src/gwget-application.c 2018-01-19 11:14:58.065852512 +0100
6 gwgetdata = gwget_data_new ((gchar *)url);
8 - gwget_data_add_download(gwgetdata);
9 - gwget_data_start_download(gwgetdata);
10 + if (gwget_data_add_download(gwgetdata)) {
11 + gwget_data_start_download(gwgetdata);
17 gwgetdata->dir = gwget_pref.download_dir;
20 - gwget_data_add_download(gwgetdata);
21 - gwget_data_start_download(gwgetdata);
22 + if (gwget_data_add_download(gwgetdata)) {
23 + gwget_data_start_download(gwgetdata);
28 diff -Naur gwget-1.0.4.orig/src/gwget_data.c gwget-1.0.4/src/gwget_data.c
29 --- gwget-1.0.4.orig/src/gwget_data.c 2018-01-19 11:03:01.907778000 +0100
30 +++ gwget-1.0.4/src/gwget_data.c 2018-01-19 11:41:09.319442608 +0100
33 dir = gwget_pref.download_dir;
37 + length = strlen (dir);
39 + dir = g_get_home_dir();
42 /* Add a trailing '/' unless already present */
43 length = strlen (dir);
44 if (dir[length - 1] == '/')
48 /* Add a gwgetdata to the main window */
51 gwget_data_add_download(GwgetData *gwgetdata)
55 if (check_url_already_exists(gwgetdata->url)) {
56 run_dialog_information(_("Unable to add this download"),
57 _("This download is already added"));
62 /* if the url it's not a file drop a dialog to recurse into the url */
64 downloads = g_list_append(downloads,gwgetdata);
65 new_download(gwgetdata);
66 gwget_data_set_state(gwgetdata,DL_NOT_CONNECTED);
71 diff -Naur gwget-1.0.4.orig/src/gwget_data.h gwget-1.0.4/src/gwget_data.h
72 --- gwget-1.0.4.orig/src/gwget_data.h 2009-06-16 19:58:06.000000000 +0200
73 +++ gwget-1.0.4/src/gwget_data.h 2018-01-19 11:10:17.784148648 +0100
75 void gwget_data_free(gpointer data);
76 void gwget_data_stop_download(GwgetData *data);
77 void gwget_data_set_filename_from_url(GwgetData *gwgetdata, gchar *url);
78 -void gwget_data_add_download(GwgetData *gwgetdata);
79 +gboolean gwget_data_add_download(GwgetData *gwgetdata);
80 void gwget_data_exec(GwgetData *gwgetdata);
81 void gwget_data_set_menus (GwgetData *gwgetdata);
82 void gwget_data_set_popupmenu (GwgetData *gwgetdata);
83 diff -Naur gwget-1.0.4.orig/src/main.c gwget-1.0.4/src/main.c
84 --- gwget-1.0.4.orig/src/main.c 2018-01-19 11:03:01.897778000 +0100
85 +++ gwget-1.0.4/src/main.c 2018-01-19 11:11:27.529567168 +0100
87 if (destination_dir) {
88 gwgetdata->dir = destination_dir;
90 - gwget_data_add_download(gwgetdata);
91 - gwget_data_start_download(gwgetdata);
92 + if (gwget_data_add_download(gwgetdata)) {
93 + gwget_data_start_download(gwgetdata);
95 g_object_unref (file);
98 diff -Naur gwget-1.0.4.orig/src/new_window.c gwget-1.0.4/src/new_window.c
99 --- gwget-1.0.4.orig/src/new_window.c 2018-01-19 11:03:01.911112000 +0100
100 +++ gwget-1.0.4/src/new_window.c 2018-01-19 11:30:04.102904944 +0100
103 if (strcmp(url,"")) {
104 save_in=g_strdup(gtk_entry_get_text (GTK_ENTRY(save_in_entry)));
106 - if (!strcmp(save_in,"") && gwget_pref.download_dir) {
107 - save_in=g_strdup(gwget_pref.download_dir);
110 - if (!strcmp(save_in,"") && !gwget_pref.download_dir) {
111 - save_in=g_strdup(g_get_home_dir());
114 save_in_list = g_strdup(save_in);
115 if (g_list_find_custom(save_in_paths, save_in, (GCompareFunc) strcmp)==NULL) {
116 save_in_paths = g_list_prepend (save_in_paths, save_in_list);
118 gwgetdata = gwget_data_create (url, save_in);
119 - gwget_data_add_download(gwgetdata);
120 - gwget_data_start_download(gwgetdata);
121 + if (gwget_data_add_download(gwgetdata)) {
122 + gwget_data_start_download(gwgetdata);
124 gtk_widget_hide(window);