[gnome-documents] Add places button to the nav bar
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] Add places button to the nav bar
- Date: Tue, 8 Jan 2013 23:17:39 +0000 (UTC)
commit 7e52bad81e5b0ca765b366cc64c2d80e78c061c9
Author: William Jon McCann <jmccann redhat com>
Date: Sun Jan 6 13:57:31 2013 -0500
Add places button to the nav bar
https://bugzilla.gnome.org/show_bug.cgi?id=691215
src/lib/gd-nav-bar.c | 23 +++++++++++++++++++++++
src/lib/gd-nav-bar.h | 1 +
src/preview.js | 9 +++++++++
3 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/lib/gd-nav-bar.c b/src/lib/gd-nav-bar.c
index f740a5a..a071164 100644
--- a/src/lib/gd-nav-bar.c
+++ b/src/lib/gd-nav-bar.c
@@ -58,6 +58,7 @@ typedef struct {
} PreviewItem;
struct _GdNavBarPrivate {
+ GtkWidget *button_area;
GtkWidget *scale;
GtkWidget *page_label;
GtkWidget *preview_window;
@@ -878,6 +879,22 @@ create_preview_window (GdNavBar *self)
gtk_widget_show_all (box);
}
+/**
+ * gd_nav_bar_get_button_area:
+ * @bar: a #GdNavBar
+ *
+ * Returns the button area of @bar.
+ *
+ * Returns: (transfer none): the button area #GtkBox.
+ **/
+GtkWidget *
+gd_nav_bar_get_button_area (GdNavBar *bar)
+{
+ g_return_val_if_fail (GD_IS_NAV_BAR (bar), NULL);
+
+ return bar->priv->button_area;
+}
+
static void
gd_nav_bar_init (GdNavBar *self)
{
@@ -900,6 +917,12 @@ gd_nav_bar_init (GdNavBar *self)
gtk_widget_set_hexpand (GTK_WIDGET (inner_box), TRUE);
gtk_container_add (GTK_CONTAINER (self), inner_box);
+ priv->button_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
+ gtk_widget_set_margin_left (priv->button_area, 5);
+ gtk_widget_set_margin_right (priv->button_area, 5);
+ gtk_widget_show (priv->button_area);
+ gtk_box_pack_start (GTK_BOX (inner_box), priv->button_area, FALSE, FALSE, 0);
+
priv->scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, NULL);
gtk_scale_set_draw_value (GTK_SCALE (priv->scale), FALSE);
gtk_scale_set_has_origin (GTK_SCALE (priv->scale), TRUE);
diff --git a/src/lib/gd-nav-bar.h b/src/lib/gd-nav-bar.h
index 94b0ef8..e60a902 100644
--- a/src/lib/gd-nav-bar.h
+++ b/src/lib/gd-nav-bar.h
@@ -52,6 +52,7 @@ struct _GdNavBarClass {
GType gd_nav_bar_get_type (void) G_GNUC_CONST;
GtkWidget *gd_nav_bar_new (EvDocumentModel *model);
+GtkWidget *gd_nav_bar_get_button_area (GdNavBar *bar);
G_END_DECLS
diff --git a/src/preview.js b/src/preview.js
index a3f92b1..a801ad1 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -346,6 +346,15 @@ const PreviewNav = new Lang.Class({
_init: function(model) {
this.widget = new GdPrivate.NavBar({ document_model: model });
this.widget.get_style_context().add_class('osd');
+
+ let button = new Gtk.Button({ action_name: 'app.places',
+ child: new Gtk.Image({ icon_name: 'view-list-symbolic',
+ pixel_size: 16 }),
+ valign: Gtk.Align.CENTER
+ });
+ let button_area = this.widget.get_button_area();
+ button_area.pack_start(button, false, false, 0);
+
this.actor = new GtkClutter.Actor({ contents: this.widget,
visible: false,
opacity: 0 });
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]