]> git.street.me.uk Git - andy/viking.git/commitdiff
Add tooltip for a more readable hours:minutes display rather than just total minutes...
authorRob Norris <rw_norris@hotmail.com>
Sun, 8 Nov 2015 12:51:31 +0000 (12:51 +0000)
committerRob Norris <rw_norris@hotmail.com>
Tue, 15 Dec 2015 00:10:37 +0000 (00:10 +0000)
src/viktrwlayer_propwin.c

index 603495f7aca96c90ad5dd18d214a43cc0b79907e..a3c611e3389e05b81c6e73ae63c2cd84e9d33baf 100644 (file)
@@ -3400,6 +3400,19 @@ void vik_trw_layer_propwin_run ( GtkWindow *parent,
     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"));