summaryrefslogtreecommitdiff
path: root/plugins/filebrowser/pluma-file-browser-view.c
diff options
context:
space:
mode:
authorLaurent Napias <[email protected]>2019-06-29 10:29:13 +0200
committerZenWalker <[email protected]>2019-07-06 21:46:58 +0200
commitdb655f3fb2f67b695d36369e584fcb598e0e1bea (patch)
treeff7a4404cb6f0d1d8ca3a08ee50c60641641f1b4 /plugins/filebrowser/pluma-file-browser-view.c
parent5153fb08a2e26015d07e7b3805de15d38bd05a9d (diff)
downloadpluma-db655f3fb2f67b695d36369e584fcb598e0e1bea.tar.bz2
pluma-db655f3fb2f67b695d36369e584fcb598e0e1bea.tar.xz
Remove trailing whitespaces
Diffstat (limited to 'plugins/filebrowser/pluma-file-browser-view.c')
-rw-r--r--plugins/filebrowser/pluma-file-browser-view.c206
1 files changed, 103 insertions, 103 deletions
diff --git a/plugins/filebrowser/pluma-file-browser-view.c b/plugins/filebrowser/pluma-file-browser-view.c
index 134bf922..1b97aaf9 100644
--- a/plugins/filebrowser/pluma-file-browser-view.c
+++ b/plugins/filebrowser/pluma-file-browser-view.c
@@ -1,5 +1,5 @@
/*
- * pluma-file-browser-view.c - Pluma plugin providing easy file access
+ * pluma-file-browser-view.c - Pluma plugin providing easy file access
* from the sidepanel
*
* Copyright (C) 2006 - Jesse van den Kieboom <[email protected]>
@@ -34,7 +34,7 @@
G_TYPE_INSTANCE_GET_PRIVATE((object), \
PLUMA_TYPE_FILE_BROWSER_VIEW, PlumaFileBrowserViewPrivate))
-struct _PlumaFileBrowserViewPrivate
+struct _PlumaFileBrowserViewPrivate
{
GtkTreeViewColumn *column;
GtkCellRenderer *pixbuf_renderer;
@@ -54,7 +54,7 @@ struct _PlumaFileBrowserViewPrivate
gboolean selected_on_button_down;
gint drag_button;
gboolean drag_started;
-
+
gboolean restore_expand_state;
gboolean is_refresh;
GHashTable * expand_state;
@@ -64,7 +64,7 @@ struct _PlumaFileBrowserViewPrivate
enum
{
PROP_0,
-
+
PROP_CLICK_POLICY,
PROP_RESTORE_EXPAND_STATE
};
@@ -88,30 +88,30 @@ static const GtkTargetEntry drag_source_targets[] = {
G_DEFINE_DYNAMIC_TYPE (PlumaFileBrowserView, pluma_file_browser_view,
GTK_TYPE_TREE_VIEW)
-static void on_cell_edited (GtkCellRendererText * cell,
+static void on_cell_edited (GtkCellRendererText * cell,
gchar * path,
gchar * new_text,
PlumaFileBrowserView * tree_view);
-static void on_begin_refresh (PlumaFileBrowserStore * model,
+static void on_begin_refresh (PlumaFileBrowserStore * model,
PlumaFileBrowserView * view);
-static void on_end_refresh (PlumaFileBrowserStore * model,
+static void on_end_refresh (PlumaFileBrowserStore * model,
PlumaFileBrowserView * view);
-static void on_unload (PlumaFileBrowserStore * model,
+static void on_unload (PlumaFileBrowserStore * model,
gchar const * uri,
PlumaFileBrowserView * view);
-static void on_row_inserted (PlumaFileBrowserStore * model,
+static void on_row_inserted (PlumaFileBrowserStore * model,
GtkTreePath * path,
GtkTreeIter * iter,
PlumaFileBrowserView * view);
-
+
static void
pluma_file_browser_view_finalize (GObject * object)
{
PlumaFileBrowserView *obj = PLUMA_FILE_BROWSER_VIEW(object);
-
+
if (obj->priv->hand_cursor)
g_object_unref (obj->priv->hand_cursor);
@@ -135,12 +135,12 @@ add_expand_state (PlumaFileBrowserView * view,
gchar const * uri)
{
GFile * file;
-
+
if (!uri)
return;
file = g_file_new_for_uri (uri);
-
+
if (view->priv->expand_state)
g_hash_table_insert (view->priv->expand_state, file, file);
else
@@ -152,12 +152,12 @@ remove_expand_state (PlumaFileBrowserView * view,
gchar const * uri)
{
GFile * file;
-
+
if (!uri)
return;
file = g_file_new_for_uri (uri);
-
+
if (view->priv->expand_state)
g_hash_table_remove (view->priv->expand_state, file);
@@ -181,7 +181,7 @@ row_expanded (GtkTreeView * tree_view,
if (view->priv->restore_expand_state)
{
gtk_tree_model_get (view->priv->model,
- iter,
+ iter,
PLUMA_FILE_BROWSER_STORE_COLUMN_URI,
&uri,
-1);
@@ -207,11 +207,11 @@ row_collapsed (GtkTreeView * tree_view,
if (!PLUMA_IS_FILE_BROWSER_STORE (view->priv->model))
return;
-
+
if (view->priv->restore_expand_state)
{
- gtk_tree_model_get (view->priv->model,
- iter,
+ gtk_tree_model_get (view->priv->model,
+ iter,
PLUMA_FILE_BROWSER_STORE_COLUMN_URI,
&uri,
-1);
@@ -290,7 +290,7 @@ motion_notify_event (GtkWidget * widget,
if (old_hover_path != NULL)
gtk_tree_path_free (old_hover_path);
}
-
+
// Chainup
return GTK_WIDGET_CLASS (pluma_file_browser_view_parent_class)->motion_notify_event (widget, event);
}
@@ -324,7 +324,7 @@ set_click_policy_property (PlumaFileBrowserView *obj,
if (gtk_widget_get_realized (GTK_WIDGET (obj))) {
win = gtk_widget_get_window (GTK_WIDGET (obj));
gdk_window_set_cursor (win, NULL);
-
+
display = gtk_widget_get_display (GTK_WIDGET (obj));
if (display != NULL)
@@ -339,7 +339,7 @@ set_click_policy_property (PlumaFileBrowserView *obj,
}
static void
-directory_activated (PlumaFileBrowserView *view,
+directory_activated (PlumaFileBrowserView *view,
GtkTreeIter *iter)
{
pluma_file_browser_store_set_virtual_root (PLUMA_FILE_BROWSER_STORE (view->priv->model), iter);
@@ -356,30 +356,30 @@ activate_selected_files (PlumaFileBrowserView *view) {
PlumaFileBrowserStoreFlag flags;
rows = gtk_tree_selection_get_selected_rows (selection, &view->priv->model);
-
+
for (row = rows; row; row = row->next) {
path = (GtkTreePath *)(row->data);
-
+
/* Get iter from path */
if (!gtk_tree_model_get_iter (view->priv->model, &iter, path))
continue;
-
+
gtk_tree_model_get (view->priv->model, &iter, PLUMA_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags, -1);
if (FILE_IS_DIR (flags)) {
if (directory == NULL)
directory = path;
-
+
} else if (!FILE_IS_DUMMY (flags)) {
g_signal_emit (view, signals[FILE_ACTIVATED], 0, &iter);
}
}
-
+
if (directory != NULL) {
if (gtk_tree_model_get_iter (view->priv->model, &iter, directory))
g_signal_emit (view, signals[DIRECTORY_ACTIVATED], 0, &iter);
}
-
+
g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
g_list_free (rows);
}
@@ -429,10 +429,10 @@ drag_begin (GtkWidget *widget,
GdkDragContext *context)
{
PlumaFileBrowserView *view = PLUMA_FILE_BROWSER_VIEW (widget);
-
+
view->priv->drag_button = 0;
view->priv->drag_started = TRUE;
-
+
/* Chain up */
GTK_WIDGET_CLASS (pluma_file_browser_view_parent_class)->drag_begin (widget, context);
}
@@ -444,14 +444,14 @@ did_not_drag (PlumaFileBrowserView *view,
GtkTreeView *tree_view;
GtkTreeSelection *selection;
GtkTreePath *path;
-
+
tree_view = GTK_TREE_VIEW (view);
selection = gtk_tree_view_get_selection (tree_view);
if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y,
&path, NULL, NULL, NULL)) {
if ((view->priv->click_policy == PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE)
- && !button_event_modifies_selection(event)
+ && !button_event_modifies_selection(event)
&& (event->button == 1 || event->button == 2)) {
/* Activate all selected items, and leave them selected */
activate_selected_items (view);
@@ -484,9 +484,9 @@ button_release_event (GtkWidget *widget,
!view->priv->ignore_release)
did_not_drag (view, event);
}
-
+
/* Chain up */
- return GTK_WIDGET_CLASS (pluma_file_browser_view_parent_class)->button_release_event (widget, event);
+ return GTK_WIDGET_CLASS (pluma_file_browser_view_parent_class)->button_release_event (widget, event);
}
static gboolean
@@ -512,7 +512,7 @@ button_press_event (GtkWidget *widget,
selection = gtk_tree_view_get_selection (tree_view);
/* Get double click time */
- g_object_get (G_OBJECT (gtk_widget_get_settings (widget)),
+ g_object_get (G_OBJECT (gtk_widget_get_settings (widget)),
"gtk-double-click-time", &double_click_time,
NULL);
@@ -521,11 +521,11 @@ button_press_event (GtkWidget *widget,
click_count++;
else
click_count = 0;
-
+
last_click_time = event->time;
/* Ignore double click if we are in single click mode */
- if (view->priv->click_policy == PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE &&
+ if (view->priv->click_policy == PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE &&
click_count >= 2) {
return TRUE;
}
@@ -537,7 +537,7 @@ button_press_event (GtkWidget *widget,
&path, NULL, NULL, NULL)) {
/* Keep track of path of last click so double clicks only happen
* on the same item */
- if ((event->button == 1 || event->button == 2) &&
+ if ((event->button == 1 || event->button == 2) &&
event->type == GDK_BUTTON_PRESS) {
if (view->priv->double_click_path[1])
gtk_tree_path_free (view->priv->double_click_path[1]);
@@ -550,7 +550,7 @@ button_press_event (GtkWidget *widget,
if (view->priv->double_click_path[1] &&
gtk_tree_path_compare (view->priv->double_click_path[0], view->priv->double_click_path[1]) == 0)
activate_selected_items (view);
-
+
/* Chain up */
widget_parent->button_press_event (widget, event);
} else {
@@ -586,14 +586,14 @@ button_press_event (GtkWidget *widget,
view->priv->ignore_release = on_expander;
}
}
-
+
if (call_parent) {
/* Chain up */
widget_parent->button_press_event (widget, event);
} else if (selected) {
gtk_widget_grab_focus (widget);
}
-
+
if ((event->button == 1 || event->button == 2) &&
event->type == GDK_BUTTON_PRESS) {
view->priv->drag_started = FALSE;
@@ -603,7 +603,7 @@ button_press_event (GtkWidget *widget,
gtk_tree_path_free (path);
} else {
- if ((event->button == 1 || event->button == 2) &&
+ if ((event->button == 1 || event->button == 2) &&
event->type == GDK_BUTTON_PRESS) {
if (view->priv->double_click_path[1])
gtk_tree_path_free (view->priv->double_click_path[1]);
@@ -669,7 +669,7 @@ key_press_event (GtkWidget *widget,
/* Chain up */
if (!handled)
return GTK_WIDGET_CLASS (pluma_file_browser_view_parent_class)->key_press_event (widget, event);
-
+
return TRUE;
}
@@ -679,31 +679,31 @@ fill_expand_state (PlumaFileBrowserView * view, GtkTreeIter * iter)
GtkTreePath * path;
GtkTreeIter child;
gchar * uri;
-
+
if (!gtk_tree_model_iter_has_child (view->priv->model, iter))
return;
-
+
path = gtk_tree_model_get_path (view->priv->model, iter);
-
+
if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), path))
{
- gtk_tree_model_get (view->priv->model,
- iter,
- PLUMA_FILE_BROWSER_STORE_COLUMN_URI,
- &uri,
+ gtk_tree_model_get (view->priv->model,
+ iter,
+ PLUMA_FILE_BROWSER_STORE_COLUMN_URI,
+ &uri,
-1);
add_expand_state (view, uri);
g_free (uri);
}
-
+
if (gtk_tree_model_iter_children (view->priv->model, &child, iter))
{
do {
fill_expand_state (view, &child);
} while (gtk_tree_model_iter_next (view->priv->model, &child));
}
-
+
gtk_tree_path_free (path);
}
@@ -711,20 +711,20 @@ static void
uninstall_restore_signals (PlumaFileBrowserView * tree_view,
GtkTreeModel * model)
{
- g_signal_handlers_disconnect_by_func (model,
- on_begin_refresh,
+ g_signal_handlers_disconnect_by_func (model,
+ on_begin_refresh,
tree_view);
-
- g_signal_handlers_disconnect_by_func (model,
- on_end_refresh,
+
+ g_signal_handlers_disconnect_by_func (model,
+ on_end_refresh,
tree_view);
-
- g_signal_handlers_disconnect_by_func (model,
- on_unload,
+
+ g_signal_handlers_disconnect_by_func (model,
+ on_unload,
tree_view);
- g_signal_handlers_disconnect_by_func (model,
- on_row_inserted,
+ g_signal_handlers_disconnect_by_func (model,
+ on_row_inserted,
tree_view);
}
@@ -732,24 +732,24 @@ static void
install_restore_signals (PlumaFileBrowserView * tree_view,
GtkTreeModel * model)
{
- g_signal_connect (model,
+ g_signal_connect (model,
"begin-refresh",
- G_CALLBACK (on_begin_refresh),
+ G_CALLBACK (on_begin_refresh),
tree_view);
- g_signal_connect (model,
+ g_signal_connect (model,
"end-refresh",
- G_CALLBACK (on_end_refresh),
+ G_CALLBACK (on_end_refresh),
tree_view);
- g_signal_connect (model,
+ g_signal_connect (model,
"unload",
- G_CALLBACK (on_unload),
+ G_CALLBACK (on_unload),
tree_view);
- g_signal_connect_after (model,
+ g_signal_connect_after (model,
"row-inserted",
- G_CALLBACK (on_row_inserted),
+ G_CALLBACK (on_row_inserted),
tree_view);
}
@@ -772,7 +772,7 @@ set_restore_expand_state (PlumaFileBrowserView * view,
(GEqualFunc)g_file_equal,
g_object_unref,
NULL);
-
+
if (view->priv->model && PLUMA_IS_FILE_BROWSER_STORE (view->priv->model))
{
fill_expand_state (view, NULL);
@@ -838,11 +838,11 @@ pluma_file_browser_view_class_init (PlumaFileBrowserViewClass * klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkTreeViewClass *tree_view_class = GTK_TREE_VIEW_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
+
object_class->finalize = pluma_file_browser_view_finalize;
object_class->get_property = get_property;
object_class->set_property = set_property;
-
+
/* Event handlers */
widget_class->motion_notify_event = motion_notify_event;
widget_class->enter_notify_event = enter_notify_event;
@@ -855,7 +855,7 @@ pluma_file_browser_view_class_init (PlumaFileBrowserViewClass * klass)
/* Tree view handlers */
tree_view_class->row_expanded = row_expanded;
tree_view_class->row_collapsed = row_collapsed;
-
+
/* Default handlers */
klass->directory_activated = directory_activated;
@@ -929,18 +929,18 @@ cell_data_cb (GtkTreeViewColumn * tree_column, GtkCellRenderer * cell,
path = gtk_tree_model_get_path (tree_model, iter);
if (obj->priv->click_policy == PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE) {
- if (obj->priv->hover_path != NULL &&
+ if (obj->priv->hover_path != NULL &&
gtk_tree_path_compare (path, obj->priv->hover_path) == 0)
- underline = PANGO_UNDERLINE_SINGLE;
+ underline = PANGO_UNDERLINE_SINGLE;
}
if (PLUMA_IS_FILE_BROWSER_STORE (tree_model))
{
- if (obj->priv->editable != NULL &&
+ if (obj->priv->editable != NULL &&
gtk_tree_row_reference_valid (obj->priv->editable))
{
GtkTreePath *edpath = gtk_tree_row_reference_get_path (obj->priv->editable);
-
+
editable = edpath && gtk_tree_path_compare (path, edpath) == 0;
}
}
@@ -1028,7 +1028,7 @@ pluma_file_browser_view_set_model (PlumaFileBrowserView * tree_view,
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
if (PLUMA_IS_FILE_BOOKMARKS_STORE (model)) {
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW
(tree_view),
bookmarks_separator_func,
@@ -1055,7 +1055,7 @@ pluma_file_browser_view_set_model (PlumaFileBrowserView * tree_view,
if (tree_view->priv->restore_expand_state)
install_restore_signals (tree_view, model);
-
+
}
if (tree_view->priv->hover_path != NULL) {
@@ -1065,7 +1065,7 @@ pluma_file_browser_view_set_model (PlumaFileBrowserView * tree_view,
if (PLUMA_IS_FILE_BROWSER_STORE (tree_view->priv->model)) {
if (tree_view->priv->restore_expand_state)
- uninstall_restore_signals (tree_view,
+ uninstall_restore_signals (tree_view,
tree_view->priv->model);
}
@@ -1098,18 +1098,18 @@ pluma_file_browser_view_start_rename (PlumaFileBrowserView * tree_view,
/* Start editing */
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
-
+
if (gtk_tree_path_up (path))
gtk_tree_view_expand_to_path (GTK_TREE_VIEW (tree_view),
path);
-
+
gtk_tree_path_free (path);
tree_view->priv->editable = rowref;
gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree_view),
gtk_tree_row_reference_get_path (tree_view->priv->editable),
tree_view->priv->column, TRUE);
-
+
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (tree_view),
gtk_tree_row_reference_get_path (tree_view->priv->editable),
tree_view->priv->column,
@@ -1121,9 +1121,9 @@ pluma_file_browser_view_set_click_policy (PlumaFileBrowserView *tree_view,
PlumaFileBrowserViewClickPolicy policy)
{
g_return_if_fail (PLUMA_IS_FILE_BROWSER_VIEW (tree_view));
-
+
set_click_policy_property (tree_view, policy);
-
+
g_object_notify (G_OBJECT (tree_view), "click-policy");
}
@@ -1146,13 +1146,13 @@ on_cell_edited (GtkCellRendererText * cell, gchar * path, gchar * new_text,
GtkTreeIter iter;
gboolean ret;
GError * error = NULL;
-
+
gtk_tree_row_reference_free (tree_view->priv->editable);
tree_view->priv->editable = NULL;
if (new_text == NULL || *new_text == '\0')
return;
-
+
treepath = gtk_tree_path_new_from_string (path);
ret = gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_view->priv->model), &iter, treepath);
gtk_tree_path_free (treepath);
@@ -1176,8 +1176,8 @@ on_cell_edited (GtkCellRendererText * cell, gchar * path, gchar * new_text,
}
}
-static void
-on_begin_refresh (PlumaFileBrowserStore * model,
+static void
+on_begin_refresh (PlumaFileBrowserStore * model,
PlumaFileBrowserView * view)
{
/* Store the refresh state, so we can handle unloading of nodes while
@@ -1185,8 +1185,8 @@ on_begin_refresh (PlumaFileBrowserStore * model,
view->priv->is_refresh = TRUE;
}
-static void
-on_end_refresh (PlumaFileBrowserStore * model,
+static void
+on_end_refresh (PlumaFileBrowserStore * model,
PlumaFileBrowserView * view)
{
/* Store the refresh state, so we can handle unloading of nodes while
@@ -1195,14 +1195,14 @@ on_end_refresh (PlumaFileBrowserStore * model,
}
static void
-on_unload (PlumaFileBrowserStore * model,
+on_unload (PlumaFileBrowserStore * model,
gchar const * uri,
PlumaFileBrowserView * view)
{
/* Don't remove the expand state if we are refreshing */
if (!view->priv->restore_expand_state || view->priv->is_refresh)
return;
-
+
remove_expand_state (view, uri);
}
@@ -1215,10 +1215,10 @@ restore_expand_state (PlumaFileBrowserView * view,
GFile * file;
GtkTreePath * path;
- gtk_tree_model_get (GTK_TREE_MODEL (model),
- iter,
- PLUMA_FILE_BROWSER_STORE_COLUMN_URI,
- &uri,
+ gtk_tree_model_get (GTK_TREE_MODEL (model),
+ iter,
+ PLUMA_FILE_BROWSER_STORE_COLUMN_URI,
+ &uri,
-1);
if (!uri)
@@ -1233,15 +1233,15 @@ restore_expand_state (PlumaFileBrowserView * view,
path,
FALSE);
}
-
+
gtk_tree_path_free (path);
- g_object_unref (file);
+ g_object_unref (file);
g_free (uri);
}
-static void
-on_row_inserted (PlumaFileBrowserStore * model,
+static void
+on_row_inserted (PlumaFileBrowserStore * model,
GtkTreePath * path,
GtkTreeIter * iter,
PlumaFileBrowserView * view)
@@ -1269,5 +1269,5 @@ _pluma_file_browser_view_register_type (GTypeModule *type_module)
{
pluma_file_browser_view_register_type (type_module);
}
-
+
// ex:ts=8:noet: