Commit d7f305d4 authored by Clement Lefebvre's avatar Clement Lefebvre

Cinnamon: Bring back panel layout selection

parent 3add6640
......@@ -18,6 +18,8 @@ from locale import gettext as _
locale.bindtextdomain("mintwelcome", "/usr/share/linuxmint/locale")
locale.textdomain("mintwelcome")
LAYOUT_STYLE_LEGACY, LAYOUT_STYLE_NEW = range(2)
class SidebarRow(Gtk.ListBoxRow):
def __init__(self, page_widget, page_name, icon_name):
......@@ -84,6 +86,8 @@ class MintWelcome():
builder.get_object("button_timeshift").connect("clicked", self.pkexec, "timeshift-gtk")
builder.get_object("button_mintdrivers").connect("clicked", self.pkexec, "driver-manager")
builder.get_object("button_gufw").connect("clicked", self.launch, "gufw")
builder.get_object("button_layout_legacy").connect("clicked", self.on_button_layout_clicked, LAYOUT_STYLE_LEGACY)
builder.get_object("button_layout_new").connect("clicked", self.on_button_layout_clicked, LAYOUT_STYLE_NEW)
# Settings button depends on DE
de_is_cinnamon = False
......@@ -100,6 +104,10 @@ class MintWelcome():
# Hide settings
builder.get_object("box_first_steps").remove(builder.get_object("box_settings"))
# Hide Cinnamon layout settings in other DEs
if not de_is_cinnamon:
builder.get_object("box_first_steps").remove(builder.get_object("box_cinnamon"))
# Hide codecs box if they're already installed
add_codecs = False
cache = apt.Cache()
......@@ -159,6 +167,17 @@ class MintWelcome():
self.dark_mode = False
# Use HIDPI pictures if appropriate
if scale == 1:
surface = self.surface_for_path("/usr/share/linuxmint/mintwelcome/legacy.png", scale)
builder.get_object("img_legacy").set_from_surface(surface)
surface = self.surface_for_path("/usr/share/linuxmint/mintwelcome/modern.png", scale)
builder.get_object("img_modern").set_from_surface(surface)
else:
surface = self.surface_for_path("/usr/share/linuxmint/mintwelcome/legacy-hidpi.png", scale)
builder.get_object("img_legacy").set_from_surface(surface)
surface = self.surface_for_path("/usr/share/linuxmint/mintwelcome/modern-hidpi.png", scale)
builder.get_object("img_modern").set_from_surface(surface)
path = "/usr/share/linuxmint/mintwelcome/colors/"
if scale == 2:
path = "/usr/share/linuxmint/mintwelcome/colors/hidpi/"
......@@ -187,6 +206,60 @@ class MintWelcome():
os.system("mkdir -p ~/.linuxmint/mintwelcome")
os.system("touch %s" % NORUN_FLAG)
def on_button_layout_clicked (self, button, style):
applets_legacy = ['panel1:left:0:menu@cinnamon.org',
'panel1:left:1:show-desktop@cinnamon.org',
'panel1:left:2:panel-launchers@cinnamon.org',
'panel1:left:3:window-list@cinnamon.org',
'panel1:right:0:systray@cinnamon.org',
'panel1:right:1:xapp-status@cinnamon.org',
'panel1:right:2:keyboard@cinnamon.org',
'panel1:right:3:notifications@cinnamon.org',
'panel1:right:4:printers@cinnamon.org',
'panel1:right:5:removable-drives@cinnamon.org',
'panel1:right:6:user@cinnamon.org',
'panel1:right:7:network@cinnamon.org',
'panel1:right:8:sound@cinnamon.org',
'panel1:right:9:power@cinnamon.org',
'panel1:right:10:calendar@cinnamon.org']
applets_new = ['panel1:left:0:menu@cinnamon.org',
'panel1:left:1:show-desktop@cinnamon.org',
'panel1:left:2:grouped-window-list@cinnamon.org',
'panel1:right:0:systray@cinnamon.org',
'panel1:right:1:xapp-status@cinnamon.org',
'panel1:right:2:notifications@cinnamon.org',
'panel1:right:3:printers@cinnamon.org',
'panel1:right:4:removable-drives@cinnamon.org',
'panel1:right:5:keyboard@cinnamon.org',
'panel1:right:6:network@cinnamon.org',
'panel1:right:7:sound@cinnamon.org',
'panel1:right:8:power@cinnamon.org',
'panel1:right:9:calendar@cinnamon.org']
settings = Gio.Settings("org.cinnamon")
settings.set_strv("panels-enabled", ['1:0:bottom'])
applets = applets_new
left_icon_size = 0
center_icon_size = 0
right_icon_size = 0
if style == LAYOUT_STYLE_LEGACY:
applets = applets_legacy
panel_size = 27
menu_label = "Menu"
elif style == LAYOUT_STYLE_NEW:
panel_size = 40
right_icon_size = 24
menu_label = ""
settings.set_strv("panels-height", ['1:%s' % panel_size])
settings.set_strv("enabled-applets", applets)
settings.set_string("app-menu-label", menu_label)
settings.set_string("panel-zone-icon-sizes", "[{\"panelId\": 1, \"left\": %s, \"center\": %s, \"right\": %s}]" % (left_icon_size, center_icon_size, right_icon_size))
os.system("cinnamon --replace &")
def on_dark_mode_changed(self, button, state):
self.dark_mode = state
self.change_color()
......
......@@ -625,7 +625,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Desktop colors</property>
<property name="label" translatable="yes">Desktop Colors</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
......@@ -938,6 +938,240 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box_cinnamon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">24</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="margin_top">6</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage" id="image_new_features8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="icon_name">cs-panel</property>
<property name="icon_size">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Panel Layout</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Choose your favorite desktop layout.</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<property name="border_width">6</property>
<property name="homogeneous">True</property>
<property name="layout_style">expand</property>
<child>
<object class="GtkButton" id="button_layout_legacy">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Traditional</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="img_legacy">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">legacy.png</property>
<property name="icon_size">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">A small panel and a traditional window list.</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_layout_new">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Modern</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="img_modern">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">modern.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">A large panel with grouped windows and a small system tray.</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Note: Cinnamon will restart after you choose a new layout. Any customization you made to the panel will be lost.</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
......@@ -1040,7 +1274,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
......@@ -1145,7 +1379,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<child>
......@@ -1250,7 +1484,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
<child>
......@@ -1355,7 +1589,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
<child>
......@@ -1460,7 +1694,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
<property name="position">6</property>
</packing>
</child>
<child>
......@@ -1565,7 +1799,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="position">7</property>
</packing>
</child>
<child>
......@@ -1670,7 +1904,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
<property name="position">8</property>
</packing>
</child>
</object>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment