[gnome-documents] sidebar: consolidate some code
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] sidebar: consolidate some code
- Date: Thu, 25 Aug 2011 21:44:19 +0000 (UTC)
commit 504adabc6a0f66c68011de416a0414692a37d311
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Aug 25 13:34:34 2011 -0400
sidebar: consolidate some code
src/lib/gd-utils.c | 6 +++---
src/lib/gd-utils.h | 4 ++--
src/sidebar.js | 13 ++++++++-----
src/sources.js | 6 +++---
4 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/src/lib/gd-utils.c b/src/lib/gd-utils.c
index fa07fd7..f79da9d 100644
--- a/src/lib/gd-utils.c
+++ b/src/lib/gd-utils.c
@@ -80,12 +80,12 @@ gd_store_update_icon (GtkListStore *store,
}
/**
- * gd_create_sidebar_store:
+ * gd_create_sources_store:
*
* Returns: (transfer full):
*/
GtkListStore *
-gd_create_sidebar_store (void)
+gd_create_sources_store (void)
{
return gtk_list_store_new (3,
G_TYPE_STRING, // ID
@@ -94,7 +94,7 @@ gd_create_sidebar_store (void)
}
void
-gd_sidebar_store_set (GtkListStore *store,
+gd_sources_store_set (GtkListStore *store,
GtkTreeIter *iter,
const gchar *id,
const gchar *name,
diff --git a/src/lib/gd-utils.h b/src/lib/gd-utils.h
index 30afc4d..3214051 100644
--- a/src/lib/gd-utils.h
+++ b/src/lib/gd-utils.h
@@ -40,8 +40,8 @@ void gd_store_update_icon (GtkListStore *store,
GtkTreeIter *iter,
GdkPixbuf *icon);
-GtkListStore* gd_create_sidebar_store (void);
-void gd_sidebar_store_set (GtkListStore *store,
+GtkListStore* gd_create_sources_store (void);
+void gd_sources_store_set (GtkListStore *store,
GtkTreeIter *iter,
const gchar *id,
const gchar *name,
diff --git a/src/sidebar.js b/src/sidebar.js
index a7d1183..d379aeb 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -32,6 +32,9 @@ const Sources = imports.sources;
const _SIDEBAR_WIDTH_REQUEST = 240;
+const _SIDEBAR_SOURCES_PAGE = 0;
+const _SIDEBAR_MAIN_PAGE = 1;
+
function SidebarView() {
this._init();
};
@@ -80,22 +83,22 @@ Sidebar.prototype = {
this.widget.get_style_context().add_class(Gtk.STYLE_CLASS_SIDEBAR);
this._sourceView = new Sources.SourceView();
- this.widget.insert_page(this._sourceView.widget, null, 0);
+ this.widget.insert_page(this._sourceView.widget, null, _SIDEBAR_SOURCES_PAGE);
this._sidebarView = new SidebarView();
- this.widget.insert_page(this._sidebarView.widget, null, 1);
+ this.widget.insert_page(this._sidebarView.widget, null, _SIDEBAR_MAIN_PAGE);
this._sidebarView.connect('sources-button-clicked',
Lang.bind(this, this._onSourcesButtonClicked));
- this.widget.set_current_page(1);
+ this.widget.set_current_page(_SIDEBAR_MAIN_PAGE);
this.widget.show_all();
},
_onSourceFilterChanged: function(sourcePage, id, name) {
- this.widget.set_current_page(1);
+ this.widget.set_current_page(_SIDEBAR_MAIN_PAGE);
},
_onSourcesButtonClicked: function() {
- this.widget.set_current_page(0);
+ this.widget.set_current_page(_SIDEBAR_SOURCES_PAGE);
}
};
diff --git a/src/sources.js b/src/sources.js
index 552cccd..8609a9f 100644
--- a/src/sources.js
+++ b/src/sources.js
@@ -158,20 +158,20 @@ function SourceModel() {
SourceModel.prototype = {
_init: function() {
- this.model = Gd.create_sidebar_store();
+ this.model = Gd.create_sources_store();
this._sourceManager = Global.sourceManager;
this.model.clear();
let iter = this.model.append();
- Gd.sidebar_store_set(this.model, iter,
+ Gd.sources_store_set(this.model, iter,
'', _("Sources"), true);
let sources = this._sourceManager.sources;
sources.forEach(Lang.bind(this,
function(source) {
iter = this.model.append();
- Gd.sidebar_store_set(this.model, iter,
+ Gd.sources_store_set(this.model, iter,
source.id, source.name, false);
}));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]