[eog: 7/11] window: add action to show presenter
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog: 7/11] window: add action to show presenter
- Date: Sat, 12 Feb 2022 18:09:30 +0000 (UTC)
commit 90d3db6215cf83ebafccb8a9c16c660185d79ba2
Author: Peter Eisenmann <p3732 getgoogleoff me>
Date: Thu Aug 5 23:19:18 2021 +0200
window: add action to show presenter
src/eog-window.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/eog-window.h | 1 +
2 files changed, 54 insertions(+)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index 4668e14e..9d00a665 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -41,6 +41,7 @@
#include "eog-statusbar.h"
#include "eog-preferences-dialog.h"
#include "eog-properties-dialog.h"
+#include "eog-remote-presenter.h"
#include "eog-print.h"
#include "eog-error-message-area.h"
#include "eog-application.h"
@@ -137,6 +138,7 @@ struct _EogWindowPrivate {
GtkWidget *statusbar;
GtkWidget *nav;
GtkWidget *message_area;
+ GtkWidget *remote_presenter;
GtkWidget *properties_dlg;
GtkBuilder *gear_menu_builder;
@@ -617,6 +619,7 @@ _eog_window_enable_window_actions (EogWindow *window, gboolean enable)
"preferences",
"manual",
"about",
+ "show-remote",
"view-gallery",
"view-sidebar",
"view-statusbar",
@@ -884,6 +887,11 @@ image_thumb_changed_cb (EogImage *image, gpointer data)
image);
}
+ if (window->priv->remote_presenter != NULL) {
+ eog_remote_presenter_update (EOG_REMOTE_PRESENTER (priv->remote_presenter),
+ image);
+ }
+
g_object_unref (thumb);
} else if (!gtk_widget_get_visible (window->priv->nav)) {
gint img_pos = eog_list_store_get_pos_by_image (window->priv->store, image);
@@ -3064,6 +3072,38 @@ eog_window_get_properties_dialog (EogWindow *window)
return priv->properties_dlg;
}
+
+/**
+ * eog_window_get_remote_presenter:
+ * @window: a #EogWindow
+ *
+ * Gets the remote presenter dialog. The widget will be built on the first call to this function.
+ *
+ * Returns: (transfer none): a #GtkWidget.
+ */
+GtkWidget*
+eog_window_get_remote_presenter (EogWindow *window)
+{
+ EogWindowPrivate *priv;
+
+ g_return_val_if_fail (EOG_IS_WINDOW (window), NULL);
+
+ priv = window->priv;
+
+ if (priv->remote_presenter == NULL) {
+ priv->remote_presenter =
+ eog_remote_presenter_new (GTK_WINDOW (window),
+ EOG_THUMB_VIEW (priv->thumbview),
+ "win.go-next",
+ "win.go-previous");
+
+ eog_remote_presenter_update (EOG_REMOTE_PRESENTER (priv->remote_presenter),
+ priv->image);
+ }
+
+ return priv->remote_presenter;
+}
+
static void
eog_window_action_properties (GSimpleAction *action,
GVariant *variant,
@@ -3076,6 +3116,18 @@ eog_window_action_properties (GSimpleAction *action,
gtk_widget_show (dialog);
}
+static void
+eog_window_action_show_remote (GSimpleAction *action,
+ GVariant *variant,
+ gpointer user_data)
+{
+ EogWindow *window = EOG_WINDOW (user_data);
+ GtkWidget *remote_presenter;
+
+ remote_presenter = eog_window_get_remote_presenter (window);
+ gtk_widget_show (remote_presenter);
+}
+
static void
eog_window_action_undo (GSimpleAction *action,
GVariant *variant,
@@ -3975,6 +4027,7 @@ static const GActionEntry window_actions[] = {
{ "close-all", eog_window_action_close_all_windows },
{ "print", eog_window_action_print },
{ "properties", eog_window_action_properties },
+ { "show-remote", eog_window_action_show_remote },
{ "set-wallpaper", eog_window_action_wallpaper },
{ "preferences", eog_window_action_preferences },
{ "manual", eog_window_action_help },
diff --git a/src/eog-window.h b/src/eog-window.h
index ede18152..61b8b520 100644
--- a/src/eog-window.h
+++ b/src/eog-window.h
@@ -129,6 +129,7 @@ gboolean eog_window_is_empty (EogWindow *window);
gboolean eog_window_is_not_initializing (const EogWindow *window);
void eog_window_reload_image (EogWindow *window);
+GtkWidget *eog_window_get_remote_presenter (EogWindow *window);
GtkWidget *eog_window_get_properties_dialog (EogWindow *window);
void eog_window_show_about_dialog (EogWindow *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]