490
488
volume_monitor = sidebar->volume_monitor;
491
last_iter = add_heading (sidebar, SECTION_COMPUTER,
494
/* add built in bookmarks */
495
desktop_path = caja_get_desktop_directory ();
498
if (strcmp (g_get_home_dir(), desktop_path) != 0) {
501
mount_uri = caja_get_home_directory_uri ();
502
display_name = g_filename_display_basename (g_get_home_dir ());
503
icon = g_themed_icon_new (CAJA_ICON_HOME);
504
last_iter = add_place (sidebar, PLACES_BUILT_IN,
507
mount_uri, NULL, NULL, NULL, 0,
508
_("Open your personal folder"));
509
g_object_unref (icon);
510
g_free (display_name);
511
compare_for_selection (sidebar,
512
location, mount_uri, last_uri,
513
&last_iter, &select_path);
518
mount_uri = g_filename_to_uri (desktop_path, NULL, NULL);
519
icon = g_themed_icon_new (CAJA_ICON_DESKTOP);
520
last_iter = add_place (sidebar, PLACES_BUILT_IN,
523
mount_uri, NULL, NULL, NULL, 0,
524
_("Open the contents of your desktop in a folder"));
525
g_object_unref (icon);
526
compare_for_selection (sidebar,
527
location, mount_uri, last_uri,
528
&last_iter, &select_path);
530
g_free (desktop_path);
532
/* file system root */
533
mount_uri = "file:///"; /* No need to strdup */
534
icon = g_themed_icon_new (CAJA_ICON_FILESYSTEM);
535
last_iter = add_place (sidebar, PLACES_BUILT_IN,
537
_("File System"), icon,
538
mount_uri, NULL, NULL, NULL, 0,
539
_("Open the contents of the File System"));
540
g_object_unref (icon);
541
compare_for_selection (sidebar,
542
location, mount_uri, last_uri,
543
&last_iter, &select_path);
546
/* XDG directories */
548
for (index = 0; index < G_USER_N_DIRECTORIES; index++) {
550
if (index == G_USER_DIRECTORY_DESKTOP ||
551
index == G_USER_DIRECTORY_TEMPLATES ||
552
index == G_USER_DIRECTORY_PUBLIC_SHARE) {
556
path = g_get_user_special_dir (index);
558
/* xdg resets special dirs to the home directory in case
559
* it's not finiding what it expects. We don't want the home
560
* to be added multiple times in that weird configuration.
563
|| g_strcmp0 (path, g_get_home_dir ()) == 0
564
|| g_list_find_custom (xdg_dirs, path, (GCompareFunc) g_strcmp0) != NULL) {
568
root = g_file_new_for_path (path);
569
name = g_file_get_basename (root);
570
icon = caja_user_special_directory_get_gicon (index);
571
mount_uri = g_file_get_uri (root);
572
tooltip = g_file_get_parse_name (root);
574
last_iter = add_place (sidebar, PLACES_BUILT_IN,
576
name, icon, mount_uri,
579
compare_for_selection (sidebar,
580
location, mount_uri, last_uri,
581
&last_iter, &select_path);
583
g_object_unref (root);
584
g_object_unref (icon);
588
xdg_dirs = g_list_prepend (xdg_dirs, (char *)path);
590
g_list_free (xdg_dirs);
592
mount_uri = "trash:///"; /* No need to strdup */
593
icon = caja_trash_monitor_get_icon ();
594
last_iter = add_place (sidebar, PLACES_BUILT_IN,
596
_("Trash"), icon, mount_uri,
598
_("Open the trash"));
599
compare_for_selection (sidebar,
600
location, mount_uri, last_uri,
601
&last_iter, &select_path);
602
g_object_unref (icon);
492
604
/* first go through all connected drives */
493
605
drives = g_volume_monitor_get_connected_drives (volume_monitor);
632
744
g_list_free (volumes);
746
/* add mounts that has no volume (/etc/mtab mounts, ftp, sftp,...) */
747
network_mounts = NULL;
748
mounts = g_volume_monitor_get_mounts (volume_monitor);
750
for (l = mounts; l != NULL; l = l->next)
753
if (g_mount_is_shadowed (mount))
755
g_object_unref (mount);
758
volume = g_mount_get_volume (mount);
761
g_object_unref (volume);
762
g_object_unref (mount);
765
root = g_mount_get_default_location (mount);
767
if (!g_file_is_native (root)) {
768
network_mounts = g_list_prepend (network_mounts, g_object_ref (mount));
772
icon = g_mount_get_icon (mount);
773
mount_uri = g_file_get_uri (root);
774
name = g_mount_get_name (mount);
775
tooltip = g_file_get_parse_name (root);
776
last_iter = add_place (sidebar, PLACES_MOUNTED_VOLUME,
778
name, icon, mount_uri,
779
NULL, NULL, mount, 0, tooltip);
780
compare_for_selection (sidebar,
781
location, mount_uri, last_uri,
782
&last_iter, &select_path);
783
g_object_unref (root);
784
g_object_unref (mount);
785
g_object_unref (icon);
790
g_list_free (mounts);
634
793
/* add bookmarks */
635
794
bookmark_count = caja_bookmark_list_length (sidebar->bookmarks);
670
829
g_free (tooltip);
673
last_iter = add_heading (sidebar, SECTION_COMPUTER,
676
/* add built in bookmarks */
677
desktop_path = caja_get_desktop_directory ();
680
if (strcmp (g_get_home_dir(), desktop_path) != 0) {
683
mount_uri = caja_get_home_directory_uri ();
684
display_name = g_filename_display_basename (g_get_home_dir ());
685
icon = g_themed_icon_new (CAJA_ICON_HOME);
686
last_iter = add_place (sidebar, PLACES_BUILT_IN,
689
mount_uri, NULL, NULL, NULL, 0,
690
_("Open your personal folder"));
691
g_object_unref (icon);
692
g_free (display_name);
693
compare_for_selection (sidebar,
694
location, mount_uri, last_uri,
695
&last_iter, &select_path);
700
mount_uri = g_filename_to_uri (desktop_path, NULL, NULL);
701
icon = g_themed_icon_new (CAJA_ICON_DESKTOP);
702
last_iter = add_place (sidebar, PLACES_BUILT_IN,
705
mount_uri, NULL, NULL, NULL, 0,
706
_("Open the contents of your desktop in a folder"));
707
g_object_unref (icon);
708
compare_for_selection (sidebar,
709
location, mount_uri, last_uri,
710
&last_iter, &select_path);
712
g_free (desktop_path);
714
/* file system root */
715
mount_uri = "file:///"; /* No need to strdup */
716
icon = g_themed_icon_new (CAJA_ICON_FILESYSTEM);
717
last_iter = add_place (sidebar, PLACES_BUILT_IN,
719
_("File System"), icon,
720
mount_uri, NULL, NULL, NULL, 0,
721
_("Open the contents of the File System"));
722
g_object_unref (icon);
723
compare_for_selection (sidebar,
724
location, mount_uri, last_uri,
725
&last_iter, &select_path);
728
/* XDG directories */
730
for (index = 0; index < G_USER_N_DIRECTORIES; index++) {
732
if (index == G_USER_DIRECTORY_DESKTOP ||
733
index == G_USER_DIRECTORY_TEMPLATES ||
734
index == G_USER_DIRECTORY_PUBLIC_SHARE) {
738
path = g_get_user_special_dir (index);
740
/* xdg resets special dirs to the home directory in case
741
* it's not finiding what it expects. We don't want the home
742
* to be added multiple times in that weird configuration.
745
|| g_strcmp0 (path, g_get_home_dir ()) == 0
746
|| g_list_find_custom (xdg_dirs, path, (GCompareFunc) g_strcmp0) != NULL) {
750
root = g_file_new_for_path (path);
751
name = g_file_get_basename (root);
752
icon = caja_user_special_directory_get_gicon (index);
753
mount_uri = g_file_get_uri (root);
754
tooltip = g_file_get_parse_name (root);
756
last_iter = add_place (sidebar, PLACES_BUILT_IN,
758
name, icon, mount_uri,
761
compare_for_selection (sidebar,
762
location, mount_uri, last_uri,
763
&last_iter, &select_path);
765
g_object_unref (root);
766
g_object_unref (icon);
770
xdg_dirs = g_list_prepend (xdg_dirs, (char *)path);
772
g_list_free (xdg_dirs);
774
/* add mounts that has no volume (/etc/mtab mounts, ftp, sftp,...) */
775
network_mounts = NULL;
776
mounts = g_volume_monitor_get_mounts (volume_monitor);
778
for (l = mounts; l != NULL; l = l->next)
781
if (g_mount_is_shadowed (mount))
783
g_object_unref (mount);
786
volume = g_mount_get_volume (mount);
789
g_object_unref (volume);
790
g_object_unref (mount);
793
root = g_mount_get_default_location (mount);
795
if (!g_file_is_native (root)) {
796
network_mounts = g_list_prepend (network_mounts, g_object_ref (mount));
800
icon = g_mount_get_icon (mount);
801
mount_uri = g_file_get_uri (root);
802
name = g_mount_get_name (mount);
803
tooltip = g_file_get_parse_name (root);
804
last_iter = add_place (sidebar, PLACES_MOUNTED_VOLUME,
806
name, icon, mount_uri,
807
NULL, NULL, mount, 0, tooltip);
808
compare_for_selection (sidebar,
809
location, mount_uri, last_uri,
810
&last_iter, &select_path);
811
g_object_unref (root);
812
g_object_unref (mount);
813
g_object_unref (icon);
818
g_list_free (mounts);
820
mount_uri = "trash:///"; /* No need to strdup */
821
icon = caja_trash_monitor_get_icon ();
822
last_iter = add_place (sidebar, PLACES_BUILT_IN,
824
_("Trash"), icon, mount_uri,
826
_("Open the trash"));
827
compare_for_selection (sidebar,
828
location, mount_uri, last_uri,
829
&last_iter, &select_path);
830
g_object_unref (icon);
833
833
last_iter = add_heading (sidebar, SECTION_NETWORK,