Add menu entry for divelogs.de upload

The menu entry for upload to divelogs.de was missing. Also renamed
the divelogs context menu entry to something less generic.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Henrik Brautaset Aronsen 2013-04-09 22:18:43 +02:00 committed by Dirk Hohndel
parent 9e4f9fad19
commit 5f03a6f631
3 changed files with 18 additions and 5 deletions

View file

@ -1382,7 +1382,7 @@ static void delete_dive_cb(GtkWidget *menuitem, GtkTreePath *path)
} }
#if defined(LIBZIP) && defined(XSLT) #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; int i;
struct dive *dive; struct dive *dive;
@ -1419,7 +1419,7 @@ static void export_selected_dives_cb(GtkWidget *menuitem, GtkTreePath *path)
dive = get_dive(i); dive = get_dive(i);
if (!dive) if (!dive)
continue; continue;
if (!dive->selected) if (selected && !dive->selected)
continue; continue;
f = tmpfile(); f = tmpfile();
@ -1472,6 +1472,16 @@ static void export_selected_dives_cb(GtkWidget *menuitem, GtkTreePath *path)
fprintf(stderr,"upload of %s failed\n", tempfile); fprintf(stderr,"upload of %s failed\n", tempfile);
g_free(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 #endif
#if defined(XSLT) #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"); char exportuddflabel[] = N_("Export dive(s) to UDDF");
#endif #endif
#if defined(LIBZIP) && defined(XSLT) #if defined(LIBZIP) && defined(XSLT)
char exportlabel[] = N_("Export dive(s)"); char uploaddivelogslabel[] = N_("Upload dive(s) to divelogs.de");
#endif #endif
GtkTreePath *path, *prevpath, *nextpath; GtkTreePath *path, *prevpath, *nextpath;
GtkTreeIter iter, previter, nextiter; 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); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
#if defined(LIBZIP) && defined(XSLT) #if defined(LIBZIP) && defined(XSLT)
menuitem = gtk_menu_item_new_with_label(exportlabel); menuitem = gtk_menu_item_new_with_label(uploaddivelogslabel);
g_signal_connect(menuitem, "activate", G_CALLBACK(export_selected_dives_cb), path); g_signal_connect(menuitem, "activate", G_CALLBACK(upload_selected_dives_divelogs_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
#endif #endif

View file

@ -16,6 +16,7 @@ extern void select_prev_dive(void);
extern void show_and_select_dive(struct dive *dive); extern void show_and_select_dive(struct dive *dive);
extern double init_decompression(struct dive * dive); extern double init_decompression(struct dive * dive);
extern void export_all_dives_uddf_cb(); extern void export_all_dives_uddf_cb();
extern void upload_all_dives_divelogs_cb();
/* divelist core logic functions */ /* divelist core logic functions */
extern dive_trip_t *find_trip_by_idx(int idx); extern dive_trip_t *find_trip_by_idx(int idx);

View file

@ -1572,6 +1572,7 @@ static GtkActionEntry menu_items[] = {
{ "Print", GTK_STOCK_PRINT, N_("Print..."), CTRLCHAR "P", NULL, G_CALLBACK(do_print) }, { "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) }, { "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) }, { "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) }, { "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) }, { "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) }, { "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\"/> \ <separator name=\"Separator1\"/> \
<menuitem name=\"Import XML File\" action=\"ImportFile\" /> \ <menuitem name=\"Import XML File\" action=\"ImportFile\" /> \
<menuitem name=\"Export to UDDF File\" action=\"ExportUDDF\" /> \ <menuitem name=\"Export to UDDF File\" action=\"ExportUDDF\" /> \
<menuitem name=\"Upload to divelogs.de\" action=\"UploadDivelogs\" /> \
<separator name=\"Separator2\"/> \ <separator name=\"Separator2\"/> \
<menuitem name=\"Print\" action=\"Print\" /> \ <menuitem name=\"Print\" action=\"Print\" /> \
<separator name=\"Separator3\"/> \ <separator name=\"Separator3\"/> \