]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Merge git://git.tdb.fi/ext/subsurface
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 28 Aug 2012 20:16:57 +0000 (13:16 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 28 Aug 2012 20:16:57 +0000 (13:16 -0700)
Pull a few buglet fixes from Mikko Rasa.

Some trivial conflicts due to changes in the dive selection logic, and
using the new "for_each_dive()" helper.

* git://git.tdb.fi/ext/subsurface:
  Check if multi-dive editing is actually needed
  Fix an off-by-one error in buffer allocation

gtk-gui.c
info.c

index bc8e6e00097e8f8c4f51cb00b3eaadedf415b5d6..2a4d77ac9a78e60cc052ddbfdf3e36421b6d6109 100644 (file)
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -262,7 +262,7 @@ static gboolean ask_save_changes()
                label = gtk_label_new (
                        "You have unsaved changes\nWould you like to save those before exiting the program?");
        } else {
-               char *label_text = (char*) malloc(sizeof(char) * (92 + strlen(existing_filename)));
+               char *label_text = (char*) malloc(sizeof(char) * (93 + strlen(existing_filename)));
                sprintf(label_text,
                        "You have unsaved changes to file: %s \nWould you like to save those before exiting the program?",
                        existing_filename);
diff --git a/info.c b/info.c
index cccc6497b9515ea71d4087dfbb905bf74d2391f9..d9379ac68b200976f08c9afada59bd87f88bb736 100644 (file)
--- a/info.c
+++ b/info.c
@@ -496,6 +496,7 @@ int edit_multi_dive_info(struct dive *single_dive)
        GtkWidget *dialog, *vbox;
        struct dive_info info;
        struct dive *master;
+       gboolean multi;
 
        dialog = gtk_dialog_new_with_buttons("Dive Info",
                GTK_WINDOW(main_window),
@@ -508,7 +509,22 @@ int edit_multi_dive_info(struct dive *single_dive)
        master = single_dive;
        if (!master)
                master = current_dive;
-       dive_info_widget(vbox, master, &info, !single_dive);
+
+       /* See if we should use multi dive mode */
+       multi = FALSE;
+       if (!single_dive) {
+               int i;
+               struct dive *dive;
+
+               for_each_dive(i, dive) {
+                       if (dive != master && dive->selected) {
+                               multi = TRUE;
+                               break;
+                       }
+               }
+       }
+
+       dive_info_widget(vbox, master, &info, multi);
        show_dive_equipment(master, W_IDX_SECONDARY);
        save_equipment_data(master);
        gtk_widget_show_all(dialog);