X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/cf2c79ce5815e425941b408edd46bb04fdc75be3..ccab0e9e7869f120d20bd41bac6043b37c88b2ec:/src/viktrwlayer_propwin.c
diff --git a/src/viktrwlayer_propwin.c b/src/viktrwlayer_propwin.c
index 7819bbe6..be0e3d6f 100644
--- a/src/viktrwlayer_propwin.c
+++ b/src/viktrwlayer_propwin.c
@@ -131,6 +131,8 @@ typedef struct _propwidgets {
GtkWidget *dialog;
GtkWidget *w_comment;
GtkWidget *w_description;
+ GtkWidget *w_source;
+ GtkWidget *w_type;
GtkWidget *w_track_length;
GtkWidget *w_tp_count;
GtkWidget *w_segment_count;
@@ -1770,7 +1772,7 @@ static void draw_vt ( GtkWidget *image, VikTrack *tr, PropWidgets *widgets)
if ( widgets->speeds == NULL )
return;
- widgets->duration = vik_track_get_duration ( tr );
+ widgets->duration = vik_track_get_duration ( tr, TRUE );
// Negative time or other problem
if ( widgets->duration <= 0 )
return;
@@ -1930,7 +1932,7 @@ static void draw_dt ( GtkWidget *image, VikTrack *tr, PropWidgets *widgets )
break;
}
- widgets->duration = vik_track_get_duration ( widgets->tr );
+ widgets->duration = vik_track_get_duration ( widgets->tr, TRUE );
// Negative time or other problem
if ( widgets->duration <= 0 )
return;
@@ -2048,7 +2050,7 @@ static void draw_et ( GtkWidget *image, VikTrack *tr, PropWidgets *widgets )
// Assign locally
gdouble mina = widgets->draw_min_altitude_time;
- widgets->duration = vik_track_get_duration ( widgets->tr );
+ widgets->duration = vik_track_get_duration ( widgets->tr, TRUE );
// Negative time or other problem
if ( widgets->duration <= 0 )
return;
@@ -2881,6 +2883,8 @@ static void propwin_response_cb( GtkDialog *dialog, gint resp, PropWidgets *widg
case GTK_RESPONSE_ACCEPT:
vik_track_set_comment(tr, gtk_entry_get_text(GTK_ENTRY(widgets->w_comment)));
vik_track_set_description(tr, gtk_entry_get_text(GTK_ENTRY(widgets->w_description)));
+ vik_track_set_source(tr, gtk_entry_get_text(GTK_ENTRY(widgets->w_source)));
+ vik_track_set_type(tr, gtk_entry_get_text(GTK_ENTRY(widgets->w_type)));
gtk_color_button_get_color ( GTK_COLOR_BUTTON(widgets->w_color), &(tr->color) );
tr->draw_name_mode = gtk_combo_box_get_active ( GTK_COMBO_BOX(widgets->w_namelabel) );
tr->max_number_dist_labels = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(widgets->w_number_distlabels) );
@@ -3131,6 +3135,8 @@ void vik_trw_layer_propwin_run ( GtkWindow *parent,
static gchar *label_texts[] = {
N_("Comment:"),
N_("Description:"),
+ N_("Source:"),
+ N_("Type:"),
N_("Color:"),
N_("Draw Name:"),
N_("Distance Labels:"),
@@ -3157,15 +3163,23 @@ void vik_trw_layer_propwin_run ( GtkWindow *parent,
widgets->w_comment = gtk_entry_new ();
if ( tr->comment )
gtk_entry_set_text ( GTK_ENTRY(widgets->w_comment), tr->comment );
- g_signal_connect_swapped ( widgets->w_comment, "activate", G_CALLBACK(a_dialog_response_accept), GTK_DIALOG(dialog) );
content_prop[cnt_prop++] = widgets->w_comment;
widgets->w_description = gtk_entry_new ();
if ( tr->description )
gtk_entry_set_text ( GTK_ENTRY(widgets->w_description), tr->description );
- g_signal_connect_swapped ( widgets->w_description, "activate", G_CALLBACK(a_dialog_response_accept), GTK_DIALOG(dialog) );
content_prop[cnt_prop++] = widgets->w_description;
+ widgets->w_source = gtk_entry_new ();
+ if ( tr->source )
+ gtk_entry_set_text ( GTK_ENTRY(widgets->w_source), tr->source );
+ content_prop[cnt_prop++] = widgets->w_source;
+
+ widgets->w_type = gtk_entry_new ();
+ if ( tr->type )
+ gtk_entry_set_text ( GTK_ENTRY(widgets->w_type), tr->type );
+ content_prop[cnt_prop++] = widgets->w_type;
+
widgets->w_color = content_prop[cnt_prop++] = gtk_color_button_new_with_color ( &(tr->color) );
static gchar *draw_name_labels[] = {
@@ -3394,8 +3408,25 @@ void vik_trw_layer_propwin_run ( GtkWindow *parent,
widgets->w_time_end = content[cnt++] = ui_label_new_selectable(msg);
g_free ( msg );
- g_snprintf(tmp_buf, sizeof(tmp_buf), _("%d minutes"), (int)(t2-t1)/60);
+ gint total_duration_s = (gint)(t2-t1);
+ gint segments_duration_s = (gint)vik_track_get_duration(tr,FALSE);
+ gint total_duration_m = total_duration_s/60;
+ gint segments_duration_m = segments_duration_s/60;
+ g_snprintf(tmp_buf, sizeof(tmp_buf), _("%d minutes - %d minutes moving"), total_duration_m, segments_duration_m);
widgets->w_time_dur = content[cnt++] = ui_label_new_selectable(tmp_buf);
+
+ // A tooltip to show in more readable hours:minutes
+ gchar tip_buf_total[20];
+ guint h_tot = total_duration_s/3600;
+ guint m_tot = (total_duration_s - h_tot*3600)/60;
+ g_snprintf(tip_buf_total, sizeof(tip_buf_total), "%d:%02d", h_tot, m_tot);
+ gchar tip_buf_segments[20];
+ guint h_seg = segments_duration_s/3600;
+ guint m_seg = (segments_duration_s - h_seg*3600)/60;
+ g_snprintf(tip_buf_segments, sizeof(tip_buf_segments), "%d:%02d", h_seg, m_seg);
+ gchar *tip = g_strdup_printf (_("%s total - %s in segments"), tip_buf_total, tip_buf_segments);
+ gtk_widget_set_tooltip_text ( GTK_WIDGET(widgets->w_time_dur), tip );
+ g_free (tip);
} else {
widgets->w_time_start = content[cnt++] = gtk_label_new(_("No Data"));
widgets->w_time_end = content[cnt++] = gtk_label_new(_("No Data"));