nautilus/nautilus-2.12.1-format.patch
2005-10-21 14:46:54 +00:00

157 lines
5.5 KiB
Diff

--- nautilus-2.12.1/src/file-manager/fm-actions.h.format 2005-07-01 06:22:19.000000000 -0400
+++ nautilus-2.12.1/src/file-manager/fm-actions.h 2005-10-21 10:35:58.000000000 -0400
@@ -57,6 +57,7 @@
#define FM_ACTION_MOUNT_VOLUME "Mount Volume"
#define FM_ACTION_UNMOUNT_VOLUME "Unmount Volume"
#define FM_ACTION_EJECT_VOLUME "Eject Volume"
+#define FM_ACTION_FORMAT_VOLUME "Format Volume"
#define FM_ACTION_SCRIPTS "Scripts"
#define FM_ACTION_NEW_DOCUMENTS "New Documents"
#define FM_ACTION_NEW_EMPTY_FILE "New Empty File"
--- nautilus-2.12.1/src/file-manager/fm-directory-view.c.format 2005-09-27 04:31:43.000000000 -0400
+++ nautilus-2.12.1/src/file-manager/fm-directory-view.c 2005-10-21 10:38:28.000000000 -0400
@@ -377,6 +377,8 @@
gpointer data);
static void action_unmount_volume_callback (GtkAction *action,
gpointer data);
+static void action_format_volume_callback (GtkAction *action,
+ gpointer data);
/* location popup-related actions */
@@ -5796,6 +5798,31 @@
nautilus_file_list_free (selection);
}
+static void
+action_format_volume_callback (GtkAction *action,
+ gpointer data)
+{
+ NautilusFile *file;
+ GList *selection, *l;
+ GnomeVFSDrive *drive;
+ FMDirectoryView *view;
+
+ view = FM_DIRECTORY_VIEW (data);
+
+ selection = fm_directory_view_get_selection (view);
+ for (l = selection; l != NULL; l = l->next) {
+ file = NAUTILUS_FILE (l->data);
+
+ if (nautilus_file_has_drive (file)) {
+ drive = nautilus_file_get_drive (file);
+ if (gnome_vfs_drive_get_device_type (drive) == GNOME_VFS_DEVICE_TYPE_FLOPPY) {
+ g_spawn_command_line_async ("gfloppy", NULL);
+ }
+ }
+ }
+ nautilus_file_list_free (selection);
+}
+
static void
action_eject_volume_callback (GtkAction *action,
gpointer data)
@@ -6218,6 +6245,10 @@
N_("_Eject"), NULL, /* label, accelerator */
N_("Eject the selected volume"), /* tooltip */
G_CALLBACK (action_eject_volume_callback) },
+ { "Format Volume", NULL, /* name, stock id */
+ N_("_Format"), NULL, /* label, accelerator */
+ N_("Format the selected volume"), /* tooltip */
+ G_CALLBACK (action_format_volume_callback) },
{ "OpenCloseParent", NULL, /* name, stock id */
N_("Open File and Close window"), "<alt><shift>Down", /* label, accelerator */
NULL, /* tooltip */
@@ -6457,7 +6488,8 @@
gboolean *show_mount,
gboolean *show_unmount,
gboolean *show_eject,
- gboolean *show_connect)
+ gboolean *show_connect,
+ gboolean *show_format)
{
GnomeVFSVolume *volume;
GnomeVFSDrive *drive;
@@ -6467,6 +6499,7 @@
*show_unmount = FALSE;
*show_eject = FALSE;
*show_connect = FALSE;
+ *show_format = FALSE;
if (nautilus_file_has_volume (file)) {
*show_unmount = TRUE;
@@ -6481,6 +6514,11 @@
} else {
*show_mount = TRUE;
}
+
+ if (gnome_vfs_drive_get_device_type (drive) == GNOME_VFS_DEVICE_TYPE_FLOPPY &&
+ g_find_program_in_path ("gfloppy")) {
+ *show_format = TRUE;
+ }
} else if (nautilus_file_is_nautilus_link (file)) {
uri = nautilus_file_get_activation_uri (file);
if (uri != NULL &&
@@ -6507,32 +6545,38 @@
gboolean show_unmount;
gboolean show_eject;
gboolean show_connect;
+ gboolean show_format;
GtkAction *action;
show_mount = (selection != NULL);
show_unmount = (selection != NULL);
show_eject = (selection != NULL);
show_connect = (selection != NULL && selection_count == 1);
+ show_format = (selection != NULL && selection_count == 1);
for (l = selection; l != NULL && (show_mount || show_unmount
- || show_eject || show_connect);
+ || show_eject || show_connect
+ || show_format);
l = l->next) {
gboolean show_mount_one;
gboolean show_unmount_one;
gboolean show_eject_one;
gboolean show_connect_one;
+ gboolean show_format_one;
file = NAUTILUS_FILE (l->data);
file_should_show_foreach (file,
&show_mount_one,
&show_unmount_one,
&show_eject_one,
- &show_connect_one);
+ &show_connect_one,
+ &show_format_one);
show_mount &= show_mount_one;
show_unmount &= show_unmount_one;
show_eject &= show_eject_one;
show_connect &= show_connect_one;
+ show_format &= show_format_one;
}
/* We don't want both eject and unmount, since eject
@@ -6556,6 +6600,10 @@
action = gtk_action_group_get_action (view->details->dir_action_group,
FM_ACTION_EJECT_VOLUME);
gtk_action_set_visible (action, show_eject);
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_FORMAT_VOLUME);
+ gtk_action_set_visible (action, show_format);
}
static void
--- nautilus-2.12.1/src/file-manager/nautilus-directory-view-ui.xml.format 2005-10-03 03:45:27.000000000 -0400
+++ nautilus-2.12.1/src/file-manager/nautilus-directory-view-ui.xml 2005-10-21 10:35:58.000000000 -0400
@@ -147,6 +147,7 @@
<menuitem name="Mount Volume" action="Mount Volume"/>
<menuitem name="Unmount Volume" action="Unmount Volume"/>
<menuitem name="Eject Volume" action="Eject Volume"/>
+ <menuitem name="Format Volume" action="Format Volume"/>
</placeholder>
<menuitem name="Connect To Server Link" action="Connect To Server Link"/>
</popup>