summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2009-07-08 12:05:11 +0100
committerCosimo Cecchi <cosimoc@gnome.org>2009-07-08 12:05:11 +0100
commit45c928d3cf112f22d69b25299898301c54d9e961 (patch)
tree69a996d18b21a9a6fd7aa067f712cec275ceb285 /src
parent4b434c4f73b56a92ff4bf50435487357719eebaf (diff)
downloadnautilus-45c928d3cf112f22d69b25299898301c54d9e961.tar.gz
Use application icons in the context menu
If it's possibile, use the application icons in the open with submenu. This also removes quotation marks and useless duplicate "Open With" strings from the submenu. Patch by Marcus Carlson, fixes bug #587533 and #546916.
Diffstat (limited to 'src')
-rw-r--r--src/file-manager/fm-directory-view.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 3dbf5c396..ae70b32e6 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -4250,7 +4250,8 @@ add_application_to_open_with_menu (FMDirectoryView *view,
GList *files,
int index,
const char *menu_placeholder,
- const char *popup_placeholder)
+ const char *popup_placeholder,
+ const gboolean submenu)
{
ApplicationLaunchParameters *launch_parameters;
char *tip;
@@ -4258,11 +4259,16 @@ add_application_to_open_with_menu (FMDirectoryView *view,
char *action_name;
char *escaped_app;
GtkAction *action;
+ GIcon *app_icon;
launch_parameters = application_launch_parameters_new
(application, files, view);
escaped_app = eel_str_double_underscores (g_app_info_get_name (application));
- label = g_strdup_printf (_("Open with \"%s\""), escaped_app);
+ if (submenu)
+ label = g_strdup_printf ("%s", escaped_app);
+ else
+ label = g_strdup_printf (_("Open with %s"), escaped_app);
+
tip = g_strdup_printf (ngettext ("Use \"%s\" to open the selected item",
"Use \"%s\" to open the selected items",
g_list_length (files)),
@@ -4276,6 +4282,14 @@ add_application_to_open_with_menu (FMDirectoryView *view,
tip,
NULL);
+ app_icon = g_object_ref (g_app_info_get_icon (application));
+
+ if (app_icon == NULL)
+ app_icon = g_themed_icon_new ("application-x-executable");
+
+ gtk_action_set_gicon (action, app_icon);
+ g_object_unref (app_icon);
+
g_signal_connect_data (action, "activate",
G_CALLBACK (open_with_launch_application_callback),
launch_parameters,
@@ -4450,7 +4464,7 @@ reset_open_with_menu (FMDirectoryView *view, GList *selection)
node->data,
selection,
index,
- menu_path, popup_path);
+ menu_path, popup_path, submenu_visible);
}
eel_g_object_list_free (applications);
if (default_app != NULL) {
@@ -6909,7 +6923,7 @@ static const GtkActionEntry directory_view_entries[] = {
/* tooltip */ N_("Open each selected item in a folder window"),
G_CALLBACK (action_open_folder_window_callback) },
/* name, stock id */ { "OtherApplication1", NULL,
- /* label, accelerator */ N_("Open with Other _Application..."), NULL,
+ /* label, accelerator */ N_("Other _Application..."), NULL,
/* tooltip */ N_("Choose another application with which to open the selected item"),
G_CALLBACK (action_other_application_callback) },
/* name, stock id */ { "OtherApplication2", NULL,
@@ -8389,7 +8403,7 @@ real_update_menus (FMDirectoryView *view)
char *escaped_app;
escaped_app = eel_str_double_underscores (g_app_info_get_name (app));
- label_with_underscore = g_strdup_printf (_("_Open with \"%s\""),
+ label_with_underscore = g_strdup_printf (_("_Open with %s"),
escaped_app);
app_icon = g_object_ref (g_app_info_get_icon (app));