diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 8 | ||||
-rw-r--r-- | src/gtk/gtkplacesviewprivate.h | 82 | ||||
-rw-r--r-- | src/gtk/gtkplacesviewrowprivate.h | 59 | ||||
-rw-r--r-- | src/gtk/nautilusgtkplacesview.c (renamed from src/gtk/gtkplacesview.c) | 608 | ||||
-rw-r--r-- | src/gtk/nautilusgtkplacesview.ui (renamed from src/gtk/gtkplacesview.ui) | 25 | ||||
-rw-r--r-- | src/gtk/nautilusgtkplacesviewprivate.h | 87 | ||||
-rw-r--r-- | src/gtk/nautilusgtkplacesviewrow.c (renamed from src/gtk/gtkplacesviewrow.c) | 141 | ||||
-rw-r--r-- | src/gtk/nautilusgtkplacesviewrow.ui (renamed from src/gtk/gtkplacesviewrow.ui) | 43 | ||||
-rw-r--r-- | src/gtk/nautilusgtkplacesviewrowprivate.h | 64 | ||||
-rwxr-xr-x | src/gtk/symbolconverter.sh | 61 | ||||
-rw-r--r-- | src/nautilus-places-view.c | 10 | ||||
-rw-r--r-- | src/resources/nautilus.gresource.xml | 4 |
12 files changed, 626 insertions, 566 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 40329ceb2..608e6a675 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -135,10 +135,10 @@ nautilus_built_sources = \ $(NULL) nautilus_SOURCES = \ - gtk/gtkplacesview.c \ - gtk/gtkplacesviewprivate.h \ - gtk/gtkplacesviewrow.c \ - gtk/gtkplacesviewrowprivate.h \ + gtk/nautilusgtkplacesview.c \ + gtk/nautilusgtkplacesviewprivate.h \ + gtk/nautilusgtkplacesviewrow.c \ + gtk/nautilusgtkplacesviewrowprivate.h \ nautilus-application.c \ nautilus-application.h \ nautilus-bookmark-list.c \ diff --git a/src/gtk/gtkplacesviewprivate.h b/src/gtk/gtkplacesviewprivate.h deleted file mode 100644 index d0e308669..000000000 --- a/src/gtk/gtkplacesviewprivate.h +++ /dev/null @@ -1,82 +0,0 @@ -/* gtkplacesview.h - * - * Copyright (C) 2015 Georges Basile Stavracas Neto <georges.stavracas@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (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 - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - - -#ifndef GTK_NAUTILUS_PLACES_VIEW_H -#define GTK_NAUTILUS_PLACES_VIEW_H - -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_NAUTILUS_PLACES_VIEW (gtk_nautilus_places_view_get_type ()) -#define GTK_NAUTILUS_PLACES_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_NAUTILUS_PLACES_VIEW, GtkNautilusPlacesView)) -#define GTK_NAUTILUS_PLACES_VIEW_CLASS(klass)(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_NAUTILUS_PLACES_VIEW, GtkNautilusPlacesViewClass)) -#define GTK_IS_NAUTILUS_PLACES_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_NAUTILUS_PLACES_VIEW)) -#define GTK_IS_NAUTILUS_PLACES_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NAUTILUS_PLACES_VIEW)) -#define GTK_NAUTILUS_PLACES_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NAUTILUS_PLACES_VIEW, GtkNautilusPlacesViewClass)) - -typedef struct _GtkNautilusPlacesView GtkNautilusPlacesView; -typedef struct _GtkNautilusPlacesViewClass GtkNautilusPlacesViewClass; -typedef struct _GtkNautilusPlacesViewPrivate GtkNautilusPlacesViewPrivate; - -struct _GtkNautilusPlacesViewClass -{ - GtkBoxClass parent_class; - - void (* open_location) (GtkNautilusPlacesView *view, - GFile *location, - GtkPlacesOpenFlags open_flags); - - void (* show_error_message) (GtkPlacesSidebar *sidebar, - const gchar *primary, - const gchar *secondary); - - /*< private >*/ - - /* Padding for future expansion */ - gpointer reserved[10]; -}; - -struct _GtkNautilusPlacesView -{ - GtkBox parent_instance; -}; - -GType gtk_nautilus_places_view_get_type (void) G_GNUC_CONST; - -GtkPlacesOpenFlags gtk_nautilus_places_view_get_open_flags (GtkNautilusPlacesView *view); -void gtk_nautilus_places_view_set_open_flags (GtkNautilusPlacesView *view, - GtkPlacesOpenFlags flags); - -const gchar* gtk_nautilus_places_view_get_search_query (GtkNautilusPlacesView *view); -void gtk_nautilus_places_view_set_search_query (GtkNautilusPlacesView *view, - const gchar *query_text); - -gboolean gtk_nautilus_places_view_get_local_only (GtkNautilusPlacesView *view); - -void gtk_nautilus_places_view_set_local_only (GtkNautilusPlacesView *view, - gboolean local_only); - -gboolean gtk_nautilus_places_view_get_loading (GtkNautilusPlacesView *view); - -GtkWidget * gtk_nautilus_places_view_new (void); - -G_END_DECLS - -#endif /* GTK_NAUTILUS_PLACES_VIEW_H */ diff --git a/src/gtk/gtkplacesviewrowprivate.h b/src/gtk/gtkplacesviewrowprivate.h deleted file mode 100644 index d5f28db0a..000000000 --- a/src/gtk/gtkplacesviewrowprivate.h +++ /dev/null @@ -1,59 +0,0 @@ -/* gtkplacesviewrow.h - * - * Copyright (C) 2015 Georges Basile Stavracas Neto <georges.stavracas@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (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 - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef GTK_NAUTILUS_PLACES_VIEW_ROW_H -#define GTK_NAUTILUS_PLACES_VIEW_ROW_H - -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_NAUTILUS_PLACES_VIEW_ROW (gtk_nautilus_places_view_row_get_type()) - -G_DECLARE_FINAL_TYPE (GtkNautilusPlacesViewRow, gtk_nautilus_places_view_row, GTK, NAUTILUS_PLACES_VIEW_ROW, GtkListBoxRow) - -GtkWidget* gtk_nautilus_places_view_row_new (GVolume *volume, - GMount *mount); - -GtkWidget* gtk_nautilus_places_view_row_get_eject_button (GtkNautilusPlacesViewRow *row); - -GtkWidget* gtk_nautilus_places_view_row_get_event_box (GtkNautilusPlacesViewRow *row); - -GMount* gtk_nautilus_places_view_row_get_mount (GtkNautilusPlacesViewRow *row); - -GVolume* gtk_nautilus_places_view_row_get_volume (GtkNautilusPlacesViewRow *row); - -GFile* gtk_nautilus_places_view_row_get_file (GtkNautilusPlacesViewRow *row); - -void gtk_nautilus_places_view_row_set_busy (GtkNautilusPlacesViewRow *row, - gboolean is_busy); - -gboolean gtk_nautilus_places_view_row_get_is_network (GtkNautilusPlacesViewRow *row); - -void gtk_nautilus_places_view_row_set_is_network (GtkNautilusPlacesViewRow *row, - gboolean is_network); - -void gtk_nautilus_places_view_row_set_path_size_group (GtkNautilusPlacesViewRow *row, - GtkSizeGroup *group); - -void gtk_nautilus_places_view_row_set_space_size_group (GtkNautilusPlacesViewRow *row, - GtkSizeGroup *group); - -G_END_DECLS - -#endif /* GTK_NAUTILUS_PLACES_VIEW_ROW_H */ diff --git a/src/gtk/gtkplacesview.c b/src/gtk/nautilusgtkplacesview.c index e1f27b238..aac7ff9e2 100644 --- a/src/gtk/gtkplacesview.c +++ b/src/gtk/nautilusgtkplacesview.c @@ -1,4 +1,6 @@ -/* gtkplacesview.c +/* Do not edit: this file is generated from https://git.gnome.org/browse/gtk+/plain/gtk//gtkplacesview.c */ + +/* nautilusgtkplacesview.c * * Copyright (C) 2015 Georges Basile Stavracas Neto <georges.stavracas@gmail.com> * @@ -18,21 +20,20 @@ #include "config.h" -#include <glib/gi18n.h> #include <gio/gio.h> #include <gtk/gtk.h> -#include "gtkplacesviewprivate.h" -#include "gtkplacesviewrowprivate.h" +#include "nautilusgtkplacesviewprivate.h" +#include "nautilusnautilusgtkplacesviewrowprivate.h" /** - * SECTION:gtkplacesview + * SECTION:nautilusgtkplacesview * @Short_description: Widget that displays persistent drives and manages mounted networks - * @Title: GtkNautilusPlacesView + * @Title: NautilusGtkPlacesView * @See_also: #GtkFileChooser * - * #GtkNautilusPlacesView is a stock widget that displays a list of persistent drives - * such as harddisk partitions and networks. #GtkNautilusPlacesView does not monitor + * #NautilusGtkPlacesView is a stock widget that displays a list of persistent drives + * such as harddisk partitions and networks. #NautilusGtkPlacesView does not monitor * removable devices. * * The places view displays drives and networks, and will automatically mount @@ -41,11 +42,11 @@ * shown at the network list. * * To make use of the places view, an application at least needs to connect - * to the #GtkNautilusPlacesView::open-location signal. This is emitted when the user + * to the #NautilusGtkPlacesView::open-location signal. This is emitted when the user * selects a location to open in the view. */ -struct _GtkNautilusPlacesViewPrivate +struct _NautilusGtkPlacesViewPrivate { GVolumeMonitor *volume_monitor; GtkPlacesOpenFlags open_flags; @@ -89,32 +90,32 @@ struct _GtkNautilusPlacesViewPrivate guint loading : 1; }; -static void mount_volume (GtkNautilusPlacesView *view, +static void mount_volume (NautilusGtkPlacesView *view, GVolume *volume); -static gboolean on_button_press_event (GtkNautilusPlacesViewRow *row, +static gboolean on_button_press_event (NautilusGtkPlacesViewRow *row, GdkEventButton *event); static void on_eject_button_clicked (GtkWidget *widget, - GtkNautilusPlacesViewRow *row); + NautilusGtkPlacesViewRow *row); -static gboolean on_row_popup_menu (GtkNautilusPlacesViewRow *row); +static gboolean on_row_popup_menu (NautilusGtkPlacesViewRow *row); -static void populate_servers (GtkNautilusPlacesView *view); +static void populate_servers (NautilusGtkPlacesView *view); -static gboolean gtk_nautilus_places_view_get_fetching_networks (GtkNautilusPlacesView *view); +static gboolean nautilus_gtk_places_view_get_fetching_networks (NautilusGtkPlacesView *view); -static void gtk_nautilus_places_view_set_fetching_networks (GtkNautilusPlacesView *view, +static void nautilus_gtk_places_view_set_fetching_networks (NautilusGtkPlacesView *view, gboolean fetching_networks); -static void gtk_nautilus_places_view_set_loading (GtkNautilusPlacesView *view, +static void nautilus_gtk_places_view_set_loading (NautilusGtkPlacesView *view, gboolean loading); -static void update_loading (GtkNautilusPlacesView *view); +static void update_loading (NautilusGtkPlacesView *view); -G_DEFINE_TYPE_WITH_PRIVATE (GtkNautilusPlacesView, gtk_nautilus_places_view, GTK_TYPE_BOX) +G_DEFINE_TYPE_WITH_PRIVATE (NautilusGtkPlacesView, nautilus_gtk_places_view, GTK_TYPE_BOX) -/* GtkNautilusPlacesView properties & signals */ +/* NautilusGtkPlacesView properties & signals */ enum { PROP_0, PROP_LOCAL_ONLY, @@ -138,49 +139,49 @@ const gchar *unsupported_protocols [] = NULL }; -static guint nautilus_places_view_signals [LAST_SIGNAL] = { 0 }; +static guint places_view_signals [LAST_SIGNAL] = { 0 }; static GParamSpec *properties [LAST_PROP]; static void -emit_open_location (GtkNautilusPlacesView *view, +emit_open_location (NautilusGtkPlacesView *view, GFile *location, GtkPlacesOpenFlags open_flags) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); if ((open_flags & priv->open_flags) == 0) open_flags = GTK_PLACES_OPEN_NORMAL; - g_signal_emit (view, nautilus_places_view_signals[OPEN_LOCATION], 0, location, open_flags); + g_signal_emit (view, places_view_signals[OPEN_LOCATION], 0, location, open_flags); } static void -emit_show_error_message (GtkNautilusPlacesView *view, +emit_show_error_message (NautilusGtkPlacesView *view, gchar *primary_message, gchar *secondary_message) { - g_signal_emit (view, nautilus_places_view_signals[SHOW_ERROR_MESSAGE], + g_signal_emit (view, places_view_signals[SHOW_ERROR_MESSAGE], 0, primary_message, secondary_message); } static void -server_file_changed_cb (GtkNautilusPlacesView *view) +server_file_changed_cb (NautilusGtkPlacesView *view) { populate_servers (view); } static GBookmarkFile * -server_list_load (GtkNautilusPlacesView *view) +server_list_load (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GBookmarkFile *bookmarks; GError *error = NULL; gchar *datadir; gchar *filename; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); bookmarks = g_bookmark_file_new (); datadir = g_build_filename (g_get_user_config_dir (), "gtk-3.0", NULL); filename = g_build_filename (datadir, "servers", NULL); @@ -246,7 +247,7 @@ server_list_save (GBookmarkFile *bookmarks) } static void -server_list_add_server (GtkNautilusPlacesView *view, +server_list_add_server (NautilusGtkPlacesView *view, GFile *file) { GBookmarkFile *bookmarks; @@ -283,7 +284,7 @@ server_list_add_server (GtkNautilusPlacesView *view, } static void -server_list_remove_server (GtkNautilusPlacesView *view, +server_list_remove_server (NautilusGtkPlacesView *view, const gchar *uri) { GBookmarkFile *bookmarks; @@ -313,7 +314,7 @@ get_toplevel (GtkWidget *widget) } static void -set_busy_cursor (GtkNautilusPlacesView *view, +set_busy_cursor (NautilusGtkPlacesView *view, gboolean busy) { GtkWidget *widget; @@ -342,19 +343,19 @@ set_busy_cursor (GtkNautilusPlacesView *view, /* Activates the given row, with the given flags as parameter */ static void -activate_row (GtkNautilusPlacesView *view, - GtkNautilusPlacesViewRow *row, +activate_row (NautilusGtkPlacesView *view, + NautilusGtkPlacesViewRow *row, GtkPlacesOpenFlags flags) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GVolume *volume; GMount *mount; GFile *file; - priv = gtk_nautilus_places_view_get_instance_private (view); - mount = gtk_nautilus_places_view_row_get_mount (row); - volume = gtk_nautilus_places_view_row_get_volume (row); - file = gtk_nautilus_places_view_row_get_file (row); + priv = nautilus_gtk_places_view_get_instance_private (view); + mount = nautilus_gtk_places_view_row_get_mount (row); + volume = nautilus_gtk_places_view_row_get_volume (row); + file = nautilus_gtk_places_view_row_get_file (row); if (file) { @@ -376,18 +377,18 @@ activate_row (GtkNautilusPlacesView *view, */ priv->should_open_location = TRUE; - gtk_nautilus_places_view_row_set_busy (row, TRUE); + nautilus_gtk_places_view_row_set_busy (row, TRUE); mount_volume (view, volume); } } -static void update_places (GtkNautilusPlacesView *view); +static void update_places (NautilusGtkPlacesView *view); static void -gtk_nautilus_places_view_finalize (GObject *object) +nautilus_gtk_places_view_finalize (GObject *object) { - GtkNautilusPlacesView *self = (GtkNautilusPlacesView *)object; - GtkNautilusPlacesViewPrivate *priv = gtk_nautilus_places_view_get_instance_private (self); + NautilusGtkPlacesView *self = (NautilusGtkPlacesView *)object; + NautilusGtkPlacesViewPrivate *priv = nautilus_gtk_places_view_get_instance_private (self); g_signal_handlers_disconnect_by_func (priv->volume_monitor, update_places, object); @@ -406,29 +407,29 @@ gtk_nautilus_places_view_finalize (GObject *object) g_clear_object (&priv->path_size_group); g_clear_object (&priv->space_size_group); - G_OBJECT_CLASS (gtk_nautilus_places_view_parent_class)->finalize (object); + G_OBJECT_CLASS (nautilus_gtk_places_view_parent_class)->finalize (object); } static void -gtk_nautilus_places_view_get_property (GObject *object, +nautilus_gtk_places_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - GtkNautilusPlacesView *self = GTK_NAUTILUS_PLACES_VIEW (object); + NautilusGtkPlacesView *self = NAUTILUS_GTK_PLACES_VIEW (object); switch (prop_id) { case PROP_LOCAL_ONLY: - g_value_set_boolean (value, gtk_nautilus_places_view_get_local_only (self)); + g_value_set_boolean (value, nautilus_gtk_places_view_get_local_only (self)); break; case PROP_LOADING: - g_value_set_boolean (value, gtk_nautilus_places_view_get_loading (self)); + g_value_set_boolean (value, nautilus_gtk_places_view_get_loading (self)); break; case PROP_FETCHING_NETWORKS: - g_value_set_boolean (value, gtk_nautilus_places_view_get_fetching_networks (self)); + g_value_set_boolean (value, nautilus_gtk_places_view_get_fetching_networks (self)); break; default: @@ -437,17 +438,17 @@ gtk_nautilus_places_view_get_property (GObject *object, } static void -gtk_nautilus_places_view_set_property (GObject *object, +nautilus_gtk_places_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - GtkNautilusPlacesView *self = GTK_NAUTILUS_PLACES_VIEW (object); + NautilusGtkPlacesView *self = NAUTILUS_GTK_PLACES_VIEW (object); switch (prop_id) { case PROP_LOCAL_ONLY: - gtk_nautilus_places_view_set_local_only (self, g_value_get_boolean (value)); + nautilus_gtk_places_view_set_local_only (self, g_value_get_boolean (value)); break; default: @@ -484,7 +485,7 @@ is_external_volume (GVolume *volume) typedef struct { gchar *uri; - GtkNautilusPlacesView *view; + NautilusGtkPlacesView *view; } RemoveServerData; static void @@ -496,16 +497,16 @@ on_remove_server_button_clicked (RemoveServerData *data) } static void -populate_servers (GtkNautilusPlacesView *view) +populate_servers (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GBookmarkFile *server_list; GList *children; gchar **uris; gsize num_uris; gint i; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); server_list = server_list_load (view); if (!server_list) @@ -610,14 +611,14 @@ populate_servers (GtkNautilusPlacesView *view) } static void -update_view_mode (GtkNautilusPlacesView *view) +update_view_mode (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GList *children; GList *l; gboolean show_listbox; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); show_listbox = FALSE; /* drives */ @@ -648,17 +649,17 @@ update_view_mode (GtkNautilusPlacesView *view) } static void -insert_row (GtkNautilusPlacesView *view, +insert_row (NautilusGtkPlacesView *view, GtkWidget *row, gboolean is_network) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); g_object_set_data (G_OBJECT (row), "is-network", GINT_TO_POINTER (is_network)); - g_signal_connect_swapped (gtk_nautilus_places_view_row_get_event_box (GTK_NAUTILUS_PLACES_VIEW_ROW (row)), + g_signal_connect_swapped (nautilus_gtk_places_view_row_get_event_box (NAUTILUS_GTK_PLACES_VIEW_ROW (row)), "button-press-event", G_CALLBACK (on_button_press_event), row); @@ -668,19 +669,19 @@ insert_row (GtkNautilusPlacesView *view, G_CALLBACK (on_row_popup_menu), row); - g_signal_connect (gtk_nautilus_places_view_row_get_eject_button (GTK_NAUTILUS_PLACES_VIEW_ROW (row)), + g_signal_connect (nautilus_gtk_places_view_row_get_eject_button (NAUTILUS_GTK_PLACES_VIEW_ROW (row)), "clicked", G_CALLBACK (on_eject_button_clicked), row); - gtk_nautilus_places_view_row_set_path_size_group (GTK_NAUTILUS_PLACES_VIEW_ROW (row), priv->path_size_group); - gtk_nautilus_places_view_row_set_space_size_group (GTK_NAUTILUS_PLACES_VIEW_ROW (row), priv->space_size_group); + nautilus_gtk_places_view_row_set_path_size_group (NAUTILUS_GTK_PLACES_VIEW_ROW (row), priv->path_size_group); + nautilus_gtk_places_view_row_set_space_size_group (NAUTILUS_GTK_PLACES_VIEW_ROW (row), priv->space_size_group); gtk_container_add (GTK_CONTAINER (priv->listbox), row); } static void -add_volume (GtkNautilusPlacesView *view, +add_volume (NautilusGtkPlacesView *view, GVolume *volume) { gboolean is_network; @@ -708,7 +709,7 @@ add_volume (GtkNautilusPlacesView *view, { GtkWidget *row; - row = g_object_new (GTK_TYPE_NAUTILUS_PLACES_VIEW_ROW, + row = g_object_new (NAUTILUS_TYPE_GTK_PLACES_VIEW_ROW, "icon", icon, "name", name, "path", path ? path : "", @@ -730,7 +731,7 @@ add_volume (GtkNautilusPlacesView *view, } static void -add_mount (GtkNautilusPlacesView *view, +add_mount (NautilusGtkPlacesView *view, GMount *mount) { gboolean is_network; @@ -756,7 +757,7 @@ add_mount (GtkNautilusPlacesView *view, { GtkWidget *row; - row = g_object_new (GTK_TYPE_NAUTILUS_PLACES_VIEW_ROW, + row = g_object_new (NAUTILUS_TYPE_GTK_PLACES_VIEW_ROW, "icon", icon, "name", name, "path", path ? path : "", @@ -778,7 +779,7 @@ add_mount (GtkNautilusPlacesView *view, } static void -add_drive (GtkNautilusPlacesView *view, +add_drive (NautilusGtkPlacesView *view, GDrive *drive) { GList *volumes; @@ -793,7 +794,7 @@ add_drive (GtkNautilusPlacesView *view, } static void -add_file (GtkNautilusPlacesView *view, +add_file (NautilusGtkPlacesView *view, GFile *file, GIcon *icon, const gchar *display_name, @@ -801,7 +802,7 @@ add_file (GtkNautilusPlacesView *view, gboolean is_network) { GtkWidget *row; - row = g_object_new (GTK_TYPE_NAUTILUS_PLACES_VIEW_ROW, + row = g_object_new (NAUTILUS_TYPE_GTK_PLACES_VIEW_ROW, "icon", icon, "name", display_name, "path", path, @@ -815,14 +816,14 @@ add_file (GtkNautilusPlacesView *view, } static gboolean -has_networks (GtkNautilusPlacesView *view) +has_networks (NautilusGtkPlacesView *view) { GList *l; - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GList *children; gboolean has_network = FALSE; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); children = gtk_container_get_children (GTK_CONTAINER (priv->listbox)); for (l = children; l != NULL; l = l->next) @@ -841,11 +842,11 @@ has_networks (GtkNautilusPlacesView *view) } static void -update_network_state (GtkNautilusPlacesView *view) +update_network_state (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); if (priv->network_placeholder == NULL) { @@ -868,7 +869,7 @@ update_network_state (GtkNautilusPlacesView *view) gtk_container_add (GTK_CONTAINER (priv->listbox), priv->network_placeholder); } - if (gtk_nautilus_places_view_get_fetching_networks (view)) + if (nautilus_gtk_places_view_get_fetching_networks (view)) { /* only show a placeholder with a message if the list is empty. * otherwise just show the spinner in the header */ @@ -892,7 +893,7 @@ update_network_state (GtkNautilusPlacesView *view) } static void -populate_networks (GtkNautilusPlacesView *view, +populate_networks (NautilusGtkPlacesView *view, GFileEnumerator *enumerator, GList *detected_networks) { @@ -930,13 +931,13 @@ network_enumeration_next_files_finished (GObject *source_object, GAsyncResult *res, gpointer user_data) { - GtkNautilusPlacesViewPrivate *priv; - GtkNautilusPlacesView *view; + NautilusGtkPlacesViewPrivate *priv; + NautilusGtkPlacesView *view; GList *detected_networks; GError *error; - view = GTK_NAUTILUS_PLACES_VIEW (user_data); - priv = gtk_nautilus_places_view_get_instance_private (view); + view = NAUTILUS_GTK_PLACES_VIEW (user_data); + priv = nautilus_gtk_places_view_get_instance_private (view); error = NULL; detected_networks = g_file_enumerator_next_files_finish (G_FILE_ENUMERATOR (source_object), @@ -951,7 +952,7 @@ network_enumeration_next_files_finished (GObject *source_object, } else { - gtk_nautilus_places_view_set_fetching_networks (view, FALSE); + nautilus_gtk_places_view_set_fetching_networks (view, FALSE); populate_networks (view, G_FILE_ENUMERATOR (source_object), detected_networks); g_list_free_full (detected_networks, g_object_unref); @@ -970,7 +971,7 @@ network_enumeration_finished (GObject *source_object, GAsyncResult *res, gpointer user_data) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GFileEnumerator *enumerator; GError *error; @@ -987,7 +988,7 @@ network_enumeration_finished (GObject *source_object, } else { - priv = gtk_nautilus_places_view_get_instance_private (GTK_NAUTILUS_PLACES_VIEW (user_data)); + priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (user_data)); g_file_enumerator_next_files_async (enumerator, G_MAXINT32, G_PRIORITY_DEFAULT, @@ -998,18 +999,18 @@ network_enumeration_finished (GObject *source_object, } static void -fetch_networks (GtkNautilusPlacesView *view) +fetch_networks (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GFile *network_file; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); network_file = g_file_new_for_uri ("network:///"); g_cancellable_cancel (priv->networks_fetching_cancellable); g_clear_object (&priv->networks_fetching_cancellable); priv->networks_fetching_cancellable = g_cancellable_new (); - gtk_nautilus_places_view_set_fetching_networks (view, TRUE); + nautilus_gtk_places_view_set_fetching_networks (view, TRUE); update_network_state (view); g_file_enumerate_children_async (network_file, @@ -1024,9 +1025,9 @@ fetch_networks (GtkNautilusPlacesView *view) } static void -update_places (GtkNautilusPlacesView *view) +update_places (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GList *children; GList *mounts; GList *volumes; @@ -1035,14 +1036,14 @@ update_places (GtkNautilusPlacesView *view) GIcon *icon; GFile *file; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); /* Clear all previously added items */ children = gtk_container_get_children (GTK_CONTAINER (priv->listbox)); g_list_free_full (children, (GDestroyNotify) gtk_widget_destroy); priv->network_placeholder = NULL; /* Inform clients that we started loading */ - gtk_nautilus_places_view_set_loading (view, TRUE); + nautilus_gtk_places_view_set_loading (view, TRUE); /* Add "Computer" row */ file = g_file_new_for_path ("/"); @@ -1116,7 +1117,7 @@ update_places (GtkNautilusPlacesView *view) populate_servers (view); /* fetch networks and add them asynchronously */ - if (!gtk_nautilus_places_view_get_local_only (view)) + if (!nautilus_gtk_places_view_get_local_only (view)) fetch_networks (view); update_view_mode (view); @@ -1129,8 +1130,8 @@ server_mount_ready_cb (GObject *source_file, GAsyncResult *res, gpointer user_data) { - GtkNautilusPlacesViewPrivate *priv; - GtkNautilusPlacesView *view; + NautilusGtkPlacesViewPrivate *priv; + NautilusGtkPlacesView *view; gboolean should_show; GError *error; GFile *location; @@ -1156,7 +1157,7 @@ server_mount_ready_cb (GObject *source_file, (error->code != G_IO_ERROR_CANCELLED && error->code != G_IO_ERROR_FAILED_HANDLED)) { - view = GTK_NAUTILUS_PLACES_VIEW (user_data); + view = NAUTILUS_GTK_PLACES_VIEW (user_data); /* if it wasn't cancelled show a dialog */ emit_show_error_message (view, _("Unable to access location"), error->message); should_show = FALSE; @@ -1170,15 +1171,14 @@ server_mount_ready_cb (GObject *source_file, g_clear_error (&error); } - view = GTK_NAUTILUS_PLACES_VIEW (user_data); - priv = gtk_nautilus_places_view_get_instance_private (view); + view = NAUTILUS_GTK_PLACES_VIEW (user_data); + priv = nautilus_gtk_places_view_get_instance_private (view); priv->should_pulse_entry = FALSE; /* Restore from Cancel to Connect */ gtk_button_set_label (GTK_BUTTON (priv->connect_button), _("Con_nect")); gtk_widget_set_sensitive (priv->address_entry, TRUE); priv->connecting_to_server = FALSE; - update_loading (view); if (should_show) { @@ -1192,25 +1192,9 @@ server_mount_ready_cb (GObject *source_file, gtk_entry_set_text (GTK_ENTRY (priv->address_entry), ""); if (priv->should_open_location) - { - GMount *mount_point; - GError *error; - - error = NULL; - mount_point = g_file_find_enclosing_mount (location, NULL, &error); - - if (error) - { - emit_show_error_message (view, _("Unable to access location"), error->message); - g_clear_error (&error); - goto out; - } - - emit_open_location (view, location, priv->open_flags); - } + emit_open_location (view, location, priv->open_flags); } -out: update_places (view); } @@ -1219,8 +1203,8 @@ volume_mount_ready_cb (GObject *source_volume, GAsyncResult *res, gpointer user_data) { - GtkNautilusPlacesViewPrivate *priv; - GtkNautilusPlacesView *view; + NautilusGtkPlacesViewPrivate *priv; + NautilusGtkPlacesView *view; gboolean should_show; GVolume *volume; GError *error; @@ -1248,7 +1232,7 @@ volume_mount_ready_cb (GObject *source_volume, error->code != G_IO_ERROR_FAILED_HANDLED)) { /* if it wasn't cancelled show a dialog */ - emit_show_error_message (GTK_NAUTILUS_PLACES_VIEW (user_data), _("Unable to access location"), error->message); + emit_show_error_message (NAUTILUS_GTK_PLACES_VIEW (user_data), _("Unable to access location"), error->message); should_show = FALSE; } else @@ -1261,8 +1245,8 @@ volume_mount_ready_cb (GObject *source_volume, g_clear_error (&error); } - view = GTK_NAUTILUS_PLACES_VIEW (user_data); - priv = gtk_nautilus_places_view_get_instance_private (view); + view = NAUTILUS_GTK_PLACES_VIEW (user_data); + priv = nautilus_gtk_places_view_get_instance_private (view); priv->mounting_volume = FALSE; update_loading (view); @@ -1275,7 +1259,7 @@ volume_mount_ready_cb (GObject *source_volume, root = g_mount_get_default_location (mount); if (priv->should_open_location) - emit_open_location (GTK_NAUTILUS_PLACES_VIEW (user_data), root, priv->open_flags); + emit_open_location (NAUTILUS_GTK_PLACES_VIEW (user_data), root, priv->open_flags); g_object_unref (mount); g_object_unref (root); @@ -1289,16 +1273,16 @@ unmount_ready_cb (GObject *source_mount, GAsyncResult *res, gpointer user_data) { - GtkNautilusPlacesView *view; - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesView *view; + NautilusGtkPlacesViewPrivate *priv; GMount *mount; GError *error; - view = GTK_NAUTILUS_PLACES_VIEW (user_data); + view = NAUTILUS_GTK_PLACES_VIEW (user_data); mount = G_MOUNT (source_mount); error = NULL; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); priv->unmounting_mount = FALSE; update_loading (view); @@ -1321,9 +1305,9 @@ unmount_ready_cb (GObject *source_mount, static gboolean pulse_entry_cb (gpointer user_data) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - priv = gtk_nautilus_places_view_get_instance_private (GTK_NAUTILUS_PLACES_VIEW (user_data)); + priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (user_data)); if (priv->should_pulse_entry) { @@ -1342,14 +1326,14 @@ pulse_entry_cb (gpointer user_data) } static void -unmount_mount (GtkNautilusPlacesView *view, +unmount_mount (NautilusGtkPlacesView *view, GMount *mount) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GMountOperation *operation; GtkWidget *toplevel; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view)); operation = gtk_mount_operation_new (GTK_WINDOW (toplevel)); @@ -1371,14 +1355,14 @@ unmount_mount (GtkNautilusPlacesView *view, } static void -mount_server (GtkNautilusPlacesView *view, +mount_server (NautilusGtkPlacesView *view, GFile *location) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GMountOperation *operation; GtkWidget *toplevel; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); g_cancellable_cancel (priv->cancellable); g_clear_object (&priv->cancellable); @@ -1415,14 +1399,14 @@ mount_server (GtkNautilusPlacesView *view, } static void -mount_volume (GtkNautilusPlacesView *view, +mount_volume (NautilusGtkPlacesView *view, GVolume *volume) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GMountOperation *operation; GtkWidget *toplevel; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view)); operation = gtk_mount_operation_new (GTK_WINDOW (toplevel)); @@ -1451,27 +1435,27 @@ static void popup_menu_detach_cb (GtkWidget *attach_widget, GtkMenu *menu) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - priv = gtk_nautilus_places_view_get_instance_private (GTK_NAUTILUS_PLACES_VIEW (attach_widget)); + priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (attach_widget)); priv->popup_menu = NULL; } static void -get_view_and_file (GtkNautilusPlacesViewRow *row, +get_view_and_file (NautilusGtkPlacesViewRow *row, GtkWidget **view, GFile **file) { if (view) - *view = gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_NAUTILUS_PLACES_VIEW); + *view = gtk_widget_get_ancestor (GTK_WIDGET (row), NAUTILUS_TYPE_GTK_PLACES_VIEW); if (file) { GVolume *volume; GMount *mount; - volume = gtk_nautilus_places_view_row_get_volume (row); - mount = gtk_nautilus_places_view_row_get_mount (row); + volume = nautilus_gtk_places_view_row_get_volume (row); + mount = nautilus_gtk_places_view_row_get_mount (row); if (mount) *file = g_mount_get_default_location (mount); @@ -1484,7 +1468,7 @@ get_view_and_file (GtkNautilusPlacesViewRow *row, static void open_cb (GtkMenuItem *item, - GtkNautilusPlacesViewRow *row) + NautilusGtkPlacesViewRow *row) { GtkWidget *view; GFile *file; @@ -1492,14 +1476,14 @@ open_cb (GtkMenuItem *item, get_view_and_file (row, &view, &file); if (file) - emit_open_location (GTK_NAUTILUS_PLACES_VIEW (view), file, GTK_PLACES_OPEN_NORMAL); + emit_open_location (NAUTILUS_GTK_PLACES_VIEW (view), file, GTK_PLACES_OPEN_NORMAL); g_clear_object (&file); } static void open_in_new_tab_cb (GtkMenuItem *item, - GtkNautilusPlacesViewRow *row) + NautilusGtkPlacesViewRow *row) { GtkWidget *view; GFile *file; @@ -1507,14 +1491,14 @@ open_in_new_tab_cb (GtkMenuItem *item, get_view_and_file (row, &view, &file); if (file) - emit_open_location (GTK_NAUTILUS_PLACES_VIEW (view), file, GTK_PLACES_OPEN_NEW_TAB); + emit_open_location (NAUTILUS_GTK_PLACES_VIEW (view), file, GTK_PLACES_OPEN_NEW_TAB); g_clear_object (&file); } static void open_in_new_window_cb (GtkMenuItem *item, - GtkNautilusPlacesViewRow *row) + NautilusGtkPlacesViewRow *row) { GtkWidget *view; GFile *file; @@ -1522,22 +1506,22 @@ open_in_new_window_cb (GtkMenuItem *item, get_view_and_file (row, &view, &file); if (file) - emit_open_location (GTK_NAUTILUS_PLACES_VIEW (view), file, GTK_PLACES_OPEN_NEW_WINDOW); + emit_open_location (NAUTILUS_GTK_PLACES_VIEW (view), file, GTK_PLACES_OPEN_NEW_WINDOW); g_clear_object (&file); } static void mount_cb (GtkMenuItem *item, - GtkNautilusPlacesViewRow *row) + NautilusGtkPlacesViewRow *row) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GtkWidget *view; GVolume *volume; - view = gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_NAUTILUS_PLACES_VIEW); - priv = gtk_nautilus_places_view_get_instance_private (GTK_NAUTILUS_PLACES_VIEW (view)); - volume = gtk_nautilus_places_view_row_get_volume (row); + view = gtk_widget_get_ancestor (GTK_WIDGET (row), NAUTILUS_TYPE_GTK_PLACES_VIEW); + priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (view)); + volume = nautilus_gtk_places_view_row_get_volume (row); /* * When the mount item is activated, it's expected that @@ -1546,40 +1530,40 @@ mount_cb (GtkMenuItem *item, */ priv->should_open_location = FALSE; - gtk_nautilus_places_view_row_set_busy (row, TRUE); - mount_volume (GTK_NAUTILUS_PLACES_VIEW (view), volume); + nautilus_gtk_places_view_row_set_busy (row, TRUE); + mount_volume (NAUTILUS_GTK_PLACES_VIEW (view), volume); } static void unmount_cb (GtkMenuItem *item, - GtkNautilusPlacesViewRow *row) + NautilusGtkPlacesViewRow *row) { GtkWidget *view; GMount *mount; - view = gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_NAUTILUS_PLACES_VIEW); - mount = gtk_nautilus_places_view_row_get_mount (row); + view = gtk_widget_get_ancestor (GTK_WIDGET (row), NAUTILUS_TYPE_GTK_PLACES_VIEW); + mount = nautilus_gtk_places_view_row_get_mount (row); - gtk_nautilus_places_view_row_set_busy (row, TRUE); + nautilus_gtk_places_view_row_set_busy (row, TRUE); - unmount_mount (GTK_NAUTILUS_PLACES_VIEW (view), mount); + unmount_mount (NAUTILUS_GTK_PLACES_VIEW (view), mount); } /* Constructs the popup menu if needed */ static void -build_popup_menu (GtkNautilusPlacesView *view, - GtkNautilusPlacesViewRow *row) +build_popup_menu (NautilusGtkPlacesView *view, + NautilusGtkPlacesViewRow *row) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GtkWidget *item; GMount *mount; GFile *file; gboolean is_network; - priv = gtk_nautilus_places_view_get_instance_private (view); - mount = gtk_nautilus_places_view_row_get_mount (row); - file = gtk_nautilus_places_view_row_get_file (row); - is_network = gtk_nautilus_places_view_row_get_is_network (row); + priv = nautilus_gtk_places_view_get_instance_private (view); + mount = nautilus_gtk_places_view_row_get_mount (row); + file = nautilus_gtk_places_view_row_get_file (row); + is_network = nautilus_gtk_places_view_row_get_is_network (row); priv->popup_menu = gtk_menu_new (); gtk_style_context_add_class (gtk_widget_get_style_context (priv->popup_menu), @@ -1656,19 +1640,19 @@ build_popup_menu (GtkNautilusPlacesView *view, } static void -popup_menu (GtkNautilusPlacesViewRow *row, +popup_menu (NautilusGtkPlacesViewRow *row, GdkEventButton *event) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; GtkWidget *view; gint button; - view = gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_NAUTILUS_PLACES_VIEW); - priv = gtk_nautilus_places_view_get_instance_private (GTK_NAUTILUS_PLACES_VIEW (view)); + view = gtk_widget_get_ancestor (GTK_WIDGET (row), NAUTILUS_TYPE_GTK_PLACES_VIEW); + priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (view)); g_clear_pointer (&priv->popup_menu, gtk_widget_destroy); - build_popup_menu (GTK_NAUTILUS_PLACES_VIEW (view), row); + build_popup_menu (NAUTILUS_GTK_PLACES_VIEW (view), row); /* The event button needs to be 0 if we're popping up this menu from * a button release, else a 2nd click outside the menu with any button @@ -1697,14 +1681,14 @@ popup_menu (GtkNautilusPlacesViewRow *row, } static gboolean -on_row_popup_menu (GtkNautilusPlacesViewRow *row) +on_row_popup_menu (NautilusGtkPlacesViewRow *row) { popup_menu (row, NULL); return TRUE; } static gboolean -on_button_press_event (GtkNautilusPlacesViewRow *row, +on_button_press_event (NautilusGtkPlacesViewRow *row, GdkEventButton *event) { if (row && @@ -1722,11 +1706,11 @@ on_button_press_event (GtkNautilusPlacesViewRow *row, static gboolean on_key_press_event (GtkWidget *widget, GdkEventKey *event, - GtkNautilusPlacesView *view) + NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); if (event) { @@ -1750,7 +1734,7 @@ on_key_press_event (GtkWidget *widget, focus_widget = gtk_window_get_focus (toplevel); - if (!GTK_IS_NAUTILUS_PLACES_VIEW_ROW (focus_widget)) + if (!GTK_IS_PLACES_VIEW_ROW (focus_widget)) return FALSE; if ((event->state & modifiers) == GDK_SHIFT_MASK) @@ -1758,7 +1742,7 @@ on_key_press_event (GtkWidget *widget, else if ((event->state & modifiers) == GDK_CONTROL_MASK) priv->current_open_flags = GTK_PLACES_OPEN_NEW_WINDOW; - activate_row (view, GTK_NAUTILUS_PLACES_VIEW_ROW (focus_widget), priv->current_open_flags); + activate_row (view, NAUTILUS_GTK_PLACES_VIEW_ROW (focus_widget), priv->current_open_flags); return TRUE; } @@ -1769,24 +1753,24 @@ on_key_press_event (GtkWidget *widget, static void on_eject_button_clicked (GtkWidget *widget, - GtkNautilusPlacesViewRow *row) + NautilusGtkPlacesViewRow *row) { if (row) { - GtkWidget *view = gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_NAUTILUS_PLACES_VIEW); + GtkWidget *view = gtk_widget_get_ancestor (GTK_WIDGET (row), NAUTILUS_TYPE_GTK_PLACES_VIEW); - unmount_mount (GTK_NAUTILUS_PLACES_VIEW (view), gtk_nautilus_places_view_row_get_mount (row)); + unmount_mount (NAUTILUS_GTK_PLACES_VIEW (view), nautilus_gtk_places_view_row_get_mount (row)); } } static void -on_connect_button_clicked (GtkNautilusPlacesView *view) +on_connect_button_clicked (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; const gchar *uri; GFile *file; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); file = NULL; /* @@ -1815,14 +1799,14 @@ on_connect_button_clicked (GtkNautilusPlacesView *view) } static void -on_address_entry_text_changed (GtkNautilusPlacesView *view) +on_address_entry_text_changed (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; const gchar* const *supported_protocols; gchar *address, *scheme; gboolean supported; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); supported = FALSE; supported_protocols = g_vfs_get_supported_uri_schemes (g_vfs_get_default ()); address = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->address_entry))); @@ -1853,7 +1837,7 @@ out: } static void -on_address_entry_clear_pressed (GtkNautilusPlacesView *view, +on_address_entry_clear_pressed (NautilusGtkPlacesView *view, GtkEntryIconPosition icon_pos, GdkEvent *event, GtkEntry *entry) @@ -1862,14 +1846,14 @@ on_address_entry_clear_pressed (GtkNautilusPlacesView *view, } static void -on_recent_servers_listbox_row_activated (GtkNautilusPlacesView *view, - GtkNautilusPlacesViewRow *row, +on_recent_servers_listbox_row_activated (NautilusGtkPlacesView *view, + NautilusGtkPlacesViewRow *row, GtkWidget *listbox) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; gchar *uri; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); uri = g_object_get_data (G_OBJECT (row), "uri"); gtk_entry_set_text (GTK_ENTRY (priv->address_entry), uri); @@ -1878,13 +1862,13 @@ on_recent_servers_listbox_row_activated (GtkNautilusPlacesView *view, } static void -on_listbox_row_activated (GtkNautilusPlacesView *view, - GtkNautilusPlacesViewRow *row, +on_listbox_row_activated (NautilusGtkPlacesView *view, + NautilusGtkPlacesViewRow *row, GtkWidget *listbox) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); activate_row (view, row, priv->current_open_flags); } @@ -1893,7 +1877,7 @@ static gboolean listbox_filter_func (GtkListBoxRow *row, gpointer user_data) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; gboolean is_network; gboolean is_placeholder; gboolean retval; @@ -1901,7 +1885,7 @@ listbox_filter_func (GtkListBoxRow *row, gchar *name; gchar *path; - priv = gtk_nautilus_places_view_get_instance_private (GTK_NAUTILUS_PLACES_VIEW (user_data)); + priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (user_data)); retval = FALSE; searching = priv->search_query && priv->search_query[0] != '\0'; @@ -1990,7 +1974,7 @@ listbox_header_func (GtkListBoxRow *row, g_object_set (network_header_spinner, "margin-end", 12, NULL); - g_object_bind_property (GTK_NAUTILUS_PLACES_VIEW (user_data), + g_object_bind_property (NAUTILUS_GTK_PLACES_VIEW (user_data), "fetching-networks", network_header_spinner, "active", @@ -2066,13 +2050,13 @@ listbox_sort_func (GtkListBoxRow *row1, } static void -gtk_nautilus_places_view_constructed (GObject *object) +nautilus_gtk_places_view_constructed (GObject *object) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - priv = gtk_nautilus_places_view_get_instance_private (GTK_NAUTILUS_PLACES_VIEW (object)); + priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (object)); - G_OBJECT_CLASS (gtk_nautilus_places_view_parent_class)->constructed (object); + G_OBJECT_CLASS (nautilus_gtk_places_view_parent_class)->constructed (object); gtk_list_box_set_sort_func (GTK_LIST_BOX (priv->listbox), listbox_sort_func, @@ -2088,7 +2072,7 @@ gtk_nautilus_places_view_constructed (GObject *object) NULL); /* load drives */ - update_places (GTK_NAUTILUS_PLACES_VIEW (object)); + update_places (NAUTILUS_GTK_PLACES_VIEW (object)); g_signal_connect_swapped (priv->volume_monitor, "mount-added", @@ -2117,32 +2101,32 @@ gtk_nautilus_places_view_constructed (GObject *object) } static void -gtk_nautilus_places_view_map (GtkWidget *widget) +nautilus_gtk_places_view_map (GtkWidget *widget) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - priv = gtk_nautilus_places_view_get_instance_private (GTK_NAUTILUS_PLACES_VIEW (widget)); + priv = nautilus_gtk_places_view_get_instance_private (NAUTILUS_GTK_PLACES_VIEW (widget)); gtk_entry_set_text (GTK_ENTRY (priv->address_entry), ""); - GTK_WIDGET_CLASS (gtk_nautilus_places_view_parent_class)->map (widget); + GTK_WIDGET_CLASS (nautilus_gtk_places_view_parent_class)->map (widget); } static void -gtk_nautilus_places_view_class_init (GtkNautilusPlacesViewClass *klass) +nautilus_gtk_places_view_class_init (NautilusGtkPlacesViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - object_class->finalize = gtk_nautilus_places_view_finalize; - object_class->constructed = gtk_nautilus_places_view_constructed; - object_class->get_property = gtk_nautilus_places_view_get_property; - object_class->set_property = gtk_nautilus_places_view_set_property; + object_class->finalize = nautilus_gtk_places_view_finalize; + object_class->constructed = nautilus_gtk_places_view_constructed; + object_class->get_property = nautilus_gtk_places_view_get_property; + object_class->set_property = nautilus_gtk_places_view_set_property; - widget_class->map = gtk_nautilus_places_view_map; + widget_class->map = nautilus_gtk_places_view_map; /** - * GtkNautilusPlacesView::open-location: + * NautilusGtkPlacesView::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 @@ -2155,18 +2139,18 @@ gtk_nautilus_places_view_class_init (GtkNautilusPlacesViewClass *klass) * * Since: 3.18 */ - nautilus_places_view_signals [OPEN_LOCATION] = + places_view_signals [OPEN_LOCATION] = g_signal_new ("open-location", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GtkNautilusPlacesViewClass, open_location), + G_STRUCT_OFFSET (NautilusGtkPlacesViewClass, open_location), NULL, NULL, NULL, G_TYPE_NONE, 2, G_TYPE_OBJECT, GTK_TYPE_PLACES_OPEN_FLAGS); /** - * GtkNautilusPlacesView::show-error-message: + * NautilusGtkPlacesView::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. @@ -2178,11 +2162,11 @@ gtk_nautilus_places_view_class_init (GtkNautilusPlacesViewClass *klass) * * Since: 3.18 */ - nautilus_places_view_signals [SHOW_ERROR_MESSAGE] = + places_view_signals [SHOW_ERROR_MESSAGE] = g_signal_new ("show-error-message", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GtkNautilusPlacesViewClass, show_error_message), + G_STRUCT_OFFSET (NautilusGtkPlacesViewClass, show_error_message), NULL, NULL, NULL, G_TYPE_NONE, 2, @@ -2221,18 +2205,18 @@ gtk_nautilus_places_view_class_init (GtkNautilusPlacesViewClass *klass) g_object_class_install_properties (object_class, LAST_PROP, properties); /* Bind class to template */ - gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/nautilus/gtk/gtkplacesview.ui"); - - gtk_widget_class_bind_template_child_private (widget_class, GtkNautilusPlacesView, actionbar); - gtk_widget_class_bind_template_child_private (widget_class, GtkNautilusPlacesView, address_entry); - gtk_widget_class_bind_template_child_private (widget_class, GtkNautilusPlacesView, address_entry_completion); - gtk_widget_class_bind_template_child_private (widget_class, GtkNautilusPlacesView, completion_store); - gtk_widget_class_bind_template_child_private (widget_class, GtkNautilusPlacesView, connect_button); - gtk_widget_class_bind_template_child_private (widget_class, GtkNautilusPlacesView, listbox); - gtk_widget_class_bind_template_child_private (widget_class, GtkNautilusPlacesView, recent_servers_listbox); - gtk_widget_class_bind_template_child_private (widget_class, GtkNautilusPlacesView, recent_servers_popover); - gtk_widget_class_bind_template_child_private (widget_class, GtkNautilusPlacesView, recent_servers_stack); - gtk_widget_class_bind_template_child_private (widget_class, GtkNautilusPlacesView, stack); + gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/ui/nautilusgtkplacesview.ui"); + + gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, actionbar); + gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, address_entry); + gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, address_entry_completion); + gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, completion_store); + gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, connect_button); + gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, listbox); + gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, recent_servers_listbox); + gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, recent_servers_popover); + gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, recent_servers_stack); + gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, stack); gtk_widget_class_bind_template_callback (widget_class, on_address_entry_text_changed); gtk_widget_class_bind_template_callback (widget_class, on_address_entry_clear_pressed); @@ -2245,11 +2229,11 @@ gtk_nautilus_places_view_class_init (GtkNautilusPlacesViewClass *klass) } static void -gtk_nautilus_places_view_init (GtkNautilusPlacesView *self) +nautilus_gtk_places_view_init (NautilusGtkPlacesView *self) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - priv = gtk_nautilus_places_view_get_instance_private (self); + priv = nautilus_gtk_places_view_get_instance_private (self); priv->volume_monitor = g_volume_monitor_get (); priv->open_flags = GTK_PLACES_OPEN_NORMAL; @@ -2260,27 +2244,27 @@ gtk_nautilus_places_view_init (GtkNautilusPlacesView *self) } /** - * gtk_nautilus_places_view_new: + * nautilus_gtk_places_view_new: * - * Creates a new #GtkNautilusPlacesView widget. + * Creates a new #NautilusGtkPlacesView widget. * * The application should connect to at least the - * #GtkNautilusPlacesView::open-location signal to be notified + * #NautilusGtkPlacesView::open-location signal to be notified * when the user makes a selection in the view. * - * Returns: a newly created #GtkNautilusPlacesView + * Returns: a newly created #NautilusGtkPlacesView * * Since: 3.18 */ GtkWidget * -gtk_nautilus_places_view_new (void) +nautilus_gtk_places_view_new (void) { - return g_object_new (GTK_TYPE_NAUTILUS_PLACES_VIEW, NULL); + return g_object_new (NAUTILUS_TYPE_GTK_PLACES_VIEW, NULL); } /** - * gtk_nautilus_places_view_set_open_flags: - * @view: a #GtkNautilusPlacesView + * nautilus_gtk_places_view_set_open_flags: + * @view: a #NautilusGtkPlacesView * @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 @@ -2292,9 +2276,9 @@ gtk_nautilus_places_view_new (void) * 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 #GtkNautilusPlacesView::open-location signal is emitted, its flags + * When the #NautilusGtkPlacesView::open-location signal is emitted, its flags * argument will be set to one of the @flags that was passed in - * gtk_nautilus_places_view_set_open_flags(). + * nautilus_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. @@ -2302,14 +2286,14 @@ gtk_nautilus_places_view_new (void) * Since: 3.18 */ void -gtk_nautilus_places_view_set_open_flags (GtkNautilusPlacesView *view, +nautilus_gtk_places_view_set_open_flags (NautilusGtkPlacesView *view, GtkPlacesOpenFlags flags) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - g_return_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW (view)); + g_return_if_fail (GTK_IS_PLACES_VIEW (view)); - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); if (priv->open_flags != flags) { @@ -2319,7 +2303,7 @@ gtk_nautilus_places_view_set_open_flags (GtkNautilusPlacesView *view, } /** - * gtk_nautilus_places_view_get_open_flags: + * nautilus_gtk_places_view_get_open_flags: * @view: a #GtkPlacesSidebar * * Gets the open flags. @@ -2329,54 +2313,54 @@ gtk_nautilus_places_view_set_open_flags (GtkNautilusPlacesView *view, * Since: 3.18 */ GtkPlacesOpenFlags -gtk_nautilus_places_view_get_open_flags (GtkNautilusPlacesView *view) +nautilus_gtk_places_view_get_open_flags (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - g_return_val_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW (view), 0); + g_return_val_if_fail (GTK_IS_PLACES_VIEW (view), 0); - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); return priv->open_flags; } /** - * gtk_nautilus_places_view_get_search_query: - * @view: a #GtkNautilusPlacesView + * nautilus_gtk_places_view_get_search_query: + * @view: a #NautilusGtkPlacesView * * Retrieves the current search query from @view. * * Returns: (transfer none): the current search query. */ const gchar* -gtk_nautilus_places_view_get_search_query (GtkNautilusPlacesView *view) +nautilus_gtk_places_view_get_search_query (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - g_return_val_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW (view), NULL); + g_return_val_if_fail (GTK_IS_PLACES_VIEW (view), NULL); - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); return priv->search_query; } /** - * gtk_nautilus_places_view_set_search_query: - * @view: a #GtkNautilusPlacesView + * nautilus_gtk_places_view_set_search_query: + * @view: a #NautilusGtkPlacesView * @query_text: the query, or NULL. * * Sets the search query of @view. The search is immediately performed * once the query is set. */ void -gtk_nautilus_places_view_set_search_query (GtkNautilusPlacesView *view, +nautilus_gtk_places_view_set_search_query (NautilusGtkPlacesView *view, const gchar *query_text) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - g_return_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW (view)); + g_return_if_fail (GTK_IS_PLACES_VIEW (view)); - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); if (g_strcmp0 (priv->search_query, query_text) != 0) { @@ -2391,50 +2375,50 @@ gtk_nautilus_places_view_set_search_query (GtkNautilusPlacesView *view, } /** - * gtk_nautilus_places_view_get_loading: - * @view: a #GtkNautilusPlacesView + * nautilus_gtk_places_view_get_loading: + * @view: a #NautilusGtkPlacesView * * Returns %TRUE if the view is loading locations. * * Since: 3.18 */ gboolean -gtk_nautilus_places_view_get_loading (GtkNautilusPlacesView *view) +nautilus_gtk_places_view_get_loading (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - g_return_val_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW (view), FALSE); + g_return_val_if_fail (GTK_IS_PLACES_VIEW (view), FALSE); - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); return priv->loading; } static void -update_loading (GtkNautilusPlacesView *view) +update_loading (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; gboolean loading; - g_return_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW (view)); + g_return_if_fail (GTK_IS_PLACES_VIEW (view)); - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); loading = priv->fetching_networks || priv->connecting_to_server || priv->mounting_volume || priv->unmounting_mount; set_busy_cursor (view, loading); - gtk_nautilus_places_view_set_loading (view, loading); + nautilus_gtk_places_view_set_loading (view, loading); } static void -gtk_nautilus_places_view_set_loading (GtkNautilusPlacesView *view, +nautilus_gtk_places_view_set_loading (NautilusGtkPlacesView *view, gboolean loading) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - g_return_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW (view)); + g_return_if_fail (GTK_IS_PLACES_VIEW (view)); - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); if (priv->loading != loading) { @@ -2444,26 +2428,26 @@ gtk_nautilus_places_view_set_loading (GtkNautilusPlacesView *view, } static gboolean -gtk_nautilus_places_view_get_fetching_networks (GtkNautilusPlacesView *view) +nautilus_gtk_places_view_get_fetching_networks (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - g_return_val_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW (view), FALSE); + g_return_val_if_fail (GTK_IS_PLACES_VIEW (view), FALSE); - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); return priv->fetching_networks; } static void -gtk_nautilus_places_view_set_fetching_networks (GtkNautilusPlacesView *view, +nautilus_gtk_places_view_set_fetching_networks (NautilusGtkPlacesView *view, gboolean fetching_networks) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - g_return_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW (view)); + g_return_if_fail (GTK_IS_PLACES_VIEW (view)); - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); if (priv->fetching_networks != fetching_networks) { @@ -2473,8 +2457,8 @@ gtk_nautilus_places_view_set_fetching_networks (GtkNautilusPlacesView *view, } /** - * gtk_nautilus_places_view_get_local_only: - * @view: a #GtkNautilusPlacesView + * nautilus_gtk_places_view_get_local_only: + * @view: a #NautilusGtkPlacesView * * Returns %TRUE if only local volumes are shown, i.e. no networks * are displayed. @@ -2484,35 +2468,35 @@ gtk_nautilus_places_view_set_fetching_networks (GtkNautilusPlacesView *view, * Since: 3.18 */ gboolean -gtk_nautilus_places_view_get_local_only (GtkNautilusPlacesView *view) +nautilus_gtk_places_view_get_local_only (NautilusGtkPlacesView *view) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - g_return_val_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW (view), FALSE); + g_return_val_if_fail (GTK_IS_PLACES_VIEW (view), FALSE); - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); return priv->local_only; } /** - * gtk_nautilus_places_view_set_local_only: - * @view: a #GtkNautilusPlacesView + * nautilus_gtk_places_view_set_local_only: + * @view: a #NautilusGtkPlacesView * @local_only: %TRUE to hide remote locations, %FALSE to show. * - * Sets the #GtkNautilusPlacesView::local-only property to @local_only. + * Sets the #NautilusGtkPlacesView::local-only property to @local_only. * * Since: 3.18 */ void -gtk_nautilus_places_view_set_local_only (GtkNautilusPlacesView *view, +nautilus_gtk_places_view_set_local_only (NautilusGtkPlacesView *view, gboolean local_only) { - GtkNautilusPlacesViewPrivate *priv; + NautilusGtkPlacesViewPrivate *priv; - g_return_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW (view)); + g_return_if_fail (GTK_IS_PLACES_VIEW (view)); - priv = gtk_nautilus_places_view_get_instance_private (view); + priv = nautilus_gtk_places_view_get_instance_private (view); if (priv->local_only != local_only) { diff --git a/src/gtk/gtkplacesview.ui b/src/gtk/nautilusgtkplacesview.ui index 00296eb84..5d7eb326d 100644 --- a/src/gtk/gtkplacesview.ui +++ b/src/gtk/nautilusgtkplacesview.ui @@ -1,3 +1,5 @@ +/* Do not edit: this file is generated from https://git.gnome.org/browse/gtk+/plain/gtk/ui//gtkplacesview.ui */ + <?xml version="1.0" encoding="UTF-8"?> <interface domain="gtk30"> <requires lib="gtk+" version="3.16"/> @@ -85,7 +87,7 @@ <property name="visible">1</property> <property name="can_focus">1</property> <property name="selection_mode">none</property> - <signal name="row-activated" handler="on_recent_servers_listbox_row_activated" object="GtkNautilusPlacesView" swapped="yes"/> + <signal name="row-activated" handler="on_recent_servers_listbox_row_activated" object="GtkPlacesView" swapped="yes"/> </object> </child> </object> @@ -103,11 +105,11 @@ </object> </child> </object> - <template class="GtkNautilusPlacesView" parent="GtkBox"> + <template class="GtkPlacesView" parent="GtkBox"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="orientation">vertical</property> - <signal name="key-press-event" handler="on_key_press_event" object="GtkNautilusPlacesView" swapped="no"/> + <signal name="key-press-event" handler="on_key_press_event" object="GtkPlacesView" swapped="no"/> <child> <object class="GtkStack" id="stack"> <property name="visible">1</property> @@ -131,12 +133,9 @@ <property name="visible">1</property> <property name="can_focus">1</property> <property name="selection_mode">none</property> - <signal name="row-activated" handler="on_listbox_row_activated" object="GtkNautilusPlacesView" swapped="yes"/> + <signal name="row-activated" handler="on_listbox_row_activated" object="GtkPlacesView" swapped="yes"/> </object> </child> - <style> - <class name="view"/> - </style> </object> </child> </object> @@ -206,6 +205,9 @@ <object class="GtkActionBar" id="actionbar"> <property name="visible">1</property> <property name="hexpand">1</property> + <style> + <class name="background"/> + </style> <child> <object class="GtkLabel"> <property name="visible">1</property> @@ -227,7 +229,8 @@ <property name="can_focus">1</property> <property name="sensitive">0</property> <property name="receives_default">1</property> - <signal name="clicked" handler="on_connect_button_clicked" object="GtkNautilusPlacesView" swapped="yes"/> + <property name="valign">center</property> + <signal name="clicked" handler="on_connect_button_clicked" object="GtkPlacesView" swapped="yes"/> </object> <packing> <property name="pack_type">end</property> @@ -245,9 +248,9 @@ <property name="width_chars">20</property> <property name="placeholder_text" translatable="yes">Enter server address…</property> <property name="completion">address_entry_completion</property> - <signal name="notify::text" handler="on_address_entry_text_changed" object="GtkNautilusPlacesView" swapped="yes"/> - <signal name="activate" handler="on_connect_button_clicked" object="GtkNautilusPlacesView" swapped="yes"/> - <signal name="icon-press" handler="on_address_entry_clear_pressed" object="GtkNautilusPlacesView" swapped="yes"/> + <signal name="notify::text" handler="on_address_entry_text_changed" object="GtkPlacesView" swapped="yes"/> + <signal name="activate" handler="on_connect_button_clicked" object="GtkPlacesView" swapped="yes"/> + <signal name="icon-press" handler="on_address_entry_clear_pressed" object="GtkPlacesView" swapped="yes"/> </object> </child> <child> diff --git a/src/gtk/nautilusgtkplacesviewprivate.h b/src/gtk/nautilusgtkplacesviewprivate.h new file mode 100644 index 000000000..5ac8c6e29 --- /dev/null +++ b/src/gtk/nautilusgtkplacesviewprivate.h @@ -0,0 +1,87 @@ +/* Do not edit: this file is generated from https://git.gnome.org/browse/gtk+/plain/gtk//gtkplacesviewprivate.h */ + +/* nautilusgtkplacesview.h + * + * Copyright (C) 2015 Georges Basile Stavracas Neto <georges.stavracas@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * 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 + * (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 + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef NAUTILUS_GTK_PLACES_VIEW_H +#define NAUTILUS_GTK_PLACES_VIEW_H + +#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) +#error "Only <gtk/gtk.h> can be included directly." +#endif + +#include <gtk/gtk.h> + +G_BEGIN_DECLS + +#define NAUTILUS_TYPE_GTK_PLACES_VIEW (nautilus_gtk_places_view_get_type ()) +#define NAUTILUS_GTK_PLACES_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_GTK_PLACES_VIEW, NautilusGtkPlacesView)) +#define NAUTILUS_GTK_PLACES_VIEW_CLASS(klass)(G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_GTK_PLACES_VIEW, NautilusGtkPlacesViewClass)) +#define GTK_IS_PLACES_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_GTK_PLACES_VIEW)) +#define GTK_IS_PLACES_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_GTK_PLACES_VIEW)) +#define NAUTILUS_GTK_PLACES_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_GTK_PLACES_VIEW, NautilusGtkPlacesViewClass)) + +typedef struct _NautilusGtkPlacesView NautilusGtkPlacesView; +typedef struct _NautilusGtkPlacesViewClass NautilusGtkPlacesViewClass; +typedef struct _NautilusGtkPlacesViewPrivate NautilusGtkPlacesViewPrivate; + +struct _NautilusGtkPlacesViewClass +{ + GtkBoxClass parent_class; + + void (* open_location) (NautilusGtkPlacesView *view, + GFile *location, + GtkPlacesOpenFlags open_flags); + + void (* show_error_message) (GtkPlacesSidebar *sidebar, + const gchar *primary, + const gchar *secondary); + + /*< private >*/ + + /* Padding for future expansion */ + gpointer reserved[10]; +}; + +struct _NautilusGtkPlacesView +{ + GtkBox parent_instance; +}; + +GType nautilus_gtk_places_view_get_type (void) G_GNUC_CONST; + +GtkPlacesOpenFlags nautilus_gtk_places_view_get_open_flags (NautilusGtkPlacesView *view); +void nautilus_gtk_places_view_set_open_flags (NautilusGtkPlacesView *view, + GtkPlacesOpenFlags flags); + +const gchar* nautilus_gtk_places_view_get_search_query (NautilusGtkPlacesView *view); +void nautilus_gtk_places_view_set_search_query (NautilusGtkPlacesView *view, + const gchar *query_text); + +gboolean nautilus_gtk_places_view_get_local_only (NautilusGtkPlacesView *view); + +void nautilus_gtk_places_view_set_local_only (NautilusGtkPlacesView *view, + gboolean local_only); + +gboolean nautilus_gtk_places_view_get_loading (NautilusGtkPlacesView *view); + +GtkWidget * nautilus_gtk_places_view_new (void); + +G_END_DECLS + +#endif /* NAUTILUS_GTK_PLACES_VIEW_H */ diff --git a/src/gtk/gtkplacesviewrow.c b/src/gtk/nautilusgtkplacesviewrow.c index 015d55ba3..6c308a94d 100644 --- a/src/gtk/gtkplacesviewrow.c +++ b/src/gtk/nautilusgtkplacesviewrow.c @@ -1,30 +1,46 @@ -/* gtkplacesviewrow.c +/* Do not edit: this file is generated from https://git.gnome.org/browse/gtk+/plain/gtk//gtkplacesviewrow.c */ + +/* nautilusgtkplacesviewrow.c * * Copyright (C) 2015 Georges Basile Stavracas Neto <georges.stavracas@gmail.com> * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or + * 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 * (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 - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "config.h" -#include <glib/gi18n.h> #include <gio/gio.h> -#include <gtk/gtk.h> -#include "gtkplacesviewrowprivate.h" +#include "nautilusgtkplacesviewrowprivate.h" -struct _GtkNautilusPlacesViewRow +/* As this widget is shared with Nautilus, we use this guard to + * ensure that internally we only include the files that we need + * instead of including gtk.h + */ +#ifdef GTK_COMPILATION +#include "gtkbutton.h" +#include "gtkeventbox.h" +#include "gtkimage.h" +#include "gtkintl.h" +#include "gtklabel.h" +#include "gtkspinner.h" +#include "gtktypebuiltins.h" +#else +#include <gtk/gtk.h> +#endif + +struct _NautilusGtkPlacesViewRow { GtkListBoxRow parent_instance; @@ -46,7 +62,7 @@ struct _GtkNautilusPlacesViewRow gint is_network : 1; }; -G_DEFINE_TYPE (GtkNautilusPlacesViewRow, gtk_nautilus_places_view_row, GTK_TYPE_LIST_BOX_ROW) +G_DEFINE_TYPE (NautilusGtkPlacesViewRow, nautilus_gtk_places_view_row, GTK_TYPE_LIST_BOX_ROW) enum { PROP_0, @@ -67,7 +83,7 @@ measure_available_space_finished (GObject *object, GAsyncResult *res, gpointer user_data) { - GtkNautilusPlacesViewRow *row = user_data; + NautilusGtkPlacesViewRow *row = user_data; GFileInfo *info; GError *error; guint64 free_space; @@ -75,6 +91,7 @@ measure_available_space_finished (GObject *object, gchar *formatted_free_size; gchar *formatted_total_size; gchar *label; + guint plural_form; error = NULL; @@ -106,8 +123,16 @@ measure_available_space_finished (GObject *object, formatted_free_size = g_format_size (free_space); formatted_total_size = g_format_size (total_space); - /* Translators: respectively, free and total space of the drive */ - label = g_strdup_printf (_("%s / %s available"), formatted_free_size, formatted_total_size); + + /* read g_format_size code in glib for further understanding */ + plural_form = free_space < 1000 ? free_space : free_space % 1000 + 1000; + + /* Translators: respectively, free and total space of the drive. The plural form + * should be based on the free space available. + * i.e. 1 GB / 24 GB available. + */ + label = g_strdup_printf (ngettext ("%s / %s available", "%s / %s available", plural_form), + formatted_free_size, formatted_total_size); gtk_label_set_label (row->available_space_label, label); @@ -120,7 +145,7 @@ out: } static void -measure_available_space (GtkNautilusPlacesViewRow *row) +measure_available_space (NautilusGtkPlacesViewRow *row) { gboolean should_measure; @@ -170,9 +195,9 @@ measure_available_space (GtkNautilusPlacesViewRow *row) } static void -gtk_nautilus_places_view_row_finalize (GObject *object) +nautilus_gtk_places_view_row_finalize (GObject *object) { - GtkNautilusPlacesViewRow *self = GTK_NAUTILUS_PLACES_VIEW_ROW (object); + NautilusGtkPlacesViewRow *self = NAUTILUS_GTK_PLACES_VIEW_ROW (object); g_cancellable_cancel (self->cancellable); @@ -181,19 +206,19 @@ gtk_nautilus_places_view_row_finalize (GObject *object) g_clear_object (&self->file); g_clear_object (&self->cancellable); - G_OBJECT_CLASS (gtk_nautilus_places_view_row_parent_class)->finalize (object); + G_OBJECT_CLASS (nautilus_gtk_places_view_row_parent_class)->finalize (object); } static void -gtk_nautilus_places_view_row_get_property (GObject *object, +nautilus_gtk_places_view_row_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - GtkNautilusPlacesViewRow *self; + NautilusGtkPlacesViewRow *self; GIcon *icon; - self = GTK_NAUTILUS_PLACES_VIEW_ROW (object); + self = NAUTILUS_GTK_PLACES_VIEW_ROW (object); icon = NULL; switch (prop_id) @@ -233,12 +258,12 @@ gtk_nautilus_places_view_row_get_property (GObject *object, } static void -gtk_nautilus_places_view_row_set_property (GObject *object, +nautilus_gtk_places_view_row_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - GtkNautilusPlacesViewRow *self = GTK_NAUTILUS_PLACES_VIEW_ROW (object); + NautilusGtkPlacesViewRow *self = NAUTILUS_GTK_PLACES_VIEW_ROW (object); switch (prop_id) { @@ -280,7 +305,7 @@ gtk_nautilus_places_view_row_set_property (GObject *object, break; case PROP_IS_NETWORK: - gtk_nautilus_places_view_row_set_is_network (self, g_value_get_boolean (value)); + nautilus_gtk_places_view_row_set_is_network (self, g_value_get_boolean (value)); measure_available_space (self); break; @@ -290,14 +315,14 @@ gtk_nautilus_places_view_row_set_property (GObject *object, } static void -gtk_nautilus_places_view_row_class_init (GtkNautilusPlacesViewRowClass *klass) +nautilus_gtk_places_view_row_class_init (NautilusGtkPlacesViewRowClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - object_class->finalize = gtk_nautilus_places_view_row_finalize; - object_class->get_property = gtk_nautilus_places_view_row_get_property; - object_class->set_property = gtk_nautilus_places_view_row_set_property; + object_class->finalize = nautilus_gtk_places_view_row_finalize; + object_class->get_property = nautilus_gtk_places_view_row_get_property; + object_class->set_property = nautilus_gtk_places_view_row_set_property; properties[PROP_ICON] = g_param_spec_object ("icon", @@ -350,108 +375,106 @@ gtk_nautilus_places_view_row_class_init (GtkNautilusPlacesViewRowClass *klass) g_object_class_install_properties (object_class, LAST_PROP, properties); - gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/nautilus/gtk/gtkplacesviewrow.ui"); + gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/ui/nautilusgtkplacesviewrow.ui"); - gtk_widget_class_bind_template_child (widget_class, GtkNautilusPlacesViewRow, available_space_label); - gtk_widget_class_bind_template_child (widget_class, GtkNautilusPlacesViewRow, busy_spinner); - gtk_widget_class_bind_template_child (widget_class, GtkNautilusPlacesViewRow, eject_button); - gtk_widget_class_bind_template_child (widget_class, GtkNautilusPlacesViewRow, eject_icon); - gtk_widget_class_bind_template_child (widget_class, GtkNautilusPlacesViewRow, event_box); - gtk_widget_class_bind_template_child (widget_class, GtkNautilusPlacesViewRow, icon_image); - gtk_widget_class_bind_template_child (widget_class, GtkNautilusPlacesViewRow, name_label); - gtk_widget_class_bind_template_child (widget_class, GtkNautilusPlacesViewRow, path_label); + gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, available_space_label); + gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, busy_spinner); + gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, eject_button); + gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, eject_icon); + gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, event_box); + gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, icon_image); + gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, name_label); + gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, path_label); } static void -gtk_nautilus_places_view_row_init (GtkNautilusPlacesViewRow *self) +nautilus_gtk_places_view_row_init (NautilusGtkPlacesViewRow *self) { gtk_widget_init_template (GTK_WIDGET (self)); } GtkWidget* -gtk_nautilus_places_view_row_new (GVolume *volume, +nautilus_gtk_places_view_row_new (GVolume *volume, GMount *mount) { - return g_object_new (GTK_TYPE_NAUTILUS_PLACES_VIEW_ROW, + return g_object_new (NAUTILUS_TYPE_GTK_PLACES_VIEW_ROW, "volume", volume, "mount", mount, NULL); } GMount* -gtk_nautilus_places_view_row_get_mount (GtkNautilusPlacesViewRow *row) +nautilus_gtk_places_view_row_get_mount (NautilusGtkPlacesViewRow *row) { - g_return_val_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW_ROW (row), NULL); + g_return_val_if_fail (GTK_IS_PLACES_VIEW_ROW (row), NULL); return row->mount; } GVolume* -gtk_nautilus_places_view_row_get_volume (GtkNautilusPlacesViewRow *row) +nautilus_gtk_places_view_row_get_volume (NautilusGtkPlacesViewRow *row) { - g_return_val_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW_ROW (row), NULL); + g_return_val_if_fail (GTK_IS_PLACES_VIEW_ROW (row), NULL); return row->volume; } GFile* -gtk_nautilus_places_view_row_get_file (GtkNautilusPlacesViewRow *row) +nautilus_gtk_places_view_row_get_file (NautilusGtkPlacesViewRow *row) { - g_return_val_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW_ROW (row), NULL); + g_return_val_if_fail (GTK_IS_PLACES_VIEW_ROW (row), NULL); return row->file; } GtkWidget* -gtk_nautilus_places_view_row_get_eject_button (GtkNautilusPlacesViewRow *row) +nautilus_gtk_places_view_row_get_eject_button (NautilusGtkPlacesViewRow *row) { - g_return_val_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW_ROW (row), NULL); + g_return_val_if_fail (GTK_IS_PLACES_VIEW_ROW (row), NULL); return GTK_WIDGET (row->eject_button); } GtkWidget* -gtk_nautilus_places_view_row_get_event_box (GtkNautilusPlacesViewRow *row) +nautilus_gtk_places_view_row_get_event_box (NautilusGtkPlacesViewRow *row) { - g_return_val_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW_ROW (row), NULL); + g_return_val_if_fail (GTK_IS_PLACES_VIEW_ROW (row), NULL); return GTK_WIDGET (row->event_box); } void -gtk_nautilus_places_view_row_set_busy (GtkNautilusPlacesViewRow *row, +nautilus_gtk_places_view_row_set_busy (NautilusGtkPlacesViewRow *row, gboolean is_busy) { - g_return_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW_ROW (row)); + g_return_if_fail (GTK_IS_PLACES_VIEW_ROW (row)); gtk_widget_set_visible (GTK_WIDGET (row->busy_spinner), is_busy); } gboolean -gtk_nautilus_places_view_row_get_is_network (GtkNautilusPlacesViewRow *row) +nautilus_gtk_places_view_row_get_is_network (NautilusGtkPlacesViewRow *row) { - g_return_val_if_fail (GTK_IS_NAUTILUS_PLACES_VIEW_ROW (row), FALSE); + g_return_val_if_fail (GTK_IS_PLACES_VIEW_ROW (row), FALSE); return row->is_network; } void -gtk_nautilus_places_view_row_set_is_network (GtkNautilusPlacesViewRow *row, +nautilus_gtk_places_view_row_set_is_network (NautilusGtkPlacesViewRow *row, gboolean is_network) { if (row->is_network != is_network) { row->is_network = is_network; - gtk_image_set_from_icon_name (row->eject_icon, - is_network ? "network-offline-symbolic" : "media-eject-symbolic", - GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name (row->eject_icon, "media-eject-symbolic", GTK_ICON_SIZE_BUTTON); gtk_widget_set_tooltip_text (GTK_WIDGET (row->eject_button), is_network ? _("Disconnect") : _("Unmount")); } } void -gtk_nautilus_places_view_row_set_path_size_group (GtkNautilusPlacesViewRow *row, +nautilus_gtk_places_view_row_set_path_size_group (NautilusGtkPlacesViewRow *row, GtkSizeGroup *group) { if (group) @@ -459,7 +482,7 @@ gtk_nautilus_places_view_row_set_path_size_group (GtkNautilusPlacesViewRow *row, } void -gtk_nautilus_places_view_row_set_space_size_group (GtkNautilusPlacesViewRow *row, +nautilus_gtk_places_view_row_set_space_size_group (NautilusGtkPlacesViewRow *row, GtkSizeGroup *group) { if (group) diff --git a/src/gtk/gtkplacesviewrow.ui b/src/gtk/nautilusgtkplacesviewrow.ui index 90e9ed05d..f1a78c601 100644 --- a/src/gtk/gtkplacesviewrow.ui +++ b/src/gtk/nautilusgtkplacesviewrow.ui @@ -1,49 +1,37 @@ +/* Do not edit: this file is generated from https://git.gnome.org/browse/gtk+/plain/gtk/ui//gtkplacesviewrow.ui */ + <?xml version="1.0" encoding="UTF-8"?> <interface domain="gtk30"> <requires lib="gtk+" version="3.16"/> - <template class="GtkNautilusPlacesViewRow" parent="GtkListBoxRow"> + <template class="NautilusGtkPlacesViewRow" parent="GtkListBoxRow"> <property name="width_request">100</property> <property name="visible">True</property> <property name="can_focus">True</property> - <style> - <class name="volume-row" /> - </style> <child> <object class="GtkEventBox" id="event_box"> - <property name="visible">True</property> + <property name="visible">1</property> <child> <object class="GtkBox" id="box"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="visible">1</property> <property name="margin_start">12</property> <property name="margin_end">12</property> <property name="margin_top">6</property> <property name="margin_bottom">6</property> - <property name="border_width">0</property> <property name="spacing">18</property> <child> <object class="GtkImage" id="icon_image"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="visible">1</property> <property name="pixel_size">32</property> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> </child> <child> <object class="GtkLabel" id="name_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> + <property name="visible">1</property> + <property name="hexpand">1</property> <property name="xalign">0</property> <property name="ellipsize">end</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> <property name="position">1</property> </packing> </child> @@ -61,8 +49,7 @@ </child> <child> <object class="GtkLabel" id="path_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="visible">1</property> <property name="justify">right</property> <property name="ellipsize">middle</property> <property name="xalign">0</property> @@ -72,8 +59,6 @@ </style> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> <property name="position">3</property> </packing> </child> @@ -85,7 +70,7 @@ <property name="tooltip-text" translatable="yes">Unmount</property> <child> <object class="GtkImage" id="eject_icon"> - <property name="visible">True</property> + <property name="visible">1</property> <property name="icon_name">media-eject-symbolic</property> <property name="icon_size">1</property> </object> @@ -96,20 +81,14 @@ </style> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> <property name="position">4</property> </packing> </child> <child> <object class="GtkSpinner" id="busy_spinner"> - <property name="visible">False</property> - <property name="can_focus">False</property> - <property name="active">True</property> + <property name="active">1</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> <property name="position">5</property> </packing> </child> diff --git a/src/gtk/nautilusgtkplacesviewrowprivate.h b/src/gtk/nautilusgtkplacesviewrowprivate.h new file mode 100644 index 000000000..854a712cf --- /dev/null +++ b/src/gtk/nautilusgtkplacesviewrowprivate.h @@ -0,0 +1,64 @@ +/* Do not edit: this file is generated from https://git.gnome.org/browse/gtk+/plain/gtk//gtkplacesviewrowprivate.h */ + +/* nautilusgtkplacesviewrow.h + * + * Copyright (C) 2015 Georges Basile Stavracas Neto <georges.stavracas@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * 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 + * (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 + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef NAUTILUS_GTK_PLACES_VIEW_ROW_H +#define NAUTILUS_GTK_PLACES_VIEW_ROW_H + +#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) +#endif + +#include <gtk/gtk.h> + +G_BEGIN_DECLS + +#define NAUTILUS_TYPE_GTK_PLACES_VIEW_ROW (nautilus_gtk_places_view_row_get_type()) + + G_DECLARE_FINAL_TYPE (NautilusGtkPlacesViewRow, nautilus_gtk_places_view_row, NAUTILUS, GTK_PLACES_VIEW_ROW, GtkListBoxRow) + +GtkWidget* nautilus_gtk_places_view_row_new (GVolume *volume, + GMount *mount); + +GtkWidget* nautilus_gtk_places_view_row_get_eject_button (NautilusGtkPlacesViewRow *row); + +GtkWidget* nautilus_gtk_places_view_row_get_event_box (NautilusGtkPlacesViewRow *row); + +GMount* nautilus_gtk_places_view_row_get_mount (NautilusGtkPlacesViewRow *row); + +GVolume* nautilus_gtk_places_view_row_get_volume (NautilusGtkPlacesViewRow *row); + +GFile* nautilus_gtk_places_view_row_get_file (NautilusGtkPlacesViewRow *row); + +void nautilus_gtk_places_view_row_set_busy (NautilusGtkPlacesViewRow *row, + gboolean is_busy); + +gboolean nautilus_gtk_places_view_row_get_is_network (NautilusGtkPlacesViewRow *row); + +void nautilus_gtk_places_view_row_set_is_network (NautilusGtkPlacesViewRow *row, + gboolean is_network); + +void nautilus_gtk_places_view_row_set_path_size_group (NautilusGtkPlacesViewRow *row, + GtkSizeGroup *group); + +void nautilus_gtk_places_view_row_set_space_size_group (NautilusGtkPlacesViewRow *row, + GtkSizeGroup *group); + +G_END_DECLS + +#endif /* NAUTILUS_GTK_PLACES_VIEW_ROW_H */ diff --git a/src/gtk/symbolconverter.sh b/src/gtk/symbolconverter.sh new file mode 100755 index 000000000..66b2b33d9 --- /dev/null +++ b/src/gtk/symbolconverter.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +# Fetch the GtkPlacesView files but rename the symbols to avoid symbol clashes + +URL=https://git.gnome.org/browse/gtk+/plain/gtk/ +URLUI=https://git.gnome.org/browse/gtk+/plain/gtk/ui/ + +update_file () { + _source="$1" + _dest="$2" + + echo "/* Do not edit: this file is generated from ${_source} */" > "${_dest}" + echo >> "${_dest}" + + curl "${_source}" | sed \ + -e 's/gtkplacesview/nautilusgtkplacesview/g' \ + -e 's/gtkplacesviewrow/nautilusgtkplacesviewrow/g' \ + -e 's/gtk_places_view/nautilus_gtk_places_view/g' \ + -e 's/GtkPlacesView/NautilusGtkPlacesView/g' \ + -e 's/GTK_PLACES_VIEW/NAUTILUS_GTK_PLACES_VIEW/g' \ + -e 's/GTK_TYPE_PLACES_VIEW/NAUTILUS_TYPE_GTK_PLACES_VIEW/g' \ + -e 's/_gtk_marshal_VOID__STRING_STRING/NULL/g' \ + -e '/gtkintl.h/d' \ + -e '/gtkmarshalers.h/d' \ + -e '/gtktypebuiltins.h/d' \ + -e 's/<gtk\/gtkbox.h>/<gtk\/gtk.h>/' \ + -e '/gtkplacessidebar.h/d' \ + -e '/#error /d' \ + -e "s/P_(\(.*\))/\1/" \ + -e "s/I_(\(.*\))/\1/" >> "${_dest}" +} + +update_file "${URL}/gtkplacesview.c" "nautilusgtkplacesview.c" +update_file "${URL}/gtkplacesviewprivate.h" "nautilusgtkplacesviewprivate.h" +update_file "${URLUI}/gtkplacesviewrow.ui" "nautilusgtkplacesviewrow.ui" + +update_file () { + _source="$1" + _dest="$2" + + echo "/* Do not edit: this file is generated from ${_source} */" > "${_dest}" + echo >> "${_dest}" + + curl "${_source}" | sed \ + -e 's/gtkplacesviewrow/nautilusgtkplacesviewrow/g' \ + -e 's/gtk_places_view_row/nautilus_gtk_places_view_row/g' \ + -e 's/GtkPlacesViewRow/NautilusGtkPlacesViewRow/g' \ + -e 's/GTK_PLACES_VIEW_ROW/NAUTILUS_GTK_PLACES_VIEW_ROW/g' \ + -e 's/GTK_TYPE_PLACES_VIEW_ROW/NAUTILUS_TYPE_GTK_PLACES_VIEW_ROW/g' \ + -e 's/G_DECLARE_FINAL_TYPE (NautilusGtkPlacesViewRow, nautilus_gtk_places_view_row, GTK, PLACES_VIEW_ROW, GtkListBoxRow/ G_DECLARE_FINAL_TYPE (NautilusGtkPlacesViewRow, nautilus_gtk_places_view_row, NAUTILUS, GTK_PLACES_VIEW_ROW, GtkListBoxRow/g' \ + -e 's/"gtkwidget.h"/<gtk\/gtk.h>/' \ + -e '/gtksizegroup.h/d' \ + -e '/gtklistbox.h/d' \ + -e '/#error /d' \ + -e "s/P_(\(.*\))/\1/" \ + -e "s/I_(\(.*\))/\1/" >> "${_dest}" +} + +update_file "${URL}/gtkplacesviewrow.c" "nautilusgtkplacesviewrow.c" +update_file "${URL}/gtkplacesviewrowprivate.h" "nautilusgtkplacesviewrowprivate.h" +update_file "${URLUI}/gtkplacesview.ui" "nautilusgtkplacesview.ui" diff --git a/src/nautilus-places-view.c b/src/nautilus-places-view.c index 9a7cd1feb..b80549023 100644 --- a/src/nautilus-places-view.c +++ b/src/nautilus-places-view.c @@ -20,7 +20,7 @@ #include "nautilus-places-view.h" #include "nautilus-window-slot.h" #include "nautilus-application.h" -#include "gtk/gtkplacesviewprivate.h" +#include "gtk/nautilusgtkplacesviewprivate.h" typedef struct { @@ -251,7 +251,7 @@ nautilus_places_view_set_search_query (NautilusView *view, text = query ? nautilus_query_get_text (query) : NULL; - gtk_nautilus_places_view_set_search_query (GTK_NAUTILUS_PLACES_VIEW (priv->places_view), text); + nautilus_gtk_places_view_set_search_query (NAUTILUS_GTK_PLACES_VIEW (priv->places_view), text); g_free (text); } @@ -270,7 +270,7 @@ nautilus_places_view_is_loading (NautilusView *view) priv = nautilus_places_view_get_instance_private (NAUTILUS_PLACES_VIEW (view)); - return gtk_nautilus_places_view_get_loading (GTK_NAUTILUS_PLACES_VIEW (priv->places_view)); + return nautilus_gtk_places_view_get_loading (NAUTILUS_GTK_PLACES_VIEW (priv->places_view)); } static gboolean @@ -329,8 +329,8 @@ nautilus_places_view_init (NautilusPlacesView *self) priv->location = g_file_new_for_uri ("other-locations:///"); /* Places view */ - priv->places_view = gtk_nautilus_places_view_new (); - gtk_nautilus_places_view_set_open_flags (GTK_NAUTILUS_PLACES_VIEW (priv->places_view), + priv->places_view = nautilus_gtk_places_view_new (); + nautilus_gtk_places_view_set_open_flags (NAUTILUS_GTK_PLACES_VIEW (priv->places_view), GTK_PLACES_OPEN_NEW_TAB | GTK_PLACES_OPEN_NEW_WINDOW | GTK_PLACES_OPEN_NORMAL); gtk_widget_set_hexpand (priv->places_view, TRUE); gtk_widget_set_vexpand (priv->places_view, TRUE); diff --git a/src/resources/nautilus.gresource.xml b/src/resources/nautilus.gresource.xml index 9463849a2..3104160cd 100644 --- a/src/resources/nautilus.gresource.xml +++ b/src/resources/nautilus.gresource.xml @@ -17,8 +17,8 @@ <file>ui/nautilus-no-search-results.ui</file> <file>ui/nautilus-folder-is-empty.ui</file> <file>gtk/help-overlay.ui</file> - <file alias="gtk/gtkplacesview.ui">../gtk/gtkplacesview.ui</file> - <file alias="gtk/gtkplacesviewrow.ui">../gtk/gtkplacesviewrow.ui</file> + <file alias="gtk/nautilusgtkplacesview.ui">../gtk/nautilusgtkplacesview.ui</file> + <file alias="gtk/nautilusgtkplacesviewrow.ui">../gtk/nautilusgtkplacesviewrow.ui</file> <file alias="icons/thumbnail_frame.png">../../icons/thumbnail_frame.png</file> <file alias="icons/filmholes.png">../../icons/filmholes.png</file> <file alias="icons/knob.png">../../icons/knob.png</file> |