[anjuta] sourceview: use GdRevealer for sliding in the message area
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] sourceview: use GdRevealer for sliding in the message area
- Date: Mon, 10 Jun 2013 19:52:21 +0000 (UTC)
commit 8455ceb29e9504383242cc78ed3f6a3904bd2a3a
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date: Tue Feb 19 21:42:48 2013 +0100
sourceview: use GdRevealer for sliding in the message area
https://bugzilla.gnome.org/show_bug.cgi?id=694212
plugins/sourceview/Makefile.am | 4 ++-
plugins/sourceview/sourceview-private.h | 1 +
plugins/sourceview/sourceview.c | 49 +++++++++++++++++++++---------
3 files changed, 38 insertions(+), 16 deletions(-)
---
diff --git a/plugins/sourceview/Makefile.am b/plugins/sourceview/Makefile.am
index 247595d..69bf443 100644
--- a/plugins/sourceview/Makefile.am
+++ b/plugins/sourceview/Makefile.am
@@ -30,6 +30,7 @@ AM_CPPFLAGS = \
$(GIO_CFLAGS) \
$(SOURCEVIEW_CFLAGS) \
$(LIBANJUTA_CFLAGS) \
+ -I$(top_srcdir)/libgd \
-DG_LOG_DOMAIN=\"sourceview\"
# Where to install the plugin
@@ -79,7 +80,8 @@ libanjuta_sourceview_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
libanjuta_sourceview_la_LIBADD = \
$(GIO_LIBS) \
$(SOURCEVIEW_LIBS) \
- $(LIBANJUTA_LIBS)
+ $(LIBANJUTA_LIBS) \
+ $(top_builddir)/libgd/libgd.la
gsettings_in_file = org.gnome.anjuta.plugins.sourceview.gschema.xml.in
gsettings_SCHEMAS = $(gsettings_in_file:.xml.in=.xml)
diff --git a/plugins/sourceview/sourceview-private.h b/plugins/sourceview/sourceview-private.h
index a5d1969..ff7482d 100644
--- a/plugins/sourceview/sourceview-private.h
+++ b/plugins/sourceview/sourceview-private.h
@@ -24,6 +24,7 @@
#include "sourceview-io.h"
#include <libanjuta/anjuta-plugin.h>
+#include <libgd/gd-revealer.h>
#include <glib.h>
struct SourceviewPrivate {
diff --git a/plugins/sourceview/sourceview.c b/plugins/sourceview/sourceview.c
index 9fd7d4f..9759583 100644
--- a/plugins/sourceview/sourceview.c
+++ b/plugins/sourceview/sourceview.c
@@ -265,28 +265,47 @@ goto_line (Sourceview* sv, gint line)
static void
on_destroy_message_area (Sourceview* sv, GObject *finalized_object)
{
- sv->priv->message_area = NULL;
+ if ((void*)finalized_object == (void*)sv->priv->message_area)
+ sv->priv->message_area = NULL;
+
g_signal_emit_by_name (G_OBJECT (sv), "update-save-ui");
}
static void
-sourceview_set_message_area (Sourceview* sv, GtkWidget *message_area)
+message_area_destroy (GtkWidget* message_area)
+{
+ GtkWidget* revealer;
+
+ revealer = gtk_widget_get_parent (message_area);
+ g_signal_connect (revealer, "notify::child-revealed",
+ G_CALLBACK(gtk_widget_destroy), NULL);
+ gd_revealer_set_reveal_child (GD_REVEALER (revealer), FALSE);
+}
+
+static void
+sourceview_set_message_area (Sourceview* sv, GtkWidget *message_area)
{
+ GtkWidget* revealer;
+
if (sv->priv->message_area != NULL)
- gtk_widget_destroy (sv->priv->message_area);
+ message_area_destroy (sv->priv->message_area);
+
sv->priv->message_area = message_area;
if (sv->priv->message_area == NULL)
return;
gtk_widget_show (message_area);
- gtk_box_pack_start (GTK_BOX (sv),
- message_area,
- FALSE,
- FALSE,
- 0);
- g_object_weak_ref (G_OBJECT (sv->priv->message_area),
- (GWeakNotify)on_destroy_message_area, sv);
+
+ revealer = gd_revealer_new ();
+ gtk_widget_show (revealer);
+ gtk_container_add (GTK_CONTAINER (revealer), message_area);
+ gtk_box_pack_start (GTK_BOX (sv), revealer, FALSE, FALSE, 0);
+
+ gd_revealer_set_reveal_child (GD_REVEALER (revealer), TRUE);
+
+ g_object_weak_ref (G_OBJECT (message_area),
+ (GWeakNotify)on_destroy_message_area, sv);
g_signal_emit_by_name (G_OBJECT (sv), "update-save-ui");
}
@@ -566,7 +585,7 @@ on_reload_dialog_response (GtkWidget *message_area, gint res, Sourceview *sv)
/* Set dirty */
gtk_text_buffer_set_modified(GTK_TEXT_BUFFER(sv->priv->document), TRUE);
}
- gtk_widget_destroy (message_area);
+ message_area_destroy (message_area);
}
static void
@@ -586,7 +605,7 @@ on_close_dialog_response (GtkWidget *message_area, gint res, Sourceview *sv)
/* Set dirty */
gtk_text_buffer_set_modified(GTK_TEXT_BUFFER(sv->priv->document), TRUE);
}
- gtk_widget_destroy (message_area);
+ message_area_destroy (message_area);
}
static gboolean
@@ -674,7 +693,7 @@ on_open_failed (SourceviewIO* io, GError* err, Sourceview* sv)
gtk_info_bar_add_button (GTK_INFO_BAR (message_area),
GTK_STOCK_OK,
GTK_RESPONSE_OK);
- g_signal_connect (message_area, "response", G_CALLBACK(gtk_widget_destroy), NULL);
+ g_signal_connect (message_area, "response", G_CALLBACK(message_area_destroy), NULL);
sourceview_set_message_area (sv, message_area);
}
@@ -701,7 +720,7 @@ on_read_only_dialog_response (GtkWidget *message_area, gint res, Sourceview *sv)
TRUE);
sv->priv->read_only = FALSE;
}
- gtk_widget_destroy (message_area);
+ message_area_destroy (message_area);
}
/* Called when document is loaded completly */
@@ -784,7 +803,7 @@ static void on_save_failed (SourceviewIO* sio, GError* err, Sourceview* sv)
gtk_info_bar_add_button (GTK_INFO_BAR (message_area),
GTK_STOCK_OK,
GTK_RESPONSE_OK);
- g_signal_connect (message_area, "response", G_CALLBACK(gtk_widget_destroy), NULL);
+ g_signal_connect (message_area, "response", G_CALLBACK(message_area_destroy), NULL);
sourceview_set_message_area (sv, message_area);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]