]> Pileus Git - ~andy/gtk/commitdiff
Avoid some unnecessary gtk_widget_get_style() calls.
authorMatthias Clasen <mclasen@redhat.com>
Sun, 28 Jan 2007 04:41:52 +0000 (04:41 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 28 Jan 2007 04:41:52 +0000 (04:41 +0000)
2007-01-27  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtknotebook.c (gtk_notebook_draw_arrow):
        (gtk_notebook_draw_focus): Avoid some unnecessary
        gtk_widget_get_style() calls.

svn path=/trunk/; revision=17229

ChangeLog
gtk/gtknotebook.c

index 088383000a09090feb426ec03be428fc320123c0..3240d7455ef59d314b671aa2badb360e5d946357 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-27  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtknotebook.c (gtk_notebook_draw_arrow):
+       (gtk_notebook_draw_focus): Avoid some unnecessary 
+       gtk_widget_get_style() calls.
+
 2007-01-27  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtktoolbar.c:
index 8b64b93f4c3cf42e2057eb2ca9bff1d51a6d2384..c1c95a4b191ea2c27a1ea08e5da30a4563214509 100644 (file)
@@ -1688,7 +1688,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
   gint scroll_arrow_vlength;
 
   gtk_widget_style_get (widget,
-                       "focus-line-width", &focus_width,
+                        "focus-line-width", &focus_width,
                        "tab-overlap", &tab_overlap,
                        "tab-curvature", &tab_curvature,
                         "arrow-spacing", &arrow_spacing,
@@ -2996,22 +2996,25 @@ gtk_notebook_draw_focus (GtkWidget      *widget,
       notebook->cur_page->tab_label->window == event->window)
     {
       GtkNotebookPage *page;
-      GdkRectangle area;
-      gint focus_width;
-
-      gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL);
 
       page = notebook->cur_page;
 
-      area.x = page->tab_label->allocation.x - focus_width;
-      area.y = page->tab_label->allocation.y - focus_width;
-      area.width = page->tab_label->allocation.width + 2 * focus_width;
-      area.height = page->tab_label->allocation.height + 2 * focus_width;
-
       if (gtk_widget_intersect (page->tab_label, &event->area, NULL))
-       gtk_paint_focus (widget->style, event->window, GTK_WIDGET_STATE (widget),
-                        NULL, widget, "tab",
-                        area.x, area.y, area.width, area.height);
+        {
+          GdkRectangle area;
+          gint focus_width;
+
+          gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL);
+
+          area.x = page->tab_label->allocation.x - focus_width;
+          area.y = page->tab_label->allocation.y - focus_width;
+          area.width = page->tab_label->allocation.width + 2 * focus_width;
+          area.height = page->tab_label->allocation.height + 2 * focus_width;
+
+         gtk_paint_focus (widget->style, event->window, 
+                           GTK_WIDGET_STATE (widget), NULL, widget, "tab",
+                          area.x, area.y, area.width, area.height);
+        }
     }
 }
 
@@ -4626,20 +4629,20 @@ gtk_notebook_draw_arrow (GtkNotebook      *notebook,
   GtkArrowType arrow;
   gboolean is_rtl, left;
 
-  gtk_notebook_get_arrow_rect (notebook, &arrow_rect, nbarrow);
-
-  widget = GTK_WIDGET (notebook);
-
-  is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
-  left = (ARROW_IS_LEFT (nbarrow) && !is_rtl) ||
-         (!ARROW_IS_LEFT (nbarrow) && is_rtl); 
-
   if (GTK_WIDGET_DRAWABLE (notebook))
     {
       gint scroll_arrow_hlength;
       gint scroll_arrow_vlength;
       gint arrow_size;
 
+      gtk_notebook_get_arrow_rect (notebook, &arrow_rect, nbarrow);
+
+      widget = GTK_WIDGET (notebook);
+
+      is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
+      left = (ARROW_IS_LEFT (nbarrow) && !is_rtl) ||
+             (!ARROW_IS_LEFT (nbarrow) && is_rtl); 
+
       gtk_widget_style_get (widget,
                             "scroll-arrow-hlength", &scroll_arrow_hlength,
                             "scroll-arrow-vlength", &scroll_arrow_vlength,