[evince] Simplify UI code



commit 8b4fc1d0e7016492f5ba9e5d6cb8e412b30af2e5
Author: Trinh Anh Ngoc <atw1990 gmail com>
Date:   Fri Apr 10 22:05:53 2015 +0700

    Simplify UI code
    
    Simplify the code added in bug #739836. Use border-width instead of
    margins in the sidebar, and remove all shadow in from GtkScrolledWindows
    instead of using custom CSS for that. These changes don't affect the UI.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747631

 shell/ev-find-sidebar.c        |    2 --
 shell/ev-sidebar-annotations.c |    4 ----
 shell/ev-sidebar-attachments.c |    2 --
 shell/ev-sidebar-bookmarks.c   |    2 --
 shell/ev-sidebar-layers.c      |    2 --
 shell/ev-sidebar-links.c       |    3 ---
 shell/ev-sidebar-thumbnails.c  |    2 --
 shell/ev-sidebar.c             |   11 +++++++----
 shell/evince.css               |   16 ----------------
 9 files changed, 7 insertions(+), 37 deletions(-)
---
diff --git a/shell/ev-find-sidebar.c b/shell/ev-find-sidebar.c
index 4152ad1..b700e06 100644
--- a/shell/ev-find-sidebar.c
+++ b/shell/ev-find-sidebar.c
@@ -195,8 +195,6 @@ ev_find_sidebar_init (EvFindSidebar *sidebar)
         swindow = gtk_scrolled_window_new (NULL, NULL);
         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
                                         GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-        gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
-                                             GTK_SHADOW_IN);
 
         priv->tree_view = gtk_tree_view_new ();
         ev_find_sidebar_reset_model (sidebar);
diff --git a/shell/ev-sidebar-annotations.c b/shell/ev-sidebar-annotations.c
index afbe6f9..993d485 100644
--- a/shell/ev-sidebar-annotations.c
+++ b/shell/ev-sidebar-annotations.c
@@ -124,8 +124,6 @@ ev_sidebar_annotations_add_annots_list (EvSidebarAnnotations *ev_annots)
        GtkWidget         *label;
 
        swindow = gtk_scrolled_window_new (NULL, NULL);
-       gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
-                                            GTK_SHADOW_IN);
 
        /* Create tree view */
        loading_model = ev_sidebar_annotations_create_simple_model (_("Loading…"));
@@ -193,8 +191,6 @@ ev_sidebar_annotations_add_annots_palette (EvSidebarAnnotations *ev_annots)
        GtkWidget   *label;
 
        swindow = gtk_scrolled_window_new (NULL, NULL);
-       gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
-                                            GTK_SHADOW_IN);
 
        ev_annots->priv->palette = gtk_tool_palette_new ();
        gtk_widget_set_margin_top (ev_annots->priv->palette, 2);
diff --git a/shell/ev-sidebar-attachments.c b/shell/ev-sidebar-attachments.c
index 9a12cf6..04ca30e 100644
--- a/shell/ev-sidebar-attachments.c
+++ b/shell/ev-sidebar-attachments.c
@@ -541,8 +541,6 @@ ev_sidebar_attachments_init (EvSidebarAttachments *ev_attachbar)
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
                                        GTK_POLICY_NEVER,
                                        GTK_POLICY_AUTOMATIC);
-       gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
-                                            GTK_SHADOW_IN);
        /* Data Model */
        ev_attachbar->priv->model = gtk_list_store_new (N_COLS,
                                                        GDK_TYPE_PIXBUF, 
diff --git a/shell/ev-sidebar-bookmarks.c b/shell/ev-sidebar-bookmarks.c
index dbe330f..33863b1 100644
--- a/shell/ev-sidebar-bookmarks.c
+++ b/shell/ev-sidebar-bookmarks.c
@@ -411,8 +411,6 @@ ev_sidebar_bookmarks_init (EvSidebarBookmarks *sidebar_bookmarks)
         priv = sidebar_bookmarks->priv;
 
         swindow = gtk_scrolled_window_new (NULL, NULL);
-        gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
-                                             GTK_SHADOW_IN);
         gtk_box_pack_start (GTK_BOX (sidebar_bookmarks), swindow, TRUE, TRUE, 0);
         gtk_widget_show (swindow);
 
diff --git a/shell/ev-sidebar-layers.c b/shell/ev-sidebar-layers.c
index 7ee04f2..7ada78b 100644
--- a/shell/ev-sidebar-layers.c
+++ b/shell/ev-sidebar-layers.c
@@ -286,8 +286,6 @@ ev_sidebar_layers_init (EvSidebarLayers *ev_layers)
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
                                        GTK_POLICY_NEVER,
                                        GTK_POLICY_AUTOMATIC);
-       gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
-                                            GTK_SHADOW_IN);
        /* Data Model */
        model = ev_sidebar_layers_create_loading_model ();
 
diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c
index d6272d2..e687271 100644
--- a/shell/ev-sidebar-links.c
+++ b/shell/ev-sidebar-links.c
@@ -397,9 +397,6 @@ ev_sidebar_links_construct (EvSidebarLinks *ev_sidebar_links)
 
        swindow = gtk_scrolled_window_new (NULL, NULL);
 
-       gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
-                                            GTK_SHADOW_IN);
-
        /* Create tree view */
        loading_model = create_loading_model ();
        priv->tree_view = gtk_tree_view_new_with_model (loading_model);
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
index 49045f3..78b4b31 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -814,8 +814,6 @@ ev_sidebar_thumbnails_init (EvSidebarThumbnails *ev_sidebar_thumbnails)
 
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->swindow),
                                        GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-       gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->swindow),
-                                            GTK_SHADOW_IN);
        priv->vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->swindow));
        g_signal_connect_data (priv->vadjustment, "value-changed",
                               G_CALLBACK (adjustment_changed_cb),
diff --git a/shell/ev-sidebar.c b/shell/ev-sidebar.c
index 65489b0..3e14308 100644
--- a/shell/ev-sidebar.c
+++ b/shell/ev-sidebar.c
@@ -334,6 +334,7 @@ ev_sidebar_init (EvSidebar *ev_sidebar)
        GtkWidget *hbox;
        GtkWidget *close_button;
        GtkWidget *select_hbox;
+       GtkWidget *separator;
        GtkWidget *arrow;
 
        ev_sidebar->priv = EV_SIDEBAR_GET_PRIVATE (ev_sidebar);
@@ -348,14 +349,16 @@ ev_sidebar_init (EvSidebar *ev_sidebar)
 
        /* top option menu */
        hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
-       gtk_widget_set_margin_top (hbox, 2);
-       gtk_widget_set_margin_bottom (hbox, 2);
-       gtk_widget_set_margin_start (hbox, 2);
-       gtk_widget_set_margin_end (hbox, 2);
+       gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
        ev_sidebar->priv->hbox = hbox;
        gtk_box_pack_start (GTK_BOX (ev_sidebar), hbox, FALSE, FALSE, 0);
        gtk_widget_show (hbox);
 
+       /* separator */
+       separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+       gtk_box_pack_start (GTK_BOX (ev_sidebar), separator, FALSE, FALSE, 0);
+       gtk_widget_show (separator);
+
        ev_sidebar->priv->select_button = gtk_toggle_button_new ();
        gtk_button_set_relief (GTK_BUTTON (ev_sidebar->priv->select_button), GTK_RELIEF_NONE);
        g_signal_connect (ev_sidebar->priv->select_button, "button_press_event",
diff --git a/shell/evince.css b/shell/evince.css
index 731ebfe..8653dec 100644
--- a/shell/evince.css
+++ b/shell/evince.css
@@ -55,19 +55,3 @@ EvSidebarThumbnails.page-thumbnail.inverted {
 GtkIconView {
     gtk-key-bindings: MoveCursor;
 }
-
-EvSidebar GtkScrolledWindow {
-    border-width: 1px 0 0 0;
-}
-
-EvFindSidebar GtkScrolledWindow {
-    border-width: 1px 0 0 0;
-}
-
-EvSidebarAnnotations GtkScrolledWindow {
-    border: none;
-}
-
-EvSidebarBookmarks GtkScrolledWindow {
-    border-width: 1px 0;
-}


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