Add a usage hint to the main window.

This commit is contained in:
Přemysl Eric Janouch 2012-10-07 23:59:34 +02:00
parent 66aca31467
commit 24b4e9956b

View File

@ -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