Code

Fix LP #179741
authorjohanengelen <johanengelen@users.sourceforge.net>
Wed, 2 Jan 2008 13:56:43 +0000 (13:56 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Wed, 2 Jan 2008 13:56:43 +0000 (13:56 +0000)
src/ui/dialog/document-properties.cpp

index d60f1f7ecfc86dab33863c326ad35b8a58b327dc..a3e0fdfbc07f72aaab5a545eefc8343a9161e3b2 100644 (file)
@@ -647,19 +647,13 @@ DocumentProperties::onRemoveGrid()
     if (pagenum == -1) // no pages
       return;
 
-    Gtk::Widget *page = _grids_notebook.get_nth_page(pagenum);
-    if (!page) return;
-
-    Glib::ustring tabtext = _grids_notebook.get_tab_label_text(*page);
-
-    // find the grid with name tabtext (it's id) and delete that one.
     SPDesktop *dt = getDesktop();
     SPNamedView *nv = sp_desktop_namedview(dt);
     Inkscape::CanvasGrid * found_grid = NULL;
-    for (GSList const * l = nv->grids; l != NULL; l = l->next) {
+    int i = 0;
+    for (GSList const * l = nv->grids; l != NULL; l = l->next, i++) {  // not a very nice fix, but works.
         Inkscape::CanvasGrid * grid = (Inkscape::CanvasGrid*) l->data;
-        gchar const *idtext = grid->repr->attribute("id");
-        if ( !strcmp(tabtext.c_str(), idtext) ) {
+        if (pagenum == i) {
             found_grid = grid;
             break; // break out of for-loop
         }