placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
/* gtkplacesview.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2015-11-19 12:44:17 +00:00
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2.1 of the License, or
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2015-11-19 12:44:17 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
*
|
2015-11-19 12:44:17 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gio/gio.h>
|
2016-05-01 19:00:25 +00:00
|
|
|
#include <gio/gvfs.h>
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2017-11-18 13:18:11 +00:00
|
|
|
#include "gtkprivate.h"
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
#include "gtkintl.h"
|
|
|
|
#include "gtkmarshalers.h"
|
|
|
|
#include "gtkplacesviewprivate.h"
|
|
|
|
#include "gtkplacesviewrowprivate.h"
|
|
|
|
#include "gtktypebuiltins.h"
|
2020-11-08 15:40:20 +00:00
|
|
|
#include "gtkprivatetypebuiltins.h"
|
2018-02-04 20:21:39 +00:00
|
|
|
#include "gtkeventcontrollerkey.h"
|
2019-12-27 01:10:34 +00:00
|
|
|
#include "gtkpopovermenu.h"
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2021-03-01 13:18:45 +00:00
|
|
|
/*< private >
|
|
|
|
* GtkPlacesView:
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
*
|
2017-12-01 15:26:21 +00:00
|
|
|
* #GtkPlacesView is a widget that displays a list of persistent drives
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
* such as harddisk partitions and networks. #GtkPlacesView does not monitor
|
|
|
|
* removable devices.
|
|
|
|
*
|
|
|
|
* The places view displays drives and networks, and will automatically mount
|
|
|
|
* them when the user activates. Network addresses are stored even if they fail
|
|
|
|
* to connect. When the connection is successful, the connected network is
|
|
|
|
* shown at the network list.
|
|
|
|
*
|
|
|
|
* To make use of the places view, an application at least needs to connect
|
|
|
|
* to the #GtkPlacesView::open-location signal. This is emitted when the user
|
|
|
|
* selects a location to open in the view.
|
|
|
|
*/
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
struct _GtkPlacesViewClass
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkBoxClass parent_class;
|
|
|
|
|
|
|
|
void (* open_location) (GtkPlacesView *view,
|
|
|
|
GFile *location,
|
|
|
|
GtkPlacesOpenFlags open_flags);
|
|
|
|
|
|
|
|
void (* show_error_message) (GtkPlacesSidebar *sidebar,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *primary,
|
|
|
|
const char *secondary);
|
2020-05-05 00:42:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GtkPlacesView
|
|
|
|
{
|
|
|
|
GtkBox parent_instance;
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
GVolumeMonitor *volume_monitor;
|
|
|
|
GtkPlacesOpenFlags open_flags;
|
|
|
|
GtkPlacesOpenFlags current_open_flags;
|
|
|
|
|
|
|
|
GFile *server_list_file;
|
|
|
|
GFileMonitor *server_list_monitor;
|
2017-04-10 21:59:33 +00:00
|
|
|
GFileMonitor *network_monitor;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
GCancellable *cancellable;
|
|
|
|
|
2020-07-24 18:40:36 +00:00
|
|
|
char *search_query;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
GtkWidget *actionbar;
|
|
|
|
GtkWidget *address_entry;
|
|
|
|
GtkWidget *connect_button;
|
2015-07-28 14:46:25 +00:00
|
|
|
GtkWidget *listbox;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
GtkWidget *popup_menu;
|
|
|
|
GtkWidget *recent_servers_listbox;
|
|
|
|
GtkWidget *recent_servers_popover;
|
|
|
|
GtkWidget *recent_servers_stack;
|
|
|
|
GtkWidget *stack;
|
2016-04-26 12:57:36 +00:00
|
|
|
GtkWidget *server_adresses_popover;
|
2018-11-24 01:49:43 +00:00
|
|
|
GtkWidget *available_protocols_grid;
|
2015-08-18 21:26:07 +00:00
|
|
|
GtkWidget *network_placeholder;
|
|
|
|
GtkWidget *network_placeholder_label;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2015-10-29 12:14:57 +00:00
|
|
|
GtkSizeGroup *path_size_group;
|
2015-11-03 02:50:06 +00:00
|
|
|
GtkSizeGroup *space_size_group;
|
2015-10-29 12:14:57 +00:00
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
GtkEntryCompletion *address_entry_completion;
|
|
|
|
GtkListStore *completion_store;
|
|
|
|
|
2015-08-18 15:58:41 +00:00
|
|
|
GCancellable *networks_fetching_cancellable;
|
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
GtkPlacesViewRow *row_for_action;
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
guint should_open_location : 1;
|
|
|
|
guint should_pulse_entry : 1;
|
|
|
|
guint entry_pulse_timeout_id;
|
2015-08-17 22:42:23 +00:00
|
|
|
guint connecting_to_server : 1;
|
2015-08-29 20:57:15 +00:00
|
|
|
guint mounting_volume : 1;
|
|
|
|
guint unmounting_mount : 1;
|
2015-08-18 15:58:41 +00:00
|
|
|
guint fetching_networks : 1;
|
2015-08-19 12:46:34 +00:00
|
|
|
guint loading : 1;
|
2016-09-05 11:19:29 +00:00
|
|
|
guint destroyed : 1;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void mount_volume (GtkPlacesView *view,
|
|
|
|
GVolume *volume);
|
|
|
|
|
|
|
|
static void on_eject_button_clicked (GtkWidget *widget,
|
|
|
|
GtkPlacesViewRow *row);
|
|
|
|
|
2020-03-19 04:52:05 +00:00
|
|
|
static gboolean on_row_popup_menu (GtkWidget *widget,
|
|
|
|
GVariant *args,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
static void click_cb (GtkGesture *gesture,
|
|
|
|
int n_press,
|
|
|
|
double x,
|
|
|
|
double y,
|
|
|
|
gpointer user_data);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
static void populate_servers (GtkPlacesView *view);
|
|
|
|
|
2015-08-29 18:36:48 +00:00
|
|
|
static gboolean gtk_places_view_get_fetching_networks (GtkPlacesView *view);
|
|
|
|
|
|
|
|
static void gtk_places_view_set_fetching_networks (GtkPlacesView *view,
|
|
|
|
gboolean fetching_networks);
|
|
|
|
|
2015-08-29 20:57:15 +00:00
|
|
|
static void gtk_places_view_set_loading (GtkPlacesView *view,
|
|
|
|
gboolean loading);
|
|
|
|
|
|
|
|
static void update_loading (GtkPlacesView *view);
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
G_DEFINE_TYPE (GtkPlacesView, gtk_places_view, GTK_TYPE_BOX)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
/* GtkPlacesView properties & signals */
|
|
|
|
enum {
|
|
|
|
PROP_0,
|
|
|
|
PROP_OPEN_FLAGS,
|
2015-08-29 18:36:48 +00:00
|
|
|
PROP_FETCHING_NETWORKS,
|
2015-08-19 12:46:34 +00:00
|
|
|
PROP_LOADING,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
LAST_PROP
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
OPEN_LOCATION,
|
|
|
|
SHOW_ERROR_MESSAGE,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *unsupported_protocols [] =
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
|
|
|
"file", "afc", "obex", "http",
|
|
|
|
"trash", "burn", "computer",
|
|
|
|
"archive", "recent", "localtest",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint places_view_signals [LAST_SIGNAL] = { 0 };
|
|
|
|
static GParamSpec *properties [LAST_PROP];
|
|
|
|
|
|
|
|
static void
|
|
|
|
emit_open_location (GtkPlacesView *view,
|
|
|
|
GFile *location,
|
|
|
|
GtkPlacesOpenFlags open_flags)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
if ((open_flags & view->open_flags) == 0)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
open_flags = GTK_PLACES_OPEN_NORMAL;
|
|
|
|
|
|
|
|
g_signal_emit (view, places_view_signals[OPEN_LOCATION], 0, location, open_flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
emit_show_error_message (GtkPlacesView *view,
|
2020-07-24 18:40:36 +00:00
|
|
|
char *primary_message,
|
|
|
|
char *secondary_message)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
|
|
|
g_signal_emit (view, places_view_signals[SHOW_ERROR_MESSAGE],
|
|
|
|
0, primary_message, secondary_message);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
server_file_changed_cb (GtkPlacesView *view)
|
|
|
|
{
|
|
|
|
populate_servers (view);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GBookmarkFile *
|
|
|
|
server_list_load (GtkPlacesView *view)
|
|
|
|
{
|
|
|
|
GBookmarkFile *bookmarks;
|
|
|
|
GError *error = NULL;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *datadir;
|
|
|
|
char *filename;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
bookmarks = g_bookmark_file_new ();
|
2016-10-23 18:06:33 +00:00
|
|
|
datadir = g_build_filename (g_get_user_config_dir (), "gtk-4.0", NULL);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
filename = g_build_filename (datadir, "servers", NULL);
|
|
|
|
|
|
|
|
g_mkdir_with_parents (datadir, 0700);
|
|
|
|
g_bookmark_file_load_from_file (bookmarks, filename, &error);
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
|
|
|
|
{
|
|
|
|
/* only warn if the file exists */
|
|
|
|
g_warning ("Unable to open server bookmarks: %s", error->message);
|
|
|
|
g_clear_pointer (&bookmarks, g_bookmark_file_free);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Monitor the file in case it's modified outside this code */
|
2020-05-05 00:42:09 +00:00
|
|
|
if (!view->server_list_monitor)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
view->server_list_file = g_file_new_for_path (filename);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->server_list_file)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
view->server_list_monitor = g_file_monitor_file (view->server_list_file,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
G_FILE_MONITOR_NONE,
|
|
|
|
NULL,
|
|
|
|
&error);
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
g_warning ("Cannot monitor server file: %s", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
g_signal_connect_swapped (view->server_list_monitor,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
"changed",
|
|
|
|
G_CALLBACK (server_file_changed_cb),
|
|
|
|
view);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
g_clear_object (&view->server_list_file);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (datadir);
|
|
|
|
g_free (filename);
|
|
|
|
|
|
|
|
return bookmarks;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
server_list_save (GBookmarkFile *bookmarks)
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
char *filename;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2016-10-23 18:06:33 +00:00
|
|
|
filename = g_build_filename (g_get_user_config_dir (), "gtk-4.0", "servers", NULL);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
g_bookmark_file_to_file (bookmarks, filename, NULL);
|
|
|
|
g_free (filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
server_list_add_server (GtkPlacesView *view,
|
|
|
|
GFile *file)
|
|
|
|
{
|
|
|
|
GBookmarkFile *bookmarks;
|
|
|
|
GFileInfo *info;
|
|
|
|
GError *error;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *title;
|
|
|
|
char *uri;
|
2020-07-31 16:18:54 +00:00
|
|
|
GDateTime *now;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
error = NULL;
|
|
|
|
bookmarks = server_list_load (view);
|
|
|
|
|
|
|
|
if (!bookmarks)
|
|
|
|
return;
|
|
|
|
|
|
|
|
uri = g_file_get_uri (file);
|
|
|
|
|
|
|
|
info = g_file_query_info (file,
|
|
|
|
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
|
|
|
|
G_FILE_QUERY_INFO_NONE,
|
|
|
|
NULL,
|
|
|
|
&error);
|
|
|
|
title = g_file_info_get_attribute_as_string (info, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
|
|
|
|
|
|
|
|
g_bookmark_file_set_title (bookmarks, uri, title);
|
2020-07-31 16:18:54 +00:00
|
|
|
now = g_date_time_new_now_utc ();
|
|
|
|
g_bookmark_file_set_visited_date_time (bookmarks, uri, now);
|
|
|
|
g_date_time_unref (now);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
g_bookmark_file_add_application (bookmarks, uri, NULL, NULL);
|
|
|
|
|
|
|
|
server_list_save (bookmarks);
|
|
|
|
|
|
|
|
g_bookmark_file_free (bookmarks);
|
|
|
|
g_clear_object (&info);
|
|
|
|
g_free (title);
|
|
|
|
g_free (uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
server_list_remove_server (GtkPlacesView *view,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *uri)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
|
|
|
GBookmarkFile *bookmarks;
|
|
|
|
|
|
|
|
bookmarks = server_list_load (view);
|
|
|
|
|
|
|
|
if (!bookmarks)
|
|
|
|
return;
|
|
|
|
|
|
|
|
g_bookmark_file_remove_item (bookmarks, uri, NULL);
|
|
|
|
server_list_save (bookmarks);
|
|
|
|
|
|
|
|
g_bookmark_file_free (bookmarks);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Returns a toplevel GtkWindow, or NULL if none */
|
|
|
|
static GtkWindow *
|
|
|
|
get_toplevel (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkWidget *toplevel;
|
|
|
|
|
2019-05-20 04:47:50 +00:00
|
|
|
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
|
2019-05-20 03:31:03 +00:00
|
|
|
if (GTK_IS_WINDOW (toplevel))
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
return GTK_WINDOW (toplevel);
|
2019-05-20 03:31:03 +00:00
|
|
|
else
|
|
|
|
return NULL;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_busy_cursor (GtkPlacesView *view,
|
|
|
|
gboolean busy)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWindow *toplevel;
|
|
|
|
|
|
|
|
toplevel = get_toplevel (GTK_WIDGET (view));
|
|
|
|
widget = GTK_WIDGET (toplevel);
|
|
|
|
if (!toplevel || !gtk_widget_get_realized (widget))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (busy)
|
2017-11-04 00:37:03 +00:00
|
|
|
gtk_widget_set_cursor_from_name (widget, "progress");
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
else
|
2017-11-04 00:37:03 +00:00
|
|
|
gtk_widget_set_cursor (widget, NULL);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Activates the given row, with the given flags as parameter */
|
|
|
|
static void
|
|
|
|
activate_row (GtkPlacesView *view,
|
|
|
|
GtkPlacesViewRow *row,
|
|
|
|
GtkPlacesOpenFlags flags)
|
|
|
|
{
|
|
|
|
GVolume *volume;
|
|
|
|
GMount *mount;
|
2015-07-27 19:52:37 +00:00
|
|
|
GFile *file;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
mount = gtk_places_view_row_get_mount (row);
|
|
|
|
volume = gtk_places_view_row_get_volume (row);
|
2015-07-27 19:52:37 +00:00
|
|
|
file = gtk_places_view_row_get_file (row);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2015-07-27 19:52:37 +00:00
|
|
|
if (file)
|
|
|
|
{
|
|
|
|
emit_open_location (view, file, flags);
|
|
|
|
}
|
|
|
|
else if (mount)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2015-08-10 13:42:43 +00:00
|
|
|
GFile *location = g_mount_get_default_location (mount);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2015-07-27 19:52:37 +00:00
|
|
|
emit_open_location (view, location, flags);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
g_object_unref (location);
|
|
|
|
}
|
|
|
|
else if (volume && g_volume_can_mount (volume))
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* When the row is activated, the unmounted volume shall
|
|
|
|
* be mounted and opened right after.
|
|
|
|
*/
|
2020-05-05 00:42:09 +00:00
|
|
|
view->should_open_location = TRUE;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
gtk_places_view_row_set_busy (row, TRUE);
|
|
|
|
mount_volume (view, volume);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-21 01:19:58 +00:00
|
|
|
static void update_places (GtkPlacesView *view);
|
|
|
|
|
2016-09-05 11:19:29 +00:00
|
|
|
static void
|
|
|
|
gtk_places_view_finalize (GObject *object)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = (GtkPlacesView *)object;
|
2016-09-05 11:19:29 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->entry_pulse_timeout_id > 0)
|
|
|
|
g_source_remove (view->entry_pulse_timeout_id);
|
2016-09-05 11:19:29 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
g_clear_pointer (&view->search_query, g_free);
|
|
|
|
g_clear_object (&view->server_list_file);
|
|
|
|
g_clear_object (&view->server_list_monitor);
|
|
|
|
g_clear_object (&view->volume_monitor);
|
|
|
|
g_clear_object (&view->network_monitor);
|
|
|
|
g_clear_object (&view->cancellable);
|
|
|
|
g_clear_object (&view->networks_fetching_cancellable);
|
|
|
|
g_clear_object (&view->path_size_group);
|
|
|
|
g_clear_object (&view->space_size_group);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (gtk_places_view_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
static void
|
|
|
|
gtk_places_view_dispose (GObject *object)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = (GtkPlacesView *)object;
|
2019-12-27 01:10:34 +00:00
|
|
|
|
2020-05-05 20:51:43 +00:00
|
|
|
view->destroyed = 1;
|
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (view->volume_monitor, update_places, object);
|
|
|
|
|
|
|
|
if (view->network_monitor)
|
|
|
|
g_signal_handlers_disconnect_by_func (view->network_monitor, update_places, object);
|
|
|
|
|
|
|
|
if (view->server_list_monitor)
|
|
|
|
g_signal_handlers_disconnect_by_func (view->server_list_monitor, server_file_changed_cb, object);
|
|
|
|
|
|
|
|
g_cancellable_cancel (view->cancellable);
|
|
|
|
g_cancellable_cancel (view->networks_fetching_cancellable);
|
2020-05-05 00:42:09 +00:00
|
|
|
g_clear_pointer (&view->popup_menu, gtk_widget_unparent);
|
2019-12-27 01:10:34 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (gtk_places_view_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
static void
|
|
|
|
gtk_places_view_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkPlacesView *self = GTK_PLACES_VIEW (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
2015-08-19 12:46:34 +00:00
|
|
|
case PROP_LOADING:
|
|
|
|
g_value_set_boolean (value, gtk_places_view_get_loading (self));
|
|
|
|
break;
|
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
case PROP_OPEN_FLAGS:
|
|
|
|
g_value_set_flags (value, gtk_places_view_get_open_flags (self));
|
|
|
|
break;
|
|
|
|
|
2015-08-29 18:36:48 +00:00
|
|
|
case PROP_FETCHING_NETWORKS:
|
|
|
|
g_value_set_boolean (value, gtk_places_view_get_fetching_networks (self));
|
|
|
|
break;
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_places_view_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkPlacesView *self = GTK_PLACES_VIEW (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
2019-12-27 01:10:34 +00:00
|
|
|
case PROP_OPEN_FLAGS:
|
|
|
|
gtk_places_view_set_open_flags (self, g_value_get_flags (value));
|
|
|
|
break;
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2015-10-14 19:48:06 +00:00
|
|
|
is_external_volume (GVolume *volume)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2015-10-14 19:48:06 +00:00
|
|
|
gboolean is_external;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
GDrive *drive;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *id;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
drive = g_volume_get_drive (volume);
|
|
|
|
id = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_CLASS);
|
|
|
|
|
2015-10-14 19:48:06 +00:00
|
|
|
is_external = g_volume_can_eject (volume);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
/* NULL volume identifier only happens on removable devices */
|
2015-10-14 19:48:06 +00:00
|
|
|
is_external |= !id;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
if (drive)
|
2016-05-02 10:55:56 +00:00
|
|
|
is_external |= g_drive_is_removable (drive);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
g_clear_object (&drive);
|
|
|
|
g_free (id);
|
|
|
|
|
2015-10-14 19:48:06 +00:00
|
|
|
return is_external;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
char *uri;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
GtkPlacesView *view;
|
|
|
|
} RemoveServerData;
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_remove_server_button_clicked (RemoveServerData *data)
|
|
|
|
{
|
|
|
|
server_list_remove_server (data->view, data->uri);
|
|
|
|
|
|
|
|
populate_servers (data->view);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
populate_servers (GtkPlacesView *view)
|
|
|
|
{
|
|
|
|
GBookmarkFile *server_list;
|
2020-05-09 14:33:02 +00:00
|
|
|
GtkWidget *child;
|
2020-07-24 18:40:36 +00:00
|
|
|
char **uris;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
gsize num_uris;
|
2020-07-24 13:54:49 +00:00
|
|
|
int i;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
server_list = server_list_load (view);
|
|
|
|
|
|
|
|
if (!server_list)
|
|
|
|
return;
|
|
|
|
|
|
|
|
uris = g_bookmark_file_get_uris (server_list, &num_uris);
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_stack_set_visible_child_name (GTK_STACK (view->recent_servers_stack),
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
num_uris > 0 ? "list" : "empty");
|
|
|
|
|
|
|
|
if (!uris)
|
|
|
|
{
|
|
|
|
g_bookmark_file_free (server_list);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear previous items */
|
2020-05-08 06:19:18 +00:00
|
|
|
while ((child = gtk_widget_get_first_child (GTK_WIDGET (view->recent_servers_listbox))))
|
2021-04-16 23:17:37 +00:00
|
|
|
gtk_list_box_remove (GTK_LIST_BOX (view->recent_servers_listbox), child);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_list_store_clear (view->completion_store);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
for (i = 0; i < num_uris; i++)
|
|
|
|
{
|
|
|
|
RemoveServerData *data;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkWidget *row;
|
|
|
|
GtkWidget *grid;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *label;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *name;
|
|
|
|
char *dup_uri;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
name = g_bookmark_file_get_title (server_list, uris[i], NULL);
|
|
|
|
dup_uri = g_strdup (uris[i]);
|
|
|
|
|
|
|
|
/* add to the completion list */
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_list_store_append (view->completion_store, &iter);
|
|
|
|
gtk_list_store_set (view->completion_store,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
&iter,
|
|
|
|
0, name,
|
|
|
|
1, uris[i],
|
|
|
|
-1);
|
|
|
|
|
|
|
|
/* add to the recent servers listbox */
|
|
|
|
row = gtk_list_box_row_new ();
|
|
|
|
|
|
|
|
grid = g_object_new (GTK_TYPE_GRID,
|
|
|
|
"orientation", GTK_ORIENTATION_VERTICAL,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* name of the connected uri, if any */
|
|
|
|
label = gtk_label_new (name);
|
|
|
|
gtk_widget_set_hexpand (label, TRUE);
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
|
2020-05-07 18:23:36 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
/* the uri itself */
|
|
|
|
label = gtk_label_new (uris[i]);
|
|
|
|
gtk_widget_set_hexpand (label, TRUE);
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
|
2020-02-06 16:32:26 +00:00
|
|
|
gtk_widget_add_css_class (label, "dim-label");
|
2020-05-07 18:23:36 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
/* remove button */
|
2017-11-15 00:43:13 +00:00
|
|
|
button = gtk_button_new_from_icon_name ("window-close-symbolic");
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
gtk_widget_set_halign (button, GTK_ALIGN_END);
|
|
|
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
2020-04-17 04:20:09 +00:00
|
|
|
gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
|
2020-02-06 16:32:26 +00:00
|
|
|
gtk_widget_add_css_class (button, "sidebar-button");
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 2);
|
|
|
|
|
2020-05-07 18:23:36 +00:00
|
|
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), grid);
|
2020-05-08 06:19:18 +00:00
|
|
|
gtk_list_box_insert (GTK_LIST_BOX (view->recent_servers_listbox), row, -1);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
/* custom data */
|
|
|
|
data = g_new0 (RemoveServerData, 1);
|
|
|
|
data->view = view;
|
|
|
|
data->uri = dup_uri;
|
|
|
|
|
|
|
|
g_object_set_data_full (G_OBJECT (row), "uri", dup_uri, g_free);
|
|
|
|
g_object_set_data_full (G_OBJECT (row), "remove-server-data", data, g_free);
|
|
|
|
|
|
|
|
g_signal_connect_swapped (button,
|
|
|
|
"clicked",
|
|
|
|
G_CALLBACK (on_remove_server_button_clicked),
|
|
|
|
data);
|
|
|
|
|
|
|
|
g_free (name);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev (uris);
|
|
|
|
g_bookmark_file_free (server_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_view_mode (GtkPlacesView *view)
|
|
|
|
{
|
2020-05-08 06:19:18 +00:00
|
|
|
GtkWidget *child;
|
2015-07-28 14:46:25 +00:00
|
|
|
gboolean show_listbox;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2015-07-28 14:46:25 +00:00
|
|
|
show_listbox = FALSE;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
/* drives */
|
2020-05-08 06:19:18 +00:00
|
|
|
for (child = gtk_widget_get_first_child (GTK_WIDGET (view->listbox));
|
|
|
|
child != NULL;
|
|
|
|
child = gtk_widget_get_next_sibling (child))
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
|
|
|
/* GtkListBox filter rows by changing their GtkWidget::child-visible property */
|
2020-05-08 06:19:18 +00:00
|
|
|
if (gtk_widget_get_child_visible (child))
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2015-07-28 14:46:25 +00:00
|
|
|
show_listbox = TRUE;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-28 14:46:25 +00:00
|
|
|
if (!show_listbox &&
|
2020-05-05 00:42:09 +00:00
|
|
|
view->search_query &&
|
|
|
|
view->search_query[0] != '\0')
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_stack_set_visible_child_name (GTK_STACK (view->stack), "empty-search");
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_stack_set_visible_child_name (GTK_STACK (view->stack), "browse");
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
insert_row (GtkPlacesView *view,
|
|
|
|
GtkWidget *row,
|
|
|
|
gboolean is_network)
|
|
|
|
{
|
2020-03-19 04:52:05 +00:00
|
|
|
GtkEventController *controller;
|
|
|
|
GtkShortcutTrigger *trigger;
|
|
|
|
GtkShortcutAction *action;
|
|
|
|
GtkShortcut *shortcut;
|
|
|
|
GtkGesture *gesture;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2015-07-28 14:46:25 +00:00
|
|
|
g_object_set_data (G_OBJECT (row), "is-network", GINT_TO_POINTER (is_network));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-03-19 04:52:05 +00:00
|
|
|
controller = gtk_shortcut_controller_new ();
|
|
|
|
trigger = gtk_alternative_trigger_new (gtk_keyval_trigger_new (GDK_KEY_F10, GDK_SHIFT_MASK),
|
|
|
|
gtk_keyval_trigger_new (GDK_KEY_Menu, 0));
|
|
|
|
action = gtk_callback_action_new (on_row_popup_menu, row, NULL);
|
|
|
|
shortcut = gtk_shortcut_new (trigger, action);
|
|
|
|
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller), shortcut);
|
|
|
|
gtk_widget_add_controller (GTK_WIDGET (row), controller);
|
|
|
|
|
|
|
|
gesture = gtk_gesture_click_new ();
|
|
|
|
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
|
|
|
g_signal_connect (gesture, "pressed", G_CALLBACK (click_cb), row);
|
|
|
|
gtk_widget_add_controller (row, GTK_EVENT_CONTROLLER (gesture));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
g_signal_connect (gtk_places_view_row_get_eject_button (GTK_PLACES_VIEW_ROW (row)),
|
|
|
|
"clicked",
|
|
|
|
G_CALLBACK (on_eject_button_clicked),
|
|
|
|
row);
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_places_view_row_set_path_size_group (GTK_PLACES_VIEW_ROW (row), view->path_size_group);
|
|
|
|
gtk_places_view_row_set_space_size_group (GTK_PLACES_VIEW_ROW (row), view->space_size_group);
|
2015-10-29 12:14:57 +00:00
|
|
|
|
2020-05-08 06:19:18 +00:00
|
|
|
gtk_list_box_insert (GTK_LIST_BOX (view->listbox), row, -1);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_volume (GtkPlacesView *view,
|
|
|
|
GVolume *volume)
|
|
|
|
{
|
|
|
|
gboolean is_network;
|
|
|
|
GMount *mount;
|
|
|
|
GFile *root;
|
|
|
|
GIcon *icon;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *identifier;
|
|
|
|
char *name;
|
|
|
|
char *path;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2015-10-14 19:48:06 +00:00
|
|
|
if (is_external_volume (volume))
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
identifier = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_CLASS);
|
|
|
|
is_network = g_strcmp0 (identifier, "network") == 0;
|
|
|
|
|
|
|
|
mount = g_volume_get_mount (volume);
|
2015-08-10 13:42:43 +00:00
|
|
|
root = mount ? g_mount_get_default_location (mount) : NULL;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
icon = g_volume_get_icon (volume);
|
|
|
|
name = g_volume_get_name (volume);
|
2015-07-27 19:51:23 +00:00
|
|
|
path = !is_network ? g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) : NULL;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2016-03-20 04:18:38 +00:00
|
|
|
if (!mount || !g_mount_is_shadowed (mount))
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
|
|
|
GtkWidget *row;
|
|
|
|
|
|
|
|
row = g_object_new (GTK_TYPE_PLACES_VIEW_ROW,
|
|
|
|
"icon", icon,
|
|
|
|
"name", name,
|
|
|
|
"path", path ? path : "",
|
|
|
|
"volume", volume,
|
|
|
|
"mount", mount,
|
2015-07-27 19:52:37 +00:00
|
|
|
"file", NULL,
|
2015-08-10 18:35:56 +00:00
|
|
|
"is-network", is_network,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
insert_row (view, row, is_network);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_clear_object (&root);
|
|
|
|
g_clear_object (&icon);
|
|
|
|
g_clear_object (&mount);
|
|
|
|
g_free (identifier);
|
|
|
|
g_free (name);
|
|
|
|
g_free (path);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_mount (GtkPlacesView *view,
|
|
|
|
GMount *mount)
|
|
|
|
{
|
|
|
|
gboolean is_network;
|
|
|
|
GFile *root;
|
|
|
|
GIcon *icon;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *name;
|
|
|
|
char *path;
|
|
|
|
char *uri;
|
|
|
|
char *schema;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
icon = g_mount_get_icon (mount);
|
|
|
|
name = g_mount_get_name (mount);
|
2015-08-10 13:42:43 +00:00
|
|
|
root = g_mount_get_default_location (mount);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
path = root ? g_file_get_parse_name (root) : NULL;
|
|
|
|
uri = g_file_get_uri (root);
|
|
|
|
schema = g_uri_parse_scheme (uri);
|
|
|
|
is_network = g_strcmp0 (schema, "file") != 0;
|
|
|
|
|
2015-08-10 17:46:23 +00:00
|
|
|
if (is_network)
|
|
|
|
g_clear_pointer (&path, g_free);
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
if (!g_mount_is_shadowed (mount))
|
|
|
|
{
|
|
|
|
GtkWidget *row;
|
|
|
|
|
|
|
|
row = g_object_new (GTK_TYPE_PLACES_VIEW_ROW,
|
|
|
|
"icon", icon,
|
|
|
|
"name", name,
|
|
|
|
"path", path ? path : "",
|
|
|
|
"volume", NULL,
|
|
|
|
"mount", mount,
|
2015-07-27 19:52:37 +00:00
|
|
|
"file", NULL,
|
2015-08-10 18:35:56 +00:00
|
|
|
"is-network", is_network,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
insert_row (view, row, is_network);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_clear_object (&root);
|
|
|
|
g_clear_object (&icon);
|
|
|
|
g_free (name);
|
|
|
|
g_free (path);
|
|
|
|
g_free (uri);
|
|
|
|
g_free (schema);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_drive (GtkPlacesView *view,
|
|
|
|
GDrive *drive)
|
|
|
|
{
|
|
|
|
GList *volumes;
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
volumes = g_drive_get_volumes (drive);
|
|
|
|
|
|
|
|
for (l = volumes; l != NULL; l = l->next)
|
|
|
|
add_volume (view, l->data);
|
|
|
|
|
|
|
|
g_list_free_full (volumes, g_object_unref);
|
|
|
|
}
|
|
|
|
|
2015-07-27 19:52:37 +00:00
|
|
|
static void
|
2015-08-18 15:58:41 +00:00
|
|
|
add_file (GtkPlacesView *view,
|
|
|
|
GFile *file,
|
|
|
|
GIcon *icon,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *display_name,
|
|
|
|
const char *path,
|
2015-08-18 15:58:41 +00:00
|
|
|
gboolean is_network)
|
2015-07-27 19:52:37 +00:00
|
|
|
{
|
|
|
|
GtkWidget *row;
|
|
|
|
row = g_object_new (GTK_TYPE_PLACES_VIEW_ROW,
|
|
|
|
"icon", icon,
|
2015-08-18 15:58:41 +00:00
|
|
|
"name", display_name,
|
|
|
|
"path", path,
|
2015-07-27 19:52:37 +00:00
|
|
|
"volume", NULL,
|
|
|
|
"mount", NULL,
|
|
|
|
"file", file,
|
2015-08-18 15:58:41 +00:00
|
|
|
"is_network", is_network,
|
2015-07-27 19:52:37 +00:00
|
|
|
NULL);
|
|
|
|
|
2015-08-18 15:58:41 +00:00
|
|
|
insert_row (view, row, is_network);
|
|
|
|
}
|
|
|
|
|
2015-08-18 21:26:07 +00:00
|
|
|
static gboolean
|
|
|
|
has_networks (GtkPlacesView *view)
|
|
|
|
{
|
2020-05-08 06:19:18 +00:00
|
|
|
GtkWidget *child;
|
2015-08-18 21:26:07 +00:00
|
|
|
gboolean has_network = FALSE;
|
|
|
|
|
2020-05-08 06:19:18 +00:00
|
|
|
for (child = gtk_widget_get_first_child (GTK_WIDGET (view->listbox));
|
|
|
|
child != NULL;
|
|
|
|
child = gtk_widget_get_next_sibling (child))
|
2015-08-18 21:26:07 +00:00
|
|
|
{
|
2020-05-08 06:19:18 +00:00
|
|
|
if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "is-network")) &&
|
|
|
|
g_object_get_data (G_OBJECT (child), "is-placeholder") == NULL)
|
2015-08-18 21:26:07 +00:00
|
|
|
{
|
|
|
|
has_network = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return has_network;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_network_state (GtkPlacesView *view)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->network_placeholder == NULL)
|
2015-08-18 21:26:07 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
view->network_placeholder = gtk_list_box_row_new ();
|
|
|
|
view->network_placeholder_label = gtk_label_new ("");
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (view->network_placeholder_label), 0.0);
|
|
|
|
gtk_widget_set_margin_start (view->network_placeholder_label, 12);
|
|
|
|
gtk_widget_set_margin_end (view->network_placeholder_label, 12);
|
|
|
|
gtk_widget_set_margin_top (view->network_placeholder_label, 6);
|
|
|
|
gtk_widget_set_margin_bottom (view->network_placeholder_label, 6);
|
|
|
|
gtk_widget_set_hexpand (view->network_placeholder_label, TRUE);
|
|
|
|
gtk_widget_set_sensitive (view->network_placeholder, FALSE);
|
2020-05-06 17:10:16 +00:00
|
|
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (view->network_placeholder),
|
|
|
|
view->network_placeholder_label);
|
2020-05-05 00:42:09 +00:00
|
|
|
g_object_set_data (G_OBJECT (view->network_placeholder),
|
2015-08-18 21:26:07 +00:00
|
|
|
"is-network", GINT_TO_POINTER (TRUE));
|
|
|
|
/* mark the row as placeholder, so it always goes first */
|
2020-05-05 00:42:09 +00:00
|
|
|
g_object_set_data (G_OBJECT (view->network_placeholder),
|
2015-08-18 21:26:07 +00:00
|
|
|
"is-placeholder", GINT_TO_POINTER (TRUE));
|
2020-05-08 06:19:18 +00:00
|
|
|
gtk_list_box_insert (GTK_LIST_BOX (view->listbox), view->network_placeholder, -1);
|
2015-08-18 21:26:07 +00:00
|
|
|
}
|
|
|
|
|
2015-08-29 18:36:48 +00:00
|
|
|
if (gtk_places_view_get_fetching_networks (view))
|
2015-08-18 21:26:07 +00:00
|
|
|
{
|
|
|
|
/* only show a placeholder with a message if the list is empty.
|
|
|
|
* otherwise just show the spinner in the header */
|
|
|
|
if (!has_networks (view))
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_widget_show (view->network_placeholder);
|
|
|
|
gtk_label_set_text (GTK_LABEL (view->network_placeholder_label),
|
2015-08-18 21:26:07 +00:00
|
|
|
_("Searching for network locations"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!has_networks (view))
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_widget_show (view->network_placeholder);
|
|
|
|
gtk_label_set_text (GTK_LABEL (view->network_placeholder_label),
|
2015-08-25 15:11:17 +00:00
|
|
|
_("No network locations found"));
|
2015-08-18 21:26:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_widget_hide (view->network_placeholder);
|
2015-08-18 21:26:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-10 21:59:33 +00:00
|
|
|
static void
|
2020-05-05 00:42:09 +00:00
|
|
|
monitor_network (GtkPlacesView *view)
|
2017-04-10 21:59:33 +00:00
|
|
|
{
|
|
|
|
GFile *network_file;
|
|
|
|
GError *error;
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->network_monitor)
|
2017-04-10 21:59:33 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
error = NULL;
|
|
|
|
network_file = g_file_new_for_uri ("network:///");
|
2020-05-05 00:42:09 +00:00
|
|
|
view->network_monitor = g_file_monitor (network_file,
|
2017-04-10 21:59:33 +00:00
|
|
|
G_FILE_MONITOR_NONE,
|
|
|
|
NULL,
|
|
|
|
&error);
|
|
|
|
|
|
|
|
g_clear_object (&network_file);
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
g_warning ("Error monitoring network: %s", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
g_signal_connect_swapped (view->network_monitor,
|
2017-04-10 21:59:33 +00:00
|
|
|
"changed",
|
|
|
|
G_CALLBACK (update_places),
|
2020-05-05 00:42:09 +00:00
|
|
|
view);
|
2017-04-10 21:59:33 +00:00
|
|
|
}
|
|
|
|
|
2015-08-18 15:58:41 +00:00
|
|
|
static void
|
|
|
|
populate_networks (GtkPlacesView *view,
|
|
|
|
GFileEnumerator *enumerator,
|
|
|
|
GList *detected_networks)
|
|
|
|
{
|
|
|
|
GList *l;
|
|
|
|
GFile *file;
|
|
|
|
GFile *activatable_file;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *uri;
|
2015-08-18 15:58:41 +00:00
|
|
|
GFileType type;
|
|
|
|
GIcon *icon;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *display_name;
|
2015-08-18 15:58:41 +00:00
|
|
|
|
|
|
|
for (l = detected_networks; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
file = g_file_enumerator_get_child (enumerator, l->data);
|
|
|
|
type = g_file_info_get_file_type (l->data);
|
|
|
|
if (type == G_FILE_TYPE_SHORTCUT || type == G_FILE_TYPE_MOUNTABLE)
|
|
|
|
uri = g_file_info_get_attribute_as_string (l->data, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI);
|
|
|
|
else
|
|
|
|
uri = g_file_get_uri (file);
|
|
|
|
activatable_file = g_file_new_for_uri (uri);
|
|
|
|
display_name = g_file_info_get_attribute_as_string (l->data, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
|
|
|
|
icon = g_file_info_get_icon (l->data);
|
|
|
|
|
|
|
|
add_file (view, activatable_file, icon, display_name, NULL, TRUE);
|
|
|
|
|
|
|
|
g_free (uri);
|
|
|
|
g_free (display_name);
|
|
|
|
g_clear_object (&file);
|
|
|
|
g_clear_object (&activatable_file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
network_enumeration_next_files_finished (GObject *source_object,
|
|
|
|
GAsyncResult *res,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkPlacesView *view;
|
|
|
|
GList *detected_networks;
|
|
|
|
GError *error;
|
|
|
|
|
|
|
|
view = GTK_PLACES_VIEW (user_data);
|
|
|
|
error = NULL;
|
|
|
|
|
|
|
|
detected_networks = g_file_enumerator_next_files_finish (G_FILE_ENUMERATOR (source_object),
|
|
|
|
res, &error);
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
{
|
2021-02-11 14:14:34 +00:00
|
|
|
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
|
|
|
{
|
|
|
|
g_clear_error (&error);
|
|
|
|
g_object_unref (view);
|
|
|
|
return;
|
|
|
|
}
|
2015-08-18 15:58:41 +00:00
|
|
|
|
2021-02-11 14:14:34 +00:00
|
|
|
g_warning ("Failed to fetch network locations: %s", error->message);
|
2015-08-18 15:58:41 +00:00
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-09-21 23:41:34 +00:00
|
|
|
gtk_places_view_set_fetching_networks (view, FALSE);
|
2015-08-18 15:58:41 +00:00
|
|
|
populate_networks (view, G_FILE_ENUMERATOR (source_object), detected_networks);
|
|
|
|
|
|
|
|
g_list_free_full (detected_networks, g_object_unref);
|
|
|
|
}
|
2015-08-18 21:26:07 +00:00
|
|
|
|
2021-02-11 14:14:34 +00:00
|
|
|
update_network_state (view);
|
|
|
|
monitor_network (view);
|
|
|
|
update_loading (view);
|
2016-09-05 11:41:16 +00:00
|
|
|
|
2021-02-11 14:14:34 +00:00
|
|
|
g_object_unref (view);
|
2015-08-18 15:58:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
network_enumeration_finished (GObject *source_object,
|
|
|
|
GAsyncResult *res,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = GTK_PLACES_VIEW (user_data);
|
2015-08-18 15:58:41 +00:00
|
|
|
GFileEnumerator *enumerator;
|
|
|
|
GError *error;
|
2015-07-28 09:51:14 +00:00
|
|
|
|
2015-08-18 15:58:41 +00:00
|
|
|
error = NULL;
|
|
|
|
enumerator = g_file_enumerate_children_finish (G_FILE (source_object), res, &error);
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
{
|
2015-09-02 05:28:57 +00:00
|
|
|
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
|
|
|
|
!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
|
2015-08-18 15:58:41 +00:00
|
|
|
g_warning ("Failed to fetch network locations: %s", error->message);
|
|
|
|
|
|
|
|
g_clear_error (&error);
|
2020-05-05 00:42:09 +00:00
|
|
|
g_object_unref (view);
|
2015-08-18 15:58:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_file_enumerator_next_files_async (enumerator,
|
|
|
|
G_MAXINT32,
|
|
|
|
G_PRIORITY_DEFAULT,
|
2020-05-05 00:42:09 +00:00
|
|
|
view->networks_fetching_cancellable,
|
2015-08-18 15:58:41 +00:00
|
|
|
network_enumeration_next_files_finished,
|
|
|
|
user_data);
|
2016-11-17 18:50:25 +00:00
|
|
|
g_object_unref (enumerator);
|
2015-08-18 15:58:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
fetch_networks (GtkPlacesView *view)
|
|
|
|
{
|
|
|
|
GFile *network_file;
|
2020-07-24 18:40:36 +00:00
|
|
|
const char * const *supported_uris;
|
2016-05-01 19:00:25 +00:00
|
|
|
gboolean found;
|
2015-08-18 15:58:41 +00:00
|
|
|
|
2016-05-02 14:45:44 +00:00
|
|
|
supported_uris = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
|
2016-05-01 19:00:25 +00:00
|
|
|
|
|
|
|
for (found = FALSE; !found && supported_uris && supported_uris[0]; supported_uris++)
|
|
|
|
if (g_strcmp0 (supported_uris[0], "network") == 0)
|
|
|
|
found = TRUE;
|
|
|
|
|
|
|
|
if (!found)
|
|
|
|
return;
|
|
|
|
|
2015-08-18 15:58:41 +00:00
|
|
|
network_file = g_file_new_for_uri ("network:///");
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
g_cancellable_cancel (view->networks_fetching_cancellable);
|
|
|
|
g_clear_object (&view->networks_fetching_cancellable);
|
|
|
|
view->networks_fetching_cancellable = g_cancellable_new ();
|
2015-08-29 18:36:48 +00:00
|
|
|
gtk_places_view_set_fetching_networks (view, TRUE);
|
2015-08-29 18:35:10 +00:00
|
|
|
update_network_state (view);
|
2015-08-18 15:58:41 +00:00
|
|
|
|
2016-09-05 11:41:16 +00:00
|
|
|
g_object_ref (view);
|
2015-08-18 15:58:41 +00:00
|
|
|
g_file_enumerate_children_async (network_file,
|
|
|
|
"standard::type,standard::target-uri,standard::name,standard::display-name,standard::icon",
|
|
|
|
G_FILE_QUERY_INFO_NONE,
|
|
|
|
G_PRIORITY_DEFAULT,
|
2020-05-05 00:42:09 +00:00
|
|
|
view->networks_fetching_cancellable,
|
2015-08-18 15:58:41 +00:00
|
|
|
network_enumeration_finished,
|
|
|
|
view);
|
|
|
|
|
|
|
|
g_clear_object (&network_file);
|
2015-07-27 19:52:37 +00:00
|
|
|
}
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
static void
|
|
|
|
update_places (GtkPlacesView *view)
|
|
|
|
{
|
|
|
|
GList *mounts;
|
|
|
|
GList *volumes;
|
|
|
|
GList *drives;
|
|
|
|
GList *l;
|
2015-08-18 15:58:41 +00:00
|
|
|
GIcon *icon;
|
|
|
|
GFile *file;
|
2020-05-09 14:33:02 +00:00
|
|
|
GtkWidget *child;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
/* Clear all previously added items */
|
2020-05-08 06:19:18 +00:00
|
|
|
while ((child = gtk_widget_get_first_child (GTK_WIDGET (view->listbox))))
|
|
|
|
gtk_list_box_remove (GTK_LIST_BOX (view->listbox), child);
|
2020-05-09 14:33:02 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->network_placeholder = NULL;
|
2015-08-29 20:57:15 +00:00
|
|
|
/* Inform clients that we started loading */
|
|
|
|
gtk_places_view_set_loading (view, TRUE);
|
2015-08-19 12:46:34 +00:00
|
|
|
|
2015-07-27 19:52:37 +00:00
|
|
|
/* Add "Computer" row */
|
2015-08-18 15:58:41 +00:00
|
|
|
file = g_file_new_for_path ("/");
|
|
|
|
icon = g_themed_icon_new_with_default_fallbacks ("drive-harddisk");
|
|
|
|
|
|
|
|
add_file (view, file, icon, _("Computer"), "/", FALSE);
|
|
|
|
|
|
|
|
g_clear_object (&file);
|
|
|
|
g_clear_object (&icon);
|
2015-07-27 19:52:37 +00:00
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
/* Add currently connected drives */
|
2020-05-05 00:42:09 +00:00
|
|
|
drives = g_volume_monitor_get_connected_drives (view->volume_monitor);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
for (l = drives; l != NULL; l = l->next)
|
|
|
|
add_drive (view, l->data);
|
|
|
|
|
|
|
|
g_list_free_full (drives, g_object_unref);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Since all volumes with an associated GDrive were already added with
|
|
|
|
* add_drive before, add all volumes that aren't associated with a
|
|
|
|
* drive.
|
|
|
|
*/
|
2020-05-05 00:42:09 +00:00
|
|
|
volumes = g_volume_monitor_get_volumes (view->volume_monitor);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
for (l = volumes; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
GVolume *volume;
|
|
|
|
GDrive *drive;
|
|
|
|
|
|
|
|
volume = l->data;
|
|
|
|
drive = g_volume_get_drive (volume);
|
|
|
|
|
|
|
|
if (drive)
|
|
|
|
{
|
|
|
|
g_object_unref (drive);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
add_volume (view, volume);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free_full (volumes, g_object_unref);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now that all necessary drives and volumes were already added, add mounts
|
|
|
|
* that have no volume, such as /etc/mtab mounts, ftp, sftp, etc.
|
|
|
|
*/
|
2020-05-05 00:42:09 +00:00
|
|
|
mounts = g_volume_monitor_get_mounts (view->volume_monitor);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
for (l = mounts; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
GMount *mount;
|
|
|
|
GVolume *volume;
|
|
|
|
|
|
|
|
mount = l->data;
|
|
|
|
volume = g_mount_get_volume (mount);
|
|
|
|
|
|
|
|
if (volume)
|
|
|
|
{
|
|
|
|
g_object_unref (volume);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
add_mount (view, mount);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free_full (mounts, g_object_unref);
|
|
|
|
|
|
|
|
/* load saved servers */
|
|
|
|
populate_servers (view);
|
|
|
|
|
2015-08-18 15:58:41 +00:00
|
|
|
/* fetch networks and add them asynchronously */
|
2017-09-12 13:32:36 +00:00
|
|
|
fetch_networks (view);
|
2015-08-18 15:58:41 +00:00
|
|
|
|
2015-07-28 14:46:25 +00:00
|
|
|
update_view_mode (view);
|
2015-08-29 20:57:15 +00:00
|
|
|
/* Check whether we still are in a loading state */
|
|
|
|
update_loading (view);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
server_mount_ready_cb (GObject *source_file,
|
|
|
|
GAsyncResult *res,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = GTK_PLACES_VIEW (user_data);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
gboolean should_show;
|
|
|
|
GError *error;
|
|
|
|
GFile *location;
|
|
|
|
|
|
|
|
location = G_FILE (source_file);
|
|
|
|
should_show = TRUE;
|
|
|
|
error = NULL;
|
|
|
|
|
|
|
|
g_file_mount_enclosing_volume_finish (location, res, &error);
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
should_show = FALSE;
|
|
|
|
|
|
|
|
if (error->code == G_IO_ERROR_ALREADY_MOUNTED)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Already mounted volume is not a critical error
|
|
|
|
* and we can still continue with the operation.
|
|
|
|
*/
|
|
|
|
should_show = TRUE;
|
|
|
|
}
|
|
|
|
else if (error->domain != G_IO_ERROR ||
|
|
|
|
(error->code != G_IO_ERROR_CANCELLED &&
|
|
|
|
error->code != G_IO_ERROR_FAILED_HANDLED))
|
|
|
|
{
|
|
|
|
/* if it wasn't cancelled show a dialog */
|
|
|
|
emit_show_error_message (view, _("Unable to access location"), error->message);
|
|
|
|
}
|
2016-09-04 13:28:11 +00:00
|
|
|
|
|
|
|
/* The operation got cancelled by the user and or the error
|
|
|
|
has been handled already. */
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->destroyed) {
|
2016-09-05 11:19:29 +00:00
|
|
|
g_object_unref (view);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->should_pulse_entry = FALSE;
|
2015-08-21 17:57:07 +00:00
|
|
|
|
|
|
|
/* Restore from Cancel to Connect */
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (view->connect_button), _("Con_nect"));
|
|
|
|
gtk_widget_set_sensitive (view->address_entry, TRUE);
|
|
|
|
view->connecting_to_server = FALSE;
|
2015-08-21 17:57:07 +00:00
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
if (should_show)
|
|
|
|
{
|
|
|
|
server_list_add_server (view, location);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Only clear the entry if it successfully connects to the server.
|
|
|
|
* Otherwise, the user would lost the typed address even if it fails
|
|
|
|
* to connect.
|
|
|
|
*/
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_editable_set_text (GTK_EDITABLE (view->address_entry), "");
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->should_open_location)
|
2019-12-19 15:49:07 +00:00
|
|
|
{
|
|
|
|
GMount *mount;
|
|
|
|
GFile *root;
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
mount = g_file_find_enclosing_mount (location, view->cancellable, NULL);
|
2019-12-19 15:49:07 +00:00
|
|
|
if (mount)
|
|
|
|
{
|
|
|
|
root = g_mount_get_default_location (mount);
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
emit_open_location (view, root, view->open_flags);
|
2019-12-19 15:49:07 +00:00
|
|
|
|
|
|
|
g_object_unref (root);
|
|
|
|
g_object_unref (mount);
|
|
|
|
}
|
|
|
|
}
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
update_places (view);
|
2016-09-04 09:47:55 +00:00
|
|
|
g_object_unref (view);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
volume_mount_ready_cb (GObject *source_volume,
|
|
|
|
GAsyncResult *res,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = GTK_PLACES_VIEW (user_data);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
gboolean should_show;
|
|
|
|
GVolume *volume;
|
|
|
|
GError *error;
|
|
|
|
|
|
|
|
volume = G_VOLUME (source_volume);
|
|
|
|
should_show = TRUE;
|
|
|
|
error = NULL;
|
|
|
|
|
|
|
|
g_volume_mount_finish (volume, res, &error);
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
should_show = FALSE;
|
|
|
|
|
|
|
|
if (error->code == G_IO_ERROR_ALREADY_MOUNTED)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* If the volume was already mounted, it's not a hard error
|
|
|
|
* and we can still continue with the operation.
|
|
|
|
*/
|
|
|
|
should_show = TRUE;
|
|
|
|
}
|
|
|
|
else if (error->domain != G_IO_ERROR ||
|
|
|
|
(error->code != G_IO_ERROR_CANCELLED &&
|
|
|
|
error->code != G_IO_ERROR_FAILED_HANDLED))
|
|
|
|
{
|
|
|
|
/* if it wasn't cancelled show a dialog */
|
|
|
|
emit_show_error_message (GTK_PLACES_VIEW (user_data), _("Unable to access location"), error->message);
|
|
|
|
should_show = FALSE;
|
|
|
|
}
|
|
|
|
|
2016-09-04 13:28:11 +00:00
|
|
|
/* The operation got cancelled by the user and or the error
|
|
|
|
has been handled already. */
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->destroyed)
|
2016-09-05 11:19:29 +00:00
|
|
|
{
|
|
|
|
g_object_unref(view);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->mounting_volume = FALSE;
|
2015-08-29 20:57:15 +00:00
|
|
|
update_loading (view);
|
2015-08-21 17:57:07 +00:00
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
if (should_show)
|
|
|
|
{
|
|
|
|
GMount *mount;
|
|
|
|
GFile *root;
|
|
|
|
|
|
|
|
mount = g_volume_get_mount (volume);
|
2015-08-10 13:42:43 +00:00
|
|
|
root = g_mount_get_default_location (mount);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->should_open_location)
|
|
|
|
emit_open_location (GTK_PLACES_VIEW (user_data), root, view->open_flags);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
g_object_unref (mount);
|
|
|
|
g_object_unref (root);
|
|
|
|
}
|
|
|
|
|
|
|
|
update_places (view);
|
2016-09-04 09:47:55 +00:00
|
|
|
g_object_unref (view);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
unmount_ready_cb (GObject *source_mount,
|
|
|
|
GAsyncResult *res,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkPlacesView *view;
|
|
|
|
GMount *mount;
|
|
|
|
GError *error;
|
|
|
|
|
|
|
|
view = GTK_PLACES_VIEW (user_data);
|
|
|
|
mount = G_MOUNT (source_mount);
|
|
|
|
error = NULL;
|
|
|
|
|
|
|
|
g_mount_unmount_with_operation_finish (mount, res, &error);
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
if (error->domain != G_IO_ERROR ||
|
|
|
|
(error->code != G_IO_ERROR_CANCELLED &&
|
|
|
|
error->code != G_IO_ERROR_FAILED_HANDLED))
|
|
|
|
{
|
|
|
|
/* if it wasn't cancelled show a dialog */
|
|
|
|
emit_show_error_message (view, _("Unable to unmount volume"), error->message);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
2016-09-04 09:47:55 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->destroyed) {
|
2016-09-05 11:19:29 +00:00
|
|
|
g_object_unref (view);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->unmounting_mount = FALSE;
|
2016-09-05 11:19:29 +00:00
|
|
|
update_loading (view);
|
|
|
|
|
2016-09-04 09:47:55 +00:00
|
|
|
g_object_unref (view);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
pulse_entry_cb (gpointer user_data)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = GTK_PLACES_VIEW (user_data);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->destroyed)
|
2016-09-05 11:19:29 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
view->entry_pulse_timeout_id = 0;
|
2016-09-05 11:19:29 +00:00
|
|
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
}
|
2020-05-05 00:42:09 +00:00
|
|
|
else if (view->should_pulse_entry)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_entry_progress_pulse (GTK_ENTRY (view->address_entry));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
return G_SOURCE_CONTINUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_entry_set_progress_pulse_step (GTK_ENTRY (view->address_entry), 0.0);
|
|
|
|
gtk_entry_set_progress_fraction (GTK_ENTRY (view->address_entry), 0.0);
|
|
|
|
view->entry_pulse_timeout_id = 0;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
unmount_mount (GtkPlacesView *view,
|
|
|
|
GMount *mount)
|
|
|
|
{
|
|
|
|
GMountOperation *operation;
|
|
|
|
GtkWidget *toplevel;
|
|
|
|
|
2019-05-20 04:47:50 +00:00
|
|
|
toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (view)));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
g_cancellable_cancel (view->cancellable);
|
|
|
|
g_clear_object (&view->cancellable);
|
|
|
|
view->cancellable = g_cancellable_new ();
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->unmounting_mount = TRUE;
|
2015-08-29 20:57:15 +00:00
|
|
|
update_loading (view);
|
|
|
|
|
2016-09-04 09:47:55 +00:00
|
|
|
g_object_ref (view);
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
operation = gtk_mount_operation_new (GTK_WINDOW (toplevel));
|
|
|
|
g_mount_unmount_with_operation (mount,
|
|
|
|
0,
|
|
|
|
operation,
|
2020-05-05 00:42:09 +00:00
|
|
|
view->cancellable,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
unmount_ready_cb,
|
|
|
|
view);
|
|
|
|
g_object_unref (operation);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
mount_server (GtkPlacesView *view,
|
|
|
|
GFile *location)
|
|
|
|
{
|
|
|
|
GMountOperation *operation;
|
|
|
|
GtkWidget *toplevel;
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
g_cancellable_cancel (view->cancellable);
|
|
|
|
g_clear_object (&view->cancellable);
|
2015-08-17 22:42:23 +00:00
|
|
|
/* User cliked when the operation was ongoing, so wanted to cancel it */
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->connecting_to_server)
|
2015-08-17 22:42:23 +00:00
|
|
|
return;
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->cancellable = g_cancellable_new ();
|
2019-05-20 04:47:50 +00:00
|
|
|
toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (view)));
|
2015-08-17 22:42:23 +00:00
|
|
|
operation = gtk_mount_operation_new (GTK_WINDOW (toplevel));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->should_pulse_entry = TRUE;
|
|
|
|
gtk_entry_set_progress_pulse_step (GTK_ENTRY (view->address_entry), 0.1);
|
2015-08-17 22:42:23 +00:00
|
|
|
/* Allow to cancel the operation */
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (view->connect_button), _("Cance_l"));
|
|
|
|
gtk_widget_set_sensitive (view->address_entry, FALSE);
|
|
|
|
view->connecting_to_server = TRUE;
|
2015-08-29 20:57:15 +00:00
|
|
|
update_loading (view);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->entry_pulse_timeout_id == 0)
|
|
|
|
view->entry_pulse_timeout_id = g_timeout_add (100, (GSourceFunc) pulse_entry_cb, view);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
g_mount_operation_set_password_save (operation, G_PASSWORD_SAVE_FOR_SESSION);
|
|
|
|
|
2016-09-04 09:47:55 +00:00
|
|
|
/* make sure we keep the view around for as long as we are running */
|
|
|
|
g_object_ref (view);
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
g_file_mount_enclosing_volume (location,
|
|
|
|
0,
|
|
|
|
operation,
|
2020-05-05 00:42:09 +00:00
|
|
|
view->cancellable,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
server_mount_ready_cb,
|
|
|
|
view);
|
|
|
|
|
|
|
|
/* unref operation here - g_file_mount_enclosing_volume() does ref for itself */
|
|
|
|
g_object_unref (operation);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
mount_volume (GtkPlacesView *view,
|
|
|
|
GVolume *volume)
|
|
|
|
{
|
|
|
|
GMountOperation *operation;
|
|
|
|
GtkWidget *toplevel;
|
|
|
|
|
2019-05-20 04:47:50 +00:00
|
|
|
toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (view)));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
operation = gtk_mount_operation_new (GTK_WINDOW (toplevel));
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
g_cancellable_cancel (view->cancellable);
|
|
|
|
g_clear_object (&view->cancellable);
|
|
|
|
view->cancellable = g_cancellable_new ();
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->mounting_volume = TRUE;
|
2015-08-29 20:57:15 +00:00
|
|
|
update_loading (view);
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
g_mount_operation_set_password_save (operation, G_PASSWORD_SAVE_FOR_SESSION);
|
|
|
|
|
2016-09-04 09:47:55 +00:00
|
|
|
/* make sure we keep the view around for as long as we are running */
|
|
|
|
g_object_ref (view);
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
g_volume_mount (volume,
|
|
|
|
0,
|
|
|
|
operation,
|
2020-05-05 00:42:09 +00:00
|
|
|
view->cancellable,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
volume_mount_ready_cb,
|
|
|
|
view);
|
|
|
|
|
|
|
|
/* unref operation here - g_file_mount_enclosing_volume() does ref for itself */
|
|
|
|
g_object_unref (operation);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-27 01:10:34 +00:00
|
|
|
open_cb (GtkWidget *widget,
|
|
|
|
const char *action_name,
|
|
|
|
GVariant *parameter)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = GTK_PLACES_VIEW (widget);
|
2019-12-27 01:10:34 +00:00
|
|
|
GtkPlacesOpenFlags flags = GTK_PLACES_OPEN_NORMAL;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->row_for_action == NULL)
|
2019-12-27 01:10:34 +00:00
|
|
|
return;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
if (strcmp (action_name, "location.open") == 0)
|
|
|
|
flags = GTK_PLACES_OPEN_NORMAL;
|
|
|
|
else if (strcmp (action_name, "location.open-tab") == 0)
|
|
|
|
flags = GTK_PLACES_OPEN_NEW_TAB;
|
|
|
|
else if (strcmp (action_name, "location.open-window") == 0)
|
|
|
|
flags = GTK_PLACES_OPEN_NEW_WINDOW;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
activate_row (view, view->row_for_action, flags);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-27 01:10:34 +00:00
|
|
|
mount_cb (GtkWidget *widget,
|
|
|
|
const char *action_name,
|
|
|
|
GVariant *parameter)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = GTK_PLACES_VIEW (widget);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
GVolume *volume;
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->row_for_action == NULL)
|
2019-12-27 01:10:34 +00:00
|
|
|
return;
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
volume = gtk_places_view_row_get_volume (view->row_for_action);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* When the mount item is activated, it's expected that
|
|
|
|
* the volume only gets mounted, without opening it after
|
|
|
|
* the operation is complete.
|
|
|
|
*/
|
2020-05-05 00:42:09 +00:00
|
|
|
view->should_open_location = FALSE;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_places_view_row_set_busy (view->row_for_action, TRUE);
|
|
|
|
mount_volume (view, volume);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-27 01:10:34 +00:00
|
|
|
unmount_cb (GtkWidget *widget,
|
|
|
|
const char *action_name,
|
|
|
|
GVariant *parameter)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = GTK_PLACES_VIEW (widget);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
GMount *mount;
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->row_for_action == NULL)
|
2019-12-27 01:10:34 +00:00
|
|
|
return;
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
mount = gtk_places_view_row_get_mount (view->row_for_action);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_places_view_row_set_busy (view->row_for_action, TRUE);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
unmount_mount (view, mount);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
2018-11-24 01:49:43 +00:00
|
|
|
static void
|
|
|
|
attach_protocol_row_to_grid (GtkGrid *grid,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *protocol_name,
|
|
|
|
const char *protocol_prefix)
|
2018-11-24 01:49:43 +00:00
|
|
|
{
|
|
|
|
GtkWidget *name_label;
|
|
|
|
GtkWidget *prefix_label;
|
|
|
|
|
|
|
|
name_label = gtk_label_new (protocol_name);
|
|
|
|
gtk_widget_set_halign (name_label, GTK_ALIGN_START);
|
|
|
|
gtk_grid_attach_next_to (grid, name_label, NULL, GTK_POS_BOTTOM, 1, 1);
|
|
|
|
|
|
|
|
prefix_label = gtk_label_new (protocol_prefix);
|
|
|
|
gtk_widget_set_halign (prefix_label, GTK_ALIGN_START);
|
|
|
|
gtk_grid_attach_next_to (grid, prefix_label, name_label, GTK_POS_RIGHT, 1, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
populate_available_protocols_grid (GtkGrid *grid)
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
const char * const *supported_protocols;
|
2020-05-08 13:07:29 +00:00
|
|
|
gboolean has_any = FALSE;
|
2018-11-24 01:49:43 +00:00
|
|
|
|
|
|
|
supported_protocols = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
|
|
|
|
|
|
|
|
if (g_strv_contains (supported_protocols, "afp"))
|
2020-05-08 13:07:29 +00:00
|
|
|
{
|
|
|
|
attach_protocol_row_to_grid (grid, _("AppleTalk"), "afp://");
|
|
|
|
has_any = TRUE;
|
|
|
|
}
|
2018-11-24 01:49:43 +00:00
|
|
|
|
|
|
|
if (g_strv_contains (supported_protocols, "ftp"))
|
2020-05-08 13:07:29 +00:00
|
|
|
{
|
|
|
|
attach_protocol_row_to_grid (grid, _("File Transfer Protocol"),
|
|
|
|
/* Translators: do not translate ftp:// and ftps:// */
|
|
|
|
_("ftp:// or ftps://"));
|
|
|
|
has_any = TRUE;
|
|
|
|
}
|
2018-11-24 01:49:43 +00:00
|
|
|
|
|
|
|
if (g_strv_contains (supported_protocols, "nfs"))
|
2020-05-08 13:07:29 +00:00
|
|
|
{
|
|
|
|
attach_protocol_row_to_grid (grid, _("Network File System"), "nfs://");
|
|
|
|
has_any = TRUE;
|
|
|
|
}
|
2018-11-24 01:49:43 +00:00
|
|
|
|
|
|
|
if (g_strv_contains (supported_protocols, "smb"))
|
2020-05-08 13:07:29 +00:00
|
|
|
{
|
|
|
|
attach_protocol_row_to_grid (grid, _("Samba"), "smb://");
|
|
|
|
has_any = TRUE;
|
|
|
|
}
|
2018-11-24 01:49:43 +00:00
|
|
|
|
|
|
|
if (g_strv_contains (supported_protocols, "ssh"))
|
2020-05-08 13:07:29 +00:00
|
|
|
{
|
|
|
|
attach_protocol_row_to_grid (grid, _("SSH File Transfer Protocol"),
|
|
|
|
/* Translators: do not translate sftp:// and ssh:// */
|
|
|
|
_("sftp:// or ssh://"));
|
|
|
|
has_any = TRUE;
|
|
|
|
}
|
2018-11-24 01:49:43 +00:00
|
|
|
|
|
|
|
if (g_strv_contains (supported_protocols, "dav"))
|
2020-05-08 13:07:29 +00:00
|
|
|
{
|
|
|
|
attach_protocol_row_to_grid (grid, _("WebDAV"),
|
|
|
|
/* Translators: do not translate dav:// and davs:// */
|
|
|
|
_("dav:// or davs://"));
|
|
|
|
has_any = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!has_any)
|
|
|
|
gtk_widget_hide (GTK_WIDGET (grid));
|
2018-11-24 01:49:43 +00:00
|
|
|
}
|
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
static GMenuModel *
|
|
|
|
get_menu_model (void)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2019-12-27 01:10:34 +00:00
|
|
|
GMenu *menu;
|
|
|
|
GMenu *section;
|
|
|
|
GMenuItem *item;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
menu = g_menu_new ();
|
|
|
|
section = g_menu_new ();
|
|
|
|
item = g_menu_item_new (_("_Open"), "location.open");
|
|
|
|
g_menu_append_item (section, item);
|
|
|
|
g_object_unref (item);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
item = g_menu_item_new (_("Open in New _Tab"), "location.open-tab");
|
|
|
|
g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
|
|
|
|
g_menu_append_item (section, item);
|
|
|
|
g_object_unref (item);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
item = g_menu_item_new (_("Open in New _Window"), "location.open-window");
|
|
|
|
g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
|
|
|
|
g_menu_append_item (section, item);
|
|
|
|
g_object_unref (item);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
|
|
|
|
g_object_unref (section);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
section = g_menu_new ();
|
|
|
|
item = g_menu_item_new (_("_Disconnect"), "location.disconnect");
|
|
|
|
g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
|
|
|
|
g_menu_append_item (section, item);
|
|
|
|
g_object_unref (item);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
item = g_menu_item_new (_("_Unmount"), "location.unmount");
|
|
|
|
g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
|
|
|
|
g_menu_append_item (section, item);
|
|
|
|
g_object_unref (item);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2015-07-29 22:37:19 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
item = g_menu_item_new (_("_Connect"), "location.connect");
|
|
|
|
g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
|
|
|
|
g_menu_append_item (section, item);
|
|
|
|
g_object_unref (item);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
item = g_menu_item_new (_("_Mount"), "location.mount");
|
|
|
|
g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
|
|
|
|
g_menu_append_item (section, item);
|
|
|
|
g_object_unref (item);
|
|
|
|
|
|
|
|
g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
|
|
|
|
g_object_unref (section);
|
|
|
|
|
|
|
|
return G_MENU_MODEL (menu);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
2020-03-19 04:52:05 +00:00
|
|
|
static gboolean
|
|
|
|
on_row_popup_menu (GtkWidget *widget,
|
|
|
|
GVariant *args,
|
|
|
|
gpointer user_data)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2020-03-19 04:52:05 +00:00
|
|
|
GtkPlacesViewRow *row = GTK_PLACES_VIEW_ROW (widget);
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view;
|
2019-12-27 01:10:34 +00:00
|
|
|
GMount *mount;
|
|
|
|
GFile *file;
|
|
|
|
gboolean is_network;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view = GTK_PLACES_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_PLACES_VIEW));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
mount = gtk_places_view_row_get_mount (row);
|
|
|
|
file = gtk_places_view_row_get_file (row);
|
|
|
|
is_network = gtk_places_view_row_get_is_network (row);
|
|
|
|
|
|
|
|
gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.disconnect",
|
|
|
|
!file && mount && is_network);
|
|
|
|
gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.unmount",
|
|
|
|
!file && mount && !is_network);
|
|
|
|
gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.connect",
|
|
|
|
!file && !mount && is_network);
|
|
|
|
gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.mount",
|
|
|
|
!file && !mount && !is_network);
|
2020-05-05 00:42:09 +00:00
|
|
|
|
|
|
|
if (!view->popup_menu)
|
2019-12-27 01:10:34 +00:00
|
|
|
{
|
|
|
|
GMenuModel *model = get_menu_model ();
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->popup_menu = gtk_popover_menu_new_from_model (model);
|
|
|
|
gtk_popover_set_position (GTK_POPOVER (view->popup_menu), GTK_POS_BOTTOM);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_popover_set_has_arrow (GTK_POPOVER (view->popup_menu), FALSE);
|
|
|
|
gtk_widget_set_halign (view->popup_menu, GTK_ALIGN_CENTER);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
g_object_unref (model);
|
|
|
|
}
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->row_for_action)
|
|
|
|
g_object_set_data (G_OBJECT (view->row_for_action), "menu", NULL);
|
2020-03-19 04:52:05 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
g_object_ref (view->popup_menu);
|
|
|
|
gtk_widget_unparent (view->popup_menu);
|
|
|
|
gtk_widget_set_parent (view->popup_menu, GTK_WIDGET (row));
|
|
|
|
g_object_unref (view->popup_menu);
|
2019-12-27 01:10:34 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->row_for_action = row;
|
|
|
|
if (view->row_for_action)
|
|
|
|
g_object_set_data (G_OBJECT (view->row_for_action), "menu", view->popup_menu);
|
2020-03-19 04:52:05 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_popover_popup (GTK_POPOVER (view->popup_menu));
|
2020-03-19 04:52:05 +00:00
|
|
|
|
|
|
|
return TRUE;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
2020-03-19 04:52:05 +00:00
|
|
|
static void
|
|
|
|
click_cb (GtkGesture *gesture,
|
|
|
|
int n_press,
|
|
|
|
double x,
|
|
|
|
double y,
|
|
|
|
gpointer user_data)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2020-03-19 04:52:05 +00:00
|
|
|
on_row_popup_menu (GTK_WIDGET (user_data), NULL, NULL);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2018-02-04 20:21:39 +00:00
|
|
|
on_key_press_event (GtkEventController *controller,
|
|
|
|
guint keyval,
|
|
|
|
guint keycode,
|
|
|
|
GdkModifierType state,
|
|
|
|
GtkPlacesView *view)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2018-02-04 20:21:39 +00:00
|
|
|
GdkModifierType modifiers;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2018-02-04 20:21:39 +00:00
|
|
|
modifiers = gtk_accelerator_get_default_mod_mask ();
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2018-02-04 20:21:39 +00:00
|
|
|
if (keyval == GDK_KEY_Return ||
|
|
|
|
keyval == GDK_KEY_KP_Enter ||
|
|
|
|
keyval == GDK_KEY_ISO_Enter ||
|
|
|
|
keyval == GDK_KEY_space)
|
|
|
|
{
|
|
|
|
GtkWidget *focus_widget;
|
|
|
|
GtkWindow *toplevel;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->current_open_flags = GTK_PLACES_OPEN_NORMAL;
|
2018-02-04 20:21:39 +00:00
|
|
|
toplevel = get_toplevel (GTK_WIDGET (view));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2018-02-04 20:21:39 +00:00
|
|
|
if (!toplevel)
|
|
|
|
return FALSE;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-03-02 13:49:00 +00:00
|
|
|
focus_widget = gtk_root_get_focus (GTK_ROOT (toplevel));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2018-02-04 20:21:39 +00:00
|
|
|
if (!GTK_IS_PLACES_VIEW_ROW (focus_widget))
|
|
|
|
return FALSE;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2018-02-04 20:21:39 +00:00
|
|
|
if ((state & modifiers) == GDK_SHIFT_MASK)
|
2020-05-05 00:42:09 +00:00
|
|
|
view->current_open_flags = GTK_PLACES_OPEN_NEW_TAB;
|
2018-02-04 20:21:39 +00:00
|
|
|
else if ((state & modifiers) == GDK_CONTROL_MASK)
|
2020-05-05 00:42:09 +00:00
|
|
|
view->current_open_flags = GTK_PLACES_OPEN_NEW_WINDOW;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
activate_row (view, GTK_PLACES_VIEW_ROW (focus_widget), view->current_open_flags);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2018-02-04 20:21:39 +00:00
|
|
|
return TRUE;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:59:41 +00:00
|
|
|
static void
|
|
|
|
on_middle_click_row_event (GtkGestureClick *gesture,
|
|
|
|
guint n_press,
|
|
|
|
double x,
|
|
|
|
double y,
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view)
|
2019-11-18 13:59:41 +00:00
|
|
|
{
|
|
|
|
GtkListBoxRow *row;
|
|
|
|
|
|
|
|
if (n_press != 1)
|
|
|
|
return;
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
row = gtk_list_box_get_row_at_y (GTK_LIST_BOX (view->listbox), y);
|
2019-11-18 13:59:41 +00:00
|
|
|
if (row != NULL && gtk_widget_is_sensitive (GTK_WIDGET (row)))
|
2020-05-05 00:42:09 +00:00
|
|
|
activate_row (view, GTK_PLACES_VIEW_ROW (row), GTK_PLACES_OPEN_NEW_TAB);
|
2019-11-18 13:59:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
static void
|
|
|
|
on_eject_button_clicked (GtkWidget *widget,
|
|
|
|
GtkPlacesViewRow *row)
|
|
|
|
{
|
|
|
|
if (row)
|
|
|
|
{
|
|
|
|
GtkWidget *view = gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_PLACES_VIEW);
|
|
|
|
|
|
|
|
unmount_mount (GTK_PLACES_VIEW (view), gtk_places_view_row_get_mount (row));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_connect_button_clicked (GtkPlacesView *view)
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *uri;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
GFile *file;
|
|
|
|
|
|
|
|
file = NULL;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Since the 'Connect' button is updated whenever the typed
|
|
|
|
* address changes, it is sufficient to check if it's sensitive
|
|
|
|
* or not, in order to determine if the given address is valid.
|
|
|
|
*/
|
2020-05-05 00:42:09 +00:00
|
|
|
if (!gtk_widget_get_sensitive (view->connect_button))
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
return;
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
uri = gtk_editable_get_text (GTK_EDITABLE (view->address_entry));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
if (uri != NULL && uri[0] != '\0')
|
|
|
|
file = g_file_new_for_commandline_arg (uri);
|
|
|
|
|
|
|
|
if (file)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
view->should_open_location = TRUE;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
mount_server (view, file);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
emit_show_error_message (view, _("Unable to get remote server location"), NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_address_entry_text_changed (GtkPlacesView *view)
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
const char * const *supported_protocols;
|
|
|
|
char *address, *scheme;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
gboolean supported;
|
|
|
|
|
|
|
|
supported = FALSE;
|
|
|
|
supported_protocols = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
|
2020-05-05 00:42:09 +00:00
|
|
|
address = g_strdup (gtk_editable_get_text (GTK_EDITABLE (view->address_entry)));
|
2015-10-14 20:04:35 +00:00
|
|
|
scheme = g_uri_parse_scheme (address);
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
if (!supported_protocols)
|
2015-09-24 09:26:59 +00:00
|
|
|
goto out;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
if (!scheme)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
supported = g_strv_contains (supported_protocols, scheme) &&
|
|
|
|
!g_strv_contains (unsupported_protocols, scheme);
|
|
|
|
|
|
|
|
out:
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_widget_set_sensitive (view->connect_button, supported);
|
2018-11-24 00:31:07 +00:00
|
|
|
if (scheme && !supported)
|
2020-08-13 23:49:02 +00:00
|
|
|
gtk_widget_add_css_class (view->address_entry, "error");
|
2018-11-24 00:31:07 +00:00
|
|
|
else
|
2020-08-13 23:49:02 +00:00
|
|
|
gtk_widget_remove_css_class (view->address_entry, "error");
|
2018-11-24 00:31:07 +00:00
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
g_free (address);
|
2015-10-14 20:04:35 +00:00
|
|
|
g_free (scheme);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
2015-09-24 09:26:59 +00:00
|
|
|
static void
|
2016-04-26 12:57:36 +00:00
|
|
|
on_address_entry_show_help_pressed (GtkPlacesView *view,
|
|
|
|
GtkEntryIconPosition icon_pos,
|
|
|
|
GtkEntry *entry)
|
2015-09-24 09:26:59 +00:00
|
|
|
{
|
2016-04-26 12:57:36 +00:00
|
|
|
GdkRectangle rect;
|
2020-05-17 21:08:01 +00:00
|
|
|
double x, y;
|
2016-04-26 12:57:36 +00:00
|
|
|
|
|
|
|
/* Setup the auxiliary popover's rectangle */
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_entry_get_icon_area (GTK_ENTRY (view->address_entry),
|
2016-04-26 12:57:36 +00:00
|
|
|
GTK_ENTRY_ICON_SECONDARY,
|
|
|
|
&rect);
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_widget_translate_coordinates (view->address_entry, GTK_WIDGET (view),
|
2020-05-17 21:08:01 +00:00
|
|
|
rect.x, rect.y, &x, &y);
|
2016-04-26 12:57:36 +00:00
|
|
|
|
2020-05-17 21:08:01 +00:00
|
|
|
rect.x = x;
|
|
|
|
rect.y = y;
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_popover_set_pointing_to (GTK_POPOVER (view->server_adresses_popover), &rect);
|
|
|
|
gtk_widget_set_visible (view->server_adresses_popover, TRUE);
|
2015-09-24 09:26:59 +00:00
|
|
|
}
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
static void
|
|
|
|
on_recent_servers_listbox_row_activated (GtkPlacesView *view,
|
|
|
|
GtkPlacesViewRow *row,
|
|
|
|
GtkWidget *listbox)
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
char *uri;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
uri = g_object_get_data (G_OBJECT (row), "uri");
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_editable_set_text (GTK_EDITABLE (view->address_entry), uri);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_widget_hide (view->recent_servers_popover);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_listbox_row_activated (GtkPlacesView *view,
|
|
|
|
GtkPlacesViewRow *row,
|
|
|
|
GtkWidget *listbox)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
activate_row (view, row, view->current_open_flags);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
listbox_filter_func (GtkListBoxRow *row,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = GTK_PLACES_VIEW (user_data);
|
2015-08-18 21:26:07 +00:00
|
|
|
gboolean is_placeholder;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
gboolean retval;
|
2015-08-27 18:58:27 +00:00
|
|
|
gboolean searching;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *name;
|
|
|
|
char *path;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
retval = FALSE;
|
2020-05-05 00:42:09 +00:00
|
|
|
searching = view->search_query && view->search_query[0] != '\0';
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2015-08-18 21:26:07 +00:00
|
|
|
is_placeholder = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "is-placeholder"));
|
2015-07-28 14:46:25 +00:00
|
|
|
|
2015-08-27 18:58:27 +00:00
|
|
|
if (is_placeholder && searching)
|
2015-08-18 21:26:07 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2015-08-27 18:58:27 +00:00
|
|
|
if (!searching)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
g_object_get (row,
|
|
|
|
"name", &name,
|
|
|
|
"path", &path,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (name)
|
2019-07-21 07:51:54 +00:00
|
|
|
{
|
|
|
|
char *lowercase_name = g_utf8_strdown (name, -1);
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
retval |= strstr (lowercase_name, view->search_query) != NULL;
|
2019-07-21 07:51:54 +00:00
|
|
|
|
|
|
|
g_free (lowercase_name);
|
|
|
|
}
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
if (path)
|
2019-07-21 07:51:54 +00:00
|
|
|
{
|
|
|
|
char *lowercase_path = g_utf8_strdown (path, -1);
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
retval |= strstr (lowercase_path, view->search_query) != NULL;
|
2019-07-21 07:51:54 +00:00
|
|
|
|
|
|
|
g_free (lowercase_path);
|
|
|
|
}
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
g_free (name);
|
|
|
|
g_free (path);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2015-07-28 14:46:25 +00:00
|
|
|
static void
|
|
|
|
listbox_header_func (GtkListBoxRow *row,
|
|
|
|
GtkListBoxRow *before,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
gboolean row_is_network;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *text;
|
2015-07-28 14:46:25 +00:00
|
|
|
|
|
|
|
text = NULL;
|
|
|
|
row_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "is-network"));
|
|
|
|
|
|
|
|
if (!before)
|
|
|
|
{
|
|
|
|
text = g_strdup_printf ("<b>%s</b>", row_is_network ? _("Networks") : _("On This Computer"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gboolean before_is_network;
|
|
|
|
|
|
|
|
before_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (before), "is-network"));
|
|
|
|
|
|
|
|
if (before_is_network != row_is_network)
|
|
|
|
text = g_strdup_printf ("<b>%s</b>", row_is_network ? _("Networks") : _("On This Computer"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (text)
|
|
|
|
{
|
|
|
|
GtkWidget *header;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *separator;
|
|
|
|
|
|
|
|
header = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
2015-09-24 09:54:58 +00:00
|
|
|
gtk_widget_set_margin_top (header, 6);
|
2015-07-28 14:46:25 +00:00
|
|
|
|
|
|
|
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
|
|
|
|
label = g_object_new (GTK_TYPE_LABEL,
|
|
|
|
"use_markup", TRUE,
|
2015-08-18 21:26:07 +00:00
|
|
|
"margin-start", 12,
|
2015-07-28 14:46:25 +00:00
|
|
|
"label", text,
|
2015-08-05 15:09:03 +00:00
|
|
|
"xalign", 0.0f,
|
2015-07-28 14:46:25 +00:00
|
|
|
NULL);
|
2015-08-18 21:26:07 +00:00
|
|
|
if (row_is_network)
|
|
|
|
{
|
|
|
|
GtkWidget *header_name;
|
2015-08-29 18:36:48 +00:00
|
|
|
GtkWidget *network_header_spinner;
|
2015-08-18 21:26:07 +00:00
|
|
|
|
2019-10-19 09:40:36 +00:00
|
|
|
gtk_widget_set_margin_end (label, 6);
|
2015-08-18 21:26:07 +00:00
|
|
|
|
|
|
|
header_name = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2015-08-29 18:36:48 +00:00
|
|
|
network_header_spinner = gtk_spinner_new ();
|
2019-10-19 09:40:36 +00:00
|
|
|
gtk_widget_set_margin_end (network_header_spinner, 12);
|
2015-08-29 18:36:48 +00:00
|
|
|
g_object_bind_property (GTK_PLACES_VIEW (user_data),
|
|
|
|
"fetching-networks",
|
|
|
|
network_header_spinner,
|
2020-02-25 02:04:49 +00:00
|
|
|
"spinning",
|
2015-08-29 18:36:48 +00:00
|
|
|
G_BINDING_SYNC_CREATE);
|
|
|
|
|
2020-05-09 12:26:52 +00:00
|
|
|
gtk_box_append (GTK_BOX (header_name), label);
|
|
|
|
gtk_box_append (GTK_BOX (header_name), network_header_spinner);
|
|
|
|
gtk_box_append (GTK_BOX (header), header_name);
|
2015-08-18 21:26:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-19 09:40:36 +00:00
|
|
|
gtk_widget_set_hexpand (label, TRUE);
|
|
|
|
gtk_widget_set_margin_end (label, 12);
|
2020-05-09 12:26:52 +00:00
|
|
|
gtk_box_append (GTK_BOX (header), label);
|
2015-08-18 21:26:07 +00:00
|
|
|
}
|
2015-07-28 14:46:25 +00:00
|
|
|
|
2020-05-09 12:26:52 +00:00
|
|
|
gtk_box_append (GTK_BOX (header), separator);
|
2015-07-28 14:46:25 +00:00
|
|
|
|
|
|
|
gtk_list_box_row_set_header (row, header);
|
|
|
|
|
|
|
|
g_free (text);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_list_box_row_set_header (row, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-24 13:54:49 +00:00
|
|
|
static int
|
2015-07-28 14:46:25 +00:00
|
|
|
listbox_sort_func (GtkListBoxRow *row1,
|
|
|
|
GtkListBoxRow *row2,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
gboolean row1_is_network;
|
|
|
|
gboolean row2_is_network;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *path1;
|
|
|
|
char *path2;
|
2015-08-18 21:26:07 +00:00
|
|
|
gboolean *is_placeholder1;
|
|
|
|
gboolean *is_placeholder2;
|
2020-07-24 13:54:49 +00:00
|
|
|
int retval;
|
2015-07-28 14:46:25 +00:00
|
|
|
|
|
|
|
row1_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row1), "is-network"));
|
|
|
|
row2_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row2), "is-network"));
|
|
|
|
|
2015-08-10 18:33:34 +00:00
|
|
|
retval = row1_is_network - row2_is_network;
|
|
|
|
|
|
|
|
if (retval != 0)
|
|
|
|
return retval;
|
|
|
|
|
2015-08-18 21:26:07 +00:00
|
|
|
is_placeholder1 = g_object_get_data (G_OBJECT (row1), "is-placeholder");
|
|
|
|
is_placeholder2 = g_object_get_data (G_OBJECT (row2), "is-placeholder");
|
|
|
|
|
|
|
|
/* we can't have two placeholders for the same section */
|
|
|
|
g_assert (!(is_placeholder1 != NULL && is_placeholder2 != NULL));
|
|
|
|
|
|
|
|
if (is_placeholder1)
|
|
|
|
return -1;
|
|
|
|
if (is_placeholder2)
|
|
|
|
return 1;
|
|
|
|
|
2015-08-21 12:49:11 +00:00
|
|
|
g_object_get (row1, "path", &path1, NULL);
|
|
|
|
g_object_get (row2, "path", &path2, NULL);
|
2015-08-10 18:33:34 +00:00
|
|
|
|
2015-08-21 12:49:11 +00:00
|
|
|
retval = g_utf8_collate (path1, path2);
|
2015-08-10 18:33:34 +00:00
|
|
|
|
2015-08-21 12:49:11 +00:00
|
|
|
g_free (path1);
|
|
|
|
g_free (path2);
|
2015-08-10 18:33:34 +00:00
|
|
|
|
|
|
|
return retval;
|
2015-07-28 14:46:25 +00:00
|
|
|
}
|
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
static void
|
|
|
|
gtk_places_view_constructed (GObject *object)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = GTK_PLACES_VIEW (object);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (gtk_places_view_parent_class)->constructed (object);
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_list_box_set_sort_func (GTK_LIST_BOX (view->listbox),
|
2015-07-28 14:46:25 +00:00
|
|
|
listbox_sort_func,
|
|
|
|
object,
|
|
|
|
NULL);
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_list_box_set_filter_func (GTK_LIST_BOX (view->listbox),
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
listbox_filter_func,
|
|
|
|
object,
|
|
|
|
NULL);
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_list_box_set_header_func (GTK_LIST_BOX (view->listbox),
|
2015-07-28 14:46:25 +00:00
|
|
|
listbox_header_func,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
object,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* load drives */
|
2020-05-05 00:42:09 +00:00
|
|
|
update_places (view);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
g_signal_connect_swapped (view->volume_monitor,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
"mount-added",
|
|
|
|
G_CALLBACK (update_places),
|
|
|
|
object);
|
2020-05-05 00:42:09 +00:00
|
|
|
g_signal_connect_swapped (view->volume_monitor,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
"mount-changed",
|
|
|
|
G_CALLBACK (update_places),
|
|
|
|
object);
|
2020-05-05 00:42:09 +00:00
|
|
|
g_signal_connect_swapped (view->volume_monitor,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
"mount-removed",
|
|
|
|
G_CALLBACK (update_places),
|
|
|
|
object);
|
2020-05-05 00:42:09 +00:00
|
|
|
g_signal_connect_swapped (view->volume_monitor,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
"volume-added",
|
|
|
|
G_CALLBACK (update_places),
|
|
|
|
object);
|
2020-05-05 00:42:09 +00:00
|
|
|
g_signal_connect_swapped (view->volume_monitor,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
"volume-changed",
|
|
|
|
G_CALLBACK (update_places),
|
|
|
|
object);
|
2020-05-05 00:42:09 +00:00
|
|
|
g_signal_connect_swapped (view->volume_monitor,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
"volume-removed",
|
|
|
|
G_CALLBACK (update_places),
|
|
|
|
object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_places_view_map (GtkWidget *widget)
|
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
GtkPlacesView *view = GTK_PLACES_VIEW (widget);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_editable_set_text (GTK_EDITABLE (view->address_entry), "");
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_places_view_parent_class)->map (widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_places_view_class_init (GtkPlacesViewClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->finalize = gtk_places_view_finalize;
|
2019-12-27 01:10:34 +00:00
|
|
|
object_class->dispose = gtk_places_view_dispose;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
object_class->constructed = gtk_places_view_constructed;
|
|
|
|
object_class->get_property = gtk_places_view_get_property;
|
|
|
|
object_class->set_property = gtk_places_view_set_property;
|
|
|
|
|
|
|
|
widget_class->map = gtk_places_view_map;
|
|
|
|
|
2016-11-19 18:44:36 +00:00
|
|
|
/*
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
* GtkPlacesView::open-location:
|
|
|
|
* @view: the object which received the signal.
|
|
|
|
* @location: (type Gio.File): #GFile to which the caller should switch.
|
|
|
|
* @open_flags: a single value from #GtkPlacesOpenFlags specifying how the @location
|
|
|
|
* should be opened.
|
|
|
|
*
|
|
|
|
* The places view emits this signal when the user selects a location
|
|
|
|
* in it. The calling application should display the contents of that
|
|
|
|
* location; for example, a file manager should show a list of files in
|
|
|
|
* the specified location.
|
|
|
|
*/
|
|
|
|
places_view_signals [OPEN_LOCATION] =
|
|
|
|
g_signal_new (I_("open-location"),
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GtkPlacesViewClass, open_location),
|
2019-06-02 21:07:27 +00:00
|
|
|
NULL, NULL,
|
|
|
|
_gtk_marshal_VOID__OBJECT_FLAGS,
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
G_TYPE_OBJECT,
|
|
|
|
GTK_TYPE_PLACES_OPEN_FLAGS);
|
2019-06-02 21:07:27 +00:00
|
|
|
g_signal_set_va_marshaller (places_view_signals [OPEN_LOCATION],
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
_gtk_marshal_VOID__OBJECT_FLAGSv);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2016-11-19 18:44:36 +00:00
|
|
|
/*
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
* GtkPlacesView::show-error-message:
|
|
|
|
* @view: the object which received the signal.
|
|
|
|
* @primary: primary message with a summary of the error to show.
|
|
|
|
* @secondary: secondary message with details of the error to show.
|
|
|
|
*
|
|
|
|
* The places view emits this signal when it needs the calling
|
|
|
|
* application to present an error message. Most of these messages
|
|
|
|
* refer to mounting or unmounting media, for example, when a drive
|
|
|
|
* cannot be started for some reason.
|
|
|
|
*/
|
|
|
|
places_view_signals [SHOW_ERROR_MESSAGE] =
|
|
|
|
g_signal_new (I_("show-error-message"),
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GtkPlacesViewClass, show_error_message),
|
|
|
|
NULL, NULL,
|
|
|
|
_gtk_marshal_VOID__STRING_STRING,
|
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_STRING);
|
|
|
|
|
2015-08-19 12:46:34 +00:00
|
|
|
properties[PROP_LOADING] =
|
|
|
|
g_param_spec_boolean ("loading",
|
|
|
|
P_("Loading"),
|
|
|
|
P_("Whether the view is loading locations"),
|
|
|
|
FALSE,
|
2017-11-18 13:18:11 +00:00
|
|
|
GTK_PARAM_READABLE);
|
2015-08-19 12:46:34 +00:00
|
|
|
|
2015-08-29 18:36:48 +00:00
|
|
|
properties[PROP_FETCHING_NETWORKS] =
|
|
|
|
g_param_spec_boolean ("fetching-networks",
|
|
|
|
P_("Fetching networks"),
|
|
|
|
P_("Whether the view is fetching networks"),
|
|
|
|
FALSE,
|
2017-11-18 13:18:11 +00:00
|
|
|
GTK_PARAM_READABLE);
|
2015-08-29 18:36:48 +00:00
|
|
|
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
properties[PROP_OPEN_FLAGS] =
|
|
|
|
g_param_spec_flags ("open-flags",
|
|
|
|
P_("Open Flags"),
|
|
|
|
P_("Modes in which the calling application can open locations selected in the sidebar"),
|
|
|
|
GTK_TYPE_PLACES_OPEN_FLAGS,
|
|
|
|
GTK_PLACES_OPEN_NORMAL,
|
2017-11-18 13:18:11 +00:00
|
|
|
GTK_PARAM_READWRITE);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
g_object_class_install_properties (object_class, LAST_PROP, properties);
|
|
|
|
|
|
|
|
/* Bind class to template */
|
|
|
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/ui/gtkplacesview.ui");
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, actionbar);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, address_entry);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, address_entry_completion);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, completion_store);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, connect_button);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, listbox);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, recent_servers_listbox);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, recent_servers_popover);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, recent_servers_stack);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, stack);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, server_adresses_popover);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkPlacesView, available_protocols_grid);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_address_entry_text_changed);
|
2016-04-27 12:06:46 +00:00
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_address_entry_show_help_pressed);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_connect_button_clicked);
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_listbox_row_activated);
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_recent_servers_listbox_row_activated);
|
2015-11-06 04:41:42 +00:00
|
|
|
|
2020-04-11 03:59:21 +00:00
|
|
|
/**
|
|
|
|
* GtkPlacesView|location.open:
|
|
|
|
*
|
|
|
|
* Opens the location in the current window.
|
|
|
|
*/
|
2019-12-27 01:10:34 +00:00
|
|
|
gtk_widget_class_install_action (widget_class, "location.open", NULL, open_cb);
|
2020-04-11 03:59:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkPlacesView|location.open-tab:
|
|
|
|
*
|
|
|
|
* Opens the location in a new tab.
|
|
|
|
*/
|
2019-12-27 01:10:34 +00:00
|
|
|
gtk_widget_class_install_action (widget_class, "location.open-tab", NULL, open_cb);
|
2020-04-11 03:59:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkPlacesView|location.open-window:
|
|
|
|
*
|
|
|
|
* Opens the location in a new window.
|
|
|
|
*/
|
2019-12-27 01:10:34 +00:00
|
|
|
gtk_widget_class_install_action (widget_class, "location.open-window", NULL, open_cb);
|
2020-04-11 03:59:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkPlacesView|location.mount:
|
|
|
|
*
|
|
|
|
* Mount the location.
|
|
|
|
*/
|
2019-12-27 01:10:34 +00:00
|
|
|
gtk_widget_class_install_action (widget_class, "location.mount", NULL, mount_cb);
|
2020-04-11 03:59:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkPlacesView|location.connect:
|
|
|
|
*
|
|
|
|
* Connect the location.
|
|
|
|
*/
|
2019-12-27 01:10:34 +00:00
|
|
|
gtk_widget_class_install_action (widget_class, "location.connect", NULL, mount_cb);
|
2020-04-11 03:59:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkPlacesView|location.unmount:
|
|
|
|
*
|
|
|
|
* Unmount the location.
|
|
|
|
*/
|
2019-12-27 01:10:34 +00:00
|
|
|
gtk_widget_class_install_action (widget_class, "location.unmount", NULL, unmount_cb);
|
2020-04-11 03:59:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkPlacesView|location.disconnect:
|
|
|
|
*
|
|
|
|
* Disconnect the location.
|
|
|
|
*/
|
2019-12-27 01:10:34 +00:00
|
|
|
gtk_widget_class_install_action (widget_class, "location.disconnect", NULL, unmount_cb);
|
|
|
|
|
2017-11-18 03:49:57 +00:00
|
|
|
gtk_widget_class_set_css_name (widget_class, I_("placesview"));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_places_view_init (GtkPlacesView *self)
|
|
|
|
{
|
2018-04-20 17:58:06 +00:00
|
|
|
GtkEventController *controller;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
self->volume_monitor = g_volume_monitor_get ();
|
|
|
|
self->open_flags = GTK_PLACES_OPEN_NORMAL;
|
|
|
|
self->path_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
self->space_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
2018-04-20 17:58:06 +00:00
|
|
|
|
2019-12-27 01:10:34 +00:00
|
|
|
gtk_widget_action_set_enabled (GTK_WIDGET (self), "location.open-tab", FALSE);
|
|
|
|
gtk_widget_action_set_enabled (GTK_WIDGET (self), "location.open-window", FALSE);
|
|
|
|
|
2019-11-18 13:59:41 +00:00
|
|
|
gtk_widget_init_template (GTK_WIDGET (self));
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_widget_set_parent (self->server_adresses_popover, GTK_WIDGET (self));
|
2018-04-20 17:58:06 +00:00
|
|
|
controller = gtk_event_controller_key_new ();
|
|
|
|
g_signal_connect (controller, "key-pressed", G_CALLBACK (on_key_press_event), self);
|
|
|
|
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2019-11-18 13:59:41 +00:00
|
|
|
/* We need an additional controller because GtkListBox only
|
|
|
|
* activates rows for GDK_BUTTON_PRIMARY clicks
|
|
|
|
*/
|
|
|
|
controller = (GtkEventController *) gtk_gesture_click_new ();
|
|
|
|
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE);
|
|
|
|
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), GDK_BUTTON_MIDDLE);
|
|
|
|
g_signal_connect (controller, "released",
|
|
|
|
G_CALLBACK (on_middle_click_row_event), self);
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_widget_add_controller (self->listbox, controller);
|
2018-11-24 01:49:43 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
populate_available_protocols_grid (GTK_GRID (self->available_protocols_grid));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
2016-11-19 18:44:36 +00:00
|
|
|
/*
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
* gtk_places_view_new:
|
|
|
|
*
|
|
|
|
* Creates a new #GtkPlacesView widget.
|
|
|
|
*
|
|
|
|
* The application should connect to at least the
|
|
|
|
* #GtkPlacesView::open-location signal to be notified
|
|
|
|
* when the user makes a selection in the view.
|
|
|
|
*
|
|
|
|
* Returns: a newly created #GtkPlacesView
|
|
|
|
*/
|
|
|
|
GtkWidget *
|
|
|
|
gtk_places_view_new (void)
|
|
|
|
{
|
|
|
|
return g_object_new (GTK_TYPE_PLACES_VIEW, NULL);
|
|
|
|
}
|
|
|
|
|
2016-11-19 18:44:36 +00:00
|
|
|
/*
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
* gtk_places_view_set_open_flags:
|
|
|
|
* @view: a #GtkPlacesView
|
|
|
|
* @flags: Bitmask of modes in which the calling application can open locations
|
|
|
|
*
|
|
|
|
* Sets the way in which the calling application can open new locations from
|
|
|
|
* the places view. For example, some applications only open locations
|
|
|
|
* “directly” into their main view, while others may support opening locations
|
|
|
|
* in a new notebook tab or a new window.
|
|
|
|
*
|
|
|
|
* This function is used to tell the places @view about the ways in which the
|
|
|
|
* application can open new locations, so that the view can display (or not)
|
|
|
|
* the “Open in new tab” and “Open in new window” menu items as appropriate.
|
|
|
|
*
|
|
|
|
* When the #GtkPlacesView::open-location signal is emitted, its flags
|
|
|
|
* argument will be set to one of the @flags that was passed in
|
|
|
|
* gtk_places_view_set_open_flags().
|
|
|
|
*
|
|
|
|
* Passing 0 for @flags will cause #GTK_PLACES_OPEN_NORMAL to always be sent
|
|
|
|
* to callbacks for the “open-location” signal.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_places_view_set_open_flags (GtkPlacesView *view,
|
|
|
|
GtkPlacesOpenFlags flags)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_PLACES_VIEW (view));
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->open_flags == flags)
|
2019-12-27 01:10:34 +00:00
|
|
|
return;
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
view->open_flags = flags;
|
2019-12-27 01:10:34 +00:00
|
|
|
|
|
|
|
gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.open-tab",
|
|
|
|
(flags & GTK_PLACES_OPEN_NEW_TAB) != 0);
|
|
|
|
gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.open-window",
|
|
|
|
(flags & GTK_PLACES_OPEN_NEW_WINDOW) != 0);
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (view), properties[PROP_OPEN_FLAGS]);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
2016-11-19 18:44:36 +00:00
|
|
|
/*
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
* gtk_places_view_get_open_flags:
|
|
|
|
* @view: a #GtkPlacesSidebar
|
|
|
|
*
|
|
|
|
* Gets the open flags.
|
|
|
|
*
|
|
|
|
* Returns: the #GtkPlacesOpenFlags of @view
|
|
|
|
*/
|
|
|
|
GtkPlacesOpenFlags
|
|
|
|
gtk_places_view_get_open_flags (GtkPlacesView *view)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_PLACES_VIEW (view), 0);
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
return view->open_flags;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
2016-11-19 18:44:36 +00:00
|
|
|
/*
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
* gtk_places_view_get_search_query:
|
|
|
|
* @view: a #GtkPlacesView
|
|
|
|
*
|
|
|
|
* Retrieves the current search query from @view.
|
|
|
|
*
|
|
|
|
* Returns: (transfer none): the current search query.
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
gtk_places_view_get_search_query (GtkPlacesView *view)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_PLACES_VIEW (view), NULL);
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
return view->search_query;
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
}
|
|
|
|
|
2016-11-19 18:44:36 +00:00
|
|
|
/*
|
2015-07-27 19:49:18 +00:00
|
|
|
* gtk_places_view_set_search_query:
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
* @view: a #GtkPlacesView
|
|
|
|
* @query_text: the query, or NULL.
|
|
|
|
*
|
|
|
|
* Sets the search query of @view. The search is immediately performed
|
|
|
|
* once the query is set.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_places_view_set_search_query (GtkPlacesView *view,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *query_text)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_PLACES_VIEW (view));
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (g_strcmp0 (view->search_query, query_text) != 0)
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
g_clear_pointer (&view->search_query, g_free);
|
|
|
|
view->search_query = g_utf8_strdown (query_text, -1);
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
gtk_list_box_invalidate_filter (GTK_LIST_BOX (view->listbox));
|
|
|
|
gtk_list_box_invalidate_headers (GTK_LIST_BOX (view->listbox));
|
placesview: add view for fixed drives and networks
Places sidebar shows XDG directories, mounted and unmounted devices,
connected networks, bookmarks and actions like 'Connect to server'
and 'Insert location', which causes the sidebar to grow very quickly
and look cluttered. Because of that, new mockups for the sidebar try
to simplify it.
To make the sidebar simpler, the new mockups propose that it should
only handle connected networks and removable devices such as flash
drives and USB devices, and delegates other devices for external
widgets through the 'Other Locations' item.
To handle fixed devices and manage network connections, add a new
widget named GtkPlacesView, based on Nautilus mockups to keep
consistency between GNOME file management tools - in this case,
between Nautilus and the bundled Gtk's file chooser.
https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-14 17:45:37 +00:00
|
|
|
|
|
|
|
update_view_mode (view);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-19 18:44:36 +00:00
|
|
|
/*
|
2015-08-19 12:46:34 +00:00
|
|
|
* gtk_places_view_get_loading:
|
|
|
|
* @view: a #GtkPlacesView
|
|
|
|
*
|
|
|
|
* Returns %TRUE if the view is loading locations.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gtk_places_view_get_loading (GtkPlacesView *view)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_PLACES_VIEW (view), FALSE);
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
return view->loading;
|
2015-08-19 12:46:34 +00:00
|
|
|
}
|
|
|
|
|
2015-08-29 20:57:15 +00:00
|
|
|
static void
|
|
|
|
update_loading (GtkPlacesView *view)
|
|
|
|
{
|
|
|
|
gboolean loading;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_PLACES_VIEW (view));
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
loading = view->fetching_networks || view->connecting_to_server ||
|
|
|
|
view->mounting_volume || view->unmounting_mount;
|
2015-08-29 20:57:15 +00:00
|
|
|
|
|
|
|
set_busy_cursor (view, loading);
|
|
|
|
gtk_places_view_set_loading (view, loading);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_places_view_set_loading (GtkPlacesView *view,
|
|
|
|
gboolean loading)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_PLACES_VIEW (view));
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->loading != loading)
|
2015-08-29 20:57:15 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
view->loading = loading;
|
2015-08-29 20:57:15 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (view), properties [PROP_LOADING]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-29 18:36:48 +00:00
|
|
|
static gboolean
|
|
|
|
gtk_places_view_get_fetching_networks (GtkPlacesView *view)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_PLACES_VIEW (view), FALSE);
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
return view->fetching_networks;
|
2015-08-29 18:36:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_places_view_set_fetching_networks (GtkPlacesView *view,
|
|
|
|
gboolean fetching_networks)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_PLACES_VIEW (view));
|
|
|
|
|
2020-05-05 00:42:09 +00:00
|
|
|
if (view->fetching_networks != fetching_networks)
|
2015-08-29 18:36:48 +00:00
|
|
|
{
|
2020-05-05 00:42:09 +00:00
|
|
|
view->fetching_networks = fetching_networks;
|
2015-08-29 18:36:48 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (view), properties [PROP_FETCHING_NETWORKS]);
|
|
|
|
}
|
|
|
|
}
|