[gedit/wip/reveal3] Use revealer for info bars



commit 162d6d80de3fecc197903439282fab5874cd8263
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sat Feb 9 13:27:30 2013 +0100

    Use revealer for info bars

 gedit/gedit-tab.c |   31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 deletions(-)
---
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 9438773..d482a59 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -32,6 +32,7 @@
 
 #include <glib/gi18n.h>
 #include <gio/gio.h>
+#include <libgd/gd.h>
 
 #include "gedit-app.h"
 #include "gedit-notebook.h"
@@ -525,27 +526,43 @@ document_modified_changed (GtkTextBuffer *document,
 }
 
 static void
+on_revealed_changed (GtkWidget  *revealer,
+                     GParamSpec *pspec,
+                     gpointer    useless)
+{
+	gtk_widget_destroy (revealer);
+}
+
+static void
 set_info_bar (GeditTab  *tab,
 	      GtkWidget *info_bar)
 {
+	GtkWidget *revealer;
+
 	if (tab->priv->info_bar == info_bar)
 		return;
 
 	if (tab->priv->info_bar != NULL)
-		gtk_widget_destroy (tab->priv->info_bar);
+	{
+		revealer = gtk_widget_get_parent (tab->priv->info_bar);
+		g_signal_connect (revealer, "notify::revealed",
+		                  G_CALLBACK(on_revealed_changed), NULL);
+		gd_revealer_set_revealed (GD_REVEALER (revealer), FALSE);
+	}
 
 	tab->priv->info_bar = info_bar;
 
 	if (info_bar == NULL)
 		return;
 
-	gtk_box_pack_start (GTK_BOX (tab),
-			    tab->priv->info_bar,
-			    FALSE,
-			    FALSE,
-			    0);		
+	revealer = gd_revealer_new ();
+	gtk_widget_show (revealer);
+	gtk_box_pack_start (GTK_BOX (tab), revealer, FALSE, FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (revealer), tab->priv->info_bar);
+
+	gd_revealer_set_revealed (GD_REVEALER (revealer), TRUE);
 
-	g_object_add_weak_pointer (G_OBJECT (tab->priv->info_bar), 
+	g_object_add_weak_pointer (G_OBJECT (tab->priv->info_bar),
 				   (gpointer *)&tab->priv->info_bar);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]