diff options
-rw-r--r-- | divelist-gtk.c | 20 | ||||
-rw-r--r-- | divelist.h | 1 | ||||
-rw-r--r-- | gtk-gui.c | 2 |
3 files changed, 18 insertions, 5 deletions
diff --git a/divelist-gtk.c b/divelist-gtk.c index e5702db97..f5ed73eb6 100644 --- a/divelist-gtk.c +++ b/divelist-gtk.c @@ -1382,7 +1382,7 @@ static void delete_dive_cb(GtkWidget *menuitem, GtkTreePath *path) } #if defined(LIBZIP) && defined(XSLT) -static void export_selected_dives_cb(GtkWidget *menuitem, GtkTreePath *path) +static void upload_dives_divelogs(const gboolean selected) { int i; struct dive *dive; @@ -1419,7 +1419,7 @@ static void export_selected_dives_cb(GtkWidget *menuitem, GtkTreePath *path) dive = get_dive(i); if (!dive) continue; - if (!dive->selected) + if (selected && !dive->selected) continue; f = tmpfile(); @@ -1472,6 +1472,16 @@ static void export_selected_dives_cb(GtkWidget *menuitem, GtkTreePath *path) fprintf(stderr,"upload of %s failed\n", tempfile); g_free(tempfile); } + +void upload_selected_dives_divelogs_cb(GtkWidget *menuitem, GtkTreePath *path) +{ + upload_dives_divelogs(TRUE); +} + +void upload_all_dives_divelogs_cb() +{ + upload_dives_divelogs(FALSE); +} #endif #if defined(XSLT) @@ -1616,7 +1626,7 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int char exportuddflabel[] = N_("Export dive(s) to UDDF"); #endif #if defined(LIBZIP) && defined(XSLT) - char exportlabel[] = N_("Export dive(s)"); + char uploaddivelogslabel[] = N_("Upload dive(s) to divelogs.de"); #endif GtkTreePath *path, *prevpath, *nextpath; GtkTreeIter iter, previter, nextiter; @@ -1697,8 +1707,8 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); #if defined(LIBZIP) && defined(XSLT) - menuitem = gtk_menu_item_new_with_label(exportlabel); - g_signal_connect(menuitem, "activate", G_CALLBACK(export_selected_dives_cb), path); + menuitem = gtk_menu_item_new_with_label(uploaddivelogslabel); + g_signal_connect(menuitem, "activate", G_CALLBACK(upload_selected_dives_divelogs_cb), path); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); #endif diff --git a/divelist.h b/divelist.h index 8fcd600a1..32e2075f6 100644 --- a/divelist.h +++ b/divelist.h @@ -16,6 +16,7 @@ extern void select_prev_dive(void); extern void show_and_select_dive(struct dive *dive); extern double init_decompression(struct dive * dive); extern void export_all_dives_uddf_cb(); +extern void upload_all_dives_divelogs_cb(); /* divelist core logic functions */ extern dive_trip_t *find_trip_by_idx(int idx); @@ -1572,6 +1572,7 @@ static GtkActionEntry menu_items[] = { { "Print", GTK_STOCK_PRINT, N_("Print..."), CTRLCHAR "P", NULL, G_CALLBACK(do_print) }, { "ImportFile", NULL, N_("Import File(s)..."), CTRLCHAR "I", NULL, G_CALLBACK(import_files) }, { "ExportUDDF", NULL, N_("Export UDDF..."), NULL, NULL, G_CALLBACK(export_all_dives_uddf_cb) }, + { "UploadDivelogs", NULL, N_("Upload to divelogs.de..."), NULL, NULL, G_CALLBACK(upload_all_dives_divelogs_cb) }, { "DownloadLog", NULL, N_("Download From Dive Computer..."), CTRLCHAR "D", NULL, G_CALLBACK(download_dialog) }, { "DownloadWeb", GTK_STOCK_CONNECT, N_("Download From Web Service..."), NULL, NULL, G_CALLBACK(webservice_download_dialog) }, { "AddDive", GTK_STOCK_ADD, N_("Add Dive..."), NULL, NULL, G_CALLBACK(add_dive_cb) }, @@ -1614,6 +1615,7 @@ static const gchar* ui_string = " \ <separator name=\"Separator1\"/> \ <menuitem name=\"Import XML File\" action=\"ImportFile\" /> \ <menuitem name=\"Export to UDDF File\" action=\"ExportUDDF\" /> \ + <menuitem name=\"Upload to divelogs.de\" action=\"UploadDivelogs\" /> \ <separator name=\"Separator2\"/> \ <menuitem name=\"Print\" action=\"Print\" /> \ <separator name=\"Separator3\"/> \ |