[gthumb] video screenshot: show a message in the statusbar after saving
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] video screenshot: show a message in the statusbar after saving
- Date: Tue, 23 Dec 2014 11:33:06 +0000 (UTC)
commit a3e7b5aac1345dfb5eb2916c09f63165257690a5
Author: Paolo Bacchilega <paobac src gnome org>
Date: Thu Dec 11 21:30:00 2014 +0100
video screenshot: show a message in the statusbar after saving
extensions/gstreamer_tools/actions.c | 9 +++++
gthumb/gth-statusbar.c | 56 ++++++++++++++++++++++++++++++++-
gthumb/gth-statusbar.h | 2 +
3 files changed, 65 insertions(+), 2 deletions(-)
---
diff --git a/extensions/gstreamer_tools/actions.c b/extensions/gstreamer_tools/actions.c
index 4280f58..30a3226 100644
--- a/extensions/gstreamer_tools/actions.c
+++ b/extensions/gstreamer_tools/actions.c
@@ -62,12 +62,21 @@ save_screenshot_task_completed_cb (GthTask *task,
{
SaveData *save_data = user_data;
GthMediaViewerPage *page = save_data->page;
+ char *filename;
+ char *text;
if (error != NULL)
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (save_data->browser), _("Could not save the
file"), error);
else if (save_data->playing_before_screenshot)
gst_element_set_state (gth_media_viewer_page_get_playbin (page), GST_STATE_PLAYING);
+ filename = g_file_get_parse_name (save_data->file_data->file);
+ /* Translators: %s is a filename */
+ text = g_strdup_printf (_("Image saved as %s"), filename);
+ gth_statusbar_set_secondary_text_temp (GTH_STATUSBAR (gth_browser_get_statusbar
(save_data->browser)), text);
+
+ g_free (text);
+ g_free (filename);
save_date_free (save_data);
g_object_unref (task);
}
diff --git a/gthumb/gth-statusbar.c b/gthumb/gth-statusbar.c
index cb5db84..85d1fca 100644
--- a/gthumb/gth-statusbar.c
+++ b/gthumb/gth-statusbar.c
@@ -24,11 +24,15 @@
#include "gth-statusbar.h"
+#define HIDE_TEXT_DELAY 5
+
+
struct _GthStatusbarPrivate {
GtkWidget *list_info;
GtkWidget *primary_text;
GtkWidget *secondary_text;
GtkWidget *action_area;
+ guint hide_secondary_text_id;
};
@@ -36,9 +40,31 @@ G_DEFINE_TYPE (GthStatusbar, gth_statusbar, GTK_TYPE_BOX)
static void
+gth_statusbar_finalize (GObject *object)
+{
+ GthStatusbar *self;
+
+ self = GTH_STATUSBAR (object);
+
+ if (self->priv->hide_secondary_text_id != 0) {
+ g_source_remove (self->priv->hide_secondary_text_id);
+ self->priv->hide_secondary_text_id = 0;
+ }
+
+ G_OBJECT_CLASS (gth_statusbar_parent_class)->finalize (object);
+}
+
+
+static void
gth_statusbar_class_init (GthStatusbarClass *klass)
{
+
+ GObjectClass *object_class;
+
g_type_class_add_private (klass, sizeof (GthStatusbarPrivate));
+
+ object_class = (GObjectClass*) klass;
+ object_class->finalize = gth_statusbar_finalize;
}
@@ -46,6 +72,7 @@ static void
gth_statusbar_init (GthStatusbar *statusbar)
{
statusbar->priv = G_TYPE_INSTANCE_GET_PRIVATE (statusbar, GTH_TYPE_STATUSBAR, GthStatusbarPrivate);
+ statusbar->priv->hide_secondary_text_id = 0;
gtk_box_set_spacing (GTK_BOX (statusbar), 6);
gtk_widget_set_margin_top (GTK_WIDGET (statusbar), 3);
@@ -105,10 +132,35 @@ gth_statusbar_set_primary_text (GthStatusbar *statusbar,
void
-gth_statusbar_set_secondary_text (GthStatusbar *statusbar,
+gth_statusbar_set_secondary_text (GthStatusbar *self,
const char *text)
{
- gtk_label_set_text (GTK_LABEL (statusbar->priv->secondary_text), text);
+ if (self->priv->hide_secondary_text_id != 0) {
+ g_source_remove (self->priv->hide_secondary_text_id);
+ self->priv->hide_secondary_text_id = 0;
+ }
+ gtk_label_set_text (GTK_LABEL (self->priv->secondary_text), text);
+}
+
+
+static gboolean
+hide_secondary_text_cb (gpointer user_data)
+{
+ GthStatusbar *self = user_data;
+
+ self->priv->hide_secondary_text_id = 0;
+ gtk_label_set_text (GTK_LABEL (self->priv->secondary_text), "");
+
+ return FALSE;
+}
+
+
+void
+gth_statusbar_set_secondary_text_temp (GthStatusbar *self,
+ const char *text)
+{
+ gth_statusbar_set_secondary_text (self, text);
+ self->priv->hide_secondary_text_id = g_timeout_add_seconds (HIDE_TEXT_DELAY, hide_secondary_text_cb,
self);
}
diff --git a/gthumb/gth-statusbar.h b/gthumb/gth-statusbar.h
index a69f84d..417b69b 100644
--- a/gthumb/gth-statusbar.h
+++ b/gthumb/gth-statusbar.h
@@ -59,6 +59,8 @@ void gth_statusbar_set_primary_text (GthStatusbar *statusbar,
const char *text);
void gth_statusbar_set_secondary_text (GthStatusbar *statusbar,
const char *text);
+void gth_statusbar_set_secondary_text_temp (GthStatusbar *statusbar,
+ const char *text);
void gth_statusbar_set_progress (GthStatusbar *statusbar,
const char *text,
gboolean pulse,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]