[eog: 5/11] remote-presenter: Add presenter dialog




commit 4391c9287b6b7bde249fe9439b1aacb316be68a9
Author: Peter Eisenmann <p3732 getgoogleoff me>
Date:   Thu Aug 5 22:41:37 2021 +0200

    remote-presenter: Add presenter dialog
    
    Adds a dialog that provides basic image information combined with
    navigation. Code is adapted from eog-properties-dialog. UI uses
    GtkWindow instead of GtkDialog.

 data/eog-remote-presenter.ui | 269 +++++++++++++++++++++++++++++
 data/meson.build             |   1 +
 po/POTFILES.in               |   2 +
 src/eog-remote-presenter.c   | 394 +++++++++++++++++++++++++++++++++++++++++++
 src/eog-remote-presenter.h   |  66 ++++++++
 src/eog.gresource.xml        |   1 +
 src/meson.build              |   2 +
 7 files changed, 735 insertions(+)
---
diff --git a/data/eog-remote-presenter.ui b/data/eog-remote-presenter.ui
new file mode 100644
index 00000000..14787391
--- /dev/null
+++ b/data/eog-remote-presenter.ui
@@ -0,0 +1,269 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
+<interface>
+  <requires lib="gtk+" version="3.24"/>
+  <template class="EogRemotePresenter" parent="GtkWindow">
+    <property name="can-focus">False</property>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="margin-start">12</property>
+        <property name="margin-end">12</property>
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="border-width">10</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkImage" id="thumbnail_image">
+                <property name="width-request">100</property>
+                <property name="height-request">100</property>
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="icon-name">image-missing</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <!-- n-columns=2 n-rows=5 -->
+          <object class="GtkGrid">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="margin-start">6</property>
+            <property name="margin-end">6</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">6</property>
+            <property name="row-spacing">6</property>
+            <property name="column-spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="name_label">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="selectable">True</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="size_label">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="selectable">True</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="type_label">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="selectable">True</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="bytes_label">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="selectable">True</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="valign">baseline</property>
+                <property name="label" translatable="yes">Type</property>
+                <property name="justify">right</property>
+                <property name="xalign">1</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="valign">baseline</property>
+                <property name="label" translatable="yes">Name</property>
+                <property name="justify">right</property>
+                <property name="xalign">1</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="valign">baseline</property>
+                <property name="label" translatable="yes">Size</property>
+                <property name="justify">right</property>
+                <property name="xalign">1</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="valign">baseline</property>
+                <property name="label" translatable="yes">Bytes</property>
+                <property name="justify">right</property>
+                <property name="xalign">1</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="valign">baseline</property>
+                <property name="label" translatable="yes">Folder</property>
+                <property name="justify">right</property>
+                <property name="xalign">1</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="folder_button">
+                <property name="label">button</property>
+                <property name="use-action-appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">True</property>
+                <property name="tooltip-text" translatable="yes">Show the folder which contains this file in 
the file manager</property>
+                <property name="halign">start</property>
+                <property name="valign">center</property>
+                <signal name="clicked" handler="rp_folder_button_clicked_cb" object="EogRemotePresenter" 
swapped="no"/>
+              </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">4</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <child type="titlebar">
+      <object class="GtkHeaderBar">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="title" translatable="yes">Presenter</property>
+        <property name="show-close-button">True</property>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <child>
+              <object class="GtkButton" id="previous_button">
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">False</property>
+                <child>
+                  <object class="GtkImage">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="icon-name">go-previous-symbolic</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="next_button">
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">False</property>
+                <child>
+                  <object class="GtkImage">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="icon-name">go-next-symbolic</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <style>
+              <class name="linked"/>
+            </style>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/data/meson.build b/data/meson.build
index db56402b..05c92b9a 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -7,6 +7,7 @@ resource_data = files(
   'eog-image-properties-dialog.ui',
   'eog-multiple-save-as-dialog.ui',
   'eog-preferences-dialog.ui',
+  'eog-remote-presenter.ui',
   'eog-zoom-entry.ui',
   'eog.css',
   'fullscreen-toolbar.ui',
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 69f553f5..06f002a4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,6 +6,7 @@ data/eog-details-dialog.ui
 data/eog-image-properties-dialog.ui
 data/eog-multiple-save-as-dialog.ui
 data/eog-preferences-dialog.ui
+data/eog-remote-presenter.ui
 data/eog-zoom-entry.ui
 data/fullscreen-toolbar.ui
 data/help-overlay.ui
@@ -32,6 +33,7 @@ src/eog-preferences-dialog.c
 src/eog-print.c
 src/eog-print-image-setup.c
 src/eog-properties-dialog.c
+src/eog-remote-presenter.c
 src/eog-save-as-dialog-helper.c
 src/eog-scroll-view.c
 src/eog-sidebar.c
diff --git a/src/eog-remote-presenter.c b/src/eog-remote-presenter.c
new file mode 100644
index 00000000..66f1ba02
--- /dev/null
+++ b/src/eog-remote-presenter.c
@@ -0,0 +1,394 @@
+/* Eye Of Gnome - Remote Presenter
+ *
+ * Copyright (C) 2006 The Free Software Foundation
+ *
+ * Author: Lucas Rocha <lucasr gnome org>
+ *         Hubert Figuiere <hub figuiere net> (XMP support)
+ *         Peter Eisenmann <p3732 getgoogleoff me> (from eog-properties-dialog)
+ *
+ * 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 of the License, 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "eog-remote-presenter.h"
+#include "eog-image.h"
+#include "eog-util.h"
+#include "eog-thumb-view.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+#ifdef HAVE_METADATA
+#include "eog-metadata-details.h"
+#endif
+
+enum {
+        PROP_0,
+        PROP_THUMBVIEW,
+        PROP_NEXT_ACTION,
+        PROP_PREV_ACTION
+};
+
+struct _EogRemotePresenterPrivate {
+        EogThumbView   *thumbview;
+
+        GtkWidget      *next_button;
+        GtkWidget      *previous_button;
+
+        GtkWidget      *thumbnail_image;
+        GtkWidget      *name_label;
+        GtkWidget      *size_label;
+        GtkWidget      *type_label;
+        GtkWidget      *bytes_label;
+        GtkWidget      *folder_button;
+        gchar          *folder_button_uri;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (EogRemotePresenter, eog_remote_presenter, GTK_TYPE_WINDOW);
+
+static void
+parent_file_display_name_query_info_cb (GObject *source_object,
+                                        GAsyncResult *res,
+                                        gpointer user_data)
+{
+        EogRemotePresenter *remote_presenter = EOG_REMOTE_PRESENTER (user_data);
+        GFile *parent_file = G_FILE (source_object);
+        GFileInfo *file_info;
+        gchar *display_name;
+
+
+        file_info = g_file_query_info_finish (parent_file, res, NULL);
+        if (file_info == NULL) {
+                display_name = g_file_get_basename (parent_file);
+        } else {
+                display_name = g_strdup (
+                        g_file_info_get_display_name (file_info));
+                g_object_unref (file_info);
+        }
+        gtk_button_set_label (GTK_BUTTON (remote_presenter->priv->folder_button),
+                              display_name);
+        gtk_widget_set_sensitive (remote_presenter->priv->folder_button, TRUE);
+
+        g_free (display_name);
+        g_object_unref (remote_presenter);
+}
+
+static void
+rp_folder_button_clicked_cb (GtkButton *button, gpointer data)
+{
+        EogRemotePresenterPrivate *priv = EOG_REMOTE_PRESENTER (data)->priv;
+        GtkWindow *window;
+        guint32 timestamp;
+
+        if (!priv->folder_button_uri)
+                return;
+        
+        timestamp = gtk_get_current_event_time ();
+
+        window = GTK_WINDOW (data);
+        gtk_show_uri_on_window (window, priv->folder_button_uri, timestamp, NULL);
+}
+
+static void
+eog_remote_presenter_set_property (GObject      *object,
+                                   guint         prop_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
+{
+        EogRemotePresenter *remote_presenter = EOG_REMOTE_PRESENTER (object);
+
+        switch (prop_id) {
+                case PROP_THUMBVIEW:
+                        remote_presenter->priv->thumbview = g_value_get_object (value);
+                        break;
+                case PROP_NEXT_ACTION:
+                        gtk_actionable_set_action_name (GTK_ACTIONABLE (remote_presenter->priv->next_button),
+                                                        g_value_get_string (value));
+                        break;
+                case PROP_PREV_ACTION:
+                        gtk_actionable_set_action_name (GTK_ACTIONABLE 
(remote_presenter->priv->previous_button),
+                                                        g_value_get_string (value));
+                        break;
+                default:
+                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id,
+                                                           pspec);
+                        break;
+        }
+}
+
+static void
+eog_remote_presenter_get_property (GObject    *object,
+                                   guint       prop_id,
+                                   GValue     *value,
+                                   GParamSpec *pspec)
+{
+        EogRemotePresenter *remote_presenter = EOG_REMOTE_PRESENTER (object);
+
+        switch (prop_id) {
+                case PROP_THUMBVIEW:
+                        g_value_set_object (value, remote_presenter->priv->thumbview);
+                        break;
+                case PROP_NEXT_ACTION:
+                {
+                        const gchar* action = gtk_actionable_get_action_name (
+                                                      GTK_ACTIONABLE (remote_presenter->priv->next_button));
+                        g_value_set_string (value, action);
+                        break;
+                }
+                case PROP_PREV_ACTION:
+                {
+                        const gchar* action = gtk_actionable_get_action_name (
+                                                      GTK_ACTIONABLE 
(remote_presenter->priv->previous_button));
+                        g_value_set_string (value, action);
+                        break;
+                }
+                default:
+                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id,
+                                                           pspec);
+                        break;
+        }
+}
+
+static void
+eog_remote_presenter_dispose (GObject *object)
+{
+        EogRemotePresenter *remote_presenter;
+        EogRemotePresenterPrivate *priv;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (EOG_IS_REMOTE_PRESENTER (object));
+
+        remote_presenter = EOG_REMOTE_PRESENTER (object);
+        priv = remote_presenter->priv;
+
+        if (priv->thumbview) {
+                g_object_unref (priv->thumbview);
+                priv->thumbview = NULL;
+        }
+
+        g_free (priv->folder_button_uri);
+        priv->folder_button_uri = NULL;
+
+        G_OBJECT_CLASS (eog_remote_presenter_parent_class)->dispose (object);
+}
+
+static void
+eog_remote_presenter_class_init (EogRemotePresenterClass *klass)
+{
+        GObjectClass *g_object_class = (GObjectClass *) klass;
+
+        g_object_class->dispose = eog_remote_presenter_dispose;
+        g_object_class->set_property = eog_remote_presenter_set_property;
+        g_object_class->get_property = eog_remote_presenter_get_property;
+
+        g_object_class_install_property (g_object_class,
+                                         PROP_THUMBVIEW,
+                                         g_param_spec_object ("thumbview",
+                                                              "Thumbview",
+                                                              "Thumbview",
+                                                              EOG_TYPE_THUMB_VIEW,
+                                                              G_PARAM_READWRITE |
+                                                              G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
+        g_object_class_install_property (g_object_class,
+                                         PROP_NEXT_ACTION,
+                                         g_param_spec_string ("next-action",
+                                                              "Next Action",
+                                                              "Action for Next button",
+                                                              NULL,
+                                                              G_PARAM_READWRITE |
+                                                              G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
+        g_object_class_install_property (g_object_class,
+                                         PROP_PREV_ACTION,
+                                         g_param_spec_string ("prev-action",
+                                                              "Prev Action",
+                                                              "Action for Prev button",
+                                                              NULL,
+                                                              G_PARAM_READWRITE |
+                                                              G_PARAM_CONSTRUCT_ONLY |
+                                                              G_PARAM_STATIC_STRINGS));
+
+        gtk_widget_class_set_template_from_resource ((GtkWidgetClass *) klass, 
"/org/gnome/eog/ui/eog-remote-presenter.ui");
+
+        GtkWidgetClass *wklass = (GtkWidgetClass*) klass;
+        gtk_widget_class_bind_template_child_private(wklass,
+                                                     EogRemotePresenter,
+                                                     previous_button);
+        gtk_widget_class_bind_template_child_private(wklass,
+                                                     EogRemotePresenter,
+                                                     next_button);
+        gtk_widget_class_bind_template_child_private(wklass,
+                                                     EogRemotePresenter,
+                                                     thumbnail_image);
+        gtk_widget_class_bind_template_child_private(wklass,
+                                                     EogRemotePresenter,
+                                                     name_label);
+        gtk_widget_class_bind_template_child_private(wklass,
+                                                     EogRemotePresenter,
+                                                     size_label);
+        gtk_widget_class_bind_template_child_private(wklass,
+                                                     EogRemotePresenter,
+                                                     type_label);
+        gtk_widget_class_bind_template_child_private(wklass,
+                                                     EogRemotePresenter,
+                                                     bytes_label);
+        gtk_widget_class_bind_template_child_private(wklass,
+                                                     EogRemotePresenter,
+                                                     folder_button);
+
+        gtk_widget_class_bind_template_callback(wklass,
+                                                rp_folder_button_clicked_cb);
+}
+
+static void
+eog_remote_presenter_init (EogRemotePresenter *remote_presenter)
+{
+        EogRemotePresenterPrivate *priv;
+
+        remote_presenter->priv = eog_remote_presenter_get_instance_private (remote_presenter);
+
+        priv = remote_presenter->priv;
+
+        gtk_widget_init_template (GTK_WIDGET (remote_presenter));
+
+
+        g_signal_connect (remote_presenter,
+                          "delete-event",
+                          G_CALLBACK (gtk_widget_hide_on_delete),
+                          remote_presenter);
+
+        priv->folder_button_uri = NULL;
+}
+
+/**
+ * eog_remote_presenter_new:
+ * @parent: the parent window
+ * @thumbview: 
+ * @next_image_action: 
+ * @previous_image_action: 
+ *
+ * If %parent implements #GActionMap its actions will be automatically
+ * inserted in the "win" namespace.
+ *
+ * Returns: (transfer full) (type EogRemotePresenter): a new #EogRemotePresenter
+ **/
+GtkWidget *
+eog_remote_presenter_new (GtkWindow    *parent,
+                          EogThumbView *thumbview,
+                          const gchar  *next_image_action,
+                          const gchar  *previous_image_action)
+{
+        GObject *remote_presenter;
+
+        g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
+        g_return_val_if_fail (EOG_IS_THUMB_VIEW (thumbview), NULL);
+
+        remote_presenter = g_object_new (EOG_TYPE_REMOTE_PRESENTER,
+                                         "thumbview", thumbview,
+                                         "next-action", next_image_action,
+                                         "prev-action", previous_image_action,
+                                         NULL);
+
+        gtk_window_set_transient_for (GTK_WINDOW (remote_presenter), parent);
+
+        if (G_LIKELY (G_IS_ACTION_GROUP (parent))) {
+                gtk_widget_insert_action_group (GTK_WIDGET (remote_presenter),
+                                                "win",
+                                                G_ACTION_GROUP (parent));
+        }
+
+        return GTK_WIDGET (remote_presenter);
+}
+
+void
+eog_remote_presenter_update (EogRemotePresenter *remote_presenter,
+                             EogImage           *image)
+{
+        gchar *bytes_str;
+        gchar *size_str;
+        GFile *file, *parent_file;
+        GFileInfo *file_info;
+        const char *mime_str;
+        char *type_str;
+        gint width, height;
+        goffset bytes;
+
+        g_return_if_fail (EOG_IS_REMOTE_PRESENTER (remote_presenter));
+
+        g_object_set (G_OBJECT (remote_presenter->priv->thumbnail_image),
+                      "pixbuf", eog_image_get_thumbnail (image),
+                      NULL);
+
+        gtk_label_set_text (GTK_LABEL (remote_presenter->priv->name_label),
+                            eog_image_get_caption (image));
+
+        eog_image_get_size (image, &width, &height);
+
+        size_str = g_strdup_printf ("%d × %d %s", width, height,
+                                    ngettext ("pixel", "pixels", width * height));
+
+        gtk_label_set_text (GTK_LABEL (remote_presenter->priv->size_label), size_str);
+
+        g_free (size_str);
+
+        file = eog_image_get_file (image);
+        file_info = g_file_query_info (file,
+                                       G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+                                       0, NULL, NULL);
+        if (file_info == NULL) {
+                type_str = g_strdup (_("Unknown"));
+        } else {
+                mime_str = g_file_info_get_content_type (file_info);
+                type_str = g_content_type_get_description (mime_str);
+                g_object_unref (file_info);
+        }
+
+        gtk_label_set_text (GTK_LABEL (remote_presenter->priv->type_label), type_str);
+
+        bytes = eog_image_get_bytes (image);
+        bytes_str = g_format_size (bytes);
+
+        gtk_label_set_text (GTK_LABEL (remote_presenter->priv->bytes_label), bytes_str);
+
+        parent_file = g_file_get_parent (file);
+        if (parent_file == NULL) {
+                /* file is root directory itself */
+                parent_file = g_object_ref (file);
+        }
+
+        gtk_widget_set_sensitive (remote_presenter->priv->folder_button, FALSE);
+        gtk_button_set_label (GTK_BUTTON (remote_presenter->priv->folder_button), NULL);
+        g_free (remote_presenter->priv->folder_button_uri);
+        remote_presenter->priv->folder_button_uri = g_file_get_uri (parent_file);
+
+        g_file_query_info_async (parent_file,
+                                 G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+                                 G_FILE_QUERY_INFO_NONE,
+                                 G_PRIORITY_DEFAULT,
+                                 NULL,
+                                 parent_file_display_name_query_info_cb,
+                                 g_object_ref (remote_presenter));
+
+        g_object_unref (parent_file);
+        g_free (type_str);
+        g_free (bytes_str);
+}
diff --git a/src/eog-remote-presenter.h b/src/eog-remote-presenter.h
new file mode 100644
index 00000000..6c4e9c56
--- /dev/null
+++ b/src/eog-remote-presenter.h
@@ -0,0 +1,66 @@
+/* Eye Of Gnome - Image Properties Dialog
+ *
+ * Copyright (C) 2006 The Free Software Foundation
+ *
+ * Author: Lucas Rocha <lucasr gnome org>
+ *
+ * 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 of the License, 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef __EOG_REMOTE_PRESENTER_H__
+#define __EOG_REMOTE_PRESENTER_H__
+
+#include "eog-image.h"
+#include "eog-thumb-view.h"
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+typedef struct _EogRemotePresenter EogRemotePresenter;
+typedef struct _EogRemotePresenterClass EogRemotePresenterClass;
+typedef struct _EogRemotePresenterPrivate EogRemotePresenterPrivate;
+
+#define EOG_TYPE_REMOTE_PRESENTER            (eog_remote_presenter_get_type ())
+#define EOG_REMOTE_PRESENTER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), EOG_TYPE_REMOTE_PRESENTER, 
EogRemotePresenter))
+#define EOG_REMOTE_PRESENTER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  EOG_TYPE_REMOTE_PRESENTER, 
EogRemotePresenterClass))
+#define EOG_IS_REMOTE_PRESENTER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOG_TYPE_REMOTE_PRESENTER))
+#define EOG_IS_REMOTE_PRESENTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  EOG_TYPE_REMOTE_PRESENTER))
+#define EOG_REMOTE_PRESENTER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  EOG_TYPE_REMOTE_PRESENTER, 
EogRemotePresenterClass))
+        
+struct _EogRemotePresenter {
+        GtkWindow window;
+
+        EogRemotePresenterPrivate *priv;
+};
+
+struct _EogRemotePresenterClass {
+        GtkWindowClass parent_class;
+};
+
+GType      eog_remote_presenter_get_type       (void) G_GNUC_CONST;
+
+GtkWidget  *eog_remote_presenter_new           (GtkWindow               *parent,
+                                                 EogThumbView            *thumbview,
+                                                 const gchar             *next_image_action,
+                                                 const gchar             *previous_image_action);
+
+void       eog_remote_presenter_update         (EogRemotePresenter     *prop,
+                                                 EogImage                *image);
+G_END_DECLS
+
+#endif /* __EOG_REMOTE_PRESENTER_H__ */
diff --git a/src/eog.gresource.xml b/src/eog.gresource.xml
index 3a16da3a..7f4d578e 100644
--- a/src/eog.gresource.xml
+++ b/src/eog.gresource.xml
@@ -7,6 +7,7 @@
     <file compressed="true" preprocess="xml-stripblanks">eog-image-properties-dialog.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">eog-multiple-save-as-dialog.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">eog-preferences-dialog.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">eog-remote-presenter.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">fullscreen-toolbar.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">metadata-sidebar.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">eog-zoom-entry.ui</file>
diff --git a/src/meson.build b/src/meson.build
index cf05a433..cc0311c9 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -32,6 +32,7 @@ headers = enum_headers + files(
   'eog-jobs.h',
   'eog-list-store.h',
   'eog-properties-dialog.h',
+  'eog-remote-presenter.h',
   'eog-sidebar.h',
   'eog-statusbar.h',
   'eog-thumbnail.h',
@@ -68,6 +69,7 @@ sources = files(
   'eog-print-image-setup.c',
   'eog-print-preview.c',
   'eog-properties-dialog.c',
+  'eog-remote-presenter.c',
   'eog-save-as-dialog-helper.c',
   'eog-scroll-view.c',
   'eog-session.c',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]