Permalink
Browse files

library: improving the look & feel of the breadcrumb bar

  • Loading branch information...
1 parent 9ac1115 commit c565d403c0cebfddf3a93a59698f594bad398acc @rhdunn committed Apr 24, 2012
Showing with 52 additions and 37 deletions.
  1. +4 −1 data/themes/Adwaita/gtk3.css
  2. +10 −6 data/themes/Ambiance/gtk3.css
  3. +10 −1 data/themes/Radiance/gtk3.css
  4. +19 −5 data/themes/gtk3-common.css
  5. +9 −24 src/library.cpp
@@ -23,7 +23,10 @@ GtkNotebook {
}
#breadcrumb-bar {
- background-color: white;
+ background-color: #f4f4f4;
+ border-style: solid;
+ border-color: @borders;
+ border-width: 0 0 1 0;
}
/* The toc pane is coloured white by default, with the notebook
@@ -18,11 +18,6 @@ GtkToolbar {
padding-right: 5;
}
-#breadcrumb-bar GtkButton {
- -unico-inner-stroke-width: 0;
- -unico-outer-stroke-width: 0;
-}
-
/* The toc pane is coloured white by default, with the notebook
* background grey, so make these both white ...
*/
@@ -68,7 +63,16 @@ GtkNotebook, #toc, GtkScrolledWindow * {
* button, with rounded corners at the ends.
*/
-.linked .button {
+#breadcrumb-bar {
+ background-color: #f4f4f4;
+ border-style: solid;
+ border-color: @borders;
+ border-width: 0 0 1 0;
+ padding: 0;
+}
+
+.linked .button,
+.breadcrumbs .button {
-unico-inner-stroke-width: 0;
-unico-outer-stroke-width: 0;
border-right-width: 1;
@@ -57,7 +57,16 @@ GtkNotebook, #toc, GtkScrolledWindow * {
* button, with rounded corners at the ends.
*/
-.linked .button {
+#breadcrumb-bar {
+ background-color: #f4f4f4;
+ border-style: solid;
+ border-color: @borders;
+ border-width: 0 0 1 0;
+ padding: 0;
+}
+
+.linked .button,
+.breadcrumbs .button {
-unico-inner-stroke-width: 0;
-unico-outer-stroke-width: 0;
border-right-width: 1;
@@ -1,12 +1,26 @@
#breadcrumb-bar {
- border-style: solid;
- border-width: 0 0 1 0;
+ padding: 0;
+}
+
+.breadcrumbs .button {
+ padding-left: 12;
+ padding-right: 12;
+}
+
+.breadcrumbs .button {
+ border-image: none;
border-color: @borders;
- padding: 2;
+ border-width: 0 1 1 0;
+ border-radius: 0;
+}
+
+.breadcrumbs .button:first-child {
+}
+
+.breadcrumbs .button:last-child {
}
-#breadcrumb-bar .button {
- background-image: none;
+.breadcrumbs .button:only-child {
}
/* Give the notebook a border at the top and bottom ...
View
@@ -40,23 +40,6 @@ static gint sort_recent_items_mru(GtkRecentInfo *a, GtkRecentInfo *b, gpointer u
return gtk_recent_info_get_modified(b) - gtk_recent_info_get_modified(a);
}
-static GtkWidget *create_nav_item(const char *name, bool is_button)
-{
- GtkWidget *item;
- if (is_button)
- {
- item = gtk_button_new_with_label(name);
- }
- else
- {
- item = gtk_label_new(name);
- }
-
- GtkToolItem *toolitem = gtk_tool_item_new();
- gtk_container_add(GTK_CONTAINER(toolitem), item);
- return GTK_WIDGET(toolitem);
-}
-
static void add_document(GtkTreeStore *store, rdf::graph &metadata, rdf::uri subject, int pos)
{
rql::results data = rql::select(metadata, rql::matches(rql::subject, subject));
@@ -95,16 +78,18 @@ DocumentLibrary::DocumentLibrary(cainteoir::languages &aLanguages, GtkRecentMana
GtkWidget *scrolled_view = gtk_scrolled_window_new(nullptr, nullptr);
gtk_container_add(GTK_CONTAINER(scrolled_view), GTK_WIDGET(view));
+ GtkWidget *breadcrumbs = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_style_context_add_class(gtk_widget_get_style_context(breadcrumbs), "breadcrumbs");
+
+ gtk_container_add(GTK_CONTAINER(breadcrumbs), gtk_button_new_with_label(i18n("All")));
+ gtk_container_add(GTK_CONTAINER(breadcrumbs), gtk_button_new_with_label(i18n("Recent")));
+
GtkWidget *topbar = gtk_toolbar_new();
gtk_widget_set_name(topbar, "breadcrumb-bar");
- gtk_container_add(GTK_CONTAINER(topbar), create_nav_item(i18n("All"), true));
- gtk_container_add(GTK_CONTAINER(topbar), create_nav_item("\xE2\x9D\xAD", false));
- gtk_container_add(GTK_CONTAINER(topbar), create_nav_item(i18n("Recent"), true));
-
- GtkToolItem *expander = gtk_tool_item_new();
- gtk_tool_item_set_expand(GTK_TOOL_ITEM(expander), TRUE);
- gtk_container_add(GTK_CONTAINER(topbar), GTK_WIDGET(expander));
+ GtkToolItem *navbar_item = gtk_tool_item_new();
+ gtk_container_add(GTK_CONTAINER(navbar_item), breadcrumbs);
+ gtk_container_add(GTK_CONTAINER(topbar), GTK_WIDGET(navbar_item));
layout = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start(GTK_BOX(layout), topbar, FALSE, FALSE, 0);

0 comments on commit c565d40

Please sign in to comment.