[gedit] Bug 697251 - Alt+Home should go to home directory
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Bug 697251 - Alt+Home should go to home directory
- Date: Fri, 14 Jun 2013 15:40:45 +0000 (UTC)
commit 4c659efe4fe479b1bcb29523e9f045ff2e02bde4
Author: Garrett Regier <garrettregier gmail com>
Date: Fri Jun 14 06:28:25 2013 -0700
Bug 697251 - Alt+Home should go to home directory
plugins/filebrowser/gedit-file-browser-widget.c | 38 ++++++++++++++++++++++-
1 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/plugins/filebrowser/gedit-file-browser-widget.c b/plugins/filebrowser/gedit-file-browser-widget.c
index dee7599..92a7314 100644
--- a/plugins/filebrowser/gedit-file-browser-widget.c
+++ b/plugins/filebrowser/gedit-file-browser-widget.c
@@ -203,6 +203,9 @@ static void next_location_activated (GSimpleAction *action,
static void up_activated (GSimpleAction *action,
GVariant *parameter,
gpointer user_data);
+static void home_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
static void new_folder_activated (GSimpleAction *action,
GVariant *parameter,
gpointer user_data);
@@ -912,7 +915,8 @@ static GActionEntry browser_entries[] = {
{ "show_binary", activate_toggle, NULL, "false", change_show_binary_state },
{ "previous_location", previous_location_activated },
{ "next_location", next_location_activated },
- { "up", up_activated }
+ { "up", up_activated },
+ { "home", home_activated }
};
static void
@@ -1054,6 +1058,9 @@ update_sensitivity (GeditFileBrowserWidget *obj)
action = g_simple_action_group_lookup (obj->priv->action_group,
"up");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), TRUE);
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "home");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), TRUE);
action = g_simple_action_group_lookup (obj->priv->action_group,
"show_hidden");
@@ -1075,6 +1082,9 @@ update_sensitivity (GeditFileBrowserWidget *obj)
action = g_simple_action_group_lookup (obj->priv->action_group,
"up");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "home");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
action = g_simple_action_group_lookup (obj->priv->action_group,
"show_hidden");
@@ -2459,6 +2469,10 @@ do_change_directory (GeditFileBrowserWidget *obj,
switch (event->keyval)
{
+ case GDK_KEY_Home:
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "home");
+ break;
case GDK_KEY_Left:
action = g_simple_action_group_lookup (obj->priv->action_group,
"previous_location");
@@ -2692,6 +2706,28 @@ up_activated (GSimpleAction *action,
}
static void
+home_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
+ GtkTreeModel *model;
+ GFile *home_location;
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
+
+ if (!GEDIT_IS_FILE_BROWSER_STORE (model))
+ return;
+
+ home_location = g_file_new_for_path (g_get_home_dir ());
+
+ gedit_file_browser_store_set_virtual_root_from_location (GEDIT_FILE_BROWSER_STORE (model),
+ home_location);
+
+ g_object_unref (home_location);
+}
+
+static void
new_folder_activated (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]