[geany/geany] d01974: Properly register the statusbar context ID

Colomban Wendling git-noreply at geany.org
Sun Dec 2 17:03:14 UTC 2012


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sun, 02 Dec 2012 17:03:14 UTC
Commit:      d01974151248c268fd89d593a7965c35ae10f104
             https://github.com/geany/geany/commit/d01974151248c268fd89d593a7965c35ae10f104

Log Message:
-----------
Properly register the statusbar context ID

Getting the statusbar context ID using the context registration API
allows for other (namely, plugins) to register their own context
without a risk of overriding Geany's one.


Modified Paths:
--------------
    src/ui_utils.c

Modified: src/ui_utils.c
12 files changed, 8 insertions(+), 4 deletions(-)
===================================================================
@@ -122,6 +122,7 @@ void ui_widget_set_sensitive(GtkWidget *widget, gboolean set)
  * that didn't use allow_override and has not timed out. */
 static void set_statusbar(const gchar *text, gboolean allow_override)
 {
+	static guint id = 0;
 	static glong last_time = 0;
 	GTimeVal timeval;
 	const gint GEANY_STATUS_TIMEOUT = 1;
@@ -129,19 +130,22 @@ static void set_statusbar(const gchar *text, gboolean allow_override)
 	if (! interface_prefs.statusbar_visible)
 		return; /* just do nothing if statusbar is not visible */
 
+	if (id == 0)
+		id = gtk_statusbar_get_context_id(GTK_STATUSBAR(ui_widgets.statusbar), "geany-main");
+
 	g_get_current_time(&timeval);
 
 	if (! allow_override)
 	{
-		gtk_statusbar_pop(GTK_STATUSBAR(ui_widgets.statusbar), 1);
-		gtk_statusbar_push(GTK_STATUSBAR(ui_widgets.statusbar), 1, text);
+		gtk_statusbar_pop(GTK_STATUSBAR(ui_widgets.statusbar), id);
+		gtk_statusbar_push(GTK_STATUSBAR(ui_widgets.statusbar), id, text);
 		last_time = timeval.tv_sec;
 	}
 	else
 	if (timeval.tv_sec > last_time + GEANY_STATUS_TIMEOUT)
 	{
-		gtk_statusbar_pop(GTK_STATUSBAR(ui_widgets.statusbar), 1);
-		gtk_statusbar_push(GTK_STATUSBAR(ui_widgets.statusbar), 1, text);
+		gtk_statusbar_pop(GTK_STATUSBAR(ui_widgets.statusbar), id);
+		gtk_statusbar_push(GTK_STATUSBAR(ui_widgets.statusbar), id, text);
 	}
 }
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).


More information about the Commits mailing list