From 24b4e9956b381fe0f9447a6c35ae72ca3e0caabc Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sun, 7 Oct 2012 23:59:34 +0200
Subject: Add a usage hint to the main window.
---
src/ld-window-main.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
(limited to 'src')
diff --git a/src/ld-window-main.c b/src/ld-window-main.c
index 634c121..0be7700 100644
--- a/src/ld-window-main.c
+++ b/src/ld-window-main.c
@@ -42,6 +42,9 @@ struct _LdWindowMainPrivate
GtkWidget *statusbar;
guint statusbar_symbol_context_id;
guint statusbar_menu_context_id;
+ guint statusbar_hint_context_id;
+
+ guint statusbar_hint_drag;
};
@@ -276,6 +279,8 @@ ld_window_main_init (LdWindowMain *self)
(GTK_STATUSBAR (priv->statusbar), "menu");
priv->statusbar_symbol_context_id = gtk_statusbar_get_context_id
(GTK_STATUSBAR (priv->statusbar), "symbol");
+ priv->statusbar_hint_context_id = gtk_statusbar_get_context_id
+ (GTK_STATUSBAR (priv->statusbar), "hint");
priv->lv_viewport = gtk_viewport_new (NULL, NULL);
gtk_viewport_set_shadow_type
@@ -338,6 +343,10 @@ ld_window_main_init (LdWindowMain *self)
diagram_set_filename (self, NULL);
+ priv->statusbar_hint_drag = gtk_statusbar_push
+ (GTK_STATUSBAR (priv->statusbar), priv->statusbar_hint_context_id,
+ _("Drag symbols from the library pane to add them to the diagram."));
+
action_set_sensitive (self, "Undo", FALSE);
action_set_sensitive (self, "Redo", FALSE);
action_set_sensitive (self, "Delete", FALSE);
@@ -498,6 +507,14 @@ static void
on_diagram_changed (LdDiagram *diagram, LdWindowMain *self)
{
update_title (self);
+
+ if (self->priv->statusbar_hint_drag)
+ {
+ gtk_statusbar_remove (GTK_STATUSBAR (self->priv->statusbar),
+ self->priv->statusbar_hint_context_id,
+ self->priv->statusbar_hint_drag);
+ self->priv->statusbar_hint_drag = 0;
+ }
}
static void
--
cgit v1.2.3-70-g09d2