Skip to content

Commit

Permalink
Make separators visible
Browse files Browse the repository at this point in the history
  • Loading branch information
bluesabre committed Aug 7, 2023
1 parent 2e37599 commit 6f6ff8a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Unreleased, MenuLibre 2.3.2
consistent icons
- Unnecessary indentation was removed from the editor sections
- Window dimensions were reduced
- Separators are now displayed in the application treeview
- Fixes
- Sidebar borders
- Execute button no longer sensitive for separators
Expand Down
9 changes: 5 additions & 4 deletions menulibre/MenuEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,15 @@ def menu_to_treestore(treestore, parent, menu_items):
item_type = item[0]
if item_type == MenuItemTypes.SEPARATOR:
executable = ""
displayed_name = "<s> </s>"
displayed_name = _("Separator")
# Translators: Separator menu item
tooltip = _("Separator")
categories = ""
filename = None
icon = None
icon_name = ""
show = True
icon_name = "content-loading-symbolic"
icon = Gio.ThemedIcon.new(icon_name)
item_type = MenuItemTypes.SEPARATOR
show = False
else:
executable = item[2]['executable']
displayed_name = escape(item[2]['display_name'])
Expand Down
8 changes: 4 additions & 4 deletions menulibre/MenulibreApplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,18 +1095,18 @@ def add_directory(self):

def add_separator(self):
"""Add Separator callback function."""
name = "<s> </s>"
name = _("Separator")
# Translators: Separator menu item
tooltip = _("Separator")
categories = ""
filename = None
icon = None
icon_name = ""
icon_name = "content-loading-symbolic"
icon = Gio.ThemedIcon.new(icon_name)
item_type = MenuItemTypes.SEPARATOR
filename = None
executable = ""
row_data = [name, tooltip, executable, categories, item_type, icon,
icon_name, filename, False, True]
icon_name, filename, False, False]

self.treeview.append(row_data)

Expand Down
6 changes: 5 additions & 1 deletion menulibre/MenulibreTreeview.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self, parent):
# Set the markup property on the Text cell.
col.add_attribute(col_cell_text, "markup", 0)

# Add the cell data func for the pixbuf column to render icons.
# Add the cell data func for the text column to render labels.
col.set_cell_data_func(col_cell_text, self._text_display_func, None)

# Set the Tooltip column.
Expand Down Expand Up @@ -474,12 +474,16 @@ def _text_display_func(self, col, renderer, treestore, treeiter,
renderer.set_property("style", Pango.Style.NORMAL)
else:
renderer.set_property("style", Pango.Style.ITALIC)
separator = treestore[treeiter][MenuEditor.COL_TYPE] == MenuItemTypes.SEPARATOR
renderer.set_property("sensitive", not separator)
renderer.set_property("style-set", True)

def _icon_name_func(self, col, renderer, treestore, treeiter, user_data):
"""CellRenderer function to set the gicon for each row."""
renderer.set_property("gicon",
treestore[treeiter][MenuEditor.COL_G_ICON])
separator = treestore[treeiter][MenuEditor.COL_TYPE] == MenuItemTypes.SEPARATOR
renderer.set_property("sensitive", not separator)

def _get_selected_iter(self):
"""Return the current treeview model and selected iter."""
Expand Down
6 changes: 4 additions & 2 deletions po/menulibre.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-06 06:18-0400\n"
"POT-Creation-Date: 2023-08-07 06:51-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -1293,7 +1293,9 @@ msgid "Select an icon"
msgstr ""

#. Translators: Separator menu item
#: ../menulibre/MenuEditor.py:125 ../menulibre/MenulibreApplication.py:792
#: ../menulibre/MenuEditor.py:123 ../menulibre/MenuEditor.py:125
#: ../menulibre/MenulibreApplication.py:792
#: ../menulibre/MenulibreApplication.py:1098
#: ../menulibre/MenulibreApplication.py:1100
msgid "Separator"
msgstr ""
Expand Down

0 comments on commit 6f6ff8a

Please sign in to comment.