~ubuntu-branches/ubuntu/wily/brasero/wily

« back to all changes in this revision

Viewing changes to src/brasero-data-tree-model.c

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2008-11-18 11:30:50 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20081118113050-hoy0pi04uv7ww9d8
Tags: 0.8.3-0ubuntu1
* New upstream release (LP: #299411)
  - allow use of remote files
  - drives are now probed asynchronously and may not popup immediatly
    but brasero starts faster
  - some parts of GUI were revisited (in particular the burn
    option dialogs)
  - command line option for video projects (LP: #273140)
  - brasero crashed with SIGSEGV in g_main_context_dispatch()
    (LP: #281599)
  - Brasero main GUI appears after closing the dialog
    when opening an ISO file using Nautilus (LP: #242022)
  - brasero delete original files in VIDEO_TS folder (LP: #280835)
  - brasero crashed with SIGSEGV in 
    brasero_mkisofs_base_write_to_files() (LP: #275312)
  - brasero crashed with SIGSEGV in 
    brasero_project_save_project_as() (LP: #275086)
  - brasero crashed with SIGSEGV in 
    IA__g_sequence_iter_get_sequence() (LP: #282622)
  - brasero crashed with SIGSEGV in brasero_medium_get_drive()
    (LP: #283197)
  - Dialog contains a lot of empty space (LP: #190192)
 * debian/patches/008-add-gettext-domain-to-desktop-file.patch:
   - Dropped, we don't need this anymore
 * debian/control:
  - Add Build-deps on libeel2-dev and libnautilus-extension-dev
 * debian/brasero.install:
  - Install nautilus extension

Show diffs side-by-side

added added

removed removed

Lines of Context:
212
212
        }
213
213
 
214
214
        node = iter->user_data;
 
215
 
 
216
        /* This is a workaround for a warning in gailtreeview.c line 2946 where
 
217
         * gail uses the GtkTreePath and not a copy which if the node inserted
 
218
         * declares to have children and is not expanded leads to the path being
 
219
         * upped and therefore wrong. */
 
220
        if (node->is_inserting)
 
221
                return FALSE;
 
222
 
215
223
        if (node->is_file)
216
224
                return FALSE;
217
225
 
218
 
        if (!BRASERO_FILE_NODE_CHILDREN (node)) {
219
 
                /* It has children but only a bogus one. */
220
 
                return TRUE;
221
 
        }
222
 
 
223
226
        /* always return TRUE here when it's a directory since even if
224
227
         * it's empty we'll add a row written empty underneath it
225
228
         * anyway. */
241
244
 
242
245
                /* This is for the top directory */
243
246
                root = brasero_data_project_get_root (BRASERO_DATA_PROJECT (model));
244
 
                if (!BRASERO_FILE_NODE_CHILDREN (root))
 
247
                if (!root || !BRASERO_FILE_NODE_CHILDREN (root))
245
248
                        return FALSE;
246
249
 
247
250
                iter->stamp = priv->stamp;
344
347
 
345
348
        node->is_visible ++;
346
349
 
347
 
        if (node->is_imported)
 
350
        if (node->is_imported) {
 
351
                if (node->is_fake && !node->is_file) {
 
352
                        /* we don't load all nodes when importing a session do it now */
 
353
                        brasero_data_session_load_directory_contents (BRASERO_DATA_SESSION (model), node, NULL);
 
354
                }
 
355
 
348
356
                return;
 
357
        }
349
358
 
350
359
        if (node->is_visible > 1)
351
360
                return;
638
647
        return;
639
648
}
640
649
 
641
 
/**
642
 
 * This is a function mainly used at project load time. In this context there
643
 
 * can be nodes that have been added to the data project tree but not added 
644
 
 * through the model. Don't count those nodes.
645
 
 */
646
 
static guint
647
 
brasero_data_tree_model_node_index (BraseroFileNode *node)
648
 
{
649
 
        BraseroFileNode *parent;
650
 
        BraseroFileNode *peers;
651
 
        guint pos = 0;
652
 
 
653
 
        parent = node->parent;
654
 
        for (peers = BRASERO_FILE_NODE_CHILDREN (parent); peers; peers = peers->next) {
655
 
                if (peers == node)
656
 
                        break;
657
 
                if (!peers->is_visible)
658
 
                        continue;
659
 
                pos ++;
660
 
        }
661
 
 
662
 
        return pos;
663
 
}
664
 
 
665
650
GtkTreePath *
666
651
brasero_data_tree_model_node_to_path (BraseroDataTreeModel *self,
667
652
                                      BraseroFileNode *node)
675
660
        for (; node->parent && !node->is_root; node = node->parent) {
676
661
                guint nth;
677
662
 
678
 
                nth = brasero_data_tree_model_node_index (node);
 
663
                nth = brasero_file_node_get_pos_as_child (node);
679
664
                gtk_tree_path_prepend_index (path, nth);
680
665
        }
681
666
 
1209
1194
        }
1210
1195
 
1211
1196
        /* Add the row itself */
 
1197
        /* This is a workaround for a warning in gailtreeview.c line 2946 where
 
1198
         * gail uses the GtkTreePath and not a copy which if the node inserted
 
1199
         * declares to have children and is not expanded leads to the path being
 
1200
         * upped and therefore wrong. */
 
1201
        node->is_inserting = 1;
1212
1202
        gtk_tree_model_row_inserted (GTK_TREE_MODEL (project),
1213
1203
                                     path,
1214
1204
                                     &iter);
 
1205
        node->is_inserting = 0;
1215
1206
        gtk_tree_path_free (path);
1216
1207
 
1217
1208
        parent = node->parent;
1247
1238
        /* we also have to set the is_visible property as all nodes added to 
1248
1239
         * root are always visible but ref_node is not necessarily called on
1249
1240
         * these nodes. */
1250
 
        if (parent->is_root)
1251
 
                node->is_visible = TRUE;
 
1241
//      if (parent->is_root)
 
1242
//              node->is_visible = TRUE;
1252
1243
 
1253
1244
end:
1254
1245
        /* chain up this function */
1356
1347
                /* emit child-toggled. Thanks to bogus rows we only need to emit
1357
1348
                 * this signal once since a directory will always have a child
1358
1349
                 * in the tree */
1359
 
                gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (project), path, &iter);
 
1350
                gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (project),
 
1351
                                                      path,
 
1352
                                                      &iter);
 
1353
 
 
1354
                /* The problem is that without that, the folder contents on disc
 
1355
                 * won't be added to the tree if the node it replaced was
 
1356
                 * already visible. */
 
1357
                if (node->is_imported
 
1358
                &&  node->is_visible
 
1359
                &&  node->is_fake)
 
1360
                        brasero_data_session_load_directory_contents (BRASERO_DATA_SESSION (project),
 
1361
                                                                      node,
 
1362
                                                                      NULL);
1360
1363
 
1361
1364
                /* add the row */
1362
1365
                if (!BRASERO_FILE_NODE_CHILDREN (node))  {