[gedit] Few more fixes for file browser coding style
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Few more fixes for file browser coding style
- Date: Fri, 4 Jun 2010 07:26:24 +0000 (UTC)
commit 16959a0a93a91a80b8134a8893ee82b0080d9930
Author: Garrett Regier <alias301 gmail com>
Date: Thu Jun 3 17:40:00 2010 -0700
Few more fixes for file browser coding style
plugins/filebrowser/gedit-file-bookmarks-store.c | 26 +-
plugins/filebrowser/gedit-file-bookmarks-store.h | 10 +-
.../gedit-file-browser-enum-register.c.template | 2 +-
.../gedit-file-browser-enum-types.h.template | 1 -
plugins/filebrowser/gedit-file-browser-error.h | 2 +-
plugins/filebrowser/gedit-file-browser-messages.c | 344 ++++++++--------
plugins/filebrowser/gedit-file-browser-messages.h | 2 +-
plugins/filebrowser/gedit-file-browser-plugin.c | 182 ++++----
plugins/filebrowser/gedit-file-browser-plugin.h | 6 +-
plugins/filebrowser/gedit-file-browser-store.c | 327 +++++++-------
plugins/filebrowser/gedit-file-browser-store.h | 20 +-
plugins/filebrowser/gedit-file-browser-utils.c | 56 ++--
plugins/filebrowser/gedit-file-browser-utils.h | 10 +-
plugins/filebrowser/gedit-file-browser-view.c | 180 ++++----
plugins/filebrowser/gedit-file-browser-view.h | 16 +-
plugins/filebrowser/gedit-file-browser-widget.c | 449 ++++++++++----------
plugins/filebrowser/gedit-file-browser-widget.h | 14 +-
17 files changed, 824 insertions(+), 823 deletions(-)
---
diff --git a/plugins/filebrowser/gedit-file-bookmarks-store.c b/plugins/filebrowser/gedit-file-bookmarks-store.c
index 3abf764..143dbb5 100644
--- a/plugins/filebrowser/gedit-file-bookmarks-store.c
+++ b/plugins/filebrowser/gedit-file-bookmarks-store.c
@@ -1,19 +1,19 @@
/*
* gedit-file-bookmarks-store.c - Gedit plugin providing easy file access
* from the sidepanel
- *
+ *
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
- *
+ *
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -334,11 +334,13 @@ process_drive_novolumes (GeditFileBookmarksStore *model,
if (g_drive_is_media_removable (drive) &&
!g_drive_is_media_check_automatic (drive) &&
g_drive_can_poll_for_media (drive))
+ {
/* This can be the case for floppy drives or other
drives where media detection fails. We show the
drive and poll for media when the user activates
it */
add_fs (model, drive, GEDIT_FILE_BOOKMARKS_STORE_NONE, NULL);
+ }
}
static void
@@ -411,10 +413,14 @@ process_mount_novolume_cb (GMount *mount,
volume = g_mount_get_volume (mount);
if (volume)
+ {
g_object_unref (volume);
+ }
else if (!g_mount_is_shadowed (mount))
+ {
/* Add the mount */
add_fs (model, mount, GEDIT_FILE_BOOKMARKS_STORE_NONE, NULL);
+ }
}
static void
@@ -445,7 +451,7 @@ init_fs (GeditFileBookmarksStore *model)
model->priv->volume_monitor = g_volume_monitor_get ();
/* Connect signals */
- for (ptr = signals; *ptr; ptr++)
+ for (ptr = signals; *ptr != NULL; ++ptr)
{
g_signal_connect (model->priv->volume_monitor,
*ptr,
@@ -625,15 +631,25 @@ bookmarks_compare_names (GtkTreeModel *model,
/* do not sort actual bookmarks to keep same order as in nautilus */
if ((f1 & GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK) &&
(f2 & GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK))
+ {
result = 0;
+ }
else if (n1 == NULL && n2 == NULL)
+ {
result = 0;
+ }
else if (n1 == NULL)
+ {
result = -1;
+ }
else if (n2 == NULL)
+ {
result = 1;
+ }
else
+ {
result = utf8_casecmp (n1, n2);
+ }
g_free (n1);
g_free (n2);
diff --git a/plugins/filebrowser/gedit-file-bookmarks-store.h b/plugins/filebrowser/gedit-file-bookmarks-store.h
index d2d2181..c74b370 100644
--- a/plugins/filebrowser/gedit-file-bookmarks-store.h
+++ b/plugins/filebrowser/gedit-file-bookmarks-store.h
@@ -1,5 +1,5 @@
/*
- * gedit-file-bookmarks-store.h - Gedit plugin providing easy file access
+ * gedit-file-bookmarks-store.h - Gedit plugin providing easy file access
* from the sidepanel
*
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
@@ -37,7 +37,7 @@ typedef struct _GeditFileBookmarksStore GeditFileBookmarksStore;
typedef struct _GeditFileBookmarksStoreClass GeditFileBookmarksStoreClass;
typedef struct _GeditFileBookmarksStorePrivate GeditFileBookmarksStorePrivate;
-enum
+enum
{
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_ICON = 0,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_NAME,
@@ -46,7 +46,7 @@ enum
GEDIT_FILE_BOOKMARKS_STORE_N_COLUMNS
};
-enum
+enum
{
GEDIT_FILE_BOOKMARKS_STORE_NONE = 0,
GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR = 1 << 0, /* Separator item */
@@ -64,14 +64,14 @@ enum
GEDIT_FILE_BOOKMARKS_STORE_IS_LOCAL_BOOKMARK = 1 << 12 /* A local gtk bookmark */
};
-struct _GeditFileBookmarksStore
+struct _GeditFileBookmarksStore
{
GtkTreeStore parent;
GeditFileBookmarksStorePrivate *priv;
};
-struct _GeditFileBookmarksStoreClass
+struct _GeditFileBookmarksStoreClass
{
GtkTreeStoreClass parent_class;
};
diff --git a/plugins/filebrowser/gedit-file-browser-enum-register.c.template b/plugins/filebrowser/gedit-file-browser-enum-register.c.template
index 63a9c56..1b20fdf 100644
--- a/plugins/filebrowser/gedit-file-browser-enum-register.c.template
+++ b/plugins/filebrowser/gedit-file-browser-enum-register.c.template
@@ -6,7 +6,7 @@ gedit_file_browser_enum_and_flag_register_type (GTypeModule * module)
/*** BEGIN file-production ***/
/* Enumerations from "@filename@" */
-
+
/*** END file-production ***/
/*** BEGIN enumeration-production ***/
diff --git a/plugins/filebrowser/gedit-file-browser-enum-types.h.template b/plugins/filebrowser/gedit-file-browser-enum-types.h.template
index aea4fad..c2013e1 100644
--- a/plugins/filebrowser/gedit-file-browser-enum-types.h.template
+++ b/plugins/filebrowser/gedit-file-browser-enum-types.h.template
@@ -26,4 +26,3 @@ G_END_DECLS
#endif /* __GEDIT_FILE_BROWSER_ENUM_TYPES_H__ */
/*** END file-tail ***/
-
diff --git a/plugins/filebrowser/gedit-file-browser-error.h b/plugins/filebrowser/gedit-file-browser-error.h
index 85f7586..71be224 100644
--- a/plugins/filebrowser/gedit-file-browser-error.h
+++ b/plugins/filebrowser/gedit-file-browser-error.h
@@ -1,5 +1,5 @@
/*
- * gedit-file-browser-error.h - Gedit plugin providing easy file access
+ * gedit-file-browser-error.h - Gedit plugin providing easy file access
* from the sidepanel
*
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
diff --git a/plugins/filebrowser/gedit-file-browser-messages.c b/plugins/filebrowser/gedit-file-browser-messages.c
index f48bdf1..702a91c 100644
--- a/plugins/filebrowser/gedit-file-browser-messages.c
+++ b/plugins/filebrowser/gedit-file-browser-messages.c
@@ -1,18 +1,18 @@
/*
* gedit-file-browser-messages.c
- *
+ *
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
- *
+ *
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -29,7 +29,7 @@
typedef struct
{
- GeditWindow *window;
+ GeditWindow *window;
GeditMessage *message;
} MessageCacheData;
@@ -43,18 +43,18 @@ typedef struct
GList *merge_ids;
GtkActionGroup *merged_actions;
-
+
GeditMessageBus *bus;
GeditFileBrowserWidget *widget;
GHashTable *row_tracking;
-
+
GHashTable *filters;
} WindowData;
typedef struct
{
gulong id;
-
+
GeditWindow *window;
GeditMessage *message;
} FilterData;
@@ -66,10 +66,10 @@ window_data_new (GeditWindow *window,
WindowData *data = g_slice_new (WindowData);
GtkUIManager *manager;
GList *groups;
-
+
data->bus = gedit_window_get_message_bus (window);
data->widget = widget;
- data->row_tracking = g_hash_table_new_full (g_str_hash,
+ data->row_tracking = g_hash_table_new_full (g_str_hash,
g_str_equal,
(GDestroyNotify)g_free,
(GDestroyNotify)gtk_tree_row_reference_free);
@@ -78,15 +78,15 @@ window_data_new (GeditWindow *window,
g_str_equal,
(GDestroyNotify)g_free,
NULL);
-
+
manager = gedit_file_browser_widget_get_ui_manager (widget);
data->merge_ids = NULL;
data->merged_actions = gtk_action_group_new ("MessageMergedActions");
-
+
groups = gtk_ui_manager_get_action_groups (manager);
gtk_ui_manager_insert_action_group (manager, data->merged_actions, g_list_length (groups));
-
+
g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, data);
return data;
@@ -104,13 +104,13 @@ window_data_free (GeditWindow *window)
WindowData *data = get_window_data (window);
GtkUIManager *manager;
GList *item;
-
- g_hash_table_destroy (data->row_tracking);
+
+ g_hash_table_destroy (data->row_tracking);
g_hash_table_destroy (data->filters);
manager = gedit_file_browser_widget_get_ui_manager (data->widget);
gtk_ui_manager_remove_action_group (manager, data->merged_actions);
-
+
for (item = data->merge_ids; item; item = item->next)
gtk_ui_manager_remove_ui (manager, GPOINTER_TO_INT (item->data));
@@ -123,19 +123,19 @@ window_data_free (GeditWindow *window)
}
static FilterData *
-filter_data_new (GeditWindow *window,
+filter_data_new (GeditWindow *window,
GeditMessage *message)
{
FilterData *data = g_slice_new (FilterData);
WindowData *wdata;
-
+
data->window = window;
data->id = 0;
data->message = message;
-
+
wdata = get_window_data (window);
-
- g_hash_table_insert (wdata->filters,
+
+ g_hash_table_insert (wdata->filters,
gedit_message_type_identifier (gedit_message_get_object_path (message),
gedit_message_get_method (message)),
data);
@@ -148,10 +148,10 @@ filter_data_free (FilterData *data)
{
WindowData *wdata = get_window_data (data->window);
gchar *identifier;
-
+
identifier = gedit_message_type_identifier (gedit_message_get_object_path (data->message),
gedit_message_get_method (data->message));
-
+
g_hash_table_remove (wdata->filters, identifier);
g_free (identifier);
@@ -160,16 +160,16 @@ filter_data_free (FilterData *data)
}
static GtkTreePath *
-track_row_lookup (WindowData *data,
+track_row_lookup (WindowData *data,
const gchar *id)
{
GtkTreeRowReference *ref;
-
+
ref = (GtkTreeRowReference *)g_hash_table_lookup (data->row_tracking, id);
-
+
if (!ref)
return NULL;
-
+
return gtk_tree_row_reference_get_path (ref);
}
@@ -185,10 +185,10 @@ message_cache_data_new (GeditWindow *window,
GeditMessage *message)
{
MessageCacheData *data = g_slice_new (MessageCacheData);
-
+
data->window = window;
data->message = message;
-
+
return data;
}
@@ -199,7 +199,7 @@ message_get_root_cb (GeditMessageBus *bus,
{
GeditFileBrowserStore *store;
GFile *location;
-
+
store = gedit_file_browser_widget_get_browser_store (data->widget);
location = gedit_file_browser_store_get_virtual_root (store);
@@ -217,12 +217,12 @@ message_set_root_cb (GeditMessageBus *bus,
{
GFile *root;
GFile *virtual = NULL;
-
+
gedit_message_get (message, "location", &root, NULL);
-
+
if (!root)
return;
-
+
if (gedit_message_has_key (message, "virtual"))
gedit_message_get (message, "virtual", &virtual, NULL);
@@ -241,57 +241,57 @@ message_set_emblem_cb (GeditMessageBus *bus,
gchar *emblem = NULL;
GtkTreePath *path;
GeditFileBrowserStore *store;
-
+
gedit_message_get (message, "id", &id, "emblem", &emblem, NULL);
-
+
if (!id || !emblem)
{
g_free (id);
g_free (emblem);
-
+
return;
}
-
+
path = track_row_lookup (data, id);
-
+
if (path != NULL)
{
GError *error = NULL;
GdkPixbuf *pixbuf;
-
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- emblem,
- 10,
- 0,
+
+ pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+ emblem,
+ 10,
+ 0,
&error);
-
+
if (pixbuf)
{
GValue value = { 0, };
GtkTreeIter iter;
-
+
store = gedit_file_browser_widget_get_browser_store (data->widget);
-
+
if (gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path))
{
g_value_init (&value, GDK_TYPE_PIXBUF);
g_value_set_object (&value, pixbuf);
-
- gedit_file_browser_store_set_value (store,
+
+ gedit_file_browser_store_set_value (store,
&iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_EMBLEM,
&value);
-
+
g_value_unset (&value);
}
-
+
g_object_unref (pixbuf);
}
-
+
if (error)
g_error_free (error);
}
-
+
g_free (id);
g_free (emblem);
}
@@ -319,20 +319,20 @@ track_row (WindowData *data,
GtkTreeRowReference *ref;
gchar *id;
gchar *pathstr;
-
+
pathstr = gtk_tree_path_to_string (path);
id = item_id (pathstr, location);
-
+
ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (store), path);
g_hash_table_insert (data->row_tracking, g_strdup (id), ref);
-
+
g_free (pathstr);
-
+
return id;
}
static void
-set_item_message (WindowData *data,
+set_item_message (WindowData *data,
GtkTreeIter *iter,
GtkTreePath *path,
GeditMessage *message)
@@ -341,14 +341,14 @@ set_item_message (WindowData *data,
GFile *location;
guint flags = 0;
gchar *track_id;
-
+
store = gedit_file_browser_widget_get_browser_store (data->widget);
-
+
gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION, &location,
GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
-1);
-
+
if (!location)
return;
@@ -361,9 +361,9 @@ set_item_message (WindowData *data,
"id", track_id,
"location", location,
NULL);
-
+
if (gedit_message_has_key (message, "is_directory"))
- gedit_message_set (message,
+ gedit_message_set (message,
"is_directory", FILE_IS_DIR (flags),
NULL);
@@ -381,24 +381,24 @@ custom_message_filter_func (GeditFileBrowserWidget *widget,
guint flags = 0;
gboolean filter = FALSE;
GtkTreePath *path;
-
- gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
+
+ gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION, &location,
GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
-1);
-
+
if (!location || FILE_IS_DUMMY (flags))
return FALSE;
-
+
path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), iter);
set_item_message (wdata, iter, path, data->message);
gtk_tree_path_free (path);
-
+
gedit_message_set (data->message, "filter", filter, NULL);
gedit_message_bus_send_message_sync (wdata->bus, data->message);
gedit_message_get (data->message, "filter", &filter, NULL);
-
+
return !filter;
}
@@ -414,38 +414,38 @@ message_add_filter_cb (GeditMessageBus *bus,
GeditMessage *cbmessage;
FilterData *filter_data;
WindowData *data = get_window_data (window);
-
- gedit_message_get (message,
+
+ gedit_message_get (message,
"object_path", &object_path,
"method", &method,
NULL);
-
+
/* Check if there exists such a 'callback' message */
if (!object_path || !method)
{
g_free (object_path);
g_free (method);
-
+
return;
}
-
+
message_type = gedit_message_bus_lookup (bus, object_path, method);
-
+
if (!message_type)
{
g_free (object_path);
g_free (method);
-
+
return;
}
-
+
/* Check if the message type has the correct arguments */
if (gedit_message_type_lookup (message_type, "id") != G_TYPE_STRING ||
gedit_message_type_lookup (message_type, "location") != G_TYPE_FILE ||
gedit_message_type_lookup (message_type, "is_directory") != G_TYPE_BOOLEAN ||
gedit_message_type_lookup (message_type, "filter") != G_TYPE_BOOLEAN)
return;
-
+
cbmessage = gedit_message_type_instantiate (message_type,
"id", NULL,
"location", NULL,
@@ -455,7 +455,7 @@ message_add_filter_cb (GeditMessageBus *bus,
/* Register the custom filter on the widget */
filter_data = filter_data_new (window, cbmessage);
- id = gedit_file_browser_widget_add_filter (data->widget,
+ id = gedit_file_browser_widget_add_filter (data->widget,
(GeditFileBrowserWidgetFilterFunc)custom_message_filter_func,
filter_data,
(GDestroyNotify)filter_data_free);
@@ -469,12 +469,12 @@ message_remove_filter_cb (GeditMessageBus *bus,
WindowData *data)
{
gulong id = 0;
-
+
gedit_message_get (message, "id", &id, NULL);
-
+
if (!id)
return;
-
+
gedit_file_browser_widget_remove_filter (data->widget, id);
}
@@ -484,7 +484,7 @@ message_up_cb (GeditMessageBus *bus,
WindowData *data)
{
GeditFileBrowserStore *store = gedit_file_browser_widget_get_browser_store (data->widget);
-
+
gedit_file_browser_store_set_virtual_root_up (store);
}
@@ -520,12 +520,12 @@ message_set_show_hidden_cb (GeditMessageBus *bus,
gboolean active = FALSE;
GeditFileBrowserStore *store;
GeditFileBrowserStoreFilterMode mode;
-
+
gedit_message_get (message, "active", &active, NULL);
-
+
store = gedit_file_browser_widget_get_browser_store (data->widget);
mode = gedit_file_browser_store_get_filter_mode (store);
-
+
if (active)
mode &= ~GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN;
else
@@ -542,12 +542,12 @@ message_set_show_binary_cb (GeditMessageBus *bus,
gboolean active = FALSE;
GeditFileBrowserStore *store;
GeditFileBrowserStoreFilterMode mode;
-
+
gedit_message_get (message, "active", &active, NULL);
-
+
store = gedit_file_browser_widget_get_browser_store (data->widget);
mode = gedit_file_browser_store_get_filter_mode (store);
-
+
if (active)
mode &= ~GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY;
else
@@ -582,12 +582,12 @@ message_add_context_item_cb (GeditMessageBus *bus,
gchar *name;
GtkUIManager *manager;
guint merge_id;
-
- gedit_message_get (message,
- "action", &action,
- "path", &path,
+
+ gedit_message_get (message,
+ "action", &action,
+ "path", &path,
NULL);
-
+
if (!action || !path)
{
if (action)
@@ -601,15 +601,15 @@ message_add_context_item_cb (GeditMessageBus *bus,
manager = gedit_file_browser_widget_get_ui_manager (data->widget);
name = g_strconcat (gtk_action_get_name (action), "MenuItem", NULL);
merge_id = gtk_ui_manager_new_merge_id (manager);
-
- gtk_ui_manager_add_ui (manager,
+
+ gtk_ui_manager_add_ui (manager,
merge_id,
path,
name,
gtk_action_get_name (action),
GTK_UI_MANAGER_AUTO,
FALSE);
-
+
if (gtk_ui_manager_get_widget (manager, path))
{
data->merge_ids = g_list_prepend (data->merge_ids, GINT_TO_POINTER (merge_id));
@@ -619,7 +619,7 @@ message_add_context_item_cb (GeditMessageBus *bus,
{
gedit_message_set (message, "id", 0, NULL);
}
-
+
g_object_unref (action);
g_free (path);
g_free (name);
@@ -632,14 +632,14 @@ message_remove_context_item_cb (GeditMessageBus *bus,
{
guint merge_id = 0;
GtkUIManager *manager;
-
+
gedit_message_get (message, "id", &merge_id, NULL);
-
+
if (merge_id == 0)
return;
-
+
manager = gedit_file_browser_widget_get_ui_manager (data->widget);
-
+
data->merge_ids = g_list_remove (data->merge_ids, GINT_TO_POINTER (merge_id));
gtk_ui_manager_remove_ui (manager, merge_id);
}
@@ -663,26 +663,26 @@ register_methods (GeditWindow *window,
WindowData *data = get_window_data (window);
/* Register method calls */
- gedit_message_bus_register (bus,
- MESSAGE_OBJECT_PATH, "get_root",
+ gedit_message_bus_register (bus,
+ MESSAGE_OBJECT_PATH, "get_root",
1,
"location", G_TYPE_FILE,
NULL);
-
- gedit_message_bus_register (bus,
- MESSAGE_OBJECT_PATH, "set_root",
- 1,
+
+ gedit_message_bus_register (bus,
+ MESSAGE_OBJECT_PATH, "set_root",
+ 1,
"location", G_TYPE_FILE,
"virtual", G_TYPE_STRING,
NULL);
-
+
gedit_message_bus_register (bus,
MESSAGE_OBJECT_PATH, "set_emblem",
0,
"id", G_TYPE_STRING,
"emblem", G_TYPE_STRING,
NULL);
-
+
gedit_message_bus_register (bus,
MESSAGE_OBJECT_PATH, "add_filter",
1,
@@ -690,13 +690,13 @@ register_methods (GeditWindow *window,
"method", G_TYPE_STRING,
"id", G_TYPE_ULONG,
NULL);
-
+
gedit_message_bus_register (bus,
MESSAGE_OBJECT_PATH, "remove_filter",
0,
"id", G_TYPE_ULONG,
NULL);
-
+
gedit_message_bus_register (bus,
MESSAGE_OBJECT_PATH, "add_context_item",
1,
@@ -710,22 +710,22 @@ register_methods (GeditWindow *window,
0,
"id", G_TYPE_UINT,
NULL);
-
+
gedit_message_bus_register (bus, MESSAGE_OBJECT_PATH, "up", 0, NULL);
-
+
gedit_message_bus_register (bus, MESSAGE_OBJECT_PATH, "history_back", 0, NULL);
gedit_message_bus_register (bus, MESSAGE_OBJECT_PATH, "history_forward", 0, NULL);
-
+
gedit_message_bus_register (bus, MESSAGE_OBJECT_PATH, "refresh", 0, NULL);
- gedit_message_bus_register (bus,
- MESSAGE_OBJECT_PATH, "set_show_hidden",
- 0,
+ gedit_message_bus_register (bus,
+ MESSAGE_OBJECT_PATH, "set_show_hidden",
+ 0,
"active", G_TYPE_BOOLEAN,
NULL);
- gedit_message_bus_register (bus,
+ gedit_message_bus_register (bus,
MESSAGE_OBJECT_PATH, "set_show_binary",
- 0,
+ 0,
"active", G_TYPE_BOOLEAN,
NULL);
@@ -752,10 +752,10 @@ register_methods (GeditWindow *window,
BUS_CONNECT (bus, history_forward, data);
BUS_CONNECT (bus, refresh, data);
-
+
BUS_CONNECT (bus, set_show_hidden, data);
BUS_CONNECT (bus, set_show_binary, data);
-
+
BUS_CONNECT (bus, show_bookmarks, data);
BUS_CONNECT (bus, show_files, data);
@@ -770,14 +770,14 @@ store_row_inserted (GeditFileBrowserStore *store,
{
guint flags = 0;
- gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
-1);
-
+
if (!FILE_IS_DUMMY (flags) && !FILE_IS_FILTERED (flags))
{
WindowData *wdata = get_window_data (data->window);
-
+
set_item_message (wdata, iter, path, data->message);
gedit_message_bus_send_message_sync (wdata->bus, data->message);
}
@@ -790,18 +790,18 @@ store_row_deleted (GeditFileBrowserStore *store,
{
GtkTreeIter iter;
guint flags = 0;
-
+
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path))
return;
-
+
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
-1);
-
+
if (!FILE_IS_DUMMY (flags) && !FILE_IS_FILTERED (flags))
{
WindowData *wdata = get_window_data (data->window);
-
+
set_item_message (wdata, &iter, path, data->message);
gedit_message_bus_send_message_sync (wdata->bus, data->message);
}
@@ -814,18 +814,18 @@ store_virtual_root_changed (GeditFileBrowserStore *store,
{
WindowData *wdata = get_window_data (data->window);
GFile *vroot;
-
+
vroot = gedit_file_browser_store_get_virtual_root (store);
-
+
if (!vroot)
return;
-
+
gedit_message_set (data->message,
"location", vroot,
NULL);
-
+
gedit_message_bus_send_message_sync (wdata->bus, data->message);
-
+
g_object_unref (vroot);
}
@@ -836,11 +836,11 @@ store_begin_loading (GeditFileBrowserStore *store,
{
GtkTreePath *path;
WindowData *wdata = get_window_data (data->window);
-
+
path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), iter);
-
+
set_item_message (wdata, iter, path, data->message);
-
+
gedit_message_bus_send_message_sync (wdata->bus, data->message);
gtk_tree_path_free (path);
}
@@ -852,15 +852,15 @@ store_end_loading (GeditFileBrowserStore *store,
{
GtkTreePath *path;
WindowData *wdata = get_window_data (data->window);
-
+
path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), iter);
-
+
set_item_message (wdata, iter, path, data->message);
-
+
gedit_message_bus_send_message_sync (wdata->bus, data->message);
gtk_tree_path_free (path);
}
-
+
static void
register_signals (GeditWindow *window,
GeditFileBrowserWidget *widget)
@@ -872,7 +872,7 @@ register_signals (GeditWindow *window,
GeditMessageType *begin_loading_type;
GeditMessageType *end_loading_type;
GeditMessageType *root_changed_type;
-
+
GeditMessage *message;
WindowData *data;
@@ -883,7 +883,7 @@ register_signals (GeditWindow *window,
"id", G_TYPE_STRING,
"location", G_TYPE_FILE,
NULL);
-
+
begin_loading_type = gedit_message_bus_register (bus,
MESSAGE_OBJECT_PATH, "begin_loading",
0,
@@ -915,41 +915,41 @@ register_signals (GeditWindow *window,
NULL);
store = gedit_file_browser_widget_get_browser_store (widget);
-
- message = gedit_message_type_instantiate (inserted_type,
+
+ message = gedit_message_type_instantiate (inserted_type,
"id", NULL,
"location", NULL,
- "is_directory", FALSE,
+ "is_directory", FALSE,
NULL);
data = get_window_data (window);
- data->row_inserted_id =
- g_signal_connect_data (store,
- "row-inserted",
- G_CALLBACK (store_row_inserted),
+ data->row_inserted_id =
+ g_signal_connect_data (store,
+ "row-inserted",
+ G_CALLBACK (store_row_inserted),
message_cache_data_new (window, message),
(GClosureNotify)message_cache_data_free,
0);
- message = gedit_message_type_instantiate (deleted_type,
- "id", NULL,
+ message = gedit_message_type_instantiate (deleted_type,
+ "id", NULL,
"location", NULL,
- "is_directory", FALSE,
+ "is_directory", FALSE,
NULL);
- data->row_deleted_id =
- g_signal_connect_data (store,
- "row-deleted",
- G_CALLBACK (store_row_deleted),
+ data->row_deleted_id =
+ g_signal_connect_data (store,
+ "row-deleted",
+ G_CALLBACK (store_row_deleted),
message_cache_data_new (window, message),
(GClosureNotify)message_cache_data_free,
0);
-
+
message = gedit_message_type_instantiate (root_changed_type,
"id", NULL,
"location", NULL,
NULL);
- data->root_changed_id =
+ data->root_changed_id =
g_signal_connect_data (store,
"notify::virtual-root",
G_CALLBACK (store_virtual_root_changed),
@@ -961,7 +961,7 @@ register_signals (GeditWindow *window,
"id", NULL,
"location", NULL,
NULL);
- data->begin_loading_id =
+ data->begin_loading_id =
g_signal_connect_data (store,
"begin_loading",
G_CALLBACK (store_begin_loading),
@@ -973,7 +973,7 @@ register_signals (GeditWindow *window,
"id", NULL,
"location", NULL,
NULL);
- data->end_loading_id =
+ data->end_loading_id =
g_signal_connect_data (store,
"end_loading",
G_CALLBACK (store_end_loading),
@@ -991,28 +991,28 @@ message_unregistered (GeditMessageBus *bus,
gedit_message_type_get_method (message_type));
FilterData *data;
WindowData *wdata = get_window_data (window);
-
+
data = g_hash_table_lookup (wdata->filters, identifier);
-
+
if (data)
gedit_file_browser_widget_remove_filter (wdata->widget, data->id);
-
+
g_free (identifier);
}
-void
-gedit_file_browser_messages_register (GeditWindow *window,
+void
+gedit_file_browser_messages_register (GeditWindow *window,
GeditFileBrowserWidget *widget)
{
window_data_new (window, widget);
-
+
register_methods (window, widget);
register_signals (window, widget);
-
+
g_signal_connect (gedit_window_get_message_bus (window),
"unregistered",
G_CALLBACK (message_unregistered),
- window);
+ window);
}
static void
@@ -1020,15 +1020,15 @@ cleanup_signals (GeditWindow *window)
{
WindowData *data = get_window_data (window);
GeditFileBrowserStore *store;
-
+
store = gedit_file_browser_widget_get_browser_store (data->widget);
-
+
g_signal_handler_disconnect (store, data->row_inserted_id);
g_signal_handler_disconnect (store, data->row_deleted_id);
g_signal_handler_disconnect (store, data->root_changed_id);
g_signal_handler_disconnect (store, data->begin_loading_id);
g_signal_handler_disconnect (store, data->end_loading_id);
-
+
g_signal_handlers_disconnect_by_func (data->bus, message_unregistered, window);
}
@@ -1036,7 +1036,7 @@ void
gedit_file_browser_messages_unregister (GeditWindow *window)
{
GeditMessageBus *bus = gedit_window_get_message_bus (window);
-
+
cleanup_signals (window);
gedit_message_bus_unregister_all (bus, MESSAGE_OBJECT_PATH);
diff --git a/plugins/filebrowser/gedit-file-browser-messages.h b/plugins/filebrowser/gedit-file-browser-messages.h
index 2a07667..a80688d 100644
--- a/plugins/filebrowser/gedit-file-browser-messages.h
+++ b/plugins/filebrowser/gedit-file-browser-messages.h
@@ -1,5 +1,5 @@
/*
- * gedit-file-browser-messages.h - Gedit plugin providing easy file access
+ * gedit-file-browser-messages.h - Gedit plugin providing easy file access
* from the sidepanel
*
* Copyright (C) 2008 - Jesse van den Kieboom <jesse icecrew nl>
diff --git a/plugins/filebrowser/gedit-file-browser-plugin.c b/plugins/filebrowser/gedit-file-browser-plugin.c
index 36472f5..1d2a2ed 100644
--- a/plugins/filebrowser/gedit-file-browser-plugin.c
+++ b/plugins/filebrowser/gedit-file-browser-plugin.c
@@ -1,19 +1,19 @@
/*
- * gedit-file-browser-plugin.c - Gedit plugin providing easy file access
+ * gedit-file-browser-plugin.c - Gedit plugin providing easy file access
* from the sidepanel
- *
+ *
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
- *
+ *
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -57,14 +57,14 @@
#define GEDIT_FILE_BROWSER_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_FILE_BROWSER_PLUGIN, GeditFileBrowserPluginPrivate))
-struct _GeditFileBrowserPluginPrivate
+struct _GeditFileBrowserPluginPrivate
{
GSettings *settings;
GSettings *nautilus_settings;
GSettings *terminal_settings;
};
-typedef struct _GeditFileBrowserPluginData
+typedef struct _GeditFileBrowserPluginData
{
GeditFileBrowserPlugin *plugin;
GeditFileBrowserWidget *tree_widget;
@@ -85,7 +85,7 @@ static void on_location_activated_cb (GeditFileBrowserWidget *widget,
GeditWindow *window);
static void on_error_cb (GeditFileBrowserWidget *widget,
guint code,
- gchar const *message,
+ gchar const *message,
GeditWindow *window);
static void on_model_set_cb (GeditFileBrowserView *widget,
GParamSpec *arg1,
@@ -128,7 +128,7 @@ static void
filetree_plugin_init (GeditFileBrowserPlugin *plugin)
{
plugin->priv = GEDIT_FILE_BROWSER_PLUGIN_GET_PRIVATE (plugin);
-
+
plugin->priv->settings = g_settings_new (FILEBROWSER_BASE_SETTINGS);
plugin->priv->nautilus_settings = g_settings_new (NAUTILUS_BASE_SETTINGS);
plugin->priv->terminal_settings = g_settings_new (TERMINAL_BASE_SETTINGS);
@@ -138,25 +138,25 @@ static void
filetree_plugin_dispose (GObject *object)
{
GeditFileBrowserPlugin *plugin = GEDIT_FILE_BROWSER_PLUGIN (object);
-
+
if (plugin->priv->settings != NULL)
{
g_object_unref (plugin->priv->settings);
plugin->priv->settings = NULL;
}
-
+
if (plugin->priv->nautilus_settings != NULL)
{
g_object_unref (plugin->priv->nautilus_settings);
plugin->priv->nautilus_settings = NULL;
}
-
+
if (plugin->priv->terminal_settings != NULL)
{
g_object_unref (plugin->priv->terminal_settings);
plugin->priv->terminal_settings = NULL;
}
-
+
G_OBJECT_CLASS (filetree_plugin_parent_class)->dispose (object);
}
@@ -166,7 +166,7 @@ get_plugin_data (GeditWindow *window)
return (GeditFileBrowserPluginData *) (g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY));
}
-static void
+static void
on_end_loading_cb (GeditFileBrowserStore *store,
GtkTreeIter *iter,
GeditFileBrowserPluginData *data)
@@ -192,13 +192,13 @@ prepare_auto_root (GeditFileBrowserPluginData *data)
data->end_loading_handle = 0;
}
- data->end_loading_handle = g_signal_connect (store,
+ data->end_loading_handle = g_signal_connect (store,
"end-loading",
G_CALLBACK (on_end_loading_cb),
data);
}
-static void
+static void
restore_default_location (GeditFileBrowserPluginData *data)
{
gchar *root;
@@ -214,7 +214,7 @@ restore_default_location (GeditFileBrowserPluginData *data)
gedit_file_browser_widget_show_bookmarks (data->tree_widget);
return;
}
-
+
root = g_settings_get_string (data->plugin->priv->settings,
FILEBROWSER_ROOT);
virtual_root = g_settings_get_string (data->plugin->priv->settings,
@@ -236,7 +236,7 @@ restore_default_location (GeditFileBrowserPluginData *data)
if (virtual_root != NULL && *virtual_root != '\0')
{
prepare_auto_root (data);
- gedit_file_browser_widget_set_root_and_virtual_root (data->tree_widget,
+ gedit_file_browser_widget_set_root_and_virtual_root (data->tree_widget,
rootfile,
vrootfile);
}
@@ -258,7 +258,7 @@ restore_default_location (GeditFileBrowserPluginData *data)
}
static void
-restore_filter (GeditFileBrowserPluginData *data)
+restore_filter (GeditFileBrowserPluginData *data)
{
gchar *filter_mode;
GeditFileBrowserStoreFilterMode mode;
@@ -267,10 +267,10 @@ restore_filter (GeditFileBrowserPluginData *data)
/* Get filter_mode */
filter_mode = g_settings_get_string (data->plugin->priv->settings,
FILEBROWSER_FILTER_MODE);
-
+
/* Filter mode */
mode = gedit_file_browser_store_filter_mode_get_default ();
-
+
if (filter_mode != NULL)
{
if (strcmp (filter_mode, "hidden") == 0)
@@ -285,7 +285,7 @@ restore_filter (GeditFileBrowserPluginData *data)
*filter_mode == '\0')
mode = GEDIT_FILE_BROWSER_STORE_FILTER_MODE_NONE;
}
-
+
/* Set the filter mode */
gedit_file_browser_store_set_filter_mode (
gedit_file_browser_widget_get_browser_store (data->tree_widget),
@@ -294,7 +294,7 @@ restore_filter (GeditFileBrowserPluginData *data)
pattern = g_settings_get_string (data->plugin->priv->settings,
FILEBROWSER_FILTER_PATTERN);
- gedit_file_browser_widget_set_filter_pattern (data->tree_widget,
+ gedit_file_browser_widget_set_filter_pattern (data->tree_widget,
pattern);
g_free (filter_mode);
@@ -321,11 +321,11 @@ on_click_policy_changed (GSettings *settings,
GeditFileBrowserView *view;
data = (GeditFileBrowserPluginData *)(user_data);
-
+
click_policy = g_settings_get_string (settings, key);
policy = click_policy_from_string (click_policy);
g_free (click_policy);
-
+
view = gedit_file_browser_widget_get_browser_view (data->tree_widget);
gedit_file_browser_view_set_click_policy (view, policy);
}
@@ -368,7 +368,7 @@ install_nautilus_prefs (GeditFileBrowserPluginData *data)
data);
g_free (pref);
}
-
+
/* Bind enable-delete */
g_settings_bind (data->plugin->priv->nautilus_settings,
NAUTILUS_ENABLE_DELETE_KEY,
@@ -382,7 +382,7 @@ install_nautilus_prefs (GeditFileBrowserPluginData *data)
data->confirm_trash = prefb;
- data->confirm_trash_handle =
+ data->confirm_trash_handle =
g_signal_connect (data->plugin->priv->nautilus_settings,
"changed::" NAUTILUS_CONFIRM_TRASH_KEY,
G_CALLBACK (on_confirm_trash_changed),
@@ -424,7 +424,7 @@ on_action_set_active_root (GtkAction *action,
GeditFileBrowserPluginData *data;
data = get_plugin_data (window);
- set_root_from_doc (data,
+ set_root_from_doc (data,
gedit_window_get_active_document (window));
}
@@ -461,7 +461,7 @@ on_action_open_terminal (GtkAction *action,
GtkTreeIter iter;
GeditFileBrowserStore *store;
-
+
data = get_plugin_data (window);
/* Get the current directory */
@@ -469,31 +469,31 @@ on_action_open_terminal (GtkAction *action,
return;
store = gedit_file_browser_widget_get_browser_store (data->tree_widget);
- gtk_tree_model_get (GTK_TREE_MODEL (store),
+ gtk_tree_model_get (GTK_TREE_MODEL (store),
&iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION,
&file,
-1);
-
+
if (file == NULL)
return;
terminal = get_terminal (data);
-
+
local = g_file_get_path (file);
argv[0] = terminal;
argv[1] = NULL;
-
- g_spawn_async (local,
- argv,
- NULL,
- G_SPAWN_SEARCH_PATH,
+
+ g_spawn_async (local,
+ argv,
+ NULL,
+ G_SPAWN_SEARCH_PATH,
NULL,
NULL,
NULL,
NULL);
-
+
g_free (terminal);
g_free (local);
}
@@ -510,18 +510,18 @@ on_selection_changed_cb (GtkTreeSelection *selection,
GFile *location;
data = get_plugin_data (window);
-
+
tree_view = GTK_TREE_VIEW (gedit_file_browser_widget_get_browser_view (data->tree_widget));
model = gtk_tree_view_get_model (tree_view);
-
+
if (!GEDIT_IS_FILE_BROWSER_STORE (model))
return;
-
+
sensitive = gedit_file_browser_widget_get_selected_directory (data->tree_widget, &iter);
if (sensitive)
{
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (model, &iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION,
&location, -1);
@@ -551,7 +551,7 @@ on_selection_changed_cb (GtkTreeSelection *selection,
" </popup>" \
"</ui>"
-static GtkActionEntry extra_actions[] =
+static GtkActionEntry extra_actions[] =
{
{"SetActiveRoot", GTK_STOCK_JUMP_TO, N_("_Set root to active document"),
NULL,
@@ -595,9 +595,9 @@ add_popup_ui (GeditWindow *window)
gtk_ui_manager_insert_action_group (manager, action_group, 0);
data->single_selection_action_group = action_group;
- data->merge_id = gtk_ui_manager_add_ui_from_string (manager,
- POPUP_UI,
- -1,
+ data->merge_id = gtk_ui_manager_add_ui_from_string (manager,
+ POPUP_UI,
+ -1,
&error);
if (data->merge_id == 0)
@@ -612,11 +612,11 @@ remove_popup_ui (GeditWindow *window)
{
GeditFileBrowserPluginData *data;
GtkUIManager *manager;
-
+
data = get_plugin_data (window);
manager = gedit_file_browser_widget_get_ui_manager (data->tree_widget);
gtk_ui_manager_remove_ui (manager, data->merge_id);
-
+
gtk_ui_manager_remove_action_group (manager, data->action_group);
g_object_unref (data->action_group);
@@ -626,16 +626,16 @@ remove_popup_ui (GeditWindow *window)
static void
impl_updateui (GeditPlugin *plugin,
- GeditWindow *window)
+ GeditWindow *window)
{
GeditFileBrowserPluginData *data;
GeditDocument *doc;
-
+
data = get_plugin_data (window);
-
+
doc = gedit_window_get_active_document (window);
-
- gtk_action_set_sensitive (gtk_action_group_get_action (data->action_group,
+
+ gtk_action_set_sensitive (gtk_action_group_get_action (data->action_group,
"SetActiveRoot"),
doc != NULL && !gedit_document_is_untitled (doc));
}
@@ -652,7 +652,7 @@ impl_activate (GeditPlugin *plugin,
gchar *data_dir;
data = g_slice_new0 (GeditFileBrowserPluginData);
-
+
data_dir = gedit_plugin_get_data_dir (plugin);
data->tree_widget = GEDIT_FILE_BROWSER_WIDGET (gedit_file_browser_widget_new (data_dir));
data->plugin = GEDIT_FILE_BROWSER_PLUGIN (plugin);
@@ -680,17 +680,17 @@ impl_activate (GeditPlugin *plugin,
G_CALLBACK (on_confirm_no_trash_cb),
window);
- g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW
- (gedit_file_browser_widget_get_browser_view
+ g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW
+ (gedit_file_browser_widget_get_browser_view
(data->tree_widget))),
"changed",
G_CALLBACK (on_selection_changed_cb),
- window);
+ window);
panel = gedit_window_get_side_panel (window);
- pixbuf = gedit_file_browser_utils_pixbuf_from_theme("system-file-manager",
+ pixbuf = gedit_file_browser_utils_pixbuf_from_theme("system-file-manager",
GTK_ICON_SIZE_MENU);
-
+
if (pixbuf)
{
image = gtk_image_new_from_pixbuf(pixbuf);
@@ -714,10 +714,10 @@ impl_activate (GeditPlugin *plugin,
/* Restore filter options */
restore_filter (data);
-
+
/* Install nautilus preferences */
install_nautilus_prefs (data);
-
+
/* Connect signals to store the last visited location */
g_signal_connect (gedit_file_browser_widget_get_browser_view (data->tree_widget),
"notify::model",
@@ -744,7 +744,7 @@ impl_activate (GeditPlugin *plugin,
"tab-added",
G_CALLBACK (on_tab_added_cb),
data);
-
+
/* Register messages on the bus */
gedit_file_browser_messages_register (window, data->tree_widget);
@@ -764,7 +764,7 @@ impl_deactivate (GeditPlugin *plugin,
gedit_file_browser_messages_unregister (window);
/* Disconnect signals */
- g_signal_handlers_disconnect_by_func (window,
+ g_signal_handlers_disconnect_by_func (window,
G_CALLBACK (on_tab_added_cb),
data);
@@ -823,12 +823,12 @@ on_error_cb (GeditFileBrowserWidget *tree_widget,
gchar *title;
GtkWidget *dlg;
GeditFileBrowserPluginData *data;
-
+
data = get_plugin_data (window);
-
+
/* Do not show the error when the root has been set automatically */
if (data->auto_root && (code == GEDIT_FILE_BROWSER_ERROR_SET_ROOT ||
- code == GEDIT_FILE_BROWSER_ERROR_LOAD_DIRECTORY))
+ code == GEDIT_FILE_BROWSER_ERROR_LOAD_DIRECTORY))
{
/* Show bookmarks */
gedit_file_browser_widget_show_bookmarks (data->tree_widget);
@@ -875,7 +875,7 @@ on_error_cb (GeditFileBrowserWidget *tree_widget,
gtk_widget_destroy (dlg);
}
-static void
+static void
on_model_set_cb (GeditFileBrowserView *widget,
GParamSpec *arg1,
GeditWindow *window)
@@ -884,7 +884,7 @@ on_model_set_cb (GeditFileBrowserView *widget,
GtkTreeModel *model;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (gedit_file_browser_widget_get_browser_view (data->tree_widget)));
-
+
if (model == NULL)
return;
@@ -893,7 +893,7 @@ on_model_set_cb (GeditFileBrowserView *widget,
GEDIT_IS_FILE_BROWSER_STORE (model));
}
-static void
+static void
on_filter_mode_changed_cb (GeditFileBrowserStore *model,
GParamSpec *param,
GeditWindow *window)
@@ -902,7 +902,7 @@ on_filter_mode_changed_cb (GeditFileBrowserStore *model,
GeditFileBrowserPluginData *data = get_plugin_data (window);
mode = gedit_file_browser_store_get_filter_mode (model);
-
+
if ((mode & GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN) &&
(mode & GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY))
{
@@ -941,16 +941,16 @@ on_rename_cb (GeditFileBrowserStore *store,
GList *item;
GeditDocument *doc;
GFile *docfile;
-
+
/* Find all documents and set its uri to newuri where it matches olduri */
app = gedit_app_get_default ();
documents = gedit_app_get_documents (app);
-
+
for (item = documents; item; item = item->next)
{
doc = GEDIT_DOCUMENT (item->data);
docfile = gedit_document_get_location (doc);
-
+
if (!docfile)
continue;
@@ -984,7 +984,7 @@ on_rename_cb (GeditFileBrowserStore *store,
g_list_free (documents);
}
-static void
+static void
on_filter_pattern_changed_cb (GeditFileBrowserWidget *widget,
GParamSpec *param,
GeditWindow *window)
@@ -993,7 +993,7 @@ on_filter_pattern_changed_cb (GeditFileBrowserWidget *widget,
gchar *pattern;
g_object_get (G_OBJECT (widget), "filter-pattern", &pattern, NULL);
-
+
if (pattern == NULL)
{
g_settings_set_string (data->plugin->priv->settings,
@@ -1010,10 +1010,10 @@ on_filter_pattern_changed_cb (GeditFileBrowserWidget *widget,
g_free (pattern);
}
-static void
+static void
on_virtual_root_changed_cb (GeditFileBrowserStore *store,
GParamSpec *param,
- GeditWindow *window)
+ GeditWindow *window)
{
GeditFileBrowserPluginData *data = get_plugin_data (window);
GFile *root;
@@ -1021,7 +1021,7 @@ on_virtual_root_changed_cb (GeditFileBrowserStore *store,
gchar *uri_root = NULL;
root = gedit_file_browser_store_get_root (store);
-
+
if (!root)
{
return;
@@ -1036,7 +1036,7 @@ on_virtual_root_changed_cb (GeditFileBrowserStore *store,
FILEBROWSER_ROOT,
uri_root);
g_free (uri_root);
-
+
virtual_root = gedit_file_browser_store_get_virtual_root (store);
if (!virtual_root)
@@ -1059,12 +1059,12 @@ on_virtual_root_changed_cb (GeditFileBrowserStore *store,
g_object_unref (virtual_root);
}
- g_signal_handlers_disconnect_by_func (window,
+ g_signal_handlers_disconnect_by_func (window,
G_CALLBACK (on_tab_added_cb),
data);
}
-static void
+static void
on_tab_added_cb (GeditWindow *window,
GeditTab *tab,
GeditFileBrowserPluginData *data)
@@ -1100,7 +1100,7 @@ on_tab_added_cb (GeditWindow *window,
restore_default_location (data);
/* Disconnect this signal, it's only called once */
- g_signal_handlers_disconnect_by_func (window,
+ g_signal_handlers_disconnect_by_func (window,
G_CALLBACK (on_tab_added_cb),
data);
}
@@ -1116,7 +1116,7 @@ get_filename_from_path (GtkTreeModel *model,
gtk_tree_model_get (model, &iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION, &location,
-1);
-
+
return gedit_file_browser_utils_file_basename (location);
}
@@ -1144,10 +1144,10 @@ on_confirm_no_trash_cb (GeditFileBrowserWidget *widget,
}
result = gedit_file_browser_utils_confirmation_dialog (window,
- GTK_MESSAGE_QUESTION,
- message,
- secondary,
- GTK_STOCK_DELETE,
+ GTK_MESSAGE_QUESTION,
+ message,
+ secondary,
+ GTK_STOCK_DELETE,
NULL);
g_free (secondary);
@@ -1185,10 +1185,10 @@ on_confirm_delete_cb (GeditFileBrowserWidget *widget,
secondary = _("If you delete an item, it is permanently lost.");
result = gedit_file_browser_utils_confirmation_dialog (window,
- GTK_MESSAGE_QUESTION,
- message,
- secondary,
- GTK_STOCK_DELETE,
+ GTK_MESSAGE_QUESTION,
+ message,
+ secondary,
+ GTK_STOCK_DELETE,
NULL);
g_free (message);
diff --git a/plugins/filebrowser/gedit-file-browser-plugin.h b/plugins/filebrowser/gedit-file-browser-plugin.h
index 07ec4db..f2d1248 100644
--- a/plugins/filebrowser/gedit-file-browser-plugin.h
+++ b/plugins/filebrowser/gedit-file-browser-plugin.h
@@ -1,5 +1,5 @@
/*
- * gedit-file-browser-plugin.h - Gedit plugin providing easy file access
+ * gedit-file-browser-plugin.h - Gedit plugin providing easy file access
* from the sidepanel
*
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
@@ -42,7 +42,7 @@ typedef struct _GeditFileBrowserPluginPrivate GeditFileBrowserPluginPrivate;
typedef struct _GeditFileBrowserPlugin GeditFileBrowserPlugin;
typedef struct _GeditFileBrowserPluginClass GeditFileBrowserPluginClass;
-struct _GeditFileBrowserPlugin
+struct _GeditFileBrowserPlugin
{
GeditPlugin parent_instance;
@@ -50,7 +50,7 @@ struct _GeditFileBrowserPlugin
GeditFileBrowserPluginPrivate *priv;
};
-struct _GeditFileBrowserPluginClass
+struct _GeditFileBrowserPluginClass
{
GeditPluginClass parent_class;
};
diff --git a/plugins/filebrowser/gedit-file-browser-store.c b/plugins/filebrowser/gedit-file-browser-store.c
index 3c3ceba..4f91580 100644
--- a/plugins/filebrowser/gedit-file-browser-store.c
+++ b/plugins/filebrowser/gedit-file-browser-store.c
@@ -1,19 +1,19 @@
/*
- * gedit-file-browser-store.c - Gedit plugin providing easy file access
+ * gedit-file-browser-store.c - Gedit plugin providing easy file access
* from the sidepanel
- *
+ *
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
- *
+ *
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -88,7 +88,7 @@ typedef struct {
GCancellable *cancellable;
} MountInfo;
-struct _FileBrowserNode
+struct _FileBrowserNode
{
GFile *file;
guint flags;
@@ -102,7 +102,7 @@ struct _FileBrowserNode
gboolean inserted;
};
-struct _FileBrowserNodeDir
+struct _FileBrowserNodeDir
{
FileBrowserNode node;
GSList *children;
@@ -113,7 +113,7 @@ struct _FileBrowserNodeDir
GeditFileBrowserStore *model;
};
-struct _GeditFileBrowserStorePrivate
+struct _GeditFileBrowserStorePrivate
{
FileBrowserNode *root;
FileBrowserNode *virtual_root;
@@ -133,7 +133,7 @@ static FileBrowserNode *model_find_node (GeditFileBrowserStore *model,
FileBrowserNode *node,
GFile *uri);
static void model_remove_node (GeditFileBrowserStore *model,
- FileBrowserNode *node,
+ FileBrowserNode *node,
GtkTreePath *path,
gboolean free_nodes);
@@ -165,7 +165,7 @@ static gint gedit_file_browser_store_iter_n_children (GtkTreeModel
GtkTreeIter *iter);
static gboolean gedit_file_browser_store_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *iter,
- GtkTreeIter *parent,
+ GtkTreeIter *parent,
gint n);
static gboolean gedit_file_browser_store_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter,
@@ -216,7 +216,7 @@ enum {
};
/* Signals */
-enum
+enum
{
BEGIN_LOADING,
END_LOADING,
@@ -256,10 +256,10 @@ gedit_file_browser_store_finalize (GObject *object)
{
AsyncData *data = (AsyncData *) (item->data);
g_cancellable_cancel (data->cancellable);
-
+
data->removed = TRUE;
}
-
+
cancel_mount_operation (obj);
g_slist_free (obj->priv->async_handles);
@@ -295,7 +295,7 @@ gedit_file_browser_store_get_property (GObject *object,
break;
case PROP_VIRTUAL_ROOT:
set_gvalue_from_node (value, obj->priv->virtual_root);
- break;
+ break;
case PROP_FILTER_MODE:
g_value_set_flags (value, obj->priv->filter_mode);
break;
@@ -669,13 +669,13 @@ gedit_file_browser_store_get_path (GtkTreeModel *tree_model,
g_return_val_if_fail (iter != NULL, NULL);
g_return_val_if_fail (iter->user_data != NULL, NULL);
- return gedit_file_browser_store_get_path_real (GEDIT_FILE_BROWSER_STORE (tree_model),
+ return gedit_file_browser_store_get_path_real (GEDIT_FILE_BROWSER_STORE (tree_model),
(FileBrowserNode *) (iter->user_data));
}
static void
gedit_file_browser_store_get_value (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
+ GtkTreeIter *iter,
gint column,
GValue *value)
{
@@ -787,7 +787,7 @@ filter_tree_model_iter_has_child_real (GeditFileBrowserStore *model,
FileBrowserNode *node)
{
GSList *item;
-
+
if (!NODE_IS_DIR (node))
return FALSE;
@@ -928,7 +928,7 @@ gedit_file_browser_store_row_inserted (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
FileBrowserNode *node = (FileBrowserNode *)(iter->user_data);
-
+
node->inserted = TRUE;
}
@@ -949,7 +949,7 @@ gedit_file_browser_store_row_draggable (GtkTreeDragSource *drag_source,
GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
-1);
- return !FILE_IS_DUMMY(flags);
+ return !FILE_IS_DUMMY (flags);
}
static gboolean
@@ -1120,8 +1120,7 @@ model_resort_node (GeditFileBrowserStore *model,
{
/* Just sort the children of the parent */
dir->children = g_slist_sort (dir->children,
- (GCompareFunc) (model->priv->
- sort_func));
+ (GCompareFunc) (model->priv->sort_func));
}
else
{
@@ -1135,8 +1134,7 @@ model_resort_node (GeditFileBrowserStore *model,
}
dir->children = g_slist_sort (dir->children,
- (GCompareFunc) (model->priv->
- sort_func));
+ (GCompareFunc) (model->priv->sort_func));
neworder = g_new (gint, pos);
pos = 0;
@@ -1169,9 +1167,9 @@ row_changed (GeditFileBrowserStore *model,
/* Insert a copy of the actual path here because the row-inserted
signal may alter the path */
- gtk_tree_model_row_changed (GTK_TREE_MODEL(model), *path, iter);
+ gtk_tree_model_row_changed (GTK_TREE_MODEL (model), *path, iter);
gtk_tree_path_free (*path);
-
+
*path = gtk_tree_row_reference_get_path (ref);
gtk_tree_row_reference_free (ref);
}
@@ -1183,16 +1181,16 @@ row_inserted (GeditFileBrowserStore *model,
{
/* This function creates a row reference for the path because it's
uncertain what might change the actual model/view when we insert
- a node, maybe another directory load is triggered for example.
+ a node, maybe another directory load is triggered for example.
Because functions that use this function rely on the notion that
the path remains pointed towards the inserted node, we use the
reference to keep track. */
GtkTreeRowReference *ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), *path);
GtkTreePath *copy = gtk_tree_path_copy (*path);
- gtk_tree_model_row_inserted (GTK_TREE_MODEL(model), copy, iter);
+ gtk_tree_model_row_inserted (GTK_TREE_MODEL (model), copy, iter);
gtk_tree_path_free (copy);
-
+
if (ref)
{
gtk_tree_path_free (*path);
@@ -1212,7 +1210,7 @@ row_deleted (GeditFileBrowserStore *model,
const GtkTreePath *path)
{
GtkTreePath *copy = gtk_tree_path_copy (path);
-
+
/* Delete a copy of the actual path here because the row-deleted
signal may alter the path */
gtk_tree_model_row_deleted (GTK_TREE_MODEL(model), copy);
@@ -1244,7 +1242,7 @@ model_refilter_node (GeditFileBrowserStore *model,
{
if (in_tree)
tmppath = gedit_file_browser_store_get_path_real (model,
- node);
+ node);
else
tmppath = gtk_tree_path_new_first ();
@@ -1292,7 +1290,7 @@ model_refilter_node (GeditFileBrowserStore *model,
gtk_tree_path_next (*path);
}
}
-
+
model_check_dummy (model, node);
if (tmppath)
@@ -1345,8 +1343,7 @@ file_browser_node_dir_new (GeditFileBrowserStore *model,
GFile *file,
FileBrowserNode *parent)
{
- FileBrowserNode *node =
- (FileBrowserNode *) g_slice_new0 (FileBrowserNodeDir);
+ FileBrowserNode *node = (FileBrowserNode *)g_slice_new0 (FileBrowserNodeDir);
file_browser_node_init (node, file, parent);
@@ -1415,7 +1412,7 @@ file_browser_node_free (GeditFileBrowserStore *model,
if (dir->hidden_file_hash)
g_hash_table_destroy (dir->hidden_file_hash);
}
-
+
if (node->file)
{
g_signal_emit (model, model_signals[UNLOAD], 0, node->file);
@@ -1430,7 +1427,7 @@ file_browser_node_free (GeditFileBrowserStore *model,
g_object_unref (node->emblem);
g_free (node->name);
-
+
if (NODE_IS_DIR (node))
g_slice_free (FileBrowserNodeDir, (FileBrowserNodeDir *)node);
else
@@ -1443,7 +1440,7 @@ file_browser_node_free (GeditFileBrowserStore *model,
* @node: the FileBrowserNode to remove
* @path: the path of the node, or NULL to let the path be calculated
* @free_nodes: whether to also remove the nodes from memory
- *
+ *
* Removes all the children of node from the model. This function is used
* to remove the child nodes from the _model_. Don't use it to just free
* a node.
@@ -1473,10 +1470,10 @@ model_remove_node_children (GeditFileBrowserStore *model,
be freed */
if (free_nodes)
file_browser_node_free_children (model, node);
-
+
return;
}
-
+
if (path == NULL)
path_child = gedit_file_browser_store_get_path_real (model, node);
else
@@ -1500,10 +1497,10 @@ model_remove_node_children (GeditFileBrowserStore *model,
* model_remove_node:
* @model: the #GeditFileBrowserStore
* @node: the FileBrowserNode to remove
- * @path: the path to use to remove this node, or NULL to use the path
+ * @path: the path to use to remove this node, or NULL to use the path
* calculated from the node itself
* @free_nodes: whether to also remove the nodes from memory
- *
+ *
* Removes this node and all its children from the model. This function is used
* to remove the node from the _model_. Don't use it to just free
* a node.
@@ -1549,7 +1546,7 @@ model_remove_node (GeditFileBrowserStore *model,
node);
}
}
-
+
/* If this is the virtual root, than set the parent as the virtual root */
if (node == model->priv->virtual_root)
set_virtual_root_from_node (model, parent);
@@ -1565,7 +1562,7 @@ model_remove_node (GeditFileBrowserStore *model,
* model_clear:
* @model: the #GeditFileBrowserStore
* @free_nodes: whether to also remove the nodes from memory
- *
+ *
* Removes all nodes from the model. This function is used
* to remove all the nodes from the _model_. Don't use it to just free the
* nodes in the model.
@@ -1596,7 +1593,7 @@ model_clear (GeditFileBrowserStore *model,
model_node_visibility (model, dummy))
{
path = gtk_tree_path_new_first ();
-
+
dummy->inserted = FALSE;
row_deleted (model, path);
gtk_tree_path_free (path);
@@ -1611,7 +1608,7 @@ file_browser_node_unload (GeditFileBrowserStore *model,
gboolean remove_children)
{
FileBrowserNodeDir *dir;
-
+
if (node == NULL)
return;
@@ -1636,7 +1633,7 @@ file_browser_node_unload (GeditFileBrowserStore *model,
{
g_file_monitor_cancel (dir->monitor);
g_object_unref (dir->monitor);
-
+
dir->monitor = NULL;
}
@@ -1659,7 +1656,7 @@ model_recomposite_icon_real (GeditFileBrowserStore *tree_model,
if (info)
{
GIcon *gicon = g_file_info_get_icon (info);
-
+
if (gicon != NULL)
icon = gedit_file_browser_utils_pixbuf_from_icon (gicon, GTK_ICON_SIZE_MENU);
else
@@ -1801,7 +1798,7 @@ model_check_dummy (GeditFileBrowserStore *model,
path =
gedit_file_browser_store_get_path_real
(model, dummy);
-
+
row_inserted (model, &path, &iter);
gtk_tree_path_free (path);
}
@@ -1814,7 +1811,7 @@ model_check_dummy (GeditFileBrowserStore *model,
dummy->flags &= ~GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN;
path = gedit_file_browser_store_get_path_real (model, dummy);
dummy->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN;
-
+
dummy->inserted = FALSE;
row_deleted (model, path);
gtk_tree_path_free (path);
@@ -1969,15 +1966,15 @@ static gchar const *
backup_content_type (GFileInfo *info)
{
gchar const *content;
-
+
if (!g_file_info_get_is_backup (info))
return NULL;
-
+
content = g_file_info_get_content_type (info);
-
+
if (!content || g_content_type_equals (content, "application/x-trash"))
return "text/plain";
-
+
return content;
}
@@ -1997,12 +1994,12 @@ file_browser_node_set_from_info (GeditFileBrowserStore *model,
if (info == NULL)
{
- info = g_file_query_info (node->file,
+ info = g_file_query_info (node->file,
STANDARD_ATTRIBUTE_TYPES,
G_FILE_QUERY_INFO_NONE,
NULL,
&error);
-
+
if (!info)
{
if (!(error->domain == G_IO_ERROR && error->code == G_IO_ERROR_NOT_FOUND))
@@ -2015,7 +2012,7 @@ file_browser_node_set_from_info (GeditFileBrowserStore *model,
return;
}
-
+
free_info = TRUE;
}
@@ -2040,15 +2037,15 @@ file_browser_node_set_from_info (GeditFileBrowserStore *model,
{
if (!(content = backup_content_type (info)))
content = g_file_info_get_content_type (info);
-
- if (!content ||
+
+ if (!content ||
g_content_type_is_unknown (content) ||
g_content_type_is_a (content, "text/plain"))
{
node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_TEXT;
- }
+ }
}
-
+
model_recomposite_icon_real (model, node, info);
if (free_info)
@@ -2059,7 +2056,7 @@ file_browser_node_set_from_info (GeditFileBrowserStore *model,
path = gedit_file_browser_store_get_path_real (model, node);
model_refilter_node (model, node, &path);
gtk_tree_path_free (path);
-
+
model_check_dummy (model, node->parent);
}
else
@@ -2111,12 +2108,12 @@ model_add_node_from_file (GeditFileBrowserStore *model,
&error);
free_info = TRUE;
}
-
+
if (!info)
{
g_warning ("Error querying file info: %s", error->message);
g_error_free (error);
-
+
/* FIXME: What to do now then... */
node = file_browser_node_new (file, parent);
}
@@ -2131,7 +2128,7 @@ model_add_node_from_file (GeditFileBrowserStore *model,
file_browser_node_set_from_info (model, node, info, FALSE);
model_add_node (model, node, parent);
-
+
if (info && free_info)
g_object_unref (info);
}
@@ -2168,7 +2165,7 @@ model_add_nodes_from_files (GeditFileBrowserStore *model,
{
g_object_unref (info);
continue;
- }
+ }
name = g_file_info_get_name (info);
@@ -2211,7 +2208,7 @@ model_add_node_from_dir (GeditFileBrowserStore *model,
/* Check if it already exists */
if ((node = node_list_contains_file (FILE_BROWSER_NODE_DIR (parent)->children, file)) == NULL)
- {
+ {
node = file_browser_node_dir_new (model, file, parent);
file_browser_node_set_from_info (model, node, NULL, FALSE);
@@ -2245,15 +2242,15 @@ parse_dot_hidden_file (FileBrowserNode *directory)
*/
if (directory->file == NULL || !g_file_is_native (directory->file))
return;
-
+
child = g_file_get_child (directory->file, ".hidden");
info = g_file_query_info (child, G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL);
type = info ? g_file_info_get_file_type (info) : G_FILE_TYPE_UNKNOWN;
-
+
if (info)
g_object_unref (info);
-
+
if (type != G_FILE_TYPE_REGULAR)
{
g_object_unref (child);
@@ -2273,7 +2270,7 @@ parse_dot_hidden_file (FileBrowserNode *directory)
dir->hidden_file_hash =
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
}
-
+
/* Now parse the data */
i = 0;
while (i < file_size)
@@ -2287,14 +2284,14 @@ parse_dot_hidden_file (FileBrowserNode *directory)
if (i > start)
{
char *hidden_filename;
-
+
hidden_filename = g_strndup (file_contents + start, i - start);
g_hash_table_insert (dir->hidden_file_hash,
hidden_filename, hidden_filename);
}
i++;
-
+
}
g_free (file_contents);
@@ -2321,7 +2318,7 @@ on_directory_monitor_event (GFileMonitor *monitor,
case G_FILE_MONITOR_EVENT_CREATED:
if (g_file_query_exists (file, NULL))
model_add_node_from_file (dir->model, parent, file, NULL);
-
+
break;
default:
break;
@@ -2337,28 +2334,28 @@ async_node_free (AsyncNode *async)
}
static void
-model_iterate_next_files_cb (GFileEnumerator *enumerator,
- GAsyncResult *result,
+model_iterate_next_files_cb (GFileEnumerator *enumerator,
+ GAsyncResult *result,
AsyncNode *async)
{
GList *files;
GError *error = NULL;
FileBrowserNodeDir *dir = async->dir;
FileBrowserNode *parent = (FileBrowserNode *)dir;
-
+
files = g_file_enumerator_next_files_finish (enumerator, result, &error);
if (files == NULL)
{
g_file_enumerator_close (enumerator, NULL, NULL);
async_node_free (async);
-
+
if (!error)
{
/* We're done loading */
g_object_unref (dir->cancellable);
dir->cancellable = NULL;
-
+
/*
* FIXME: This is temporarly, it is a bug in gio:
* http://bugzilla.gnome.org/show_bug.cgi?id=565924
@@ -2366,7 +2363,7 @@ model_iterate_next_files_cb (GFileEnumerator *enumerator,
#ifndef G_OS_WIN32
if (g_file_is_native (parent->file) && dir->monitor == NULL)
{
- dir->monitor = g_file_monitor_directory (parent->file,
+ dir->monitor = g_file_monitor_directory (parent->file,
G_FILE_MONITOR_NONE,
NULL,
NULL);
@@ -2388,7 +2385,7 @@ model_iterate_next_files_cb (GFileEnumerator *enumerator,
/* Simply return if we were cancelled */
if (error->domain == G_IO_ERROR && error->code == G_IO_ERROR_CANCELLED)
return;
-
+
/* Otherwise handle the error appropriately */
g_signal_emit (dir->model,
model_signals[ERROR],
@@ -2409,7 +2406,7 @@ model_iterate_next_files_cb (GFileEnumerator *enumerator,
else
{
model_add_nodes_from_files (dir->model, parent, async->original_children, files);
-
+
g_list_free (files);
next_files_async (enumerator, async);
}
@@ -2428,7 +2425,7 @@ next_files_async (GFileEnumerator *enumerator,
}
static void
-model_iterate_children_cb (GFile *file,
+model_iterate_children_cb (GFile *file,
GAsyncResult *result,
AsyncNode *async)
{
@@ -2440,14 +2437,14 @@ model_iterate_children_cb (GFile *file,
async_node_free (async);
return;
}
-
+
enumerator = g_file_enumerate_children_finish (file, result, &error);
if (enumerator == NULL)
{
/* Simply return if we were cancelled or if the dir is not there */
FileBrowserNodeDir *dir = async->dir;
-
+
/* Otherwise handle the error appropriately */
g_signal_emit (dir->model,
model_signals[ERROR],
@@ -2485,9 +2482,9 @@ model_load_directory (GeditFileBrowserStore *model,
/* Read the '.hidden' file first (if any) */
parse_dot_hidden_file (node);
-
+
dir->cancellable = g_cancellable_new ();
-
+
async = g_slice_new (AsyncNode);
async->dir = dir;
async->cancellable = g_object_ref (dir->cancellable);
@@ -2508,7 +2505,7 @@ get_parent_files (GeditFileBrowserStore *model,
GFile *file)
{
GList *result = NULL;
-
+
result = g_list_prepend (result, g_object_ref (file));
while ((file = g_file_get_parent (file)))
@@ -2585,7 +2582,7 @@ model_fill (GeditFileBrowserStore *model,
/* Move back up to node path */
gtk_tree_path_up (*path);
}
-
+
model_check_dummy (model, node);
if (free_path)
@@ -2650,9 +2647,9 @@ set_virtual_root_from_node (GeditFileBrowserStore *model,
item = item->next)
{
check = (FileBrowserNode *) (item->data);
-
+
if (NODE_IS_DIR (check))
- {
+ {
for (copy = FILE_BROWSER_NODE_DIR (check)->children;
copy; copy = copy->next)
{
@@ -2701,7 +2698,7 @@ set_virtual_root_from_file (GeditFileBrowserStore *model,
for (item = files; item; item = item->next)
{
check = G_FILE (item->data);
-
+
parent = model_add_node_from_dir (model, parent, check);
g_object_unref (check);
}
@@ -2719,22 +2716,22 @@ model_find_node_children (GeditFileBrowserStore *model,
FileBrowserNode *child;
FileBrowserNode *result;
GSList *children;
-
+
if (!NODE_IS_DIR (parent))
return NULL;
-
+
dir = FILE_BROWSER_NODE_DIR (parent);
-
+
for (children = dir->children; children; children = children->next)
{
child = (FileBrowserNode *)(children->data);
-
+
result = model_find_node (model, child, file);
-
+
if (result)
return result;
}
-
+
return NULL;
}
@@ -2751,7 +2748,7 @@ model_find_node (GeditFileBrowserStore *model,
if (NODE_IS_DIR (node) && g_file_has_prefix (file, node->file))
return model_find_node_children (model, node, file);
-
+
return NULL;
}
@@ -2820,40 +2817,40 @@ handle_root_error (GeditFileBrowserStore *model,
{
FileBrowserNode *root;
- g_signal_emit (model,
- model_signals[ERROR],
- 0,
+ g_signal_emit (model,
+ model_signals[ERROR],
+ 0,
GEDIT_FILE_BROWSER_ERROR_SET_ROOT,
error->message);
-
+
/* Set the virtual root to the root */
root = model->priv->root;
model->priv->virtual_root = root;
-
+
/* Set the root to be loaded */
root->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_LOADED;
-
+
/* Check the dummy */
model_check_dummy (model, root);
-
+
g_object_notify (G_OBJECT (model), "root");
g_object_notify (G_OBJECT (model), "virtual-root");
}
static void
-mount_cb (GFile *file,
- GAsyncResult *res,
+mount_cb (GFile *file,
+ GAsyncResult *res,
MountInfo *mount_info)
{
gboolean mounted;
GError *error = NULL;
GeditFileBrowserStore *model = mount_info->model;
-
+
mounted = g_file_mount_enclosing_volume_finish (file, res, &error);
if (mount_info->model)
{
- model->priv->mount_info = NULL;
+ model->priv->mount_info = NULL;
model_end_loading (model, model->priv->root);
}
@@ -2870,7 +2867,7 @@ mount_cb (GFile *file,
{
handle_root_error (model, error);
}
-
+
if (error)
g_error_free (error);
@@ -2892,9 +2889,9 @@ model_mount_root (GeditFileBrowserStore *model,
GFileInfo *info;
GError *error = NULL;
MountInfo *mount_info;
-
- info = g_file_query_info (model->priv->root->file,
- G_FILE_ATTRIBUTE_STANDARD_TYPE,
+
+ info = g_file_query_info (model->priv->root->file,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE,
NULL,
&error);
@@ -2905,23 +2902,23 @@ model_mount_root (GeditFileBrowserStore *model,
{
/* Try to mount it */
FILE_BROWSER_NODE_DIR (model->priv->root)->cancellable = g_cancellable_new ();
-
+
mount_info = g_slice_new (MountInfo);
mount_info->model = model;
mount_info->virtual_root = g_file_dup (virtual_root);
-
+
/* FIXME: we should be setting the correct window */
mount_info->operation = gtk_mount_operation_new (NULL);
mount_info->cancellable = g_object_ref (FILE_BROWSER_NODE_DIR (model->priv->root)->cancellable);
-
+
model_begin_loading (model, model->priv->root);
- g_file_mount_enclosing_volume (model->priv->root->file,
+ g_file_mount_enclosing_volume (model->priv->root->file,
G_MOUNT_MOUNT_NONE,
mount_info->operation,
mount_info->cancellable,
(GAsyncReadyCallback)mount_cb,
mount_info);
-
+
model->priv->mount_info = mount_info;
return GEDIT_FILE_BROWSER_STORE_RESULT_MOUNTING;
}
@@ -2929,16 +2926,16 @@ model_mount_root (GeditFileBrowserStore *model,
{
handle_root_error (model, error);
}
-
+
g_error_free (error);
}
else
{
g_object_unref (info);
-
+
return model_root_mounted (model, virtual_root);
}
-
+
return GEDIT_FILE_BROWSER_STORE_RESULT_OK;
}
@@ -2990,7 +2987,7 @@ gedit_file_browser_store_set_value (GeditFileBrowserStore *tree_model,
if (model_node_visibility (tree_model, node))
{
- path = gedit_file_browser_store_get_path (GTK_TREE_MODEL (tree_model),
+ path = gedit_file_browser_store_get_path (GTK_TREE_MODEL (tree_model),
iter);
row_changed (tree_model, &path, iter);
gtk_tree_path_free (path);
@@ -3146,7 +3143,7 @@ void
gedit_file_browser_store_cancel_mount_operation (GeditFileBrowserStore *store)
{
g_return_if_fail (GEDIT_IS_FILE_BROWSER_STORE (store));
-
+
cancel_mount_operation (store);
}
@@ -3177,7 +3174,7 @@ gedit_file_browser_store_set_root_and_virtual_root (GeditFileBrowserStore *model
if (equal && g_file_equal (virtual_root, model->priv->virtual_root->file))
return GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE;
}
-
+
/* Make sure to cancel any previous mount operations */
cancel_mount_operation (model);
@@ -3211,6 +3208,7 @@ gedit_file_browser_store_set_root (GeditFileBrowserStore *model,
{
g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model),
GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE);
+
return gedit_file_browser_store_set_root_and_virtual_root (model,
root,
NULL);
@@ -3220,7 +3218,7 @@ GFile *
gedit_file_browser_store_get_root (GeditFileBrowserStore *model)
{
g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model), NULL);
-
+
if (model->priv->root == NULL || model->priv->root->file == NULL)
return NULL;
else
@@ -3231,7 +3229,7 @@ GFile *
gedit_file_browser_store_get_virtual_root (GeditFileBrowserStore *model)
{
g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model), NULL);
-
+
if (model->priv->virtual_root == NULL || model->priv->virtual_root->file == NULL)
return NULL;
else
@@ -3359,7 +3357,7 @@ reparent_node (FileBrowserNode *node,
if (!node->file)
return;
-
+
if (reparent)
{
parent = node->parent->file;
@@ -3369,11 +3367,11 @@ reparent_node (FileBrowserNode *node,
node->file = g_file_get_child (parent, base);
g_free (base);
}
-
+
if (NODE_IS_DIR (node))
{
dir = FILE_BROWSER_NODE_DIR (node);
-
+
for (child = dir->children; child; child = child->next)
reparent_node ((FileBrowserNode *)child->data, TRUE);
}
@@ -3418,7 +3416,7 @@ gedit_file_browser_store_rename (GeditFileBrowserStore *model,
/* This makes sure the actual info for the node is requeried */
file_browser_node_set_name (node);
file_browser_node_set_from_info (model, node, NULL, TRUE);
-
+
reparent_node (node, FALSE);
if (model_node_visibility (model, node))
@@ -3433,7 +3431,7 @@ gedit_file_browser_store_rename (GeditFileBrowserStore *model,
else
{
g_object_unref (previous);
-
+
if (error != NULL)
{
*error = g_error_new_literal (gedit_file_browser_store_error_quark (),
@@ -3460,12 +3458,11 @@ gedit_file_browser_store_rename (GeditFileBrowserStore *model,
{
if (error != NULL)
{
- *error = g_error_new_literal
- (gedit_file_browser_store_error_quark (),
- GEDIT_FILE_BROWSER_ERROR_RENAME,
- err->message);
+ *error = g_error_new_literal (gedit_file_browser_store_error_quark (),
+ GEDIT_FILE_BROWSER_ERROR_RENAME,
+ err->message);
}
-
+
g_error_free (err);
}
@@ -3477,13 +3474,13 @@ static void
async_data_free (AsyncData *data)
{
g_object_unref (data->cancellable);
-
+
g_list_foreach (data->files, (GFunc)g_object_unref, NULL);
g_list_free (data->files);
-
+
if (!data->removed)
data->model->priv->async_handles = g_slist_remove (data->model->priv->async_handles, data);
-
+
g_slice_free (AsyncData, data);
}
@@ -3494,6 +3491,7 @@ emit_no_trash (AsyncData *data)
gboolean ret;
g_signal_emit (data->model, model_signals[NO_TRASH], 0, data->files, &ret);
+
return ret;
}
@@ -3510,7 +3508,7 @@ file_deleted (IdleDelete *data)
if (node != NULL)
model_remove_node (data->model, node, NULL, TRUE);
-
+
return FALSE;
}
@@ -3524,14 +3522,14 @@ delete_files (GIOSchedulerJob *job,
gboolean ret;
gint code;
IdleDelete delete;
-
+
/* Check if our job is done */
if (!data->iter)
return FALSE;
-
+
/* Move a file to the trash */
file = G_FILE (data->iter->data);
-
+
if (data->trash)
ret = g_file_trash (file, cancellable, &error);
else
@@ -3561,7 +3559,7 @@ delete_files (GIOSchedulerJob *job,
return TRUE;
}
-
+
/* End the job */
return FALSE;
}
@@ -3571,7 +3569,7 @@ delete_files (GIOSchedulerJob *job,
return FALSE;
}
}
-
+
/* Process the next item */
data->iter = data->iter->next;
return TRUE;
@@ -3591,7 +3589,7 @@ gedit_file_browser_store_delete_all (GeditFileBrowserStore *model,
GtkTreePath *path;
g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model), GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE);
-
+
if (rows == NULL)
return GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE;
@@ -3606,17 +3604,17 @@ gedit_file_browser_store_delete_all (GeditFileBrowserStore *model,
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path))
continue;
-
+
/* Skip if the current path is actually a descendant of the
previous path */
if (prev != NULL && gtk_tree_path_is_descendant (path, prev))
continue;
-
+
prev = path;
node = (FileBrowserNode *)(iter.user_data);
files = g_list_prepend (files, g_object_ref (node->file));
}
-
+
data = g_slice_new (AsyncData);
data->model = model;
@@ -3625,16 +3623,16 @@ gedit_file_browser_store_delete_all (GeditFileBrowserStore *model,
data->trash = trash;
data->iter = files;
data->removed = FALSE;
-
+
model->priv->async_handles = g_slist_prepend (model->priv->async_handles, data);
- g_io_scheduler_push_job ((GIOSchedulerJobFunc)delete_files,
+ g_io_scheduler_push_job ((GIOSchedulerJobFunc)delete_files,
data,
- (GDestroyNotify)async_data_free,
- G_PRIORITY_DEFAULT,
+ (GDestroyNotify)async_data_free,
+ G_PRIORITY_DEFAULT,
data->cancellable);
g_list_free (rows);
-
+
return GEDIT_FILE_BROWSER_STORE_RESULT_OK;
}
@@ -3658,10 +3656,10 @@ gedit_file_browser_store_delete (GeditFileBrowserStore *model,
rows = g_list_append(NULL, gedit_file_browser_store_get_path_real (model, node));
result = gedit_file_browser_store_delete_all (model, rows, trash);
-
+
g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
g_list_free (rows);
-
+
return result;
}
@@ -3680,9 +3678,7 @@ gedit_file_browser_store_new_file (GeditFileBrowserStore *model,
g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model), FALSE);
g_return_val_if_fail (parent != NULL, FALSE);
g_return_val_if_fail (parent->user_data != NULL, FALSE);
- g_return_val_if_fail (NODE_IS_DIR
- ((FileBrowserNode *) (parent->user_data)),
- FALSE);
+ g_return_val_if_fail (NODE_IS_DIR ((FileBrowserNode *) (parent->user_data)), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
parent_node = FILE_BROWSER_NODE_DIR (parent->user_data);
@@ -3690,7 +3686,7 @@ gedit_file_browser_store_new_file (GeditFileBrowserStore *model,
file = unique_new_name (((FileBrowserNode *) parent_node)->file, _("file"));
stream = g_file_create (file, G_FILE_CREATE_NONE, NULL, &error);
-
+
if (!stream)
{
g_signal_emit (model, model_signals[ERROR], 0,
@@ -3701,9 +3697,9 @@ gedit_file_browser_store_new_file (GeditFileBrowserStore *model,
else
{
g_object_unref (stream);
- node = model_add_node_from_file (model,
- (FileBrowserNode *)parent_node,
- file,
+ node = model_add_node_from_file (model,
+ (FileBrowserNode *)parent_node,
+ file,
NULL);
if (model_node_visibility (model, node))
@@ -3757,9 +3753,9 @@ gedit_file_browser_store_new_directory (GeditFileBrowserStore *model,
}
else
{
- node = model_add_node_from_file (model,
- (FileBrowserNode *)parent_node,
- file,
+ node = model_add_node_from_file (model,
+ (FileBrowserNode *)parent_node,
+ file,
NULL);
if (model_node_visibility (model, node))
@@ -3780,4 +3776,5 @@ gedit_file_browser_store_new_directory (GeditFileBrowserStore *model,
g_object_unref (file);
return result;
}
+
/* ex:ts=8:noet: */
diff --git a/plugins/filebrowser/gedit-file-browser-store.h b/plugins/filebrowser/gedit-file-browser-store.h
index 37f1a39..1a78a83 100644
--- a/plugins/filebrowser/gedit-file-browser-store.h
+++ b/plugins/filebrowser/gedit-file-browser-store.h
@@ -1,19 +1,19 @@
/*
- * gedit-file-browser-store.h - Gedit plugin providing easy file access
+ * gedit-file-browser-store.h - Gedit plugin providing easy file access
* from the sidepanel
- *
+ *
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
- *
+ *
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
#define GEDIT_IS_FILE_BROWSER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_FILE_BROWSER_STORE))
#define GEDIT_FILE_BROWSER_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_FILE_BROWSER_STORE, GeditFileBrowserStoreClass))
-typedef enum
+typedef enum
{
GEDIT_FILE_BROWSER_STORE_COLUMN_ICON = 0,
GEDIT_FILE_BROWSER_STORE_COLUMN_NAME,
@@ -43,7 +43,7 @@ typedef enum
GEDIT_FILE_BROWSER_STORE_COLUMN_NUM
} GeditFileBrowserStoreColumn;
-typedef enum
+typedef enum
{
GEDIT_FILE_BROWSER_STORE_FLAG_IS_DIRECTORY = 1 << 0,
GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN = 1 << 1,
@@ -53,7 +53,7 @@ typedef enum
GEDIT_FILE_BROWSER_STORE_FLAG_IS_DUMMY = 1 << 5
} GeditFileBrowserStoreFlag;
-typedef enum
+typedef enum
{
GEDIT_FILE_BROWSER_STORE_RESULT_OK,
GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE,
@@ -63,7 +63,7 @@ typedef enum
GEDIT_FILE_BROWSER_STORE_RESULT_NUM
} GeditFileBrowserStoreResult;
-typedef enum
+typedef enum
{
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_NONE = 0,
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN = 1 << 0,
@@ -85,7 +85,7 @@ typedef gboolean (*GeditFileBrowserStoreFilterFunc) (GeditFileBrowserStore *mode
GtkTreeIter *iter,
gpointer user_data);
-struct _GeditFileBrowserStore
+struct _GeditFileBrowserStore
{
GObject parent;
diff --git a/plugins/filebrowser/gedit-file-browser-utils.c b/plugins/filebrowser/gedit-file-browser-utils.c
index dc96c37..a2c0843 100644
--- a/plugins/filebrowser/gedit-file-browser-utils.c
+++ b/plugins/filebrowser/gedit-file-browser-utils.c
@@ -1,19 +1,19 @@
/*
- * gedit-file-bookmarks-utils.c - Gedit plugin providing easy file access
+ * gedit-file-bookmarks-utils.c - Gedit plugin providing easy file access
* from the sidepanel
- *
+ *
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
- *
+ *
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -26,8 +26,8 @@
static GdkPixbuf *
process_icon_pixbuf (GdkPixbuf *pixbuf,
- gchar const *name,
- gint size,
+ gchar const *name,
+ gint size,
GError *error)
{
GdkPixbuf *scale;
@@ -39,12 +39,12 @@ process_icon_pixbuf (GdkPixbuf *pixbuf,
error->message);
g_error_free (error);
}
-
+
if (pixbuf && gdk_pixbuf_get_width (pixbuf) > size)
{
- scale = gdk_pixbuf_scale_simple (pixbuf,
- size,
- size,
+ scale = gdk_pixbuf_scale_simple (pixbuf,
+ size,
+ size,
GDK_INTERP_BILINEAR);
g_object_unref (pixbuf);
pixbuf = scale;
@@ -63,10 +63,10 @@ gedit_file_browser_utils_pixbuf_from_theme (gchar const *name,
gtk_icon_size_lookup (size, &width, NULL);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- name,
- width,
- 0,
+ pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+ name,
+ width,
+ 0,
&error);
pixbuf = process_icon_pixbuf (pixbuf, name, width, error);
@@ -88,7 +88,7 @@ gedit_file_browser_utils_pixbuf_from_icon (GIcon *icon,
theme = gtk_icon_theme_get_default ();
gtk_icon_size_lookup (size, &width, NULL);
-
+
info = gtk_icon_theme_lookup_by_gicon (theme,
icon,
width,
@@ -96,10 +96,10 @@ gedit_file_browser_utils_pixbuf_from_icon (GIcon *icon,
if (!info)
return NULL;
-
+
ret = gtk_icon_info_load_icon (info, NULL);
gtk_icon_info_free (info);
-
+
return ret;
}
@@ -111,12 +111,12 @@ gedit_file_browser_utils_pixbuf_from_file (GFile *file,
GFileInfo *info;
GdkPixbuf *ret = NULL;
- info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_ICON,
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_ICON,
G_FILE_QUERY_INFO_NONE,
- NULL,
+ NULL,
NULL);
-
+
if (!info)
return NULL;
@@ -125,7 +125,7 @@ gedit_file_browser_utils_pixbuf_from_file (GFile *file,
ret = gedit_file_browser_utils_pixbuf_from_icon (icon, size);
g_object_unref (info);
-
+
return ret;
}
@@ -139,8 +139,8 @@ gboolean
gedit_file_browser_utils_confirmation_dialog (GeditWindow *window,
GtkMessageType type,
gchar const *message,
- gchar const *secondary,
- gchar const *button_stock,
+ gchar const *secondary,
+ gchar const *button_stock,
gchar const *button_label)
{
GtkWidget *dlg;
@@ -170,19 +170,19 @@ gedit_file_browser_utils_confirmation_dialog (GeditWindow *window,
/* Add custom button */
button = gtk_button_new_from_stock (button_stock);
-
+
if (button_label)
{
gtk_button_set_use_stock (GTK_BUTTON (button), FALSE);
gtk_button_set_label (GTK_BUTTON (button), button_label);
}
-
+
gtk_widget_show (button);
gtk_widget_set_can_default (button, TRUE);
gtk_dialog_add_action_widget (GTK_DIALOG (dlg),
button,
GTK_RESPONSE_OK);
-
+
ret = gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
diff --git a/plugins/filebrowser/gedit-file-browser-utils.h b/plugins/filebrowser/gedit-file-browser-utils.h
index ade5e27..f45cd26 100644
--- a/plugins/filebrowser/gedit-file-browser-utils.h
+++ b/plugins/filebrowser/gedit-file-browser-utils.h
@@ -1,19 +1,19 @@
/*
- * gedit-file-browser-utils.h - Gedit plugin providing easy file access
+ * gedit-file-browser-utils.h - Gedit plugin providing easy file access
* from the sidepanel
- *
+ *
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
- *
+ *
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
diff --git a/plugins/filebrowser/gedit-file-browser-view.c b/plugins/filebrowser/gedit-file-browser-view.c
index df76a25..7508bd0 100644
--- a/plugins/filebrowser/gedit-file-browser-view.c
+++ b/plugins/filebrowser/gedit-file-browser-view.c
@@ -1,19 +1,19 @@
/*
- * gedit-file-browser-view.c - Gedit plugin providing easy file access
+ * gedit-file-browser-view.c - Gedit plugin providing easy file access
* from the sidepanel
- *
+ *
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
- *
+ *
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -37,7 +37,7 @@
G_TYPE_INSTANCE_GET_PRIVATE((object), \
GEDIT_TYPE_FILE_BROWSER_VIEW, GeditFileBrowserViewPrivate))
-struct _GeditFileBrowserViewPrivate
+struct _GeditFileBrowserViewPrivate
{
GtkTreeViewColumn *column;
GtkCellRenderer *pixbuf_renderer;
@@ -58,7 +58,7 @@ struct _GeditFileBrowserViewPrivate
gboolean selected_on_button_down;
gint drag_button;
gboolean drag_started;
-
+
gboolean restore_expand_state;
gboolean is_refresh;
GHashTable *expand_state;
@@ -68,7 +68,7 @@ struct _GeditFileBrowserViewPrivate
enum
{
PROP_0,
-
+
PROP_CLICK_POLICY,
PROP_RESTORE_EXPAND_STATE
};
@@ -92,30 +92,30 @@ static const GtkTargetEntry drag_source_targets[] = {
GEDIT_PLUGIN_DEFINE_TYPE (GeditFileBrowserView, gedit_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,
GeditFileBrowserView *tree_view);
-static void on_begin_refresh (GeditFileBrowserStore *model,
+static void on_begin_refresh (GeditFileBrowserStore *model,
GeditFileBrowserView *view);
-static void on_end_refresh (GeditFileBrowserStore *model,
+static void on_end_refresh (GeditFileBrowserStore *model,
GeditFileBrowserView *view);
-static void on_unload (GeditFileBrowserStore *model,
+static void on_unload (GeditFileBrowserStore *model,
GFile *location,
GeditFileBrowserView *view);
-static void on_row_inserted (GeditFileBrowserStore *model,
+static void on_row_inserted (GeditFileBrowserStore *model,
GtkTreePath *path,
GtkTreeIter *iter,
GeditFileBrowserView *view);
-
+
static void
gedit_file_browser_view_finalize (GObject *object)
{
GeditFileBrowserView *obj = GEDIT_FILE_BROWSER_VIEW (object);
-
+
if (obj->priv->hand_cursor)
gdk_cursor_unref (obj->priv->hand_cursor);
@@ -139,7 +139,7 @@ add_expand_state (GeditFileBrowserView *view,
{
if (!location)
return;
-
+
if (view->priv->expand_state)
g_hash_table_insert (view->priv->expand_state, location, g_object_ref (location));
}
@@ -172,7 +172,7 @@ row_expanded (GtkTreeView *tree_view,
if (view->priv->restore_expand_state)
{
gtk_tree_model_get (view->priv->model,
- iter,
+ iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION,
&location,
-1);
@@ -197,11 +197,11 @@ row_collapsed (GtkTreeView *tree_view,
if (!GEDIT_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,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION,
&location,
-1);
@@ -289,7 +289,7 @@ motion_notify_event (GtkWidget *widget,
if (old_hover_path != NULL)
gtk_tree_path_free (old_hover_path);
}
-
+
/* Chainup */
return GTK_WIDGET_CLASS (gedit_file_browser_view_parent_class)->motion_notify_event (widget, event);
}
@@ -328,7 +328,7 @@ set_click_policy_property (GeditFileBrowserView *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)
@@ -344,7 +344,7 @@ set_click_policy_property (GeditFileBrowserView *obj,
}
static void
-directory_activated (GeditFileBrowserView *view,
+directory_activated (GeditFileBrowserView *view,
GtkTreeIter *iter)
{
gedit_file_browser_store_set_virtual_root (GEDIT_FILE_BROWSER_STORE (view->priv->model), iter);
@@ -362,15 +362,15 @@ activate_selected_files (GeditFileBrowserView *view)
GeditFileBrowserStoreFlag 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, GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags, -1);
if (FILE_IS_DIR (flags) && directory == NULL)
@@ -378,10 +378,10 @@ activate_selected_files (GeditFileBrowserView *view)
else if (!FILE_IS_DUMMY (flags))
g_signal_emit (view, signals[FILE_ACTIVATED], 0, &iter);
}
-
+
if (directory != NULL && 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);
}
@@ -432,10 +432,10 @@ drag_begin (GtkWidget *widget,
GdkDragContext *context)
{
GeditFileBrowserView *view = GEDIT_FILE_BROWSER_VIEW (widget);
-
+
view->priv->drag_button = 0;
view->priv->drag_started = TRUE;
-
+
/* Chain up */
GTK_WIDGET_CLASS (gedit_file_browser_view_parent_class)->drag_begin (widget, context);
}
@@ -447,7 +447,7 @@ did_not_drag (GeditFileBrowserView *view,
GtkTreeView *tree_view;
GtkTreeSelection *selection;
GtkTreePath *path;
-
+
tree_view = GTK_TREE_VIEW (view);
selection = gtk_tree_view_get_selection (tree_view);
@@ -494,9 +494,9 @@ button_release_event (GtkWidget *widget,
if (!view->priv->drag_started && !view->priv->ignore_release)
did_not_drag (view, event);
}
-
+
/* Chain up */
- return GTK_WIDGET_CLASS (gedit_file_browser_view_parent_class)->button_release_event (widget, event);
+ return GTK_WIDGET_CLASS (gedit_file_browser_view_parent_class)->button_release_event (widget, event);
}
static gboolean
@@ -522,7 +522,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);
@@ -531,11 +531,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 == GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE &&
+ if (view->priv->click_policy == GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE &&
click_count >= 2)
{
return TRUE;
@@ -549,7 +549,7 @@ button_press_event (GtkWidget *widget,
{
/* 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])
@@ -564,7 +564,7 @@ button_press_event (GtkWidget *widget,
/* Chain up, must be before activating the selected
items because this will cause the view to grab focus */
widget_parent->button_press_event (widget, event);
-
+
if (view->priv->double_click_path[1] &&
gtk_tree_path_compare (view->priv->double_click_path[0], view->priv->double_click_path[1]) == 0)
{
@@ -611,7 +611,7 @@ button_press_event (GtkWidget *widget,
view->priv->ignore_release = on_expander;
}
}
-
+
if (call_parent)
{
/* Chain up */
@@ -621,7 +621,7 @@ button_press_event (GtkWidget *widget,
{
gtk_widget_grab_focus (widget);
}
-
+
if ((event->button == 1 || event->button == 2) &&
event->type == GDK_BUTTON_PRESS)
{
@@ -634,7 +634,7 @@ button_press_event (GtkWidget *widget,
}
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])
@@ -706,7 +706,7 @@ key_press_event (GtkWidget *widget,
/* Chain up */
if (!handled)
return GTK_WIDGET_CLASS (gedit_file_browser_view_parent_class)->key_press_event (widget, event);
-
+
return TRUE;
}
@@ -717,12 +717,12 @@ fill_expand_state (GeditFileBrowserView *view,
GtkTreePath *path;
GtkTreeIter child;
GFile *location;
-
+
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,
@@ -733,7 +733,7 @@ fill_expand_state (GeditFileBrowserView *view,
add_expand_state (view, location);
}
-
+
if (gtk_tree_model_iter_children (view->priv->model, &child, iter))
{
do
@@ -742,7 +742,7 @@ fill_expand_state (GeditFileBrowserView *view,
}
while (gtk_tree_model_iter_next (view->priv->model, &child));
}
-
+
gtk_tree_path_free (path);
}
@@ -750,20 +750,20 @@ static void
uninstall_restore_signals (GeditFileBrowserView *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);
}
@@ -771,24 +771,24 @@ static void
install_restore_signals (GeditFileBrowserView *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);
}
@@ -811,7 +811,7 @@ set_restore_expand_state (GeditFileBrowserView *view,
(GEqualFunc)g_file_equal,
g_object_unref,
NULL);
-
+
if (view->priv->model && GEDIT_IS_FILE_BROWSER_STORE (view->priv->model))
{
fill_expand_state (view, NULL);
@@ -877,11 +877,11 @@ gedit_file_browser_view_class_init (GeditFileBrowserViewClass *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 = gedit_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;
@@ -894,7 +894,7 @@ gedit_file_browser_view_class_init (GeditFileBrowserViewClass *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;
@@ -968,7 +968,7 @@ cell_data_cb (GtkTreeViewColumn *tree_column,
gtk_tree_path_compare (path, obj->priv->hover_path) == 0)
{
underline = PANGO_UNDERLINE_SINGLE;
- }
+ }
if (GEDIT_IS_FILE_BROWSER_STORE (tree_model) &&
obj->priv->editable != NULL &&
@@ -1060,7 +1060,7 @@ gedit_file_browser_view_set_model (GeditFileBrowserView *tree_view,
if (GEDIT_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,
@@ -1089,7 +1089,7 @@ gedit_file_browser_view_set_model (GeditFileBrowserView *tree_view,
if (tree_view->priv->restore_expand_state)
install_restore_signals (tree_view, model);
-
+
}
if (tree_view->priv->hover_path != NULL)
@@ -1101,7 +1101,7 @@ gedit_file_browser_view_set_model (GeditFileBrowserView *tree_view,
if (GEDIT_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);
}
@@ -1134,18 +1134,18 @@ gedit_file_browser_view_start_rename (GeditFileBrowserView *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,
@@ -1157,9 +1157,9 @@ gedit_file_browser_view_set_click_policy (GeditFileBrowserView *tree_
GeditFileBrowserViewClickPolicy policy)
{
g_return_if_fail (GEDIT_IS_FILE_BROWSER_VIEW (tree_view));
-
+
set_click_policy_property (tree_view, policy);
-
+
g_object_notify (G_OBJECT (tree_view), "click-policy");
}
@@ -1184,13 +1184,13 @@ on_cell_edited (GtkCellRendererText *cell,
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);
@@ -1215,8 +1215,8 @@ on_cell_edited (GtkCellRendererText *cell,
}
}
-static void
-on_begin_refresh (GeditFileBrowserStore *model,
+static void
+on_begin_refresh (GeditFileBrowserStore *model,
GeditFileBrowserView *view)
{
/* Store the refresh state, so we can handle unloading of nodes while
@@ -1224,8 +1224,8 @@ on_begin_refresh (GeditFileBrowserStore *model,
view->priv->is_refresh = TRUE;
}
-static void
-on_end_refresh (GeditFileBrowserStore *model,
+static void
+on_end_refresh (GeditFileBrowserStore *model,
GeditFileBrowserView *view)
{
/* Store the refresh state, so we can handle unloading of nodes while
@@ -1241,7 +1241,7 @@ on_unload (GeditFileBrowserStore *model,
/* 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, location);
}
@@ -1253,8 +1253,8 @@ restore_expand_state (GeditFileBrowserView *view,
GFile *location;
GtkTreePath *path;
- gtk_tree_model_get (GTK_TREE_MODEL (model),
- iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (model),
+ iter,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION,
&location,
-1);
@@ -1270,12 +1270,12 @@ restore_expand_state (GeditFileBrowserView *view,
path,
FALSE);
}
-
+
gtk_tree_path_free (path);
}
-static void
-on_row_inserted (GeditFileBrowserStore *model,
+static void
+on_row_inserted (GeditFileBrowserStore *model,
GtkTreePath *path,
GtkTreeIter *iter,
GeditFileBrowserView *view)
diff --git a/plugins/filebrowser/gedit-file-browser-view.h b/plugins/filebrowser/gedit-file-browser-view.h
index e4a06e2..5e4f61c 100644
--- a/plugins/filebrowser/gedit-file-browser-view.h
+++ b/plugins/filebrowser/gedit-file-browser-view.h
@@ -1,19 +1,19 @@
/*
- * gedit-file-browser-view.h - Gedit plugin providing easy file access
+ * gedit-file-browser-view.h - Gedit plugin providing easy file access
* from the sidepanel
- *
+ *
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
- *
+ *
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -39,17 +39,17 @@ typedef struct _GeditFileBrowserViewPrivate GeditFileBrowserViewPrivate;
typedef enum {
GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE,
- GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE
+ GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE
} GeditFileBrowserViewClickPolicy;
-struct _GeditFileBrowserView
+struct _GeditFileBrowserView
{
GtkTreeView parent;
GeditFileBrowserViewPrivate *priv;
};
-struct _GeditFileBrowserViewClass
+struct _GeditFileBrowserViewClass
{
GtkTreeViewClass parent_class;
diff --git a/plugins/filebrowser/gedit-file-browser-widget.c b/plugins/filebrowser/gedit-file-browser-widget.c
index 81c36f9..e08f47a 100644
--- a/plugins/filebrowser/gedit-file-browser-widget.c
+++ b/plugins/filebrowser/gedit-file-browser-widget.c
@@ -1,19 +1,19 @@
/*
- * gedit-file-browser-widget.c - Gedit plugin providing easy file access
+ * gedit-file-browser-widget.c - Gedit plugin providing easy file access
* from the sidepanel
- *
+ *
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
- *
+ *
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -48,7 +48,7 @@
#define XML_UI_FILE "gedit-file-browser-widget-ui.xml"
#define LOCATION_DATA_KEY "gedit-file-browser-widget-location"
-enum
+enum
{
BOOKMARKS_ID,
SEPARATOR_CUSTOM_ID,
@@ -57,7 +57,7 @@ enum
NUM_DEFAULT_IDS
};
-enum
+enum
{
COLUMN_INDENT,
COLUMN_ICON,
@@ -68,16 +68,16 @@ enum
};
/* Properties */
-enum
+enum
{
PROP_0,
-
+
PROP_FILTER_PATTERN,
PROP_ENABLE_DELETE
};
/* Signals */
-enum
+enum
{
LOCATION_ACTIVATED,
ERROR,
@@ -88,7 +88,7 @@ enum
static guint signals[NUM_SIGNALS] = { 0 };
-typedef struct _SignalNode
+typedef struct _SignalNode
{
GObject *object;
gulong id;
@@ -102,7 +102,7 @@ typedef struct
GDestroyNotify destroy_notify;
} FilterFunc;
-typedef struct
+typedef struct
{
GFile *root;
GFile *virtual_root;
@@ -114,7 +114,7 @@ typedef struct
GdkPixbuf *icon;
} NameIcon;
-struct _GeditFileBrowserWidgetPrivate
+struct _GeditFileBrowserWidgetPrivate
{
GeditFileBrowserView *treeview;
GeditFileBrowserStore *file_store;
@@ -151,29 +151,29 @@ struct _GeditFileBrowserWidgetPrivate
GtkWidget *location_previous_menu;
GtkWidget *location_next_menu;
GtkWidget *current_location_menu_item;
-
+
gboolean enable_delete;
-
+
GCancellable *cancellable;
-
+
GdkCursor *busy_cursor;
};
static void set_enable_delete (GeditFileBrowserWidget *obj,
gboolean enable);
-static void on_model_set (GObject *gobject,
+static void on_model_set (GObject *gobject,
GParamSpec *arg1,
GeditFileBrowserWidget *obj);
static void on_treeview_error (GeditFileBrowserView *tree_view,
- guint code,
+ guint code,
gchar *message,
GeditFileBrowserWidget *obj);
-static void on_file_store_error (GeditFileBrowserStore *store,
+static void on_file_store_error (GeditFileBrowserStore *store,
guint code,
gchar *message,
GeditFileBrowserWidget *obj);
-static gboolean on_file_store_no_trash (GeditFileBrowserStore *store,
- GList *files,
+static gboolean on_file_store_no_trash (GeditFileBrowserStore *store,
+ GList *files,
GeditFileBrowserWidget *obj);
static void on_combo_changed (GtkComboBox *combo,
GeditFileBrowserWidget *obj);
@@ -182,7 +182,7 @@ static gboolean on_treeview_popup_menu (GeditFileBrowserView *treeview
static gboolean on_treeview_button_press_event (GeditFileBrowserView *treeview,
GdkEventButton *event,
GeditFileBrowserWidget *obj);
-static gboolean on_treeview_key_press_event (GeditFileBrowserView *treeview,
+static gboolean on_treeview_key_press_event (GeditFileBrowserView *treeview,
GdkEventKey *event,
GeditFileBrowserWidget *obj);
static void on_selection_changed (GtkTreeSelection *selection,
@@ -195,11 +195,11 @@ static void on_virtual_root_changed (GeditFileBrowserStore *model,
static gboolean on_entry_filter_activate (GeditFileBrowserWidget *obj);
static void on_location_jump_activate (GtkMenuItem *item,
GeditFileBrowserWidget *obj);
-static void on_bookmarks_row_changed (GtkTreeModel *model,
+static void on_bookmarks_row_changed (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
GeditFileBrowserWidget *obj);
-static void on_bookmarks_row_deleted (GtkTreeModel *model,
+static void on_bookmarks_row_deleted (GtkTreeModel *model,
GtkTreePath *path,
GeditFileBrowserWidget *obj);
static void on_filter_mode_changed (GeditFileBrowserStore *model,
@@ -277,7 +277,7 @@ location_free (Location *loc)
{
if (loc->root)
g_object_unref (loc->root);
-
+
if (loc->virtual_root)
g_object_unref (loc->virtual_root);
@@ -325,7 +325,7 @@ cancel_async_operation (GeditFileBrowserWidget *widget)
{
if (!widget->priv->cancellable)
return;
-
+
g_cancellable_cancel (widget->priv->cancellable);
g_object_unref (widget->priv->cancellable);
@@ -365,9 +365,9 @@ gedit_file_browser_widget_finalize (GObject *object)
g_list_free (obj->priv->locations);
g_hash_table_destroy (obj->priv->bookmarks_hash);
-
+
cancel_async_operation (obj);
-
+
gdk_cursor_unref (obj->priv->busy_cursor);
G_OBJECT_CLASS (gedit_file_browser_widget_parent_class)->finalize (object);
@@ -539,10 +539,10 @@ get_from_bookmark_file (GeditFileBrowserWidget *obj,
NameIcon *item;
data = g_hash_table_lookup (obj->priv->bookmarks_hash, file);
-
+
if (data == NULL)
return FALSE;
-
+
item = (NameIcon *)data;
*name = g_strdup (item->name);
@@ -552,10 +552,10 @@ get_from_bookmark_file (GeditFileBrowserWidget *obj,
}
static void
-insert_path_item (GeditFileBrowserWidget *obj,
+insert_path_item (GeditFileBrowserWidget *obj,
GFile *file,
- GtkTreeIter *after,
- GtkTreeIter *iter,
+ GtkTreeIter *after,
+ GtkTreeIter *iter,
guint indent)
{
gchar *unescape;
@@ -566,21 +566,21 @@ insert_path_item (GeditFileBrowserWidget *obj,
{
/* It's not a bookmark, fetch the name and the icon ourselves */
unescape = gedit_file_browser_utils_file_basename (file);
-
+
/* Get the icon */
icon = gedit_file_browser_utils_pixbuf_from_file (file, GTK_ICON_SIZE_MENU);
}
gtk_tree_store_insert_after (obj->priv->combo_model, iter, NULL,
after);
-
- gtk_tree_store_set (obj->priv->combo_model,
- iter,
+
+ gtk_tree_store_set (obj->priv->combo_model,
+ iter,
COLUMN_INDENT, indent,
- COLUMN_ICON, icon,
- COLUMN_NAME, unescape,
+ COLUMN_ICON, icon,
+ COLUMN_NAME, unescape,
COLUMN_FILE, file,
- COLUMN_ID, PATH_ID,
+ COLUMN_ID, PATH_ID,
-1);
if (icon)
@@ -624,16 +624,16 @@ uri_num_parents (GFile *from,
return 0;
g_object_ref (from);
-
+
while ((parent = g_file_get_parent (from)) && !(to && g_file_equal (from, to)))
{
g_object_unref (from);
from = parent;
-
+
++parents;
}
-
- g_object_unref (from);
+
+ g_object_unref (from);
return parents;
}
@@ -646,7 +646,7 @@ insert_location_path (GeditFileBrowserWidget *obj)
GtkTreeIter separator;
GtkTreeIter iter;
guint indent;
-
+
if (!obj->priv->current_location)
{
g_message ("insert_location_path: no current location");
@@ -657,7 +657,7 @@ insert_location_path (GeditFileBrowserWidget *obj)
current = loc->virtual_root;
combo_find_by_id (obj, SEPARATOR_ID, &separator);
-
+
indent = uri_num_parents (loc->virtual_root, loc->root);
while (current != NULL)
@@ -686,7 +686,7 @@ insert_location_path (GeditFileBrowserWidget *obj)
}
tmp = g_file_get_parent (current);
-
+
if (current != loc->virtual_root)
g_object_unref (current);
@@ -739,17 +739,17 @@ fill_combo_model (GeditFileBrowserWidget *obj)
}
static void
-indent_cell_data_func (GtkCellLayout *cell_layout,
+indent_cell_data_func (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
gpointer data)
{
gchar *indent;
guint num;
-
+
gtk_tree_model_get (model, iter, COLUMN_INDENT, &num, -1);
-
+
if (num == 0)
{
g_object_set (cell, "text", "", NULL);
@@ -757,7 +757,7 @@ indent_cell_data_func (GtkCellLayout *cell_layout,
else
{
indent = g_strnfill (num *2, ' ');
-
+
g_object_set (cell, "text", indent, NULL);
g_free (indent);
}
@@ -811,12 +811,12 @@ create_combo (GeditFileBrowserWidget *obj)
gtk_widget_show (obj->priv->combo);
}
-static GtkActionEntry toplevel_actions[] =
+static GtkActionEntry toplevel_actions[] =
{
{"FilterMenuAction", NULL, N_("_Filter")}
};
-static const GtkActionEntry tree_actions_selection[] =
+static const GtkActionEntry tree_actions_selection[] =
{
{"FileMoveToTrash", "gnome-stock-trash", N_("_Move to Trash"), NULL,
N_("Move selected file or folder to trash"),
@@ -848,14 +848,14 @@ static const GtkActionEntry tree_actions_single_most_selection[] =
N_("Add new empty file"), G_CALLBACK (on_action_file_new)}
};
-static const GtkActionEntry tree_actions_single_selection[] =
+static const GtkActionEntry tree_actions_single_selection[] =
{
{"FileRename", NULL, N_("_Rename"), NULL,
N_("Rename selected file or folder"),
G_CALLBACK (on_action_file_rename)}
};
-static const GtkActionEntry tree_actions_sensitive[] =
+static const GtkActionEntry tree_actions_sensitive[] =
{
{"DirectoryPrevious", GTK_STOCK_GO_BACK, N_("_Previous Location"),
NULL,
@@ -870,7 +870,7 @@ static const GtkActionEntry tree_actions_sensitive[] =
G_CALLBACK (on_action_directory_open)}
};
-static const GtkToggleActionEntry tree_actions_toggle[] =
+static const GtkToggleActionEntry tree_actions_toggle[] =
{
{"FilterHidden", GTK_STOCK_DIALOG_AUTHENTICATION,
N_("Show _Hidden"), NULL,
@@ -1046,23 +1046,23 @@ create_toolbar (GeditFileBrowserWidget *obj,
gtk_box_pack_start (GTK_BOX (obj), toolbar, FALSE, FALSE, 0);
gtk_widget_show (toolbar);
-
+
set_enable_delete (obj, obj->priv->enable_delete);
}
-static void
+static void
set_enable_delete (GeditFileBrowserWidget *obj,
gboolean enable)
{
GtkAction *action;
obj->priv->enable_delete = enable;
-
+
if (obj->priv->action_group_selection == NULL)
return;
-
+
action = gtk_action_group_get_action (obj->priv->action_group_selection,
"FileDelete");
-
+
g_object_set (action, "visible", enable, "sensitive", enable, NULL);
}
@@ -1108,8 +1108,8 @@ add_bookmark_hash (GeditFileBrowserWidget *obj,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_ICON,
&pixbuf,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_NAME,
- &name, -1);
-
+ &name, -1);
+
item = g_slice_new (NameIcon);
item->name = name;
item->icon = pixbuf;
@@ -1126,16 +1126,16 @@ init_bookmarks_hash (GeditFileBrowserWidget *obj)
GtkTreeModel *model;
model = GTK_TREE_MODEL (obj->priv->bookmarks_store);
-
+
if (!gtk_tree_model_get_iter_first (model, &iter))
return;
-
+
do
{
add_bookmark_hash (obj, &iter);
}
while (gtk_tree_model_iter_next (model, &iter));
-
+
g_signal_connect (obj->priv->bookmarks_store,
"row-changed",
G_CALLBACK (on_bookmarks_row_changed),
@@ -1148,7 +1148,7 @@ init_bookmarks_hash (GeditFileBrowserWidget *obj)
}
static void
-on_begin_loading (GeditFileBrowserStore *model,
+on_begin_loading (GeditFileBrowserStore *model,
GtkTreeIter *iter,
GeditFileBrowserWidget *obj)
{
@@ -1160,7 +1160,7 @@ on_begin_loading (GeditFileBrowserStore *model,
}
static void
-on_end_loading (GeditFileBrowserStore *model,
+on_end_loading (GeditFileBrowserStore *model,
GtkTreeIter *iter,
GeditFileBrowserWidget *obj)
{
@@ -1183,12 +1183,11 @@ create_tree (GeditFileBrowserWidget *obj)
gedit_file_browser_view_set_restore_expand_state (obj->priv->treeview, TRUE);
gedit_file_browser_store_set_filter_mode (obj->priv->file_store,
- GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN
- |
+ GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN |
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY);
gedit_file_browser_store_set_filter_func (obj->priv->file_store,
- (GeditFileBrowserStoreFilterFunc)
- filter_real, obj);
+ (GeditFileBrowserStoreFilterFunc) filter_real,
+ obj);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
@@ -1221,16 +1220,16 @@ create_tree (GeditFileBrowserWidget *obj)
g_signal_connect (obj->priv->file_store, "notify::virtual-root",
G_CALLBACK (on_virtual_root_changed), obj);
-
+
g_signal_connect (obj->priv->file_store, "begin-loading",
G_CALLBACK (on_begin_loading), obj);
-
+
g_signal_connect (obj->priv->file_store, "end-loading",
G_CALLBACK (on_end_loading), obj);
g_signal_connect (obj->priv->file_store, "error",
G_CALLBACK (on_file_store_error), obj);
-
+
init_bookmarks_hash (obj);
gtk_widget_show (sw);
@@ -1280,7 +1279,7 @@ gedit_file_browser_widget_init (GeditFileBrowserWidget *obj)
free_name_icon);
gtk_box_set_spacing (GTK_BOX (obj), 3);
-
+
obj->priv->busy_cursor = gdk_cursor_new (GDK_WATCH);
}
@@ -1301,13 +1300,10 @@ update_sensitivity (GeditFileBrowserWidget *obj)
gtk_action_group_set_sensitive (obj->priv->bookmark_action_group,
FALSE);
- mode =
- gedit_file_browser_store_get_filter_mode
- (GEDIT_FILE_BROWSER_STORE (model));
+ mode = gedit_file_browser_store_get_filter_mode (GEDIT_FILE_BROWSER_STORE (model));
- action =
- gtk_action_group_get_action (obj->priv->action_group,
- "FilterHidden");
+ action = gtk_action_group_get_action (obj->priv->action_group,
+ "FilterHidden");
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
!(mode &
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN));
@@ -1327,7 +1323,8 @@ update_sensitivity (GeditFileBrowserWidget *obj)
}
on_selection_changed (gtk_tree_view_get_selection
- (GTK_TREE_VIEW (obj->priv->treeview)), obj);
+ GTK_TREE_VIEW (obj->priv->treeview),
+ obj);
}
static gboolean
@@ -1338,15 +1335,15 @@ gedit_file_browser_widget_get_first_selected (GeditFileBrowserWidget *obj,
GtkTreeModel *model;
GList *rows = gtk_tree_selection_get_selected_rows (selection, &model);
gboolean result;
-
+
if (!rows)
return FALSE;
-
- result = gtk_tree_model_get_iter(model, iter, (GtkTreePath *)(rows->data));
+
+ result = gtk_tree_model_get_iter (model, iter, (GtkTreePath *)(rows->data));
g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
g_list_free (rows);
-
+
return result;
}
@@ -1467,16 +1464,16 @@ get_deletable_files (GeditFileBrowserWidget *obj) {
/* Get all selected files */
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview));
rows = gtk_tree_selection_get_selected_rows (selection, &model);
-
+
for (row = rows; row; row = row->next)
{
path = (GtkTreePath *)(row->data);
-
+
if (!gtk_tree_model_get_iter (model, &iter, path))
continue;
-
- gtk_tree_model_get (model, &iter,
- GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS,
+
+ gtk_tree_model_get (model, &iter,
+ GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS,
&flags, -1);
if (FILE_IS_DUMMY (flags))
@@ -1484,10 +1481,10 @@ get_deletable_files (GeditFileBrowserWidget *obj) {
paths = g_list_append (paths, gtk_tree_path_copy (path));
}
-
+
g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
g_list_free (rows);
-
+
return paths;
}
@@ -1504,7 +1501,7 @@ delete_selected_files (GeditFileBrowserWidget *obj,
if (!GEDIT_IS_FILE_BROWSER_STORE (model))
return FALSE;
-
+
rows = get_deletable_files (obj);
if (!rows)
@@ -1520,7 +1517,7 @@ delete_selected_files (GeditFileBrowserWidget *obj,
result = gedit_file_browser_store_delete_all (GEDIT_FILE_BROWSER_STORE (model),
rows, trash);
-
+
g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
g_list_free (rows);
@@ -1528,14 +1525,14 @@ delete_selected_files (GeditFileBrowserWidget *obj,
}
static gboolean
-on_file_store_no_trash (GeditFileBrowserStore *store,
- GList *files,
+on_file_store_no_trash (GeditFileBrowserStore *store,
+ GList *files,
GeditFileBrowserWidget *obj)
{
gboolean confirm = FALSE;
-
+
g_signal_emit (obj, signals[CONFIRM_NO_TRASH], 0, files, &confirm);
-
+
return confirm;
}
@@ -1544,15 +1541,15 @@ get_topmost_file (GFile *file)
{
GFile *tmp;
GFile *current;
-
+
current = g_object_ref (file);
-
+
while ((tmp = g_file_get_parent (current)) != NULL)
{
g_object_unref (current);
current = tmp;
}
-
+
return current;
}
@@ -1572,7 +1569,7 @@ create_goto_menu_item (GeditFileBrowserWidget *obj,
if (!get_from_bookmark_file (obj, loc->virtual_root, &unescape, &pixbuf))
{
unescape = gedit_file_browser_utils_file_basename (loc->virtual_root);
-
+
if (icon)
pixbuf = g_object_ref (icon);
}
@@ -1592,7 +1589,7 @@ create_goto_menu_item (GeditFileBrowserWidget *obj,
{
result = gtk_menu_item_new_with_label (unescape);
}
-
+
g_object_set_data (G_OBJECT (result), LOCATION_DATA_KEY, item);
g_signal_connect (result, "activate",
G_CALLBACK (on_location_jump_activate), obj);
@@ -1742,29 +1739,24 @@ clear_next_locations (GeditFileBrowserWidget *obj)
}
static void
-update_filter_mode (GeditFileBrowserWidget *obj,
- GtkAction *action,
+update_filter_mode (GeditFileBrowserWidget *obj,
+ GtkAction *action,
GeditFileBrowserStoreFilterMode mode)
{
- gboolean active =
- gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- GtkTreeModel *model =
- gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
- gint now;
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
if (GEDIT_IS_FILE_BROWSER_STORE (model))
{
- now =
- gedit_file_browser_store_get_filter_mode
- (GEDIT_FILE_BROWSER_STORE (model));
+ gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ gint now = gedit_file_browser_store_get_filter_mode (GEDIT_FILE_BROWSER_STORE (model));
if (active)
now &= ~mode;
else
now |= mode;
- gedit_file_browser_store_set_filter_mode
- (GEDIT_FILE_BROWSER_STORE (model), now);
+ gedit_file_browser_store_set_filter_mode (GEDIT_FILE_BROWSER_STORE (model),
+ now);
}
}
@@ -1775,16 +1767,15 @@ set_filter_pattern_real (GeditFileBrowserWidget *obj,
{
GtkTreeModel *model;
- model =
- gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
if (pattern != NULL && *pattern == '\0')
pattern = NULL;
if (pattern == NULL && obj->priv->filter_pattern_str == NULL)
return;
-
- if (pattern != NULL && obj->priv->filter_pattern_str != NULL &&
+
+ if (pattern != NULL && obj->priv->filter_pattern_str != NULL &&
strcmp (pattern, obj->priv->filter_pattern_str) == 0)
{
return;
@@ -1814,11 +1805,13 @@ set_filter_pattern_real (GeditFileBrowserWidget *obj,
obj->priv->filter_pattern = g_pattern_spec_new (pattern);
if (obj->priv->glob_filter_id == 0)
+ {
obj->priv->glob_filter_id =
gedit_file_browser_widget_add_filter (obj,
filter_glob,
NULL,
NULL);
+ }
}
if (update_entry)
@@ -1840,8 +1833,7 @@ set_filter_pattern_real (GeditFileBrowserWidget *obj,
if (GEDIT_IS_FILE_BROWSER_STORE (model))
{
- gedit_file_browser_store_refilter (GEDIT_FILE_BROWSER_STORE
- (model));
+ gedit_file_browser_store_refilter (GEDIT_FILE_BROWSER_STORE (model));
}
g_object_notify (G_OBJECT (obj), "filter-pattern");
@@ -1941,8 +1933,7 @@ gedit_file_browser_widget_set_root (GeditFileBrowserWidget *obj,
parent = get_topmost_file (root);
- gedit_file_browser_widget_set_root_and_virtual_root
- (obj, parent, root);
+ gedit_file_browser_widget_set_root_and_virtual_root (obj, parent, root);
g_object_unref (parent);
}
@@ -1979,15 +1970,13 @@ gedit_file_browser_widget_get_filter_entry (GeditFileBrowserWidget *obj)
gulong
gedit_file_browser_widget_add_filter (GeditFileBrowserWidget *obj,
- GeditFileBrowserWidgetFilterFunc func,
+ GeditFileBrowserWidgetFilterFunc func,
gpointer user_data,
GDestroyNotify notify)
{
- FilterFunc *f;
- GtkTreeModel *model =
- gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
+ FilterFunc *f = filter_func_new (obj, func, user_data, notify);;
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
- f = filter_func_new (obj, func, user_data, notify);
obj->priv->filter_funcs = g_slist_append (obj->priv->filter_funcs, f);
if (GEDIT_IS_FILE_BROWSER_STORE (model))
@@ -2022,7 +2011,7 @@ gedit_file_browser_widget_remove_filter (GeditFileBrowserWidget *obj,
}
}
-void
+void
gedit_file_browser_widget_set_filter_pattern (GeditFileBrowserWidget *obj,
gchar const *pattern)
{
@@ -2030,11 +2019,10 @@ gedit_file_browser_widget_set_filter_pattern (GeditFileBrowserWidget *obj,
}
gboolean
-gedit_file_browser_widget_get_selected_directory (GeditFileBrowserWidget *obj,
+gedit_file_browser_widget_get_selected_directory (GeditFileBrowserWidget *obj,
GtkTreeIter *iter)
{
- GtkTreeModel *model =
- gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
GtkTreeIter parent;
guint flags;
@@ -2080,13 +2068,13 @@ gedit_file_browser_widget_get_num_selected_files_or_directories (GeditFileBrowse
if (GEDIT_IS_FILE_BOOKMARKS_STORE (model))
return 0;
-
+
rows = gtk_tree_selection_get_selected_rows (selection, &model);
-
+
for (row = rows; row; row = row->next)
{
path = (GtkTreePath *)(row->data);
-
+
/* Get iter from path */
if (!gtk_tree_model_get_iter (model, &iter, path))
continue;
@@ -2108,7 +2096,7 @@ gedit_file_browser_widget_get_num_selected_files_or_directories (GeditFileBrowse
g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
g_list_free (rows);
-
+
return result;
}
@@ -2122,15 +2110,15 @@ static AsyncData *
async_data_new (GeditFileBrowserWidget *widget)
{
AsyncData *ret;
-
+
ret = g_slice_new (AsyncData);
ret->widget = widget;
-
+
cancel_async_operation (widget);
widget->priv->cancellable = g_cancellable_new ();
-
+
ret->cancellable = g_object_ref (widget->priv->cancellable);
-
+
return ret;
}
@@ -2147,9 +2135,9 @@ set_busy (GeditFileBrowserWidget *obj,
{
GdkCursor *cursor;
GdkWindow *window;
-
+
window = gtk_widget_get_window (GTK_WIDGET (obj->priv->treeview));
-
+
if (!GDK_IS_WINDOW (window))
return;
@@ -2173,30 +2161,30 @@ activate_mount (GeditFileBrowserWidget *widget,
GMount *mount)
{
GFile *root;
-
+
if (!mount)
{
gchar *message;
gchar *name;
-
+
name = g_volume_get_name (volume);
message = g_strdup_printf (_("No mount object for mounted volume: %s"), name);
-
- g_signal_emit (widget,
- signals[ERROR],
- 0,
+
+ g_signal_emit (widget,
+ signals[ERROR],
+ 0,
GEDIT_FILE_BROWSER_ERROR_SET_ROOT,
message);
-
+
g_free (name);
g_free (message);
return;
}
-
+
root = g_mount_get_root (mount);
-
+
gedit_file_browser_widget_set_root (widget, root, FALSE);
-
+
g_object_unref (root);
}
@@ -2207,12 +2195,12 @@ try_activate_drive (GeditFileBrowserWidget *widget,
GList *volumes;
GVolume *volume;
GMount *mount;
-
+
volumes = g_drive_get_volumes (drive);
-
+
volume = G_VOLUME (volumes->data);
mount = g_volume_get_mount (volume);
-
+
if (mount)
{
/* try set the root of the mount */
@@ -2224,7 +2212,7 @@ try_activate_drive (GeditFileBrowserWidget *widget,
/* try to mount it then? */
try_mount_volume (widget, volume);
}
-
+
g_list_foreach (volumes, (GFunc)g_object_unref, NULL);
g_list_free (volumes);
}
@@ -2242,11 +2230,11 @@ poll_for_media_cb (GDrive *drive,
async_free (async);
return;
}
-
+
/* finish poll operation */
set_busy (async->widget, FALSE);
-
- if (g_drive_poll_for_media_finish (drive, res, &error) &&
+
+ if (g_drive_poll_for_media_finish (drive, res, &error) &&
g_drive_has_media (drive) &&
g_drive_has_volumes (drive))
{
@@ -2256,22 +2244,22 @@ poll_for_media_cb (GDrive *drive,
{
gchar *message;
gchar *name;
-
+
name = g_drive_get_name (drive);
message = g_strdup_printf (_("Could not open media: %s"), name);
- g_signal_emit (async->widget,
- signals[ERROR],
- 0,
+ g_signal_emit (async->widget,
+ signals[ERROR],
+ 0,
GEDIT_FILE_BROWSER_ERROR_SET_ROOT,
message);
g_free (name);
g_free (message);
-
+
g_error_free (error);
}
-
+
async_free (async);
}
@@ -2288,14 +2276,14 @@ mount_volume_cb (GVolume *volume,
async_free (async);
return;
}
-
+
if (g_volume_mount_finish (volume, res, &error))
{
GMount *mount;
-
+
mount = g_volume_get_mount (volume);
activate_mount (async->widget, volume, mount);
-
+
if (mount)
g_object_unref (mount);
}
@@ -2303,22 +2291,22 @@ mount_volume_cb (GVolume *volume,
{
gchar *message;
gchar *name;
-
+
name = g_volume_get_name (volume);
message = g_strdup_printf (_("Could not mount volume: %s"), name);
- g_signal_emit (async->widget,
- signals[ERROR],
- 0,
+ g_signal_emit (async->widget,
+ signals[ERROR],
+ 0,
GEDIT_FILE_BROWSER_ERROR_SET_ROOT,
message);
g_free (name);
g_free (message);
-
+
g_error_free (error);
}
-
+
set_busy (async->widget, FALSE);
async_free (async);
}
@@ -2337,8 +2325,8 @@ activate_drive (GeditFileBrowserWidget *obj,
/* most common use case is a floppy drive, we'll poll for media and
go from there */
async = async_data_new (obj);
- g_drive_poll_for_media (drive,
- async->cancellable,
+ g_drive_poll_for_media (drive,
+ async->cancellable,
(GAsyncReadyCallback)poll_for_media_cb,
async);
@@ -2346,8 +2334,8 @@ activate_drive (GeditFileBrowserWidget *obj,
set_busy (obj, TRUE);
}
-static void
-try_mount_volume (GeditFileBrowserWidget *widget,
+static void
+try_mount_volume (GeditFileBrowserWidget *widget,
GVolume *volume)
{
GMountOperation *operation;
@@ -2355,14 +2343,14 @@ try_mount_volume (GeditFileBrowserWidget *widget,
operation = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget))));
async = async_data_new (widget);
-
+
g_volume_mount (volume,
G_MOUNT_MOUNT_NONE,
operation,
async->cancellable,
(GAsyncReadyCallback)mount_volume_cb,
async);
-
+
g_object_unref (operation);
set_busy (widget, TRUE);
}
@@ -2372,17 +2360,17 @@ activate_volume (GeditFileBrowserWidget *obj,
GtkTreeIter *iter)
{
GVolume *volume;
-
+
gtk_tree_model_get (GTK_TREE_MODEL (obj->priv->bookmarks_store), iter,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_OBJECT,
&volume, -1);
/* see if we can mount the volume */
- try_mount_volume (obj, volume);
+ try_mount_volume (obj, volume);
g_object_unref (volume);
}
-void
+void
gedit_file_browser_widget_refresh (GeditFileBrowserWidget *obj)
{
GtkTreeModel *model =
@@ -2403,7 +2391,7 @@ gedit_file_browser_widget_refresh (GeditFileBrowserWidget *obj)
}
}
-void
+void
gedit_file_browser_widget_history_back (GeditFileBrowserWidget *obj)
{
if (obj->priv->locations)
@@ -2442,7 +2430,7 @@ bookmark_open (GeditFileBrowserWidget *obj,
gtk_tree_model_get (model, iter,
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS,
&flags, -1);
-
+
if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_DRIVE)
{
/* handle a drive node */
@@ -2556,7 +2544,7 @@ on_bookmark_activated (GeditFileBrowserView *tree_view,
}
static void
-on_file_activated (GeditFileBrowserView *tree_view,
+on_file_activated (GeditFileBrowserView *tree_view,
GtkTreeIter *iter,
GeditFileBrowserWidget *obj)
{
@@ -2566,18 +2554,18 @@ on_file_activated (GeditFileBrowserView *tree_view,
}
static gboolean
-virtual_root_is_root (GeditFileBrowserWidget *obj,
+virtual_root_is_root (GeditFileBrowserWidget *obj,
GeditFileBrowserStore *model)
{
GtkTreeIter root;
GtkTreeIter virtual_root;
-
+
if (!gedit_file_browser_store_get_iter_root (model, &root))
return TRUE;
-
+
if (!gedit_file_browser_store_get_iter_virtual_root (model, &virtual_root))
return TRUE;
-
+
return gedit_file_browser_store_iter_equal (model, &root, &virtual_root);
}
@@ -2649,10 +2637,10 @@ on_virtual_root_changed (GeditFileBrowserStore *model,
g_object_unref (pixbuf);
}
-
+
action = gtk_action_group_get_action (obj->priv->action_group,
"DirectoryUp");
- gtk_action_set_sensitive (action,
+ gtk_action_set_sensitive (action,
!virtual_root_is_root (obj, model));
action = gtk_action_group_get_action (obj->priv->action_group_sensitive,
@@ -2780,7 +2768,7 @@ on_combo_changed (GtkComboBox *combo,
gedit_file_browser_store_set_virtual_root_from_location
(obj->priv->file_store, file);
-
+
g_object_unref (file);
break;
}
@@ -2811,14 +2799,14 @@ do_change_directory (GeditFileBrowserWidget *obj,
{
GtkAction *action = NULL;
- if ((event->state &
- (~GDK_CONTROL_MASK & ~GDK_SHIFT_MASK & ~GDK_MOD1_MASK)) ==
+ if ((event->state &
+ (~GDK_CONTROL_MASK & ~GDK_SHIFT_MASK & ~GDK_MOD1_MASK)) ==
event->state && event->keyval == GDK_BackSpace)
{
action = gtk_action_group_get_action (obj->priv->action_group_sensitive,
"DirectoryPrevious");
}
- else if (!((event->state & GDK_MOD1_MASK) &&
+ else if (!((event->state & GDK_MOD1_MASK) &&
(event->state & (~GDK_CONTROL_MASK & ~GDK_SHIFT_MASK)) == event->state))
{
return FALSE;
@@ -2841,13 +2829,13 @@ do_change_directory (GeditFileBrowserWidget *obj,
default:
break;
}
-
- if (action != NULL)
+
+ if (action != NULL)
{
gtk_action_activate (action);
return TRUE;
}
-
+
return FALSE;
}
@@ -2956,7 +2944,7 @@ on_location_jump_activate (GtkMenuItem *item,
}
static void
-on_bookmarks_row_changed (GtkTreeModel *model,
+on_bookmarks_row_changed (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
GeditFileBrowserWidget *obj)
@@ -2965,19 +2953,19 @@ on_bookmarks_row_changed (GtkTreeModel *model,
}
static void
-on_bookmarks_row_deleted (GtkTreeModel *model,
+on_bookmarks_row_deleted (GtkTreeModel *model,
GtkTreePath *path,
GeditFileBrowserWidget *obj)
{
GtkTreeIter iter;
GFile *location;
-
+
if (!gtk_tree_model_get_iter (model, &iter, path))
return;
location = gedit_file_bookmarks_store_get_location (obj->priv->bookmarks_store,
&iter);
-
+
if (!location)
return;
@@ -2986,7 +2974,7 @@ on_bookmarks_row_deleted (GtkTreeModel *model,
g_object_unref (location);
}
-static void
+static void
on_filter_mode_changed (GeditFileBrowserStore *model,
GParamSpec *param,
GeditFileBrowserWidget *obj)
@@ -2996,20 +2984,20 @@ on_filter_mode_changed (GeditFileBrowserStore *model,
gboolean active;
mode = gedit_file_browser_store_get_filter_mode (model);
-
- action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (obj->priv->action_group,
+
+ action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (obj->priv->action_group,
"FilterHidden"));
active = !(mode & GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN);
-
+
if (active != gtk_toggle_action_get_active (action))
gtk_toggle_action_set_active (action, active);
- action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (obj->priv->action_group,
+ action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (obj->priv->action_group,
"FilterBinary"));
active = !(mode & GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY);
-
+
if (active != gtk_toggle_action_get_active (action))
- gtk_toggle_action_set_active (action, active);
+ gtk_toggle_action_set_active (action, active);
}
static void
@@ -3026,7 +3014,7 @@ on_action_directory_previous (GtkAction *action,
gedit_file_browser_widget_history_back (obj);
}
-static void
+static void
on_action_directory_up (GtkAction *action,
GeditFileBrowserWidget *obj)
{
@@ -3036,8 +3024,8 @@ on_action_directory_up (GtkAction *action,
if (!GEDIT_IS_FILE_BROWSER_STORE (model))
return;
-
- gedit_file_browser_store_set_virtual_root_up (GEDIT_FILE_BROWSER_STORE (model));
+
+ gedit_file_browser_store_set_virtual_root_up (GEDIT_FILE_BROWSER_STORE (model));
}
static void
@@ -3056,8 +3044,8 @@ on_action_directory_new (GtkAction *action,
if (!gedit_file_browser_widget_get_selected_directory (obj, &parent))
return;
- if (gedit_file_browser_store_new_directory
- (GEDIT_FILE_BROWSER_STORE (model), &parent, &iter))
+ if (gedit_file_browser_store_new_directory (GEDIT_FILE_BROWSER_STORE (model),
+ &parent, &iter))
{
gedit_file_browser_view_start_rename (obj->priv->treeview,
&iter);
@@ -3076,7 +3064,7 @@ on_action_file_open (GtkAction *action,
GtkTreePath *path;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview));
if (!GEDIT_IS_FILE_BROWSER_STORE (model))
return;
@@ -3112,8 +3100,8 @@ on_action_file_new (GtkAction *action,
if (!gedit_file_browser_widget_get_selected_directory (obj, &parent))
return;
- if (gedit_file_browser_store_new_file
- (GEDIT_FILE_BROWSER_STORE (model), &parent, &iter))
+ if (gedit_file_browser_store_new_file (GEDIT_FILE_BROWSER_STORE (model),
+ &parent, &iter))
{
gedit_file_browser_view_start_rename (obj->priv->treeview,
&iter);
@@ -3161,23 +3149,23 @@ on_action_directory_open (GtkAction *action,
GtkTreePath *path;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview));
if (!GEDIT_IS_FILE_BROWSER_STORE (model))
return;
rows = gtk_tree_selection_get_selected_rows (selection, &model);
-
+
for (row = rows; row; row = row->next)
{
path = (GtkTreePath *)(row->data);
if (gtk_tree_model_get_iter (model, &iter, path))
directory_opened |= directory_open (obj, model, &iter);
-
+
gtk_tree_path_free (path);
}
-
+
if (!directory_opened &&
gedit_file_browser_widget_get_selected_directory (obj, &iter))
{
@@ -3191,8 +3179,8 @@ static void
on_action_filter_hidden (GtkAction *action,
GeditFileBrowserWidget *obj)
{
- update_filter_mode (obj,
- action,
+ update_filter_mode (obj,
+ action,
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN);
}
@@ -3200,8 +3188,8 @@ static void
on_action_filter_binary (GtkAction *action,
GeditFileBrowserWidget *obj)
{
- update_filter_mode (obj,
- action,
+ update_filter_mode (obj,
+ action,
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY);
}
@@ -3222,4 +3210,5 @@ on_action_bookmark_open (GtkAction *action,
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
bookmark_open (obj, model, &iter);
}
+
/* ex:ts=8:noet: */
diff --git a/plugins/filebrowser/gedit-file-browser-widget.h b/plugins/filebrowser/gedit-file-browser-widget.h
index 377c046..1bdbf54 100644
--- a/plugins/filebrowser/gedit-file-browser-widget.h
+++ b/plugins/filebrowser/gedit-file-browser-widget.h
@@ -1,19 +1,19 @@
/*
- * gedit-file-browser-widget.h - Gedit plugin providing easy file access
+ * gedit-file-browser-widget.h - Gedit plugin providing easy file access
* from the sidepanel
- *
+ *
* Copyright (C) 2006 - Jesse van den Kieboom <jesse icecrew nl>
- *
+ *
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -46,14 +46,14 @@ gboolean (*GeditFileBrowserWidgetFilterFunc) (GeditFileBrowserWidget *obj,
GtkTreeIter *iter,
gpointer user_data);
-struct _GeditFileBrowserWidget
+struct _GeditFileBrowserWidget
{
GtkVBox parent;
GeditFileBrowserWidgetPrivate *priv;
};
-struct _GeditFileBrowserWidgetClass
+struct _GeditFileBrowserWidgetClass
{
GtkVBoxClass parent_class;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]