summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalló György <[email protected]>2014-10-04 02:49:13 +0200
committerStefano Karapetsas <[email protected]>2014-10-13 09:27:13 +0200
commit469727d8d2f9dea7277b89c20bd4e1da0c2969f7 (patch)
tree55260ef2262dd8711a1d14585e1fd58000b5050a
parent9144c25beaf0fe63cb668c730bbaaa532069c2d3 (diff)
downloadmate-panel-469727d8d2f9dea7277b89c20bd4e1da0c2969f7.tar.bz2
mate-panel-469727d8d2f9dea7277b89c20bd4e1da0c2969f7.tar.xz
Places menu: don't rely on Caja desktop files
This adds better support for other GVFS-compliant file managers (e.g. nautilus, nemo, pcmanfm). Closes https://github.com/mate-desktop/mate-panel/pull/242
-rw-r--r--mate-panel/panel-action-button.c13
-rw-r--r--mate-panel/panel-menu-items.c52
2 files changed, 46 insertions, 19 deletions
diff --git a/mate-panel/panel-action-button.c b/mate-panel/panel-action-button.c
index 6596f6be..0a2c9ff2 100644
--- a/mate-panel/panel-action-button.c
+++ b/mate-panel/panel-action-button.c
@@ -293,17 +293,26 @@ static void
panel_action_connect_server (GtkWidget *widget)
{
GdkScreen *screen;
+ char *command;
GError *error;
screen = gtk_widget_get_screen (GTK_WIDGET (widget));
error = NULL;
+ if (panel_is_program_in_path ("caja-connect-server"))
+ command = g_strdup ("caja-connect-server");
+ else if (panel_is_program_in_path ("nautilus-connect-server"))
+ command = g_strdup ("nautilus-connect-server");
+ else
+ command = g_strdup ("nemo-connect-server");
+
#if GTK_CHECK_VERSION (3, 0, 0)
- mate_gdk_spawn_command_line_on_screen (screen, "caja-connect-server",
+ mate_gdk_spawn_command_line_on_screen (screen, command,
#else
- gdk_spawn_command_line_on_screen (screen, "caja-connect-server",
+ gdk_spawn_command_line_on_screen (screen, command,
#endif
&error);
+ g_free (command);
if (error) {
panel_error_dialog (NULL, screen,
diff --git a/mate-panel/panel-menu-items.c b/mate-panel/panel-menu-items.c
index 1f4e6475..05082e8e 100644
--- a/mate-panel/panel-menu-items.c
+++ b/mate-panel/panel-menu-items.c
@@ -1027,7 +1027,7 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
{
GtkWidget *places_menu;
GtkWidget *item;
- char *gsettings_name;
+ char *gsettings_name = NULL;
char *name;
char *uri;
GFile *file;
@@ -1072,27 +1072,39 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
panel_place_menu_item_append_gtk_bookmarks (places_menu);
add_menu_separator (places_menu);
- if (place_item->priv->caja_desktop_settings != NULL) {
+ if (place_item->priv->caja_desktop_settings != NULL)
gsettings_name = g_settings_get_string (place_item->priv->caja_desktop_settings,
CAJA_DESKTOP_COMPUTER_ICON_NAME_KEY);
- panel_menu_items_append_from_desktop (places_menu,
- "caja-computer.desktop",
- gsettings_name,
- TRUE);
- if (gsettings_name)
+
+ if (PANEL_GLIB_STR_EMPTY (gsettings_name))
+ gsettings_name = g_strdup (_("Computer"));
+
+ panel_menu_items_append_place_item (
+ PANEL_ICON_COMPUTER, NULL,
+ gsettings_name,
+ _("Browse all local and remote disks and folders accessible from this computer"),
+ places_menu,
+ G_CALLBACK (activate_uri),
+ "computer://");
+
+ if (gsettings_name)
g_free (gsettings_name);
- }
panel_place_menu_item_append_local_gio (place_item, places_menu);
add_menu_separator (places_menu);
- panel_menu_items_append_from_desktop (places_menu,
- "mate-network-scheme.desktop",
- NULL,
- TRUE);
+ panel_menu_items_append_place_item (
+ PANEL_ICON_NETWORK, NULL,
+ _("Network"),
+ _("Browse bookmarked and local network locations"),
+ places_menu,
+ G_CALLBACK (activate_uri),
+ "network://");
panel_place_menu_item_append_remote_gio (place_item, places_menu);
- if (panel_is_program_in_path ("caja-connect-server")) {
+ if (panel_is_program_in_path ("caja-connect-server") ||
+ panel_is_program_in_path ("nautilus-connect-server") ||
+ panel_is_program_in_path ("nemo-connect-server")) {
item = panel_menu_items_create_action_item (PANEL_ACTION_CONNECT_SERVER);
if (item != NULL)
gtk_menu_shell_append (GTK_MENU_SHELL (places_menu),
@@ -1101,10 +1113,16 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
add_menu_separator (places_menu);
- panel_menu_items_append_from_desktop (places_menu,
- "mate-search-tool.desktop",
- NULL,
- FALSE);
+ if (panel_is_program_in_path ("mate-search-tool"))
+ panel_menu_items_append_from_desktop (places_menu,
+ "mate-search-tool.desktop",
+ NULL,
+ FALSE);
+ else
+ panel_menu_items_append_from_desktop (places_menu,
+ "gnome-search-tool.desktop",
+ NULL,
+ FALSE);
panel_recent_append_documents_menu (places_menu,
place_item->priv->recent_manager);