summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Gupta <[email protected]>2011-05-20 12:07:19 +0200
committerraveit65 <[email protected]>2018-07-03 10:39:59 +0200
commit07de8758476b62430ca15f29d0d75b88afef1345 (patch)
tree14e3a2210105db00f9ded617f9a693f73560e196
parent13330357ea72f27d56838d910a0714e94607e9ec (diff)
downloadeom-07de8758476b62430ca15f29d0d75b88afef1345.tar.bz2
eom-07de8758476b62430ca15f29d0d75b88afef1345.tar.xz
Add an "Open containing folder" command
https://bugzilla.gnome.org/show_bug.cgi?id=650402 origin commit: https://git.gnome.org/browse/eog/commit/?id=9df5fd43
-rw-r--r--data/eom-toolbar.xml1
-rw-r--r--data/eom-ui.xml3
-rw-r--r--src/eom-window.c54
3 files changed, 58 insertions, 0 deletions
diff --git a/data/eom-toolbar.xml b/data/eom-toolbar.xml
index 38e895c..5083867 100644
--- a/data/eom-toolbar.xml
+++ b/data/eom-toolbar.xml
@@ -3,6 +3,7 @@
<available>
<toolitem name="ImageOpen"/>
<toolitem name="ImageSave"/>
+ <toolitem name="ImageOpenContainingFolder"/>
<toolitem name="ImagePrint"/>
<toolitem name="ImageProperties"/>
<toolitem name="ViewImageCollection"/>
diff --git a/data/eom-ui.xml b/data/eom-ui.xml
index ad5c9f2..724e2cf 100644
--- a/data/eom-ui.xml
+++ b/data/eom-ui.xml
@@ -12,6 +12,7 @@
<menuitem action="ImagePrint"/>
<separator/>
<menuitem action="ImageSetAsWallpaper"/>
+ <menuitem action="ImageOpenContainingFolder"/>
<separator/>
<menuitem action="ImageProperties"/>
<separator/>
@@ -121,6 +122,7 @@
<separator/>
<menuitem action="ImageProperties"/>
<menuitem action="ImageSetAsWallpaper"/>
+ <menuitem action="ImageOpenContainingFolder"/>
</popup>
<popup name="ViewPopup">
@@ -139,6 +141,7 @@
<separator/>
<menuitem action="ImageProperties"/>
<menuitem action="ImageSetAsWallpaper"/>
+ <menuitem action="ImageOpenContainingFolder"/>
</popup>
<popup name="ToolbarPopup" action="ToolbarPopupAction">
diff --git a/src/eom-window.c b/src/eom-window.c
index a8dca71..4bff663 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -2954,6 +2954,54 @@ eom_window_cmd_save_as (GtkAction *action, gpointer user_data)
}
static void
+eom_window_cmd_open_containing_folder (GtkAction *action, gpointer user_data)
+{
+ EomWindow *window = EOM_WINDOW (user_data);
+ EomWindowPrivate *priv;
+
+ GtkWidget *eom_window_widget;
+
+ GFile *file;
+ GFile *parent = NULL;
+
+ eom_window_widget = GTK_WIDGET (window);
+ priv = window->priv;
+
+ g_return_if_fail (priv->image != NULL);
+
+ file = eom_image_get_file (priv->image);
+
+ if (file) {
+ parent = g_file_get_parent (file);
+ g_object_unref(file);
+ }
+
+ if (parent) {
+ char *parent_uri;
+
+ parent_uri = g_file_get_uri (parent);
+ if (parent_uri) {
+ GdkScreen *screen;
+ guint32 timestamp;
+ GError *error;
+
+ screen = gtk_widget_get_screen (eom_window_widget);
+ timestamp = gtk_get_current_event_time ();
+
+ error = NULL;
+ if (!gtk_show_uri (screen, parent_uri, timestamp, &error)) {
+ eom_debug_message (DEBUG_WINDOW, "Could not open the containing folder");
+ g_error_free (error);
+ }
+
+ g_free (parent_uri);
+ }
+
+ g_object_unref(parent);
+ }
+}
+
+static void
eom_window_cmd_print (GtkAction *action, gpointer user_data)
{
EomWindow *window = EOM_WINDOW (user_data);
@@ -3651,6 +3699,9 @@ static const GtkActionEntry action_entries_image[] = {
{ "ImageSaveAs", "document-save-as", N_("Save _As…"), "<control><shift>s",
N_("Save the selected images with a different name"),
G_CALLBACK (eom_window_cmd_save_as) },
+ { "ImageOpenContainingFolder", GTK_STOCK_DIRECTORY, N_("Open Containing _Folder"), NULL,
+ N_("Show the folder which contains this file in the file manager"),
+ G_CALLBACK (eom_window_cmd_open_containing_folder) },
{ "ImagePrint", "document-print", N_("_Print…"), "<control>p",
N_("Print the selected image"),
G_CALLBACK (eom_window_cmd_print) },
@@ -3824,6 +3875,9 @@ set_action_properties (GtkActionGroup *window_group,
action = gtk_action_group_get_action (image_group, "EditRotate270");
g_object_set (action, "short_label", _("Left"), NULL);
+ action = gtk_action_group_get_action (image_group, "ImageOpenContainingFolder");
+ g_object_set (action, "short_label", _("Open Folder"), NULL);
+
action = gtk_action_group_get_action (image_group, "ViewZoomIn");
g_object_set (action, "short_label", _("In"), NULL);