[gnome-utils] Allow nautilus to highlight the file when using 'Open Containing Folder'
- From: Dennis Cranston <dcransto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-utils] Allow nautilus to highlight the file when using 'Open Containing Folder'
- Date: Sat, 25 Jun 2011 06:34:42 +0000 (UTC)
commit 85129258fcff91eb16f49516e40bf944773c4143
Author: Dennis Cranston <dennis_cranston yahoo com>
Date: Fri Jun 24 23:32:41 2011 -0700
Allow nautilus to highlight the file when using 'Open Containing Folder'
gsearchtool/ChangeLog | 6 ++++++
gsearchtool/gsearchtool-callbacks.c | 4 ++--
gsearchtool/gsearchtool-support.c | 16 ++++++++++++----
gsearchtool/gsearchtool-support.h | 3 ++-
4 files changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/gsearchtool/ChangeLog b/gsearchtool/ChangeLog
index 6d1c49d..e05fe6a 100644
--- a/gsearchtool/ChangeLog
+++ b/gsearchtool/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-24 Dennis Cranston <dennis_cranston yahoo com>
+
+ * gsearchtool-callbacks.c, gsearchtool-support.[ch]:
+ Allow nautilus to highlight the file when using the
+ 'Open Containing Folder' menu option.
+
2011-05-23 Dennis Cranston <dennis_cranston yahoo com>
* gsearchtool-support.c:
diff --git a/gsearchtool/gsearchtool-callbacks.c b/gsearchtool/gsearchtool-callbacks.c
index d3b7b16..6660e3c 100644
--- a/gsearchtool/gsearchtool-callbacks.c
+++ b/gsearchtool/gsearchtool-callbacks.c
@@ -494,7 +494,7 @@ open_file_cb (GtkMenuItem * action,
if (g_file_test (locale_file, G_FILE_TEST_IS_DIR)) {
- if (open_file_with_filemanager (gsearch->window, locale_file) == FALSE) {
+ if (open_file_with_filemanager (gsearch->window, locale_file, FALSE) == FALSE) {
display_dialog_could_not_open_folder (gsearch->window, utf8_name);
}
}
@@ -612,7 +612,7 @@ open_folder_cb (GtkAction * action,
if (open_file_with_application (gsearch->window, locale_folder, g_app_info) == FALSE) {
- if (open_file_with_filemanager (gsearch->window, locale_folder) == FALSE) {
+ if (open_file_with_filemanager (gsearch->window, locale_file, TRUE) == FALSE) {
display_dialog_could_not_open_folder (gsearch->window, utf8_folder);
diff --git a/gsearchtool/gsearchtool-support.c b/gsearchtool/gsearchtool-support.c
index 3defd73..d393b45 100644
--- a/gsearchtool/gsearchtool-support.c
+++ b/gsearchtool/gsearchtool-support.c
@@ -1191,7 +1191,8 @@ get_file_pixbuf (GSearchWindow * gsearch,
gboolean
open_file_with_filemanager (GtkWidget * window,
- const gchar * file)
+ const gchar * file,
+ gboolean open_parent)
{
GDesktopAppInfo * d_app_info;
GKeyFile * key_file;
@@ -1204,10 +1205,17 @@ open_file_with_filemanager (GtkWidget * window,
gchar * uri;
gboolean result = TRUE;
- uri = g_filename_to_uri (file, NULL, NULL);
- list = g_list_prepend (list, uri);
+ if (open_parent == TRUE && g_file_test (file, G_FILE_TEST_IS_DIR)) {
+ gchar * folder = g_path_get_dirname (file);
+ uri = g_filename_to_uri (folder, NULL, NULL);
+ g_free (folder);
+ }
+ else {
+ uri = g_filename_to_uri (file, NULL, NULL);
+ }
- g_file = g_file_new_for_path (file);
+ list = g_list_prepend (list, uri);
+ g_file = g_file_new_for_path (g_path_get_dirname (file));
g_app_info = g_file_query_default_handler (g_file, NULL, NULL);
if (strcmp (g_app_info_get_executable (g_app_info), "nautilus") == 0) {
diff --git a/gsearchtool/gsearchtool-support.h b/gsearchtool/gsearchtool-support.h
index a34b058..e6f6ebf 100644
--- a/gsearchtool/gsearchtool-support.h
+++ b/gsearchtool/gsearchtool-support.h
@@ -115,7 +115,8 @@ get_file_pixbuf (GSearchWindow * gsearch,
GFileInfo * file_info);
gboolean
open_file_with_filemanager (GtkWidget * window,
- const gchar * file);
+ const gchar * file,
+ gboolean open_parent);
gboolean
open_file_with_application (GtkWidget * window,
const gchar * file,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]