[gimp/gtk3-port: 210/457] Incomplete notebook and tab theming commit, to be improved



commit 0f4e57faea3a0836e756fd3e9843d718d651b90d
Author: Michael Natterer <mitch gimp org>
Date:   Wed Feb 1 20:32:22 2012 +0100

    Incomplete notebook and tab theming commit, to be improved

 app/widgets/gimpdockbook.c         |   61 +++++-------------------------------
 libgimpwidgets/gimpcolornotebook.c |   17 +---------
 themes/Small/gimp.css              |   10 +++++-
 themes/System/gimp.css             |   24 ++++++++++----
 4 files changed, 34 insertions(+), 78 deletions(-)
---
diff --git a/app/widgets/gimpdockbook.c b/app/widgets/gimpdockbook.c
index 0552076..7a45ab3 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -23,6 +23,7 @@
 #include <string.h>
 
 #include <gegl.h>
+#undef GTK_DISABLE_DEPRECATED
 #include <gtk/gtk.h>
 
 #include "libgimpwidgets/gimpwidgets.h"
@@ -54,7 +55,7 @@
 #include "gimp-log.h"
 #include "gimp-intl.h"
 
-#define DEFAULT_TAB_BORDER           0
+
 #define DEFAULT_TAB_ICON_SIZE        GTK_ICON_SIZE_BUTTON
 #define DND_WIDGET_ICON_SIZE         GTK_ICON_SIZE_BUTTON
 #define MENU_WIDGET_ICON_SIZE        GTK_ICON_SIZE_MENU
@@ -111,8 +112,7 @@ static void         gimp_dockbook_dispose                     (GObject        *o
 static void         gimp_dockbook_finalize                    (GObject        *object);
 static void         gimp_dockbook_size_allocate               (GtkWidget      *widget,
                                                                GtkAllocation  *allocation);
-static void         gimp_dockbook_style_set                   (GtkWidget      *widget,
-                                                               GtkStyle       *prev_style);
+static void         gimp_dockbook_style_updated               (GtkWidget      *widget);
 static void         gimp_dockbook_drag_leave                  (GtkWidget      *widget,
                                                                GdkDragContext *context,
                                                                guint           time);
@@ -170,7 +170,6 @@ static GtkWidget *  gimp_dockable_create_event_box_tab_widget (GimpDockable   *d
                                                                GimpTabStyle    tab_style,
                                                                GtkIconSize     size);
 static GtkIconSize  gimp_dockbook_get_tab_icon_size           (GimpDockbook   *dockbook);
-static gint         gimp_dockbook_get_tab_border              (GimpDockbook   *dockbook);
 static void         gimp_dockbook_add_tab_timeout             (GimpDockbook   *dockbook,
                                                                GimpDockable   *dockable);
 static void         gimp_dockbook_remove_tab_timeout          (GimpDockbook   *dockbook);
@@ -235,7 +234,7 @@ gimp_dockbook_class_init (GimpDockbookClass *klass)
   object_class->finalize    = gimp_dockbook_finalize;
 
   widget_class->size_allocate = gimp_dockbook_size_allocate;
-  widget_class->style_set     = gimp_dockbook_style_set;
+  widget_class->style_updated = gimp_dockbook_style_updated;
   widget_class->drag_leave    = gimp_dockbook_drag_leave;
   widget_class->drag_motion   = gimp_dockbook_drag_motion;
   widget_class->drag_drop     = gimp_dockbook_drag_drop;
@@ -246,12 +245,6 @@ gimp_dockbook_class_init (GimpDockbookClass *klass)
   klass->dockable_reordered = NULL;
 
   gtk_widget_class_install_style_property (widget_class,
-                                           g_param_spec_int ("tab-border",
-                                                             NULL, NULL,
-                                                             0, G_MAXINT,
-                                                             DEFAULT_TAB_BORDER,
-                                                             GIMP_PARAM_READABLE));
-  gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_enum ("tab-icon-size",
                                                               NULL, NULL,
                                                               GTK_TYPE_ICON_SIZE,
@@ -359,10 +352,9 @@ gimp_dockbook_size_allocate (GtkWidget      *widget,
 }
 
 static void
-gimp_dockbook_style_set (GtkWidget *widget,
-                         GtkStyle  *prev_style)
+gimp_dockbook_style_updated (GtkWidget *widget)
 {
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   /* Don't attempt to construct widgets that require a GimpContext if
    * we are detached from a top-level, we're either on our way to
@@ -786,9 +778,11 @@ gimp_dockbook_update_automatic_tab_style (GimpDockbook *dockbook)
   gint          action_widget_size  = 0;
 
   xthickness = gtk_widget_get_style (widget)->xthickness;
+#if 0
   g_object_get (widget,
                 "tab-hborder", &tab_hborder,
                 NULL);
+#endif
   gtk_widget_style_get (widget,
                         "tab-curvature",    &tab_curvature,
                         "focus-line-width", &focus_width,
@@ -1313,10 +1307,6 @@ gimp_dockbook_recreate_tab_widgets (GimpDockbook *dockbook,
   GList *dockables = gtk_container_get_children (GTK_CONTAINER (dockbook));
   GList *iter      = NULL;
 
-  g_object_set (dockbook,
-                "tab-border", gimp_dockbook_get_tab_border (dockbook),
-                NULL);
-
   for (iter = dockables; iter; iter = g_list_next (iter))
     {
       GimpDockable *dockable = GIMP_DOCKABLE (iter->data);
@@ -1634,41 +1624,6 @@ gimp_dockbook_get_tab_icon_size (GimpDockbook *dockbook)
   return tab_size;
 }
 
-static gint
-gimp_dockbook_get_tab_border (GimpDockbook *dockbook)
-{
-  Gimp         *gimp;
-  GimpIconSize  size;
-  gint          tab_border = DEFAULT_TAB_BORDER;
-
-  gimp = gimp_dock_get_context (dockbook->p->dock)->gimp;
-
-  gtk_widget_style_get (GTK_WIDGET (dockbook),
-                        "tab-border", &tab_border,
-                        NULL);
-
-  size = gimp_gui_config_detect_icon_size (GIMP_GUI_CONFIG (gimp->config));
-  /* Match GimpIconSize with GtkIconSize. */
-  switch (size)
-    {
-    case GIMP_ICON_SIZE_SMALL:
-      tab_border /= 2;
-      break;
-    case GIMP_ICON_SIZE_LARGE:
-      tab_border *= 2;
-      break;
-    case GIMP_ICON_SIZE_HUGE:
-      tab_border *= 3;
-      break;
-    default:
-      /* GIMP_ICON_SIZE_MEDIUM and GIMP_ICON_SIZE_DEFAULT:
-       * let's use the size set by the theme. */
-      break;
-    }
-
-  return tab_border;
-}
-
 static void
 gimp_dockbook_add_tab_timeout (GimpDockbook *dockbook,
                                GimpDockable *dockable)
diff --git a/libgimpwidgets/gimpcolornotebook.c b/libgimpwidgets/gimpcolornotebook.c
index 0bdee9b..737c295 100644
--- a/libgimpwidgets/gimpcolornotebook.c
+++ b/libgimpwidgets/gimpcolornotebook.c
@@ -50,7 +50,6 @@
  **/
 
 
-#define DEFAULT_TAB_BORDER     0
 #define DEFAULT_TAB_ICON_SIZE  GTK_ICON_SIZE_BUTTON
 
 
@@ -137,14 +136,6 @@ gimp_color_notebook_class_init (GimpColorNotebookClass *klass)
   selector_class->set_config            = gimp_color_notebook_set_config;
 
   gtk_widget_class_install_style_property (widget_class,
-                                           g_param_spec_int ("tab-border",
-                                                             NULL,
-                                                             "Width of the border around the tab contents",
-                                                             0, G_MAXINT,
-                                                             DEFAULT_TAB_BORDER,
-                                                             G_PARAM_READABLE));
-
-  gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_enum ("tab-icon-size",
                                                               NULL,
                                                               "Size for icons displayed in the tab",
@@ -211,20 +202,14 @@ gimp_color_notebook_style_updated (GtkWidget *widget)
 {
   GimpColorNotebookPrivate *private = GET_PRIVATE (widget);
   GList                    *list;
-  gint                      tab_border;
   GtkIconSize               icon_size;
 
   GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   gtk_widget_style_get (widget,
-                        "tab-border",    &tab_border,
-                        "tab-icon_size", &icon_size,
+                        "tab-icon-size", &icon_size,
                         NULL);
 
-  g_object_set (private->notebook,
-                "tab-border", tab_border,
-                NULL);
-
   for (list = private->selectors; list; list = g_list_next (list))
     {
       GimpColorSelectorClass *selector_class;
diff --git a/themes/Small/gimp.css b/themes/Small/gimp.css
index 3483846..05c79ea 100644
--- a/themes/Small/gimp.css
+++ b/themes/Small/gimp.css
@@ -27,9 +27,7 @@
     -GimpDockWindow-menu-preview-size: small-toolbar;
     -GimpToolPalette-tool-icon-size:   menu;
     -GimpToolPalette-button-relief:    none;
-    -GimpDockbook-tab-border:          0;
     -GimpDockbook-tab-icon-size:       menu;
-    -GimpColorNotebook-tab-border:     0;
     -GimpColorNotebook-tab-icon-size:  menu;
     -GimpDeviceEditor-handle-size:     12;
     -GimpDockable-content-border:      1;
@@ -47,6 +45,14 @@ GimpToolDialog {
     -GtkDialog-action-area-border: 6;
 }
 
+GimpColorNotebook tab {
+    padding: 0 0 0 0;
+}
+
+GimpDockbook tab {
+    padding: 0 0 0 0;
+}
+
 GimpDockable {
     -GimpFrame-label-bold:       0;
     -GimpFrame-label-spacing:    0;
diff --git a/themes/System/gimp.css b/themes/System/gimp.css
index d3a31a8..7a54010 100644
--- a/themes/System/gimp.css
+++ b/themes/System/gimp.css
@@ -27,11 +27,9 @@
     -GimpDockWindow-menu-preview-size: button;
     -GimpToolPalette-tool-icon-size:   button;
     -GimpToolPalette-button-relief:    none;
-    -GimpDockbook-tab-border:          0;
     -GimpDockbook-tab-icon-size:       button;
-    -GimpColorNotebook-tab-border:     0;
     -GimpColorNotebook-tab-icon-size:  button;
-    -GimpDeviceEditor-handle-size;     12;
+    -GimpDeviceEditor-handle-size:     12;
     -GimpDockable-content-border:      2;
     -GimpEditor-content-spacing:       2;
     -GimpEditor-button-spacing:        2;
@@ -47,11 +45,23 @@ GimpToolDialog {
     -GtkDialog-action-area-border: 6;
 }
 
+GimpColorNotebook tab {
+    padding: 0 0 0 0;
+}
+
+GimpDockbook tab {
+    padding: 0 0 0 0;
+}
+
+GimpDockbook GtkButton {
+    -GtkWidget-focus-padding: 0;
+}
+
 GimpDockable {
     -GimpFrame-label-bold:       0;
     -GimpFrame-label-spacing:    2;
-    -GtkButton-focus-line-width: 1;
-    -GtkButton-focus-padding:    0;
+    -GtkWidget-focus-line-width: 1;
+    -GtkWidget-focus-padding:    0;
 }
 
 GimpDisplayShell {
@@ -60,8 +70,8 @@ GimpDisplayShell {
     -GimpScaleComboBox-label-scale: 0.8333;
     -GtkComboBox-arrow-size:        8;
     -GtkButton-inner-border:        0 0 0 0;
-    -GtkButton-focus-line_width:    0;
-    -GtkButton-focus-padding:       0;
+    -GtkWidget-focus-line_width:    0;
+    -GtkWidget-focus-padding:       0;
 }
 
 GimpColorFrame {


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