[Pkg-sugar-commit] [sugar-toolkit-gtk3] 02/03: Set css name for widgets

Jonas Smedegaard dr at jones.dk
Wed May 24 08:56:41 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag v0.108.1
in repository sugar-toolkit-gtk3.

commit b2be72ccff1cfeebfe432da33ecb47f3d8938f16
Author: Sam Parkinson <sam at sam.today>
Date:   Thu Dec 31 22:53:47 2015 +1100

    Set css name for widgets
    
    In Gtk+ 3.20, you need to use the css name to select elements,
    rather than the gtype name.  Therefore, these must be added.
    
    The css name must be set before the class instances are created, as
    it effects the class rather than the instance.  This is why it must
    be places after the class definition.
---
 src/sugar3/graphics/alert.py         | 4 ++++
 src/sugar3/graphics/icon.py          | 2 ++
 src/sugar3/graphics/palettewindow.py | 4 +++-
 src/sugar3/graphics/toolbarbox.py    | 2 ++
 src/sugar3/graphics/tray.py          | 4 ++++
 5 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/sugar3/graphics/alert.py b/src/sugar3/graphics/alert.py
index 70f8695..e5a4d3a 100644
--- a/src/sugar3/graphics/alert.py
+++ b/src/sugar3/graphics/alert.py
@@ -209,6 +209,8 @@ class Alert(Gtk.EventBox):
 
     def __button_clicked_cb(self, button, response_id):
         self._response(response_id)
+if hasattr(Alert, 'set_css_name'):
+    Alert.set_css_name('alert')
 
 
 class ConfirmationAlert(Alert):
@@ -344,6 +346,8 @@ class _TimeoutIcon(Gtk.Alignment):
 
     def set_text(self, text):
         self._text.set_markup('<b>%s</b>' % GLib.markup_escape_text(str(text)))
+if hasattr(_TimeoutIcon, 'set_css_name'):
+    _TimeoutIcon.set_css_name('timeouticon')
 
 
 class _TimeoutAlert(Alert):
diff --git a/src/sugar3/graphics/icon.py b/src/sugar3/graphics/icon.py
index 0956569..d2a36f7 100644
--- a/src/sugar3/graphics/icon.py
+++ b/src/sugar3/graphics/icon.py
@@ -831,6 +831,8 @@ class CanvasIcon(EventIcon):
 
     def __palette_popdown_cb(self, palette):
         self.unset_state_flags(Gtk.StateFlags.PRELIGHT)
+if hasattr(CanvasIcon, 'set_css_name'):
+    CanvasIcon.set_css_name('canvasicon')
 
 
 class CellRendererIcon(Gtk.CellRenderer):
diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py
index e7284f6..7f10585 100644
--- a/src/sugar3/graphics/palettewindow.py
+++ b/src/sugar3/graphics/palettewindow.py
@@ -363,7 +363,7 @@ class _PaletteWindowWidget(Gtk.Window):
 
         allocation = self.get_allocation()
         context = self.get_style_context()
-        context.add_class('toolitem')
+        context.add_class('palette')
         if gap:
             cr.save()
             cr.set_source_rgb(0, 0, 0)
@@ -406,6 +406,8 @@ class _PaletteWindowWidget(Gtk.Window):
         self.disconnect_by_func(self.__enter_notify_event_cb)
         self.disconnect_by_func(self.__leave_notify_event_cb)
         self.hide()
+if hasattr(_PaletteWindowWidget, 'set_css_name'):
+    _PaletteWindowWidget.set_css_name('palette')
 
 
 class MouseSpeedDetector(GObject.GObject):
diff --git a/src/sugar3/graphics/toolbarbox.py b/src/sugar3/graphics/toolbarbox.py
index 85b2b99..ee2b4cb 100644
--- a/src/sugar3/graphics/toolbarbox.py
+++ b/src/sugar3/graphics/toolbarbox.py
@@ -203,6 +203,8 @@ class ToolbarBox(Gtk.VBox):
         if button == self.expanded_button:
             self.remove(button.page_widget)
             self._expanded_button_index = -1
+if hasattr(ToolbarBox, 'set_css_name'):
+    ToolbarBox.set_css_name('toolbarbox')
 
 
 class _ToolbarPalette(PaletteWindow):
diff --git a/src/sugar3/graphics/tray.py b/src/sugar3/graphics/tray.py
index 21f7f0d..e44334e 100644
--- a/src/sugar3/graphics/tray.py
+++ b/src/sugar3/graphics/tray.py
@@ -323,6 +323,8 @@ class HTray(Gtk.EventBox):
 
     def scroll_to_item(self, item):
         self._viewport.scroll_to_item(item)
+if hasattr(HTray, 'set_css_name'):
+    HTray.set_css_name('htray')
 
 
 class VTray(Gtk.EventBox):
@@ -414,6 +416,8 @@ class VTray(Gtk.EventBox):
 
     def scroll_to_item(self, item):
         self._viewport.scroll_to_item(item)
+if hasattr(VTray, 'set_css_name'):
+    VTray.set_css_name('VTray')
 
 
 class TrayButton(ToolButton):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit-gtk3.git



More information about the pkg-sugar-commit mailing list