From cf94f9ae2115d1bb6a9a9de8418936a1808ec1f8 Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Wed, 6 Oct 1999 19:23:16 +0000 Subject: [PATCH] 1999-10-06 Jonathan Blandford * gpopup2.c (create_actions): Now the Mount/Unmount/Eject device code will be lumped together with the other MIME_ACTIONS, even thought they're not controlled there. --- gnome/ChangeLog | 6 ++++++ gnome/gpopup2.c | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 026d149b3..ee22ea057 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,9 @@ +1999-10-06 Jonathan Blandford + + * gpopup2.c (create_actions): Now the Mount/Unmount/Eject device + code will be lumped together with the other MIME_ACTIONS, even + thought they're not controlled there. + 1999-10-06 Norbert Warmuth * gmain.c, gmain.h: removed disable_root_warning. This variable diff --git a/gnome/gpopup2.c b/gnome/gpopup2.c index 2b1652327..9e84da325 100644 --- a/gnome/gpopup2.c +++ b/gnome/gpopup2.c @@ -78,6 +78,7 @@ static void handle_edit_symlink (GtkWidget *widget, WPanel *panel); static gboolean check_mount_func (WPanel *panel, DesktopIconInfo *dii); static gboolean check_unmount_func (WPanel *panel, DesktopIconInfo *dii); static gboolean check_eject_func (WPanel *panel, DesktopIconInfo *dii); +static gboolean check_device_func (WPanel *panel, DesktopIconInfo *dii); static gchar * get_full_filename (WPanel *panel); @@ -179,17 +180,25 @@ check_eject_func (WPanel *panel, DesktopIconInfo *dii) g_free (full_name); return retval; } +static gboolean +check_device_func (WPanel *panel, DesktopIconInfo *dii) +{ + return (check_mount_func (panel, dii) || + check_unmount_func (panel, dii) || + check_eject_func (panel, dii)); +} /* global vars */ extern int we_can_afford_the_speed; static struct action file_actions[] = { { N_("Open"), F_NOTDEV | F_SINGLE, handle_open, NULL }, + { "", F_NOTDEV | F_SINGLE, NULL, NULL }, { N_("Mount device"), F_ALL | F_SINGLE, handle_mount, check_mount_func }, { N_("Unmount device"), F_ALL | F_SINGLE, handle_unmount, check_unmount_func }, { N_("Eject device"), F_ALL | F_SINGLE, handle_eject, check_eject_func }, - { "", F_NOTDEV | F_SINGLE, NULL, NULL }, - { "", F_MIME_ACTIONS | F_SINGLE, NULL, NULL }, + /* Custom actions go here */ + { "", F_MIME_ACTIONS | F_SINGLE, NULL, check_device_func }, { N_("Open with..."), F_REGULAR | F_SINGLE, handle_open_with, NULL }, { N_("View"), F_REGULAR | F_SINGLE, handle_view, NULL }, { N_("View Unfiltered"), F_REGULAR | F_ADVANCED | F_SINGLE, handle_view_unfiltered, NULL }, @@ -444,7 +453,15 @@ create_actions (GtkWidget *menu, gint flags, WPanel *panel, DesktopIconInfo *dii for (action = file_actions; action->text; action++) { /* Insert the MIME actions if appropriate */ if ((action->flags & F_MIME_ACTIONS) && (flags & F_SINGLE)) { + int curpos = pos; pos = create_mime_actions (menu, panel, pos, dii); + /* Why do we do this? If the mime actions are there, and it's mountable, + * we can count on the separator at the end of the mime_actions + * menu. However, if the mime_actions aren't there, we need a separator */ + if (pos == curpos && (action->func)(panel, dii)) { + uiinfo[0].type = GNOME_APP_UI_SEPARATOR; + fill_menu (GTK_MENU_SHELL (menu), uiinfo, pos++); + } continue; }