Skip to content

Commit 6fb5c5d

Browse files
committed
cs_default: Fix small issues
- Don't show empty categories - Don't gettext the same string twice - Rename variables
1 parent aae720d commit 6fb5c5d

File tree

1 file changed

+46
-44
lines changed

1 file changed

+46
-44
lines changed

files/usr/share/cinnamon/cinnamon-settings/modules/cs_default.py

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -580,51 +580,53 @@ def on_module_selected(self):
580580

581581
size_group = Gtk.SizeGroup.new(Gtk.SizeGroupMode.HORIZONTAL)
582582

583-
for e in preferred_app_defs:
584-
settings = page.add_section(_(e))
585-
# size_group = Gtk.SizeGroup.new(Gtk.SizeGroupMode.HORIZONTAL)
586-
for d in preferred_app_defs[e]:
587-
widget = SettingsWidget()
588-
button = DefaultAppChooserButton(d[PREF_CONTENT_TYPE], d[PREF_GEN_CONTENT_TYPE])
589-
label = MnemonicLabel(d[PREF_LABEL], button)
590-
size_group.add_widget(button)
591-
widget.pack_start(label, False, False, 0)
592-
widget.pack_end(button, False, False, 0)
593-
#Hide button if there are no apps
594-
if not button.get_active():
583+
for name in preferred_app_defs:
584+
items = preferred_app_defs[name]
585+
if len(items) > 0:
586+
settings = page.add_section(name)
587+
# size_group = Gtk.SizeGroup.new(Gtk.SizeGroupMode.HORIZONTAL)
588+
for item in items:
589+
widget = SettingsWidget()
590+
button = DefaultAppChooserButton(item[PREF_CONTENT_TYPE], item[PREF_GEN_CONTENT_TYPE])
591+
label = MnemonicLabel(item[PREF_LABEL], button)
592+
size_group.add_widget(button)
593+
widget.pack_start(label, False, False, 0)
594+
widget.pack_end(button, False, False, 0)
595+
#Hide button if there are no apps
596+
if not button.get_active():
597+
settings.add_row(widget)
598+
if name.lower() == "system":
599+
# Add Terminal and calculator to the "System" section
600+
601+
# Calculator
602+
widget = SettingsWidget()
603+
button = DefaultCalculatorButton()
604+
label = MnemonicLabel(_("Calculator"), button)
605+
size_group.add_widget(button)
606+
widget.pack_start(label, False, False, 0)
607+
widget.pack_end(button, False, False, 0)
608+
settings.add_row(widget)
609+
610+
# Terminal
611+
widget = SettingsWidget()
612+
button = DefaultTerminalButton()
613+
label = MnemonicLabel(_("Terminal"), button)
614+
entry_label = Gtk.Label(label="<i>%s</i>" % _("Arguments"), margin_end=4, use_markup=True)
615+
entry_label.get_style_context().add_class("dim-label")
616+
entry = TerminalExecArgEntry()
617+
618+
entry_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, margin_top=6)
619+
entry_box.pack_start(entry_label, False, False, 0)
620+
entry_box.pack_start(entry, True, True, 0)
621+
622+
box = Gtk.VBox()
623+
box.pack_start(button, False, False, 0)
624+
box.pack_start(entry_box, False, False, 0)
625+
size_group.add_widget(box)
626+
627+
widget.pack_start(label, False, False, 0)
628+
widget.pack_end(box, False, False, 0)
595629
settings.add_row(widget)
596-
if e.lower() == "system":
597-
# Add Terminal and calculator to the "System" section
598-
599-
# Calculator
600-
widget = SettingsWidget()
601-
button = DefaultCalculatorButton()
602-
label = MnemonicLabel(_("Calculator"), button)
603-
size_group.add_widget(button)
604-
widget.pack_start(label, False, False, 0)
605-
widget.pack_end(button, False, False, 0)
606-
settings.add_row(widget)
607-
608-
# Terminal
609-
widget = SettingsWidget()
610-
button = DefaultTerminalButton()
611-
label = MnemonicLabel(_("Terminal"), button)
612-
entry_label = Gtk.Label(label="<i>%s</i>" % _("Arguments"), margin_end=4, use_markup=True)
613-
entry_label.get_style_context().add_class("dim-label")
614-
entry = TerminalExecArgEntry()
615-
616-
entry_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, margin_top=6)
617-
entry_box.pack_start(entry_label, False, False, 0)
618-
entry_box.pack_start(entry, True, True, 0)
619-
620-
box = Gtk.VBox()
621-
box.pack_start(button, False, False, 0)
622-
box.pack_start(entry_box, False, False, 0)
623-
size_group.add_widget(box)
624-
625-
widget.pack_start(label, False, False, 0)
626-
widget.pack_end(box, False, False, 0)
627-
settings.add_row(widget)
628630

629631

630632
# Removable media

0 commit comments

Comments
 (0)