Commit bd5e5fc7 authored by Sébastien Lafargue's avatar Sébastien Lafargue

file-browser: coding style cleanup

parent e1489317
......@@ -29,7 +29,7 @@
struct _GeditFileBookmarksStorePrivate
{
GVolumeMonitor *volume_monitor;
GFileMonitor *bookmarks_monitor;
GFileMonitor *bookmarks_monitor;
};
static void remove_node (GtkTreeModel *model,
......@@ -127,11 +127,9 @@ add_file (GeditFileBookmarksStore *model,
GtkTreeIter *iter)
{
GdkPixbuf *pixbuf = NULL;
gboolean native;
gboolean native = g_file_is_native (file);
gchar *newname;
native = g_file_is_native (file);
if (native && !g_file_query_exists (file, NULL))
return FALSE;
......@@ -172,17 +170,14 @@ check_mount_separator (GeditFileBookmarksStore *model,
gboolean added)
{
GtkTreeIter iter;
gboolean found;
found =
find_with_flags (GTK_TREE_MODEL (model), &iter, NULL,
flags | GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR,
0);
gboolean found = find_with_flags (GTK_TREE_MODEL (model), &iter, NULL,
flags | GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR,
0);
if (added && !found)
{
/* Add the separator */
add_node (model, NULL, NULL, NULL,
add_node (model, NULL, NULL, NULL, NULL,
flags | GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR,
NULL);
}
......@@ -195,15 +190,17 @@ check_mount_separator (GeditFileBookmarksStore *model,
static void
init_special_directories (GeditFileBookmarksStore *model)
{
gchar const *path;
gchar const *path = g_get_home_dir ();
GFile *file;
path = g_get_home_dir ();
if (path != NULL)
{
file = g_file_new_for_path (path);
add_file (model, file, _("Home"), GEDIT_FILE_BOOKMARKS_STORE_IS_HOME |
GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
add_file (model,
file,
_("Home"),
GEDIT_FILE_BOOKMARKS_STORE_IS_HOME | GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR,
NULL);
g_object_unref (file);
}
......@@ -212,8 +209,11 @@ init_special_directories (GeditFileBookmarksStore *model)
if (path != NULL)
{
file = g_file_new_for_path (path);
add_file (model, file, NULL, GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP |
GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
add_file (model,
file,
NULL,
GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP | GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR,
NULL);
g_object_unref (file);
}
......@@ -221,8 +221,11 @@ init_special_directories (GeditFileBookmarksStore *model)
if (path != NULL)
{
file = g_file_new_for_path (path);
add_file (model, file, NULL, GEDIT_FILE_BOOKMARKS_STORE_IS_DOCUMENTS |
GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
add_file (model,
file,
NULL,
GEDIT_FILE_BOOKMARKS_STORE_IS_DOCUMENTS | GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR,
NULL);
g_object_unref (file);
}
#endif
......@@ -300,9 +303,8 @@ static void
process_volume_cb (GVolume *volume,
GeditFileBookmarksStore *model)
{
GMount *mount;
GMount *mount = g_volume_get_mount (volume);
guint flags = GEDIT_FILE_BOOKMARKS_STORE_NONE;
mount = g_volume_get_mount (volume);
/* CHECK: should we use the LOCAL/REMOTE thing still? */
if (mount)
......@@ -339,9 +341,7 @@ static void
process_drive_cb (GDrive *drive,
GeditFileBookmarksStore *model)
{
GList *volumes;
volumes = g_drive_get_volumes (drive);
GList *volumes = g_drive_get_volumes (drive);
if (volumes)
{
......@@ -358,9 +358,7 @@ process_drive_cb (GDrive *drive,
static void
init_drives (GeditFileBookmarksStore *model)
{
GList *drives;
drives = g_volume_monitor_get_connected_drives (model->priv->volume_monitor);
GList *drives = g_volume_monitor_get_connected_drives (model->priv->volume_monitor);
g_list_foreach (drives, (GFunc)process_drive_cb, model);
g_list_free_full (drives, g_object_unref);
......@@ -370,9 +368,7 @@ static void
process_volume_nodrive_cb (GVolume *volume,
GeditFileBookmarksStore *model)
{
GDrive *drive;
drive = g_volume_get_drive (volume);
GDrive *drive = g_volume_get_drive (volume);
if (drive)
{
......@@ -386,9 +382,7 @@ process_volume_nodrive_cb (GVolume *volume,
static void
init_volumes (GeditFileBookmarksStore *model)
{
GList *volumes;
volumes = g_volume_monitor_get_volumes (model->priv->volume_monitor);
GList *volumes = g_volume_monitor_get_volumes (model->priv->volume_monitor);
g_list_foreach (volumes, (GFunc)process_volume_nodrive_cb, model);
g_list_free_full (volumes, g_object_unref);
......@@ -398,9 +392,7 @@ static void
process_mount_novolume_cb (GMount *mount,
GeditFileBookmarksStore *model)
{
GVolume *volume;
volume = g_mount_get_volume (mount);
GVolume *volume = g_mount_get_volume (mount);
if (volume)
{
......@@ -416,9 +408,7 @@ process_mount_novolume_cb (GMount *mount,
static void
init_mounts (GeditFileBookmarksStore *model)
{
GList *mounts;
mounts = g_volume_monitor_get_mounts (model->priv->volume_monitor);
GList *mounts = g_volume_monitor_get_mounts (model->priv->volume_monitor);
g_list_foreach (mounts, (GFunc)process_mount_novolume_cb, model);
g_list_free_full (mounts, g_object_unref);
......@@ -463,12 +453,10 @@ add_bookmark (GeditFileBookmarksStore *model,
gchar const *name,
gchar const *uri)
{
GFile *file;
gboolean ret;
GFile *file = g_file_new_for_uri (uri);
guint flags = GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK;
GtkTreeIter iter;
file = g_file_new_for_uri (uri);
gboolean ret;
if (g_file_is_native (file))
flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_LOCAL_BOOKMARK;
......@@ -478,7 +466,6 @@ add_bookmark (GeditFileBookmarksStore *model,
ret = add_file (model, file, name, flags, &iter);
g_object_unref (file);
return ret;
}
......@@ -553,9 +540,8 @@ parse_bookmarks_file (GeditFileBookmarksStore *model,
/* Add a watch */
if (model->priv->bookmarks_monitor == NULL)
{
GFile *file;
GFile *file = g_file_new_for_path (bookmarks);
file = g_file_new_for_path (bookmarks);
model->priv->bookmarks_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL);
g_object_unref (file);
......@@ -571,11 +557,9 @@ parse_bookmarks_file (GeditFileBookmarksStore *model,
static void
init_bookmarks (GeditFileBookmarksStore *model)
{
gchar *bookmarks;
gchar *bookmarks = get_bookmarks_file ();
gboolean added = FALSE;
bookmarks = get_bookmarks_file ();
if (!parse_bookmarks_file (model, bookmarks, &added))
{
g_free (bookmarks);
......@@ -588,9 +572,9 @@ init_bookmarks (GeditFileBookmarksStore *model)
if (added)
{
/* Bookmarks separator */
add_node (model, NULL, NULL, NULL,
GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK |
GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR, NULL);
add_node (model, NULL, NULL, NULL, NULL,
GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK | GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR,
NULL);
}
g_free (bookmarks);
......@@ -678,12 +662,10 @@ bookmarks_compare_flags (GtkTreeModel *model,
GtkTreeIter *a,
GtkTreeIter *b)
{
guint sep = GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR;
guint f1;
guint f2;
gint *flags;
guint sep;
sep = GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR;
gtk_tree_model_get (model, a,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &f1,
......@@ -719,9 +701,7 @@ bookmarks_compare_func (GtkTreeModel *model,
GtkTreeIter *b,
gpointer user_data)
{
gint result;
result = bookmarks_compare_flags (model, a, b);
gint result = bookmarks_compare_flags (model, a, b);
if (result == 0)
result = bookmarks_compare_names (model, a, b);
......@@ -746,11 +726,11 @@ find_with_flags (GtkTreeModel *model,
do
{
gtk_tree_model_get (model, &child,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_OBJECT,
&childobj,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS,
&childflags, -1);
gtk_tree_model_get (model,
&child,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_OBJECT, &childobj,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &childflags,
-1);
fequal = (obj == childobj);
......@@ -771,11 +751,13 @@ find_with_flags (GtkTreeModel *model,
}
static void
remove_node (GtkTreeModel *model, GtkTreeIter *iter)
remove_node (GtkTreeModel *model,
GtkTreeIter *iter)
{
guint flags;
gtk_tree_model_get (model, iter,
gtk_tree_model_get (model,
iter,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &flags,
-1);
......@@ -853,11 +835,10 @@ gedit_file_bookmarks_store_get_location (GeditFileBookmarksStore *model,
g_return_val_if_fail (GEDIT_IS_FILE_BOOKMARKS_STORE (model), NULL);
g_return_val_if_fail (iter != NULL, NULL);
gtk_tree_model_get (GTK_TREE_MODEL (model), iter,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS,
&flags,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_OBJECT,
&obj,
gtk_tree_model_get (GTK_TREE_MODEL (model),
iter,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &flags,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_OBJECT, &obj,
-1);
if (obj == NULL)
......@@ -868,7 +849,7 @@ gedit_file_bookmarks_store_get_location (GeditFileBookmarksStore *model,
if (isfs && (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT))
file = g_mount_get_root (G_MOUNT (obj));
else if (!isfs)
file = g_object_ref (obj);
file = (GFile *)g_object_ref (obj);
g_object_unref (obj);
......
......@@ -65,7 +65,7 @@ enum
struct _GeditFileBookmarksStore
{
GtkTreeStore parent;
GtkTreeStore parent;
GeditFileBookmarksStorePrivate *priv;
};
......
......@@ -118,91 +118,68 @@ struct _GeditFileBrowserStoreClass {
GtkTreePath *path);
};
GType gedit_file_browser_store_get_type (void) G_GNUC_CONST;
GeditFileBrowserStore *gedit_file_browser_store_new (GFile *root);
GeditFileBrowserStoreResult
gedit_file_browser_store_set_root_and_virtual_root (GeditFileBrowserStore *model,
GFile *root,
GFile *virtual_root);
GeditFileBrowserStoreResult
gedit_file_browser_store_set_root (GeditFileBrowserStore *model,
GFile *root);
GeditFileBrowserStoreResult
gedit_file_browser_store_set_virtual_root (GeditFileBrowserStore *model,
GtkTreeIter *iter);
GeditFileBrowserStoreResult
gedit_file_browser_store_set_virtual_root_from_location (GeditFileBrowserStore *model,
GFile *root);
GeditFileBrowserStoreResult
gedit_file_browser_store_set_virtual_root_up (GeditFileBrowserStore *model);
GeditFileBrowserStoreResult
gedit_file_browser_store_set_virtual_root_top (GeditFileBrowserStore *model);
gboolean gedit_file_browser_store_get_iter_virtual_root (GeditFileBrowserStore *model,
GtkTreeIter *iter);
gboolean gedit_file_browser_store_get_iter_root (GeditFileBrowserStore *model,
GtkTreeIter *iter);
GFile *gedit_file_browser_store_get_root (GeditFileBrowserStore *model);
GFile *gedit_file_browser_store_get_virtual_root (GeditFileBrowserStore *model);
gboolean gedit_file_browser_store_iter_equal (GeditFileBrowserStore *model,
GtkTreeIter *iter1,
GtkTreeIter *iter2);
void gedit_file_browser_store_set_value (GeditFileBrowserStore *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value);
void _gedit_file_browser_store_iter_expanded (GeditFileBrowserStore *model,
GtkTreeIter *iter);
void _gedit_file_browser_store_iter_collapsed (GeditFileBrowserStore *model,
GtkTreeIter *iter);
GeditFileBrowserStoreFilterMode
gedit_file_browser_store_get_filter_mode (GeditFileBrowserStore *model);
void gedit_file_browser_store_set_filter_mode (GeditFileBrowserStore *model,
GeditFileBrowserStoreFilterMode mode);
void gedit_file_browser_store_set_filter_func (GeditFileBrowserStore *model,
GeditFileBrowserStoreFilterFunc func,
gpointer user_data);
const gchar * const *
gedit_file_browser_store_get_binary_patterns (GeditFileBrowserStore *model);
void gedit_file_browser_store_set_binary_patterns (GeditFileBrowserStore *model,
const gchar **binary_patterns);
void gedit_file_browser_store_refilter (GeditFileBrowserStore *model);
GeditFileBrowserStoreFilterMode
gedit_file_browser_store_filter_mode_get_default (void);
void gedit_file_browser_store_refresh (GeditFileBrowserStore *model);
gboolean gedit_file_browser_store_rename (GeditFileBrowserStore *model,
GtkTreeIter *iter,
gchar const *new_name,
GError **error);
GeditFileBrowserStoreResult
gedit_file_browser_store_delete (GeditFileBrowserStore *model,
GtkTreeIter *iter,
gboolean trash);
GeditFileBrowserStoreResult
gedit_file_browser_store_delete_all (GeditFileBrowserStore *model,
GList *rows,
gboolean trash);
gboolean gedit_file_browser_store_new_file (GeditFileBrowserStore *model,
GtkTreeIter *parent,
GtkTreeIter *iter);
gboolean gedit_file_browser_store_new_directory (GeditFileBrowserStore *model,
GtkTreeIter *parent,
GtkTreeIter *iter);
void
gedit_file_browser_store_cancel_mount_operation (GeditFileBrowserStore *store);
void _gedit_file_browser_store_register_type (GTypeModule *type_module);
GType gedit_file_browser_store_get_type (void) G_GNUC_CONST;
GeditFileBrowserStore *gedit_file_browser_store_new (GFile *root);
GeditFileBrowserStoreResult gedit_file_browser_store_set_root_and_virtual_root (GeditFileBrowserStore *model,
GFile *root,
GFile *virtual_root);
GeditFileBrowserStoreResult gedit_file_browser_store_set_root (GeditFileBrowserStore *model,
GFile *root);
GeditFileBrowserStoreResult gedit_file_browser_store_set_virtual_root (GeditFileBrowserStore *model,
GtkTreeIter *iter);
GeditFileBrowserStoreResult gedit_file_browser_store_set_virtual_root_from_location (GeditFileBrowserStore *model,
GFile *root);
GeditFileBrowserStoreResult gedit_file_browser_store_set_virtual_root_up (GeditFileBrowserStore *model);
GeditFileBrowserStoreResult gedit_file_browser_store_set_virtual_root_top (GeditFileBrowserStore *model);
gboolean gedit_file_browser_store_get_iter_virtual_root (GeditFileBrowserStore *model,
GtkTreeIter *iter);
gboolean gedit_file_browser_store_get_iter_root (GeditFileBrowserStore *model,
GtkTreeIter *iter);
GFile *gedit_file_browser_store_get_root (GeditFileBrowserStore *model);
GFile *gedit_file_browser_store_get_virtual_root (GeditFileBrowserStore *model);
gboolean gedit_file_browser_store_iter_equal (GeditFileBrowserStore *model,
GtkTreeIter *iter1,
GtkTreeIter *iter2);
void gedit_file_browser_store_set_value (GeditFileBrowserStore *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value);
void _gedit_file_browser_store_iter_expanded (GeditFileBrowserStore *model,
GtkTreeIter *iter);
void _gedit_file_browser_store_iter_collapsed (GeditFileBrowserStore *model,
GtkTreeIter *iter);
GeditFileBrowserStoreFilterMode gedit_file_browser_store_get_filter_mode (GeditFileBrowserStore *model);
void gedit_file_browser_store_set_filter_mode (GeditFileBrowserStore *model,
GeditFileBrowserStoreFilterMode mode);
void gedit_file_browser_store_set_filter_func (GeditFileBrowserStore *model,
GeditFileBrowserStoreFilterFunc func,
gpointer user_data);
const gchar * const *gedit_file_browser_store_get_binary_patterns (GeditFileBrowserStore *model);
void gedit_file_browser_store_set_binary_patterns (GeditFileBrowserStore *model,
const gchar **binary_patterns);
void gedit_file_browser_store_refilter (GeditFileBrowserStore *model);
GeditFileBrowserStoreFilterMode gedit_file_browser_store_filter_mode_get_default (void);
void gedit_file_browser_store_refresh (GeditFileBrowserStore *model);
gboolean gedit_file_browser_store_rename (GeditFileBrowserStore *model,
GtkTreeIter *iter,
gchar const *new_name,
GError **error);
GeditFileBrowserStoreResult gedit_file_browser_store_delete (GeditFileBrowserStore *model,
GtkTreeIter *iter,
gboolean trash);
GeditFileBrowserStoreResult gedit_file_browser_store_delete_all (GeditFileBrowserStore *model,
GList *rows,
gboolean trash);
gboolean gedit_file_browser_store_new_file (GeditFileBrowserStore *model,
GtkTreeIter *parent,
GtkTreeIter *iter);
gboolean gedit_file_browser_store_new_directory (GeditFileBrowserStore *model,
GtkTreeIter *parent,
GtkTreeIter *iter);
void gedit_file_browser_store_cancel_mount_operation (GeditFileBrowserStore *store);
void _gedit_file_browser_store_register_type (GTypeModule *type_module);
G_END_DECLS
......
......@@ -31,30 +31,30 @@
struct _GeditFileBrowserViewPrivate
{
GtkTreeViewColumn *column;
GtkCellRenderer *pixbuf_renderer;
GtkCellRenderer *text_renderer;
GtkTreeViewColumn *column;
GtkCellRenderer *pixbuf_renderer;
GtkCellRenderer *text_renderer;
GtkTreeModel *model;
GtkTreeModel *model;
/* Used when renaming */
gchar *orig_markup;
GtkTreeRowReference *editable;
gchar *orig_markup;
GtkTreeRowReference *editable;
/* Click policy */
GeditFileBrowserViewClickPolicy click_policy;
GeditFileBrowserViewClickPolicy click_policy;
/* Both clicks in a double click need to be on the same row */
GtkTreePath *double_click_path[2];
GtkTreePath *hover_path;
GdkCursor *hand_cursor;
gboolean ignore_release;
gboolean selected_on_button_down;
gint drag_button;
gboolean drag_started;
gboolean restore_expand_state;
gboolean is_refresh;
GHashTable *expand_state;
GtkTreePath *double_click_path[2];
GtkTreePath *hover_path;
GdkCursor *hand_cursor;
gboolean ignore_release;
gboolean selected_on_button_down;
gint drag_button;
gboolean drag_started;
gboolean restore_expand_state;
gboolean is_refresh;
GHashTable *expand_state;
};
/* Properties */
......@@ -168,8 +168,7 @@ row_expanded (GtkTreeView *tree_view,
gtk_tree_model_get (view->priv->model,
iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION,
&location,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION, &location,
-1);
add_expand_state (view, location);
......@@ -201,8 +200,7 @@ row_collapsed (GtkTreeView *tree_view,
gtk_tree_model_get (view->priv->model,
iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION,
&location,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION, &location,
-1);
remove_expand_state (view, location);
......@@ -300,25 +298,21 @@ static void
set_click_policy_property (GeditFileBrowserView *obj,
GeditFileBrowserViewClickPolicy click_policy)
{
GdkDisplay *display;
GtkTreeIter iter;
GdkWindow *win;
display = gtk_widget_get_display (GTK_WIDGET (obj));
GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (obj));
obj->priv->click_policy = click_policy;
if (click_policy == GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE)
{
if (obj->priv->hand_cursor == NULL)
{
obj->priv->hand_cursor = gdk_cursor_new_from_name (display, "pointer");
}
}
else if (click_policy == GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE)
{
if (obj->priv->hover_path != NULL)
{
GtkTreeIter iter;
if (gtk_tree_model_get_iter (GTK_TREE_MODEL (obj->priv->model),
&iter, obj->priv->hover_path))
{
......@@ -332,13 +326,12 @@ set_click_policy_property (GeditFileBrowserView *obj,
if (gtk_widget_get_realized (GTK_WIDGET (obj)))
{
win = gtk_widget_get_window (GTK_WIDGET (obj));
GdkWindow *win = gtk_widget_get_window (GTK_WIDGET (obj));
gdk_window_set_cursor (win, NULL);
if (display != NULL)
{
gdk_display_flush (display);
}
}
if (obj->priv->hand_cursor)
......@@ -361,14 +354,13 @@ activate_selected_files (GeditFileBrowserView *view)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (view);
GtkTreeSelection *selection = gtk_tree_view_get_selection (tree_view);
GList *rows, *row;
GList *rows = gtk_tree_selection_get_selected_rows (selection, &view->priv->model);
GList *row;
GtkTreePath *directory = NULL;
GtkTreePath *path;
GtkTreeIter iter;
GeditFileBrowserStoreFlag flags;
rows = gtk_tree_selection_get_selected_rows (selection, &view->priv->model);
for (row = rows; row; row = row->next)
{
path = (GtkTreePath *)(row->data);
......@@ -435,11 +427,9 @@ toggle_hidden_filter (GeditFileBrowserView *view)
if (GEDIT_IS_FILE_BROWSER_STORE (view->priv->model))
{
mode = gedit_file_browser_store_get_filter_mode
(GEDIT_FILE_BROWSER_STORE (view->priv->model));
mode = gedit_file_browser_store_get_filter_mode (GEDIT_FILE_BROWSER_STORE (view->priv->model));
mode ^= GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN;
gedit_file_browser_store_set_filter_mode
(GEDIT_FILE_BROWSER_STORE (view->priv->model), mode);
gedit_file_browser_store_set_filter_mode (GEDIT_FILE_BROWSER_STORE (view->priv->model), mode);
}
}
......@@ -466,15 +456,11 @@ static void
did_not_drag (GeditFileBrowserView *view,
GdkEventButton *event)
{
GtkTreeView *tree_view;
GtkTreeSelection *selection;
GtkTreeView *tree_view = GTK_TREE_VIEW (view);
GtkTreeSelection *selection = gtk_tree_view_get_selection (tree_view);
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 (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y, &path, NULL, NULL, NULL))
{
if ((view->priv->click_policy == GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE) &&
!button_event_modifies_selection (event) &&
......@@ -484,8 +470,7 @@ did_not_drag (GeditFileBrowserView *view,
activate_selected_items (view);
}
else if ((event->button == 1 || event->button == 2) &&
((event->state & GDK_CONTROL_MASK) != 0 ||
(event->state & GDK_SHIFT_MASK) == 0) &&
((event->state & GDK_CONTROL_MASK) != 0 || (event->state & GDK_SHIFT_MASK) == 0) &&
view->priv->selected_on_button_down)
{
if (!button_event_modifies_selection (event))
......@@ -525,23 +510,19 @@ static gboolean
button_press_event (GtkWidget *widget,
GdkEventButton *event)
{
GtkWidgetClass *widget_parent = GTK_WIDGET_CLASS (gedit_file_browser_view_parent_class);
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GeditFileBrowserView *view = GEDIT_FILE_BROWSER_VIEW (widget);
GtkTreeSelection *selection = gtk_tree_view_get_selection (tree_view);
int double_click_time;
static int click_count = 0;
static guint32 last_click_time = 0;
GeditFileBrowserView *view;
GtkTreeView *tree_view;
GtkTreeSelection *selection;
GtkTreePath *path;
int expander_size;
int horizontal_separator;
gboolean on_expander;
gboolean call_parent;
gboolean selected;
GtkWidgetClass *widget_parent = GTK_WIDGET_CLASS (gedit_file_browser_view_parent_class);
tree_view = GTK_TREE_VIEW (widget);
view = GEDIT_FILE_BROWSER_VIEW (widget);
selection = gtk_tree_view_get_selection (tree_view);
/* Get double click time */
g_object_get (G_OBJECT (gtk_widget_get_settings (widget)),
......@@ -566,8 +547,7 @@ button_press_event (GtkWidget *widget,
view->priv->ignore_release = FALSE;
call_parent = TRUE;
if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y,
&path, NULL, NULL, NULL))
if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y, &path, NULL, NULL, NULL))
{
/* Keep track of path of last click so double clicks only happen
* on the same item */
......@@ -674,14 +654,9 @@ static gboolean
key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
GeditFileBrowserView *view;
guint modifiers;
gboolean handled;
view = GEDIT_FILE_BROWSER_VIEW (widget);
handled = FALSE;
modifiers = gtk_accelerator_get_default_mod_mask ();
GeditFileBrowserView *view = GEDIT_FILE_BROWSER_VIEW (widget);
guint modifiers = gtk_accelerator_get_default_mod_mask ();
gboolean handled = FALSE;
switch (event->keyval)
{
......@@ -729,7 +704,7 @@ key_press_event (GtkWidget *widget,
static void
fill_expand_state (GeditFileBrowserView *view,
GtkTreeIter *iter)
GtkTreeIter *iter)
{
GtkTreePath *path;
GtkTreeIter child;
......@@ -745,8 +720,7 @@ fill_expand_state (GeditFileBrowserView *view,
gtk_tree_model_get (view->priv->model,
iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION,
&location,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION, &location,
-1);
add_expand_state (view, location);
......@@ -771,46 +745,20 @@ static void
uninstall_restore_signals (GeditFileBrowserView *tree_view,
GtkTreeModel *model)
{