Skip to content

Commit 07de875

Browse files
kitallisraveit65
authored andcommitted
1 parent 1333035 commit 07de875

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

data/eom-toolbar.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<available>
44
<toolitem name="ImageOpen"/>
55
<toolitem name="ImageSave"/>
6+
<toolitem name="ImageOpenContainingFolder"/>
67
<toolitem name="ImagePrint"/>
78
<toolitem name="ImageProperties"/>
89
<toolitem name="ViewImageCollection"/>

data/eom-ui.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<menuitem action="ImagePrint"/>
1313
<separator/>
1414
<menuitem action="ImageSetAsWallpaper"/>
15+
<menuitem action="ImageOpenContainingFolder"/>
1516
<separator/>
1617
<menuitem action="ImageProperties"/>
1718
<separator/>
@@ -121,6 +122,7 @@
121122
<separator/>
122123
<menuitem action="ImageProperties"/>
123124
<menuitem action="ImageSetAsWallpaper"/>
125+
<menuitem action="ImageOpenContainingFolder"/>
124126
</popup>
125127

126128
<popup name="ViewPopup">
@@ -139,6 +141,7 @@
139141
<separator/>
140142
<menuitem action="ImageProperties"/>
141143
<menuitem action="ImageSetAsWallpaper"/>
144+
<menuitem action="ImageOpenContainingFolder"/>
142145
</popup>
143146

144147
<popup name="ToolbarPopup" action="ToolbarPopupAction">

src/eom-window.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,6 +2953,54 @@ eom_window_cmd_save_as (GtkAction *action, gpointer user_data)
29532953
eom_job_queue_add_job (priv->save_job);
29542954
}
29552955

2956+
static void
2957+
eom_window_cmd_open_containing_folder (GtkAction *action, gpointer user_data)
2958+
{
2959+
EomWindow *window = EOM_WINDOW (user_data);
2960+
EomWindowPrivate *priv;
2961+
2962+
GtkWidget *eom_window_widget;
2963+
2964+
GFile *file;
2965+
GFile *parent = NULL;
2966+
2967+
eom_window_widget = GTK_WIDGET (window);
2968+
priv = window->priv;
2969+
2970+
g_return_if_fail (priv->image != NULL);
2971+
2972+
file = eom_image_get_file (priv->image);
2973+
2974+
if (file) {
2975+
parent = g_file_get_parent (file);
2976+
g_object_unref(file);
2977+
}
2978+
2979+
if (parent) {
2980+
char *parent_uri;
2981+
2982+
parent_uri = g_file_get_uri (parent);
2983+
if (parent_uri) {
2984+
GdkScreen *screen;
2985+
guint32 timestamp;
2986+
GError *error;
2987+
2988+
screen = gtk_widget_get_screen (eom_window_widget);
2989+
timestamp = gtk_get_current_event_time ();
2990+
2991+
error = NULL;
2992+
if (!gtk_show_uri (screen, parent_uri, timestamp, &error)) {
2993+
eom_debug_message (DEBUG_WINDOW, "Could not open the containing folder");
2994+
g_error_free (error);
2995+
}
2996+
2997+
g_free (parent_uri);
2998+
}
2999+
3000+
g_object_unref(parent);
3001+
}
3002+
}
3003+
29563004
static void
29573005
eom_window_cmd_print (GtkAction *action, gpointer user_data)
29583006
{
@@ -3651,6 +3699,9 @@ static const GtkActionEntry action_entries_image[] = {
36513699
{ "ImageSaveAs", "document-save-as", N_("Save _As…"), "<control><shift>s",
36523700
N_("Save the selected images with a different name"),
36533701
G_CALLBACK (eom_window_cmd_save_as) },
3702+
{ "ImageOpenContainingFolder", GTK_STOCK_DIRECTORY, N_("Open Containing _Folder"), NULL,
3703+
N_("Show the folder which contains this file in the file manager"),
3704+
G_CALLBACK (eom_window_cmd_open_containing_folder) },
36543705
{ "ImagePrint", "document-print", N_("_Print…"), "<control>p",
36553706
N_("Print the selected image"),
36563707
G_CALLBACK (eom_window_cmd_print) },
@@ -3824,6 +3875,9 @@ set_action_properties (GtkActionGroup *window_group,
38243875
action = gtk_action_group_get_action (image_group, "EditRotate270");
38253876
g_object_set (action, "short_label", _("Left"), NULL);
38263877

3878+
action = gtk_action_group_get_action (image_group, "ImageOpenContainingFolder");
3879+
g_object_set (action, "short_label", _("Open Folder"), NULL);
3880+
38273881
action = gtk_action_group_get_action (image_group, "ViewZoomIn");
38283882
g_object_set (action, "short_label", _("In"), NULL);
38293883

0 commit comments

Comments
 (0)