bin/ui-rules-enforcer.py           |   33 +++++++++++++++++++++++++++++++++
 cui/uiconfig/ui/spellingdialog.ui  |    1 +
 sfx2/uiconfig/ui/tabbarcontents.ui |    2 +-
 3 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit e2e89bb4187e08c4b6052f535d80886e198051c8
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Jun 6 11:30:31 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Jun 6 21:36:49 2021 +0200

    enforce indicator consistency
    
    so there is either a standard indicator shown or one of a small subset
    of named icons
    
    a) adds an indicator to show the MenuButton provides a dropdown to the
    spelling dialog when there are multiple user dictionaries the word could
    be added to
    b) use open-menu-symbolic instead of gear icon for the sidebar menu
    
    Change-Id: If4f0842fb0f805dde45e375061f23d2aaea0990c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116757
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/bin/ui-rules-enforcer.py b/bin/ui-rules-enforcer.py
index dfffe79ce7cd..bc3561bab1e1 100755
--- a/bin/ui-rules-enforcer.py
+++ b/bin/ui-rules-enforcer.py
@@ -222,6 +222,38 @@ def remove_label_fill(current):
   if label_fill != None:
     current.remove(label_fill)
 
+def enforce_menubutton_indicator_consistency(current):
+  draw_indicator = None
+  image = None
+  ismenubutton = current.get('class') == "GtkMenuButton"
+  insertpos = 0
+  for child in current:
+    enforce_menubutton_indicator_consistency(child)
+    if not ismenubutton:
+      continue
+    if child.tag == "property":
+      insertpos = insertpos + 1;
+      attributes = child.attrib
+      if attributes.get("name") == "draw_indicator" or attributes.get("name") 
== "draw-indicator":
+        draw_indicator = child
+      elif attributes.get("name") == "image":
+        image = child
+
+  if ismenubutton:
+    if draw_indicator == None:
+      if image == None:
+        # if there is no draw indicator and no image there should be a draw 
indicator
+        draw_indicator = etree.Element("property")
+        attributes = draw_indicator.attrib
+        attributes["name"] = "draw-indicator"
+        draw_indicator.text = "True"
+        current.insert(insertpos, draw_indicator)
+      else:
+        # if there is no draw indicator but there is an image that image 
should be open-menu-symbolic or x-office-calendar
+        for status_elem in tree.xpath("/interface/object[@id='" + image.text + 
"']/property[@name='icon_name' or @name='icon-name']"):
+          if status_elem.text != 'x-office-calendar':
+            status_elem.text = "open-menu-symbolic"
+
 with open(sys.argv[1], encoding="utf-8") as f:
   header = f.readline()
   f.seek(0)
@@ -244,6 +276,7 @@ replace_image_stock(root)
 remove_check_button_align(root)
 remove_track_visited_links(root)
 remove_label_fill(root)
+enforce_menubutton_indicator_consistency(root)
 
 with open(sys.argv[1], 'wb') as o:
   # without encoding='unicode' (and the matching encode("utf8")) we get &#XXXX 
replacements for non-ascii characters
diff --git a/cui/uiconfig/ui/spellingdialog.ui 
b/cui/uiconfig/ui/spellingdialog.ui
index c2465fd57972..cbd9093a6180 100644
--- a/cui/uiconfig/ui/spellingdialog.ui
+++ b/cui/uiconfig/ui/spellingdialog.ui
@@ -605,6 +605,7 @@
                     <property name="use_underline">True</property>
                     <property name="popup">addmenu</property>
                     <property name="use_popover">False</property>
+                    <property name="draw-indicator">True</property>
                     <child>
                       <placeholder/>
                     </child>
diff --git a/sfx2/uiconfig/ui/tabbarcontents.ui 
b/sfx2/uiconfig/ui/tabbarcontents.ui
index ba2822692be4..31a8ceb818b4 100644
--- a/sfx2/uiconfig/ui/tabbarcontents.ui
+++ b/sfx2/uiconfig/ui/tabbarcontents.ui
@@ -5,7 +5,7 @@
   <object class="GtkImage" id="image6">
     <property name="visible">True</property>
     <property name="can-focus">False</property>
-    <property name="icon-name">sfx2/res/symphony/open_more.png</property>
+    <property name="icon-name">open-menu-symbolic</property>
     <property name="icon_size">2</property>
   </object>
   <object class="GtkMenu" id="mainmenu">
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to