diff --git a/NEWS b/NEWS index 379cf62ebe..78b7ccac84 100644 --- a/NEWS +++ b/NEWS @@ -99,9 +99,3 @@ THEME CHANGES SINCE 1.4 max-height: 100px; } -/* =================================================================== - * Menu Applet - * ===================================================================*/ - -.menu-place-cat-button-label { -} diff --git a/data/org.cinnamon.gschema.xml.in b/data/org.cinnamon.gschema.xml.in index 4dbd797e40..6058230c99 100644 --- a/data/org.cinnamon.gschema.xml.in +++ b/data/org.cinnamon.gschema.xml.in @@ -74,6 +74,14 @@ + + false + <_summary>Scale panel applet text and icons + <_description> + Whether the panel icons and text from applets is resized according to the custom panel height + + + true <_summary>Enable desktop effects @@ -464,6 +472,14 @@ + + false + Enable mouse-scroll in window-list applet + + When enabled the mouse wheel can scroll through the items in the window list applet. + + + false <_summary>Whether edge flip is enabled diff --git a/data/theme/cinnamon.css b/data/theme/cinnamon.css index 2131fb981e..911bf856cb 100644 --- a/data/theme/cinnamon.css +++ b/data/theme/cinnamon.css @@ -277,6 +277,7 @@ StScrollBar StButton#vhandle:hover { spacing: 0px; margin: 0px; } + .panel-corner { -panel-corner-radius: 0px; -panel-corner-background-color: black; @@ -1228,7 +1229,6 @@ StScrollBar StButton#vhandle:hover { /* Main menu title */ .menu-favorites-box { - width: 50px; margin: auto; padding: 10px; border: 1px solid #666; @@ -1252,22 +1252,7 @@ StScrollBar StButton#vhandle:hover { box-shadow: inset 0px 0px 1px 1px rgba(255,255,255,0.06); border-radius: 4px; } -.menu-help-button { - padding-top: 2px; - padding-left: 5px; - padding-right: 5px; - padding-bottom: 2px; -} -.menu-help-button:hover { - color: white; - background-gradient-direction: vertical; - background-gradient-start: rgba(255,255,255,0.2); - background-gradient-end: rgba(255,255,255,0.08); - box-shadow: inset 0px 0px 1px 1px rgba(255,255,255,0.06); - border-radius: 4px; -} .menu-places-box { - width: 50px; margin: auto; padding: 10px; border: 0px solid #666; @@ -1296,7 +1281,6 @@ StScrollBar StButton#vhandle:hover { padding-right: 7px; padding-bottom: 7px; } -.menu-application-button:hover, .menu-application-button-selected { padding-top: 7px; padding-left: 7px; @@ -1315,19 +1299,12 @@ StScrollBar StButton#vhandle:hover { .menu-application-button-label:rtl { padding-right: 5px; } -.menu-place-cat-button-label:ltr { - padding-top: 4px; - padding-left: 5px; -} -.menu-place-cat-button-label:rtl { - padding-top: 4px; - padding-right: 5px; -} .menu-category-button { padding-top: 7px; padding-left: 7px; padding-right: 7px; padding-bottom: 7px; + transition-duration: 75; } .menu-category-button-greyed { padding-top: 7px; @@ -1348,7 +1325,7 @@ StScrollBar StButton#vhandle:hover { background-gradient-end: rgba(255,255,255,0.08); box-shadow: inset 0px 0px 1px 1px rgba(255,255,255,0.06); border-radius: 4px; - transition-duration: 300; + transition-duration: 75; } .menu-category-button-label:ltr { padding-left: 5px; @@ -1446,7 +1423,7 @@ StScrollBar StButton#vhandle:hover { border-radius: 2px 2px 0px 0px; padding-left: 5px; padding-right: 5px; - transition-duration: 300; + transition-duration: 100; } .window-list-item-box:active, .window-list-item-box:checked, @@ -1619,12 +1596,10 @@ StScrollBar StButton#vhandle:hover { * ===================================================================*/ .applet-box { padding-left: 3px; - padding-right: 3px; + padding-right: 3px; color: #ccc; text-shadow: black 0px 0px 2px; transition-duration: 300; - min-width: 1em; - } .applet-box:hover { color: #fff; @@ -1640,6 +1615,7 @@ StScrollBar StButton#vhandle:hover { } .applet-icon { color: #ccc; + icon-size: 22px; } .applet-icon:hover, .applet-box:hover > .applet-icon { diff --git a/data/theme/menu.png b/data/theme/menu.png index 131ae513e5..08308615ac 100644 Binary files a/data/theme/menu.png and b/data/theme/menu.png differ diff --git a/files/usr/lib/cinnamon-settings/cinnamon-settings.py b/files/usr/lib/cinnamon-settings/cinnamon-settings.py index bef5d12aa3..7f1aaa400e 100755 --- a/files/usr/lib/cinnamon-settings/cinnamon-settings.py +++ b/files/usr/lib/cinnamon-settings/cinnamon-settings.py @@ -167,13 +167,25 @@ def rec_mkdir(path): os.mkdir(path) class GSettingsColorChooser(Gtk.ColorButton): - def __init__(self, schema, key): + def __init__(self, schema, key, dep_key): Gtk.ColorButton.__init__(self) self._schema = Gio.Settings(schema) self._key = key + self.dep_key = dep_key self.set_value(self._schema[self._key]) self.connect("color-set", self._on_color_set) self._schema.connect("changed::"+key, self._on_settings_value_changed) + self.dependency_invert = False + if self.dep_key is not None: + if self.dep_key[0] == '!': + self.dependency_invert = True + self.dep_key = self.dep_key[1:] + split = self.dep_key.split('/') + self.dep_settings = Gio.Settings.new(split[0]) + self.dep_key = split[1] + self.dep_settings.connect("changed::"+self.dep_key, self.on_dependency_setting_changed) + self.on_dependency_setting_changed(self, None) + def _on_settings_value_changed(self, schema, key): self.set_value(schema[key]) def _on_color_set(self, *args): @@ -183,6 +195,12 @@ def get_value(self): def set_value(self, value): self.set_color(Gdk.color_parse(value)) + def on_dependency_setting_changed(self, settings, dep_key): + if not self.dependency_invert: + self.set_sensitive(self.dep_settings.get_boolean(self.dep_key)) + else: + self.set_sensitive(not self.dep_settings.get_boolean(self.dep_key)) + class ThreadedIconView(Gtk.IconView): def __init__(self): Gtk.IconView.__init__(self) @@ -491,7 +509,7 @@ def build(self): l = Gtk.Label(_("Mode")) topbox.pack_start(l, False, False, 0) - self.background_mode = GSettingsComboBox("", "org.cinnamon.background", "mode", BACKGROUND_MODES).content_widget + self.background_mode = GSettingsComboBox("", "org.cinnamon.background", "mode", None, BACKGROUND_MODES).content_widget self.background_mode.unparent() topbox.pack_start(self.background_mode, False, False, 0) @@ -535,21 +553,21 @@ def build(self): l = Gtk.Label(_("Picture aspect")) l.set_alignment(0, 0.5) advanced_options_box.pack_start(l, False, False, 0) - self.picture_options = GSettingsComboBox("", "org.gnome.desktop.background", "picture-options", BACKGROUND_PICTURE_OPTIONS) + self.picture_options = GSettingsComboBox("", "org.gnome.desktop.background", "picture-options", None, BACKGROUND_PICTURE_OPTIONS) advanced_options_box.pack_start(self.picture_options, False, False, 0) l = Gtk.Label(_("Gradient")) l.set_alignment(0, 0.5) advanced_options_box.pack_start(l, False, False, 0) - self.color_shading_type = GSettingsComboBox("", "org.gnome.desktop.background", "color-shading-type", BACKGROUND_COLOR_SHADING_TYPES) + self.color_shading_type = GSettingsComboBox("", "org.gnome.desktop.background", "color-shading-type", None, BACKGROUND_COLOR_SHADING_TYPES) advanced_options_box.pack_start(self.color_shading_type, False, False, 0) hbox = Gtk.HBox() l = Gtk.Label(_("Colors")) hbox.pack_start(l, False, False, 2) - self.primary_color = GSettingsColorChooser("org.gnome.desktop.background", "primary-color") + self.primary_color = GSettingsColorChooser("org.gnome.desktop.background", "primary-color", None) hbox.pack_start(self.primary_color, False, False, 2) - self.secondary_color = GSettingsColorChooser("org.gnome.desktop.background", "secondary-color") + self.secondary_color = GSettingsColorChooser("org.gnome.desktop.background", "secondary-color", None) hbox.pack_start(self.secondary_color, False, False, 2) advanced_options_box.pack_start(hbox, False, False, 0) @@ -629,22 +647,22 @@ def build(self): scrolledWindow.add_with_viewport(other_settings_box) other_settings_box.set_border_width(5) - windowThemeSwitcher = GSettingsComboBox(_("Window theme"), "org.gnome.desktop.wm.preferences", "theme", self._load_window_themes()) + windowThemeSwitcher = GSettingsComboBox(_("Window theme"), "org.gnome.desktop.wm.preferences", "theme", None, self._load_window_themes()) other_settings_box.pack_start(windowThemeSwitcher, False, False, 2) - menusHaveIconsCB = GSettingsCheckButton(_("Menus Have Icons"), "org.gnome.desktop.interface", "menus-have-icons") + menusHaveIconsCB = GSettingsCheckButton(_("Menus Have Icons"), "org.gnome.desktop.interface", "menus-have-icons", None) other_settings_box.pack_start(menusHaveIconsCB, False, False, 2) - buttonsHaveIconsCB = GSettingsCheckButton(_("Buttons Have Icons"), "org.gnome.desktop.interface", "buttons-have-icons") + buttonsHaveIconsCB = GSettingsCheckButton(_("Buttons Have Icons"), "org.gnome.desktop.interface", "buttons-have-icons", None) other_settings_box.pack_start(buttonsHaveIconsCB, False, False, 2) if 'org.gnome.nautilus' in Gio.Settings.list_schemas(): - alwaysUseLocationEntryCB = GSettingsCheckButton(_("Always Use Location Entry"), "org.gnome.nautilus.preferences", "always-use-location-entry") + alwaysUseLocationEntryCB = GSettingsCheckButton(_("Always Use Location Entry"), "org.gnome.nautilus.preferences", "always-use-location-entry", None) other_settings_box.pack_start(alwaysUseLocationEntryCB, False, False, 2) - cursorThemeSwitcher = GSettingsComboBox(_("Cursor theme"), "org.gnome.desktop.interface", "cursor-theme", self._load_cursor_themes()) + cursorThemeSwitcher = GSettingsComboBox(_("Cursor theme"), "org.gnome.desktop.interface", "cursor-theme", None, self._load_cursor_themes()) other_settings_box.pack_start(cursorThemeSwitcher, False, False, 2) - keybindingThemeSwitcher = GSettingsComboBox(_("Keybinding theme"), "org.gnome.desktop.interface", "gtk-key-theme", self._load_keybinding_themes()) + keybindingThemeSwitcher = GSettingsComboBox(_("Keybinding theme"), "org.gnome.desktop.interface", "gtk-key-theme", None, self._load_keybinding_themes()) other_settings_box.pack_start(keybindingThemeSwitcher, False, False, 2) - iconThemeSwitcher = GSettingsComboBox(_("Icon theme"), "org.gnome.desktop.interface", "icon-theme", self._load_icon_themes()) + iconThemeSwitcher = GSettingsComboBox(_("Icon theme"), "org.gnome.desktop.interface", "icon-theme", None, self._load_icon_themes()) other_settings_box.pack_start(iconThemeSwitcher, False, False, 2) - gtkThemeSwitcher = GSettingsComboBox(_("GTK+ theme"), "org.gnome.desktop.interface", "gtk-theme", self._load_gtk_themes()) + gtkThemeSwitcher = GSettingsComboBox(_("GTK+ theme"), "org.gnome.desktop.interface", "gtk-theme", None, self._load_gtk_themes()) other_settings_box.pack_start(gtkThemeSwitcher, False, False, 2) notebook.append_page(scrolledWindow, Gtk.Label(_("Other settings"))) @@ -966,20 +984,39 @@ def on_my_value_changed(self, widget): class GSettingsCheckButton(Gtk.CheckButton): - def __init__(self, label, schema, key): + def __init__(self, label, schema, key, dep_key): self.key = key + self.dep_key = dep_key super(GSettingsCheckButton, self).__init__(label) self.settings = Gio.Settings.new(schema) self.set_active(self.settings.get_boolean(self.key)) self.settings.connect("changed::"+self.key, self.on_my_setting_changed) - self.connect('toggled', self.on_my_value_changed) - + self.connectorId = self.connect('toggled', self.on_my_value_changed) + self.dependency_invert = False + if self.dep_key is not None: + if self.dep_key[0] == '!': + self.dependency_invert = True + self.dep_key = self.dep_key[1:] + split = self.dep_key.split('/') + self.dep_settings = Gio.Settings.new(split[0]) + self.dep_key = split[1] + self.dep_settings.connect("changed::"+self.dep_key, self.on_dependency_setting_changed) + self.on_dependency_setting_changed(self, None) + def on_my_setting_changed(self, settings, key): - self.set_active(self.settings.get_boolean(self.key)) - + self.disconnect(self.connectorId) # panel-edit-mode can trigger changed:: twice in certain instances, + self.set_active(self.settings.get_boolean(self.key)) # so disconnect temporarily when we're simply updating the widget state + self.connectorId = self.connect('toggled', self.on_my_value_changed) + def on_my_value_changed(self, widget): self.settings.set_boolean(self.key, self.get_active()) - + + def on_dependency_setting_changed(self, settings, dep_key): + if not self.dependency_invert: + self.set_sensitive(self.dep_settings.get_boolean(self.dep_key)) + else: + self.set_sensitive(not self.dep_settings.get_boolean(self.dep_key)) + class DBusCheckButton(Gtk.CheckButton): def __init__(self, label, service, path, get_method, set_method): super(DBusCheckButton, self).__init__(label) @@ -994,8 +1031,9 @@ def on_my_value_changed(self, widget): getattr(self.dbus_iface, self.dbus_set_method)(self.get_active()) class GSettingsSpinButton(Gtk.HBox): - def __init__(self, label, schema, key, min, max, step, page, units): + def __init__(self, label, schema, key, dep_key, min, max, step, page, units): self.key = key + self.dep_key = dep_key super(GSettingsSpinButton, self).__init__() self.label = Gtk.Label(label) self.content_widget = Gtk.SpinButton() @@ -1009,21 +1047,37 @@ def __init__(self, label, schema, key, min, max, step, page, units): self.content_widget.set_range(min, max) self.content_widget.set_increments(step, page) #self.content_widget.set_editable(False) - self.settings = Gio.Settings.new(schema) self.content_widget.set_value(self.settings.get_int(self.key)) self.settings.connect("changed::"+self.key, self.on_my_setting_changed) self.content_widget.connect('focus-out-event', self.on_my_value_changed) - + self.dependency_invert = False + if self.dep_key is not None: + if self.dep_key[0] == '!': + self.dependency_invert = True + self.dep_key = self.dep_key[1:] + split = self.dep_key.split('/') + self.dep_settings = Gio.Settings.new(split[0]) + self.dep_key = split[1] + self.dep_settings.connect("changed::"+self.dep_key, self.on_dependency_setting_changed) + self.on_dependency_setting_changed(self, None) + def on_my_setting_changed(self, settings, key): self.content_widget.set_value(self.settings.get_int(self.key)) - + def on_my_value_changed(self, widget, data): self.settings.set_int(self.key, self.content_widget.get_value()) + def on_dependency_setting_changed(self, settings, dep_key): + if not self.dependency_invert: + self.set_sensitive(self.dep_settings.get_boolean(self.dep_key)) + else: + self.set_sensitive(not self.dep_settings.get_boolean(self.dep_key)) + class GSettingsEntry(Gtk.HBox): - def __init__(self, label, schema, key): + def __init__(self, label, schema, key, dep_key): self.key = key + self.dep_key = dep_key super(GSettingsEntry, self).__init__() self.label = Gtk.Label(label) self.content_widget = Gtk.Entry() @@ -1033,18 +1087,34 @@ def __init__(self, label, schema, key): self.content_widget.set_text(self.settings.get_string(self.key)) self.settings.connect("changed::"+self.key, self.on_my_setting_changed) self.content_widget.connect('focus-out-event', self.on_my_value_changed) - - self.content_widget.show_all() - + self.content_widget.show_all() + self.dependency_invert = False + if self.dep_key is not None: + if self.dep_key[0] == '!': + self.dependency_invert = True + self.dep_key = self.dep_key[1:] + split = self.dep_key.split('/') + self.dep_settings = Gio.Settings.new(split[0]) + self.dep_key = split[1] + self.dep_settings.connect("changed::"+self.dep_key, self.on_dependency_setting_changed) + self.on_dependency_setting_changed(self, None) + def on_my_setting_changed(self, settings, key): self.content_widget.set_text(self.settings.get_string(self.key)) - + def on_my_value_changed(self, event, widget): self.settings.set_string(self.key, self.content_widget.get_text()) + def on_dependency_setting_changed(self, settings, dep_key): + if not self.dependency_invert: + self.set_sensitive(self.dep_settings.get_boolean(self.dep_key)) + else: + self.set_sensitive(not self.dep_settings.get_boolean(self.dep_key)) + class GSettingsFileChooser(Gtk.HBox): - def __init__(self, label, schema, key, show_none_cb = False): + def __init__(self, label, schema, key, dep_key, show_none_cb = False): self.key = key + self.dep_key = dep_key super(GSettingsFileChooser, self).__init__() self.label = Gtk.Label(label) self.content_widget = Gtk.FileChooserButton() @@ -1064,8 +1134,18 @@ def __init__(self, label, schema, key, show_none_cb = False): self.content_widget.set_filename(value) self.content_widget.connect('file-set', self.on_my_value_changed) self.show_none_cb.connect('toggled', self.on_my_value_changed) - self.content_widget.show_all() + self.dependency_invert = False + if self.dep_key is not None: + if self.dep_key[0] == '!': + self.dependency_invert = True + self.dep_key = self.dep_key[1:] + split = self.dep_key.split('/') + self.dep_settings = Gio.Settings.new(split[0]) + self.dep_key = split[1] + self.dep_settings.connect("changed::"+self.dep_key, self.on_dependency_setting_changed) + self.on_dependency_setting_changed(self, None) + def on_my_value_changed(self, widget): if self.show_none_cb.get_active(): value = "" @@ -1077,9 +1157,16 @@ def on_my_value_changed(self, widget): self.content_widget.set_sensitive(True) self.settings.set_string(self.key, value) + def on_dependency_setting_changed(self, settings, dep_key): + if not self.dependency_invert: + self.set_sensitive(self.dep_settings.get_boolean(self.dep_key)) + else: + self.set_sensitive(not self.dep_settings.get_boolean(self.dep_key)) + class GSettingsFontButton(Gtk.HBox): - def __init__(self, label, schema, key): + def __init__(self, label, schema, key, dep_key): self.key = key + self.dep_key = dep_key super(GSettingsFontButton, self).__init__() self.settings = Gio.Settings.new(schema) self.value = self.settings.get_string(key) @@ -1094,9 +1181,26 @@ def __init__(self, label, schema, key): self.pack_start(self.content_widget, False, False, 2) self.content_widget.connect('font-set', self.on_my_value_changed) self.content_widget.show_all() + self.dependency_invert = False + if self.dep_key is not None: + if self.dep_key[0] == '!': + self.dependency_invert = True + self.dep_key = self.dep_key[1:] + split = self.dep_key.split('/') + self.dep_settings = Gio.Settings.new(split[0]) + self.dep_key = split[1] + self.dep_settings.connect("changed::"+self.dep_key, self.on_dependency_setting_changed) + self.on_dependency_setting_changed(self, None) + def on_my_value_changed(self, widget): self.settings.set_string(self.key, widget.get_font_name()) + def on_dependency_setting_changed(self, settings, dep_key): + if not self.dependency_invert: + self.set_sensitive(self.dep_settings.get_boolean(self.dep_key)) + else: + self.set_sensitive(not self.dep_settings.get_boolean(self.dep_key)) + class GConfFontButton(Gtk.HBox): def __init__(self, label, key): self.key = key @@ -1118,8 +1222,9 @@ def on_my_value_changed(self, widget): self.settings.set_string(self.key, widget.get_font_name()) class GSettingsRange(Gtk.HBox): - def __init__(self, label, schema, key, **options): + def __init__(self, label, schema, key, dep_key, **options): self.key = key + self.dep_key = dep_key super(GSettingsRange, self).__init__() self.settings = Gio.Settings.new(schema) self.value = self.settings.get_double(self.key) @@ -1136,12 +1241,30 @@ def __init__(self, label, schema, key, **options): self.pack_start(self.content_widget, True, True, 2) self.content_widget.connect('value-changed', self.on_my_value_changed) self.content_widget.show_all() + self.dependency_invert = False + if self.dep_key is not None: + if self.dep_key[0] == '!': + self.dependency_invert = True + self.dep_key = self.dep_key[1:] + split = self.dep_key.split('/') + self.dep_settings = Gio.Settings.new(split[0]) + self.dep_key = split[1] + self.dep_settings.connect("changed::"+self.dep_key, self.on_dependency_setting_changed) + self.on_dependency_setting_changed(self, None) + def on_my_value_changed(self, widget): self.settings.set_double(self.key, widget.get_value()) + def on_dependency_setting_changed(self, settings, dep_key): + if not self.dependency_invert: + self.set_sensitive(self.dep_settings.get_boolean(self.dep_key)) + else: + self.set_sensitive(not self.dep_settings.get_boolean(self.dep_key)) + class GSettingsRangeSpin(Gtk.HBox): - def __init__(self, label, schema, key, **options): + def __init__(self, label, schema, key, dep_key, **options): self.key = key + self.dep_key = dep_key super(GSettingsRangeSpin, self).__init__() self.label = Gtk.Label(label) self.content_widget = Gtk.SpinButton() @@ -1163,6 +1286,16 @@ def __init__(self, label, schema, key, **options): self.settings.connect("changed::"+self.key, self.on_my_setting_changed) self.content_widget.connect('value-changed', self.on_my_value_changed) + self.dependency_invert = False + if self.dep_key is not None: + if self.dep_key[0] == '!': + self.dependency_invert = True + self.dep_key = self.dep_key[1:] + split = self.dep_key.split('/') + self.dep_settings = Gio.Settings.new(split[0]) + self.dep_key = split[1] + self.dep_settings.connect("changed::"+self.dep_key, self.on_dependency_setting_changed) + self.on_dependency_setting_changed(self, None) def on_my_setting_changed(self, settings, key): self.content_widget.set_value(self.settings.get_double(self.key)) @@ -1170,9 +1303,16 @@ def on_my_setting_changed(self, settings, key): def on_my_value_changed(self, widget): self.settings.set_double(self.key, self.content_widget.get_value()) + def on_dependency_setting_changed(self, settings, dep_key): + if not self.dependency_invert: + self.set_sensitive(self.dep_settings.get_boolean(self.dep_key)) + else: + self.set_sensitive(not self.dep_settings.get_boolean(self.dep_key)) + class GSettingsComboBox(Gtk.HBox): - def __init__(self, label, schema, key, options): + def __init__(self, label, schema, key, dep_key, options): self.key = key + self.dep_key = dep_key super(GSettingsComboBox, self).__init__() self.settings = Gio.Settings.new(schema) self.value = self.settings.get_string(self.key) @@ -1200,13 +1340,29 @@ def __init__(self, label, schema, key, options): self.pack_start(self.content_widget, False, False, 2) self.content_widget.connect('changed', self.on_my_value_changed) self.content_widget.show_all() - - + self.dependency_invert = False + self.dependency_invert = False + if self.dep_key is not None: + if self.dep_key[0] == '!': + self.dependency_invert = True + self.dep_key = self.dep_key[1:] + split = self.dep_key.split('/') + self.dep_settings = Gio.Settings.new(split[0]) + self.dep_key = split[1] + self.dep_settings.connect("changed::"+self.dep_key, self.on_dependency_setting_changed) + self.on_dependency_setting_changed(self, None) + def on_my_value_changed(self, widget): tree_iter = widget.get_active_iter() if tree_iter != None: value = self.model[tree_iter][0] - self.settings.set_string(self.key, value) + self.settings.set_string(self.key, value) + + def on_dependency_setting_changed(self, settings, dep_key): + if not self.dependency_invert: + self.set_sensitive(self.dep_settings.get_boolean(self.dep_key)) + else: + self.set_sensitive(not self.dep_settings.get_boolean(self.dep_key)) class TimeZoneSelectorWidget(Gtk.HBox): def __init__(self): @@ -1580,35 +1736,37 @@ def __init__(self): sidePage = SidePage(_("Menu"), "menu.svg", self.content_box) self.sidePages.append((sidePage, "menu")) - sidePage.add_widget(GSettingsEntry(_("Menu text"), "org.cinnamon", "menu-text")) - sidePage.add_widget(GSettingsFileChooser(_("Menu icon"), "org.cinnamon", "menu-icon", True)) - sidePage.add_widget(GSettingsSpinButton(_("Menu hover delay"), "org.cinnamon", "menu-hover-delay", 0, 2000, 50, 200, _("milliseconds"))) - sidePage.add_widget(GSettingsCheckButton(_("Activate menu on hover"), "org.cinnamon", "activate-menu-applet-on-hover")) - sidePage.add_widget(GSettingsCheckButton(_("Show bookmarks and places"), "org.cinnamon", "menu-show-places")) - sidePage.add_widget(GSettingsCheckButton(_("Show recent files"), "org.cinnamon", "menu-show-recent")) + sidePage.add_widget(GSettingsEntry(_("Menu text"), "org.cinnamon", "menu-text", None)) + sidePage.add_widget(GSettingsFileChooser(_("Menu icon"), "org.cinnamon", "menu-icon", None, True)) + sidePage.add_widget(GSettingsSpinButton(_("Menu hover delay"), "org.cinnamon", "menu-hover-delay", None, 0, 2000, 50, 200, _("milliseconds"))) + sidePage.add_widget(GSettingsCheckButton(_("Activate menu on hover"), "org.cinnamon", "activate-menu-applet-on-hover", None)) + sidePage.add_widget(GSettingsCheckButton(_("Show bookmarks and places"), "org.cinnamon", "menu-show-places", None)) + sidePage.add_widget(GSettingsCheckButton(_("Show recent files"), "org.cinnamon", "menu-show-recent", None)) sidePage = SidePage(_("Panel"), "panel.svg", self.content_box) self.sidePages.append((sidePage, "panel")) - sidePage.add_widget(GSettingsCheckButton(_("Auto-hide panel"), "org.cinnamon", "panel-autohide")) - sidePage.add_widget(GSettingsSpinButton(_("Show delay"), "org.cinnamon", "panel-show-delay", 0, 2000, 50, 200, _("milliseconds"))) - sidePage.add_widget(GSettingsSpinButton(_("Hide delay"), "org.cinnamon", "panel-hide-delay", 0, 2000, 50, 200, _("milliseconds"))) + sidePage.add_widget(GSettingsCheckButton(_("Auto-hide panel"), "org.cinnamon", "panel-autohide", None)) + sidePage.add_widget(GSettingsSpinButton(_("Show delay"), "org.cinnamon", "panel-show-delay", "org.cinnamon/panel-autohide", 0, 2000, 50, 200, _("milliseconds"))) + sidePage.add_widget(GSettingsSpinButton(_("Hide delay"), "org.cinnamon", "panel-hide-delay", "org.cinnamon/panel-autohide", 0, 2000, 50, 200, _("milliseconds"))) desktop_layouts = [["traditional", _("Traditional (panel at the bottom)")], ["flipped", _("Flipped (panel at the top)")], ["classic", _("Classic (panels at the top and at the bottom)")]] - desktop_layouts_combo = GSettingsComboBox(_("Panel layout"), "org.cinnamon", "desktop-layout", desktop_layouts) + desktop_layouts_combo = GSettingsComboBox(_("Panel layout"), "org.cinnamon", "desktop-layout", None, desktop_layouts) sidePage.add_widget(desktop_layouts_combo) label = Gtk.Label() label.set_markup("%s" % _("Note: If you change the layout you will need to restart Cinnamon.")) sidePage.add_widget(label) - sidePage.add_widget(GSettingsCheckButton(_("Use customized panel size (otherwise it's defined by the theme)"), "org.cinnamon", "panel-resizable")) - sidePage.add_widget(GSettingsSpinButton(_("Top panel height"), "org.cinnamon", "panel-top-height", 0, 2000, 1, 5, _("Pixels"))) - sidePage.add_widget(GSettingsSpinButton(_("Bottom panel height"), "org.cinnamon", "panel-bottom-height", 0, 2000, 1, 5, _("Pixels"))) - sidePage.add_widget(GSettingsCheckButton(_("Panel edit mode"), "org.cinnamon", "panel-edit-mode")) - + + sidePage.add_widget(GSettingsCheckButton(_("Use customized panel size (otherwise it's defined by the theme)"), "org.cinnamon", "panel-resizable", None)) + sidePage.add_widget(GSettingsCheckButton(_("Allow Cinnamon to scale panel text and icons according to the panel heights"), "org.cinnamon", "panel-scale-text-icons", "org.cinnamon/panel-resizable")) + sidePage.add_widget(GSettingsSpinButton(_("Top panel height"), "org.cinnamon", "panel-top-height", "org.cinnamon/panel-resizable", 0, 2000, 1, 5, _("Pixels"))) + sidePage.add_widget(GSettingsSpinButton(_("Bottom panel height"), "org.cinnamon", "panel-bottom-height", "org.cinnamon/panel-resizable", 0, 2000, 1, 5, _("Pixels"))) + sidePage.add_widget(GSettingsCheckButton(_("Panel edit mode"), "org.cinnamon", "panel-edit-mode", None)) + sidePage = SidePage(_("Calendar"), "clock.svg", self.content_box) self.sidePages.append((sidePage, "calendar")) - sidePage.add_widget(GSettingsCheckButton(_("Show week dates in calendar"), "org.cinnamon.calendar", "show-weekdate")) - sidePage.add_widget(GSettingsEntry(_("Date format for the panel"), "org.cinnamon.calendar", "date-format")) - sidePage.add_widget(GSettingsEntry(_("Date format inside the date applet"), "org.cinnamon.calendar", "date-format-full")) + sidePage.add_widget(GSettingsCheckButton(_("Show week dates in calendar"), "org.cinnamon.calendar", "show-weekdate", None)) + sidePage.add_widget(GSettingsEntry(_("Date format for the panel"), "org.cinnamon.calendar", "date-format", None)) + sidePage.add_widget(GSettingsEntry(_("Date format inside the date applet"), "org.cinnamon.calendar", "date-format-full", None)) sidePage.add_widget(Gtk.LinkButton.new_with_label("http://www.foragoodstrftime.com/", _("Generate your own date formats"))) try: @@ -1633,14 +1791,14 @@ def __init__(self): sidePage = SidePage(_("Hot corner"), "overview.svg", self.content_box) self.sidePages.append((sidePage, "hotcorner")) - sidePage.add_widget(GSettingsCheckButton(_("Hot corner icon visible"), "org.cinnamon", "overview-corner-visible")) - sidePage.add_widget(GSettingsCheckButton(_("Hot corner enabled"), "org.cinnamon", "overview-corner-hover")) + sidePage.add_widget(GSettingsCheckButton(_("Hot corner icon visible"), "org.cinnamon", "overview-corner-visible", None)) + sidePage.add_widget(GSettingsCheckButton(_("Hot corner enabled"), "org.cinnamon", "overview-corner-hover", None)) box = Gtk.HBox() label = Gtk.Label() label.set_markup("%s" % _("Hot corner position:")) box.pack_start(label, False, False, 0) positions = [["topLeft", _("Top left")], ["topRight", _("Top right")], ["bottomLeft", _("Bottom left")], ["bottomRight", _("Bottom right")]] - combo = GSettingsComboBox("", "org.cinnamon", "overview-corner-position", positions) + combo = GSettingsComboBox("", "org.cinnamon", "overview-corner-position", "org.cinnamon/overview-corner-hover", positions) box.pack_start(combo, False, False, 0) sidePage.add_widget(box) @@ -1649,20 +1807,20 @@ def __init__(self): label.set_markup("%s" % _("Hot corner function:")) box.pack_start(label, False, False, 0) cornerfunctions = [["expo", _("Workspace selection (ala Compiz Expo)")], ["scale", _("Window selection (ala Compiz Scale)")]] - combo = GSettingsComboBox("", "org.cinnamon", "overview-corner-functionality", cornerfunctions) + combo = GSettingsComboBox("", "org.cinnamon", "overview-corner-functionality", "org.cinnamon/overview-corner-hover", cornerfunctions) box.pack_start(combo, False, False, 0) sidePage.add_widget(box) - sidePage.add_widget(GSettingsCheckButton(_("Expo applet: activate on hover"), "org.cinnamon", "expo-applet-hover")) - sidePage.add_widget(GSettingsCheckButton(_("Scale applet: activate on hover"), "org.cinnamon", "scale-applet-hover")) + sidePage.add_widget(GSettingsCheckButton(_("Expo applet: activate on hover"), "org.cinnamon", "expo-applet-hover", None)) + sidePage.add_widget(GSettingsCheckButton(_("Scale applet: activate on hover"), "org.cinnamon", "scale-applet-hover", None)) sidePage = ThemeViewSidePage(_("Themes"), "themes.svg", self.content_box) self.sidePages.append((sidePage, "themes")) sidePage = SidePage(_("Effects"), "desktop-effects.svg", self.content_box) self.sidePages.append((sidePage, "effects")) - sidePage.add_widget(GSettingsCheckButton(_("Enable desktop effects"), "org.cinnamon", "desktop-effects")) - sidePage.add_widget(GSettingsCheckButton(_("Enable desktop effects on dialog boxes"), "org.cinnamon", "desktop-effects-on-dialogs")) + sidePage.add_widget(GSettingsCheckButton(_("Enable desktop effects"), "org.cinnamon", "desktop-effects", None)) + sidePage.add_widget(GSettingsCheckButton(_("Enable desktop effects on dialog boxes"), "org.cinnamon", "desktop-effects-on-dialogs", "org.cinnamon/desktop-effects")) # Destroy window effects transition_effects = [] @@ -1703,11 +1861,11 @@ def __init__(self): label.set_markup("%s" % _("Closing windows:")) box.pack_start(label, False, False, 0) effects = [["none", _("None")], ["scale", _("Scale")], ["fade", _("Fade")]] - combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-close-effect", effects) + combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-close-effect", "org.cinnamon/desktop-effects", effects) box.pack_start(combo, False, False, 0) - combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-close-transition", transition_effects) + combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-close-transition", "org.cinnamon/desktop-effects", transition_effects) box.pack_start(combo, False, False, 0) - spin = GSettingsSpinButton("", "org.cinnamon", "desktop-effects-close-time", 0, 2000, 50, 200, _("milliseconds")) + spin = GSettingsSpinButton("", "org.cinnamon", "desktop-effects-close-time", "org.cinnamon/desktop-effects", 0, 2000, 50, 200, _("milliseconds")) box.pack_start(spin, False, False, 0) sidePage.add_widget(box) @@ -1717,11 +1875,11 @@ def __init__(self): label.set_markup("%s" % _("Mapping windows:")) box.pack_start(label, False, False, 0) effects = [["none", _("None")], ["scale", _("Scale")], ["fade", _("Fade")]] - combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-map-effect", effects) + combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-map-effect", "org.cinnamon/desktop-effects", effects) box.pack_start(combo, False, False, 0) - combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-map-transition", transition_effects) + combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-map-transition", "org.cinnamon/desktop-effects", transition_effects) box.pack_start(combo, False, False, 0) - spin = GSettingsSpinButton("", "org.cinnamon", "desktop-effects-map-time", 0, 2000, 50, 200, _("milliseconds")) + spin = GSettingsSpinButton("", "org.cinnamon", "desktop-effects-map-time", "org.cinnamon/desktop-effects", 0, 2000, 50, 200, _("milliseconds")) box.pack_start(spin, False, False, 0) sidePage.add_widget(box) @@ -1730,12 +1888,12 @@ def __init__(self): label = Gtk.Label() label.set_markup("%s" % _("Minimizing windows:")) box.pack_start(label, False, False, 0) - effects = [["none", _("None")], ["traditional", _("Traditional")], ["scale", _("Scale")], ["fade", _("Fade")]] - combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-minimize-effect", effects) + effects = [["none", _("None")], ["traditional", _("Traditional")], ["scale", _("Scale")], ["fade", _("Fade")]] + combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-minimize-effect", "org.cinnamon/desktop-effects", effects) box.pack_start(combo, False, False, 0) - combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-minimize-transition", transition_effects) + combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-minimize-transition", "org.cinnamon/desktop-effects", transition_effects) box.pack_start(combo, False, False, 0) - spin = GSettingsSpinButton("", "org.cinnamon", "desktop-effects-minimize-time", 0, 2000, 50, 200, _("milliseconds")) + spin = GSettingsSpinButton("", "org.cinnamon", "desktop-effects-minimize-time", "org.cinnamon/desktop-effects", 0, 2000, 50, 200, _("milliseconds")) box.pack_start(spin, False, False, 0) sidePage.add_widget(box) @@ -1745,11 +1903,11 @@ def __init__(self): label.set_markup("%s" % _("Maximizing windows:")) box.pack_start(label, False, False, 0) effects = [["none", _("None")], ["scale", _("Scale")]] - combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-maximize-effect", effects) + combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-maximize-effect", "org.cinnamon/desktop-effects", effects) box.pack_start(combo, False, False, 0) - combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-maximize-transition", transition_effects) + combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-maximize-transition", "org.cinnamon/desktop-effects", transition_effects) box.pack_start(combo, False, False, 0) - spin = GSettingsSpinButton("", "org.cinnamon", "desktop-effects-maximize-time", 0, 2000, 50, 200, _("milliseconds")) + spin = GSettingsSpinButton("", "org.cinnamon", "desktop-effects-maximize-time", "org.cinnamon/desktop-effects", 0, 2000, 50, 200, _("milliseconds")) box.pack_start(spin, False, False, 0) sidePage.add_widget(box) @@ -1758,12 +1916,12 @@ def __init__(self): label = Gtk.Label() label.set_markup("%s" % _("Unmaximizing windows:")) box.pack_start(label, False, False, 0) - effects = [["none", _("None")]] - combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-unmaximize-effect", effects) + effects = [["none", _("None")], ["scale", _("Scale")]] + combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-unmaximize-effect", "org.cinnamon/desktop-effects", effects) box.pack_start(combo, False, False, 0) - combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-unmaximize-transition", transition_effects) + combo = GSettingsComboBox("", "org.cinnamon", "desktop-effects-unmaximize-transition", "org.cinnamon/desktop-effects", transition_effects) box.pack_start(combo, False, False, 0) - spin = GSettingsSpinButton("", "org.cinnamon", "desktop-effects-unmaximize-time", 0, 2000, 50, 200, _("milliseconds")) + spin = GSettingsSpinButton("", "org.cinnamon", "desktop-effects-unmaximize-time", "org.cinnamon/desktop-effects", 0, 2000, 50, 200, _("milliseconds")) box.pack_start(spin, False, False, 0) sidePage.add_widget(box) @@ -1779,65 +1937,66 @@ def __init__(self): sidePage = SidePage(_("Desktop"), "desktop.svg", self.content_box) self.sidePages.append((sidePage, "desktop")) - sidePage.add_widget(GSettingsCheckButton(_("Have file manager handle the desktop"), "org.gnome.desktop.background", "show-desktop-icons")) + sidePage.add_widget(GSettingsCheckButton(_("Have file manager handle the desktop"), "org.gnome.desktop.background", "show-desktop-icons", None)) if "computer-icon-visible" in nautilus_desktop_keys: - sidePage.add_widget(GSettingsCheckButton(_("Computer icon visible on desktop"), "org.gnome.nautilus.desktop", "computer-icon-visible")) + sidePage.add_widget(GSettingsCheckButton(_("Computer icon visible on desktop"), "org.gnome.nautilus.desktop", "computer-icon-visible", "org.gnome.desktop.background/show-desktop-icons")) if "home-icon-visible" in nautilus_desktop_keys: - sidePage.add_widget(GSettingsCheckButton(_("Home icon visible on desktop"), "org.gnome.nautilus.desktop", "home-icon-visible")) + sidePage.add_widget(GSettingsCheckButton(_("Home icon visible on desktop"), "org.gnome.nautilus.desktop", "home-icon-visible", "org.gnome.desktop.background/show-desktop-icons")) if "network-icon-visible" in nautilus_desktop_keys: - sidePage.add_widget(GSettingsCheckButton(_("Network Servers icon visible on desktop"), "org.gnome.nautilus.desktop", "network-icon-visible")) + sidePage.add_widget(GSettingsCheckButton(_("Network Servers icon visible on desktop"), "org.gnome.nautilus.desktop", "network-icon-visible", "org.gnome.desktop.background/show-desktop-icons")) if "trash-icon-visible" in nautilus_desktop_keys: - sidePage.add_widget(GSettingsCheckButton(_("Trash icon visible on desktop"), "org.gnome.nautilus.desktop", "trash-icon-visible")) + sidePage.add_widget(GSettingsCheckButton(_("Trash icon visible on desktop"), "org.gnome.nautilus.desktop", "trash-icon-visible", "org.gnome.desktop.background/show-desktop-icons")) if "volumes-visible" in nautilus_desktop_keys: - sidePage.add_widget(GSettingsCheckButton(_("Show mounted volumes on the desktop"), "org.gnome.nautilus.desktop", "volumes-visible")) + sidePage.add_widget(GSettingsCheckButton(_("Show mounted volumes on the desktop"), "org.gnome.nautilus.desktop", "volumes-visible", "org.gnome.desktop.background/show-desktop-icons")) sidePage = SidePage(_("Windows"), "windows.svg", self.content_box) self.sidePages.append((sidePage, "windows")) sidePage.add_widget(GSettingsComboBox(_("Action on title bar double-click"), - "org.gnome.desktop.wm.preferences", "action-double-click-titlebar", + "org.gnome.desktop.wm.preferences", "action-double-click-titlebar", None, [(i, i.replace("-", " ").title()) for i in ('toggle-shade', 'toggle-maximize', 'toggle-maximize-horizontally', 'toggle-maximize-vertically', 'minimize', 'shade', 'menu', 'lower', 'none')])) sidePage.add_widget(GSettingsComboBox(_("Action on title bar middle-click"), - "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", + "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", None, [(i, i.replace("-", " ").title()) for i in ('toggle-shade', 'toggle-maximize', 'toggle-maximize-horizontally', 'toggle-maximize-vertically', 'minimize', 'shade', 'menu', 'lower', 'none')])) sidePage.add_widget(GSettingsComboBox(_("Action on title bar right-click"), - "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", + "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", None, [(i, i.replace("-", " ").title()) for i in ('toggle-shade', 'toggle-maximize', 'toggle-maximize-horizontally', 'toggle-maximize-vertically', 'minimize', 'shade', 'menu', 'lower', 'none')])) sidePage.add_widget(GSettingsComboBox(_("Window focus mode"), - "org.gnome.desktop.wm.preferences", "focus-mode", + "org.gnome.desktop.wm.preferences", "focus-mode", None, [(i, i.title()) for i in ("click","sloppy","mouse")])) sidePage.add_widget(TitleBarButtonsOrderSelector()) - sidePage.add_widget(GSettingsCheckButton(_("Enable Edge Tiling (\"Aero Snap\")"), "org.cinnamon.overrides", "edge-tiling")) - sidePage.add_widget(GSettingsCheckButton(_("Enable Edge Flip"), "org.cinnamon", "enable-edge-flip")) - sidePage.add_widget(GSettingsCheckButton(_("Attach dialog windows to their parent window's titlebar"), "org.cinnamon.overrides", "attach-modal-dialogs")) + sidePage.add_widget(GSettingsCheckButton(_("Enable Edge Tiling (\"Aero Snap\")"), "org.cinnamon.overrides", "edge-tiling", None)) + sidePage.add_widget(GSettingsCheckButton(_("Enable Edge Flip"), "org.cinnamon", "enable-edge-flip", None)) + sidePage.add_widget(GSettingsCheckButton(_("Attach dialog windows to their parent window's titlebar"), "org.cinnamon.overrides", "attach-modal-dialogs", None)) alttab_styles = [["icons", _("Icons only")],["icons+thumbnails", _("Icons and thumbnails")],["icons+preview", _("Icons and window preview")],["preview", _("Window preview (no icons)")]] - alttab_styles_combo = GSettingsComboBox(_("ALT-tab switcher style"), "org.cinnamon", "alttab-switcher-style", alttab_styles) + alttab_styles_combo = GSettingsComboBox(_("ALT-tab switcher style"), "org.cinnamon", "alttab-switcher-style", None, alttab_styles) sidePage.add_widget(alttab_styles_combo) + sidePage.add_widget(GSettingsCheckButton(_("Enable mouse-wheel scrolling in Window List applet"), "org.cinnamon", "window-list-applet-scroll", None)) sidePage = SidePage(_("Workspaces"), "workspaces.svg", self.content_box) self.sidePages.append((sidePage, "workspaces")) - sidePage.add_widget(GSettingsCheckButton(_("Enable workspace OSD"), "org.cinnamon", "workspace-osd-visible")) - sidePage.add_widget(GSettingsSpinButton(_("Workspace OSD duration"), "org.cinnamon", "workspace-osd-duration", 0, 2000, 50, 400, _("milliseconds"))) - sidePage.add_widget(GSettingsSpinButton(_("Workspace OSD horizontal position"), "org.cinnamon", "workspace-osd-x", 0, 100, 5, 50, _("percent of the monitor's width"))) - sidePage.add_widget(GSettingsSpinButton(_("Workspace OSD vertical position"), "org.cinnamon", "workspace-osd-y", 0, 100, 5, 50, _("percent of the monitor's height"))) - sidePage.add_widget(GSettingsCheckButton(_("Only use workspaces on primary monitor (requires Cinnamon restart)"), "org.cinnamon.overrides", "workspaces-only-on-primary")) - sidePage.add_widget(GSettingsCheckButton(_("Display Expo view as a grid"), "org.cinnamon", "workspace-expo-view-as-grid")) + sidePage.add_widget(GSettingsCheckButton(_("Enable workspace OSD"), "org.cinnamon", "workspace-osd-visible", None)) + sidePage.add_widget(GSettingsSpinButton(_("Workspace OSD duration"), "org.cinnamon", "workspace-osd-duration", "org.cinnamon/workspace-osd-visible", 0, 2000, 50, 400, _("milliseconds"))) + sidePage.add_widget(GSettingsSpinButton(_("Workspace OSD horizontal position"), "org.cinnamon", "workspace-osd-x", "org.cinnamon/workspace-osd-visible", 0, 100, 5, 50, _("percent of the monitor's width"))) + sidePage.add_widget(GSettingsSpinButton(_("Workspace OSD vertical position"), "org.cinnamon", "workspace-osd-y", "org.cinnamon/workspace-osd-visible", 0, 100, 5, 50, _("percent of the monitor's height"))) + sidePage.add_widget(GSettingsCheckButton(_("Only use workspaces on primary monitor (requires Cinnamon restart)"), "org.cinnamon.overrides", "workspaces-only-on-primary", None)) + sidePage.add_widget(GSettingsCheckButton(_("Display Expo view as a grid"), "org.cinnamon", "workspace-expo-view-as-grid", None)) sidePage = SidePage(_("Fonts"), "fonts.svg", self.content_box) self.sidePages.append((sidePage, "fonts")) - sidePage.add_widget(GSettingsRangeSpin(_("Text scaling factor"), "org.gnome.desktop.interface", "text-scaling-factor", adjustment_step = 0.1)) - sidePage.add_widget(GSettingsFontButton(_("Default font"), "org.gnome.desktop.interface", "font-name")) - sidePage.add_widget(GSettingsFontButton(_("Document font"), "org.gnome.desktop.interface", "document-font-name")) - sidePage.add_widget(GSettingsFontButton(_("Monospace font"), "org.gnome.desktop.interface", "monospace-font-name")) - sidePage.add_widget(GSettingsFontButton(_("Window title font"), "org.gnome.desktop.wm.preferences", "titlebar-font")) - sidePage.add_widget(GSettingsComboBox(_("Hinting"), "org.gnome.settings-daemon.plugins.xsettings", "hinting", [(i, i.title()) for i in ("none", "slight", "medium", "full")])) - sidePage.add_widget(GSettingsComboBox(_("Antialiasing"), "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", [(i, i.title()) for i in ("none", "grayscale", "rgba")])) + sidePage.add_widget(GSettingsRangeSpin(_("Text scaling factor"), "org.gnome.desktop.interface", "text-scaling-factor", None, adjustment_step = 0.1)) + sidePage.add_widget(GSettingsFontButton(_("Default font"), "org.gnome.desktop.interface", "font-name", None)) + sidePage.add_widget(GSettingsFontButton(_("Document font"), "org.gnome.desktop.interface", "document-font-name", None)) + sidePage.add_widget(GSettingsFontButton(_("Monospace font"), "org.gnome.desktop.interface", "monospace-font-name", None)) + sidePage.add_widget(GSettingsFontButton(_("Window title font"), "org.gnome.desktop.wm.preferences", "titlebar-font", None)) + sidePage.add_widget(GSettingsComboBox(_("Hinting"), "org.gnome.settings-daemon.plugins.xsettings", "hinting", None, [(i, i.title()) for i in ("none", "slight", "medium", "full")])) + sidePage.add_widget(GSettingsComboBox(_("Antialiasing"), "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", None, [(i, i.title()) for i in ("none", "grayscale", "rgba")])) sidePage = SidePage(_("General"), "general.svg", self.content_box) self.sidePages.append((sidePage, "general")) - sidePage.add_widget(GSettingsCheckButton(_("Log LookingGlass output to ~/.cinnamon/glass.log (Requires Cinnamon restart)"), "org.cinnamon", "enable-looking-glass-logs")) - sidePage.add_widget(GSettingsCheckButton(_("Emulate middle click by clicking both left and right buttons"), "org.gnome.settings-daemon.peripherals.mouse", "middle-button-enabled")) - sidePage.add_widget(GSettingsCheckButton(_("Display notifications"), "org.cinnamon", "display-notifications")) + sidePage.add_widget(GSettingsCheckButton(_("Log LookingGlass output to ~/.cinnamon/glass.log (Requires Cinnamon restart)"), "org.cinnamon", "enable-looking-glass-logs", None)) + sidePage.add_widget(GSettingsCheckButton(_("Emulate middle click by clicking both left and right buttons"), "org.gnome.settings-daemon.peripherals.mouse", "middle-button-enabled", None)) + sidePage.add_widget(GSettingsCheckButton(_("Display notifications"), "org.cinnamon", "display-notifications", None)) #sidePage = SidePage(_("Terminal"), "terminal", self.content_box) #self.sidePages.append(sidePage) diff --git a/files/usr/share/cinnamon/applets/a11y@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/a11y@cinnamon.org/applet.js index aec86789cd..ac9f746f01 100644 --- a/files/usr/share/cinnamon/applets/a11y@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/a11y@cinnamon.org/applet.js @@ -29,15 +29,15 @@ const KEY_TEXT_SCALING_FACTOR = 'text-scaling-factor'; const HIGH_CONTRAST_THEME = 'HighContrast'; -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { this.set_applet_icon_symbolic_name("preferences-desktop-accessibility"); @@ -204,7 +204,7 @@ MyApplet.prototype = { }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/bluetooth@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/bluetooth@cinnamon.org/applet.js index 1cf828a44f..d0d804780c 100644 --- a/files/usr/share/cinnamon/applets/bluetooth@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/bluetooth@cinnamon.org/applet.js @@ -187,15 +187,15 @@ PinNotification.prototype = { } } -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.TextIconApplet.prototype, - _init: function(orientation) { - Applet.TextIconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.TextIconApplet.prototype._init.call(this, orientation, panel_height); try { this.menuManager = new PopupMenu.PopupMenuManager(this); @@ -518,7 +518,7 @@ MyApplet.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/brightness@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/brightness@cinnamon.org/applet.js index 1f1a4ce9f0..75139fe47f 100644 --- a/files/usr/share/cinnamon/applets/brightness@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/brightness@cinnamon.org/applet.js @@ -89,15 +89,15 @@ TextImageMenuItem.prototype = { } /* end of TextImageMenuItem */ -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { this._proxy = new PowerManagerProxy(DBus.session, PowerBusName, PowerObjectPath); @@ -231,8 +231,8 @@ MyApplet.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/calendar@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/calendar@cinnamon.org/applet.js index 1837680818..fd54e45f36 100644 --- a/files/usr/share/cinnamon/applets/calendar@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/calendar@cinnamon.org/applet.js @@ -25,15 +25,15 @@ function _onVertSepRepaint (area) cr.stroke(); }; -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.TextApplet.prototype, - _init: function(orientation) { - Applet.TextApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.TextApplet.prototype._init.call(this, orientation, panel_height); try { this.menuManager = new PopupMenu.PopupMenuManager(this); @@ -158,7 +158,7 @@ MyApplet.prototype = { }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/expo@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/expo@cinnamon.org/applet.js index 2aeb587cef..e367b6ddc7 100644 --- a/files/usr/share/cinnamon/applets/expo@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/expo@cinnamon.org/applet.js @@ -3,15 +3,15 @@ const Lang = imports.lang; const Main = imports.ui.main; const Gtk = imports.gi.Gtk; -function MyApplet(metadata, orientation) { - this._init(metadata, orientation); +function MyApplet(metadata, orientation, panel_height) { + this._init(metadata, orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(metadata, orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(metadata, orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { Gtk.IconTheme.get_default().append_search_path(metadata.path); @@ -56,7 +56,7 @@ MyApplet.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(metadata, orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(metadata, orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/keyboard@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/keyboard@cinnamon.org/applet.js index ef82501ff1..783899cc7a 100644 --- a/files/usr/share/cinnamon/applets/keyboard@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/keyboard@cinnamon.org/applet.js @@ -32,15 +32,15 @@ LayoutMenuItem.prototype = { } }; -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.TextIconApplet.prototype, - _init: function(orientation) { - Applet.TextIconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.TextIconApplet.prototype._init.call(this, orientation, panel_height); try { this.menuManager = new PopupMenu.PopupMenuManager(this); @@ -172,7 +172,7 @@ MyApplet.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js index fddca0316f..37be560cc6 100644 --- a/files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js @@ -24,9 +24,11 @@ const ICON_SIZE = 16; const MAX_FAV_ICON_SIZE = 32; const CATEGORY_ICON_SIZE = 22; const APPLICATION_ICON_SIZE = 22; +const MAX_RECENT_FILES = 20; const USER_DESKTOP_PATH = FileUtils.getUserDesktopDir(); + let appsys = Cinnamon.AppSystem.get_default(); /* VisibleChildIterator takes a container (boxlayout, etc.) @@ -230,7 +232,7 @@ ApplicationButton.prototype = { _init: function(appsMenuButton, app) { GenericApplicationButton.prototype._init.call(this, appsMenuButton, app, true); - + this.category = new Array(); this.actor.set_style_class_name('menu-application-button'); this.icon = this.app.create_icon_texture(APPLICATION_ICON_SIZE); this.addActor(this.icon); @@ -261,86 +263,112 @@ ApplicationButton.prototype = { return this.actor; } }; -Signals.addSignalMethods(ApplicationButton.prototype); function PlaceButton(appsMenuButton, place, button_name) { this._init(appsMenuButton, place, button_name); } PlaceButton.prototype = { - _init: function(appsMenuButton,place, button_name) { + __proto__: PopupMenu.PopupBaseMenuItem.prototype, + + _init: function(appsMenuButton, place, button_name) { + PopupMenu.PopupBaseMenuItem.prototype._init.call(this, {hover: false}); + this.appsMenuButton = appsMenuButton; this.place = place; this.button_name = button_name; - this.actor = new St.Button({ reactive: true, style_class: 'menu-application-button', x_align: St.Align.START }); + this.actor.set_style_class_name('menu-application-button'); this.actor._delegate = this; - this.buttonbox = new St.BoxLayout(); - this.label = new St.Label({ text: this.button_name, style_class: 'menu-place-cat-button-label' }); + this.label = new St.Label({ text: this.button_name, style_class: 'menu-application-button-label' }); this.icon = place.iconFactory(APPLICATION_ICON_SIZE); - this.buttonbox.add_actor(this.icon); - this.buttonbox.add_actor(this.label); - this.actor.set_child(this.buttonbox); - this.actor.connect('clicked', Lang.bind(this, function() { + this.addActor(this.icon); + this.addActor(this.label); + }, + + _onButtonReleaseEvent: function (actor, event) { + if (event.get_button()==1){ this.place.launch(); - appsMenuButton.menu.close(); - })); + this.appsMenuButton.menu.close(); + } + }, + + activate: function(event) { + this.place.launch(); + this.appsMenuButton.menu.close(); } }; -Signals.addSignalMethods(PlaceButton.prototype); function RecentButton(appsMenuButton, file) { this._init(appsMenuButton, file); } RecentButton.prototype = { + __proto__: PopupMenu.PopupBaseMenuItem.prototype, + _init: function(appsMenuButton, file) { + PopupMenu.PopupBaseMenuItem.prototype._init.call(this, {hover: false}); this.file = file; + this.appsMenuButton = appsMenuButton; this.button_name = this.file.name; - this.actor = new St.Button({ reactive: true, style_class: 'menu-application-button', x_align: St.Align.START }); + this.actor.set_style_class_name('menu-application-button'); this.actor._delegate = this; - this.buttonbox = new St.BoxLayout(); - this.label = new St.Label({ text: this.button_name, style_class: 'menu-place-cat-button-label' }); + this.label = new St.Label({ text: this.button_name, style_class: 'menu-application-button-label' }); this.icon = file.createIcon(APPLICATION_ICON_SIZE); - this.buttonbox.add_actor(this.icon); - this.buttonbox.add_actor(this.label); - this.actor.set_child(this.buttonbox); - this.actor.connect('clicked', Lang.bind(this, function() { + this.addActor(this.icon); + this.addActor(this.label); + }, + + _onButtonReleaseEvent: function (actor, event) { + if (event.get_button()==1){ Gio.app_info_launch_default_for_uri(this.file.uri, global.create_app_launch_context()); - appsMenuButton.menu.close(); - })); + this.appsMenuButton.menu.close(); + } + }, + + activate: function(event) { + Gio.app_info_launch_default_for_uri(this.file.uri, global.create_app_launch_context()); + this.appsMenuButton.menu.close(); } }; -Signals.addSignalMethods(RecentButton.prototype); function RecentClearButton(appsMenuButton) { this._init(appsMenuButton); } RecentClearButton.prototype = { + __proto__: PopupMenu.PopupBaseMenuItem.prototype, + _init: function(appsMenuButton) { + PopupMenu.PopupBaseMenuItem.prototype._init.call(this, {hover: false}); + this.appsMenuButton = appsMenuButton; + this.actor.set_style_class_name('menu-application-button'); this.button_name = _("Clear list"); - this.actor = new St.Button({ reactive: true, style_class: 'menu-application-button', x_align: St.Align.START }); this.actor._delegate = this; - this.buttonbox = new St.BoxLayout(); - this.label = new St.Label({ text: this.button_name, style_class: 'menu-place-cat-button-label' }); - let icon = new St.Icon({ icon_name: 'edit-clear', icon_type: St.IconType.SYMBOLIC, icon_size: APPLICATION_ICON_SIZE }); - this.buttonbox.add_actor(icon); - this.buttonbox.add_actor(this.label); - this.actor.set_child(this.buttonbox); - this.actor.connect('clicked', Lang.bind(this, function() { - appsMenuButton.menu.close(); + this.label = new St.Label({ text: this.button_name, style_class: 'menu-application-button-label' }); + this.icon = new St.Icon({ icon_name: 'edit-clear', icon_type: St.IconType.SYMBOLIC, icon_size: APPLICATION_ICON_SIZE }); + this.addActor(this.icon); + this.addActor(this.label); + }, + + _onButtonReleaseEvent: function (actor, event) { + if (event.get_button()==1){ + this.appsMenuButton.menu.close(); let GtkRecent = new Gtk.RecentManager(); GtkRecent.purge_items(); - })); + } } }; -Signals.addSignalMethods(RecentClearButton.prototype); function CategoryButton(app) { this._init(app); } CategoryButton.prototype = { + __proto__: PopupMenu.PopupBaseMenuItem.prototype, + _init: function(category) { + PopupMenu.PopupBaseMenuItem.prototype._init.call(this, {hover: false}); + + this.actor.set_style_class_name('menu-category-button'); var label; if (category) { let icon = category.get_icon(); @@ -351,58 +379,52 @@ CategoryButton.prototype = { label = category.get_name(); } else label = _("All Applications"); - this.actor = new St.Button({ reactive: true, style_class: 'menu-category-button', x_align: St.Align.START }); + this.actor._delegate = this; - this.buttonbox = new St.BoxLayout(); - this.label = new St.Label({ text: label, style_class: 'menu-place-cat-button-label' }); + this.label = new St.Label({ text: label, style_class: 'menu-category-button-label' }); if (category && this.icon_name) { this.icon = new St.Icon({icon_name: this.icon_name, icon_size: CATEGORY_ICON_SIZE, icon_type: St.IconType.FULLCOLOR}); - this.buttonbox.add_actor(this.icon); + this.addActor(this.icon); } - this.buttonbox.add_actor(this.label); - this.actor.set_child(this.buttonbox); - //this.actor.set_tooltip_text(category.get_name()); + this.addActor(this.label); } }; -Signals.addSignalMethods(CategoryButton.prototype); function PlaceCategoryButton(app) { this._init(app); } PlaceCategoryButton.prototype = { + __proto__: PopupMenu.PopupBaseMenuItem.prototype, + _init: function(category) { - this.actor = new St.Button({ reactive: true, style_class: 'menu-category-button', x_align: St.Align.START }); + PopupMenu.PopupBaseMenuItem.prototype._init.call(this, {hover: false}); + this.actor.set_style_class_name('menu-category-button'); this.actor._delegate = this; - this.buttonbox = new St.BoxLayout(); - this.label = new St.Label({ text: _("Places"), style_class: 'menu-place-cat-button-label' }); + this.label = new St.Label({ text: _("Places"), style_class: 'menu-category-button-label' }); this.icon = new St.Icon({icon_name: "folder", icon_size: CATEGORY_ICON_SIZE, icon_type: St.IconType.FULLCOLOR}); - this.buttonbox.add_actor(this.icon); - this.buttonbox.add_actor(this.label); - this.actor.set_child(this.buttonbox); + this.addActor(this.icon); + this.addActor(this.label); } }; -Signals.addSignalMethods(PlaceCategoryButton.prototype); function RecentCategoryButton(app) { this._init(app); } RecentCategoryButton.prototype = { + __proto__: PopupMenu.PopupBaseMenuItem.prototype, + _init: function(category) { - this.actor = new St.Button({ reactive: true, style_class: 'menu-category-button', x_align: St.Align.START }); + PopupMenu.PopupBaseMenuItem.prototype._init.call(this, {hover: false}); + this.actor.set_style_class_name('menu-category-button'); this.actor._delegate = this; - this.buttonbox = new St.BoxLayout(); - this.label = new St.Label({ text: _("Recent Files"), style_class: 'menu-place-cat-button-label' }); + this.label = new St.Label({ text: _("Recent Files"), style_class: 'menu-category-button-label' }); this.icon = new St.Icon({icon_name: "folder-recent", icon_size: CATEGORY_ICON_SIZE, icon_type: St.IconType.FULLCOLOR}); - this.buttonbox.add_actor(this.icon); - this.buttonbox.add_actor(this.label); - this.actor.set_child(this.buttonbox); + this.addActor(this.icon); + this.addActor(this.label); } }; -Signals.addSignalMethods(RecentCategoryButton.prototype); - - function FavoritesButton(appsMenuButton, app, nbFavorites) { this._init(appsMenuButton, app, nbFavorites); @@ -625,15 +647,15 @@ FavoritesBox.prototype = { } } -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.TextIconApplet.prototype, - _init: function(orientation) { - Applet.TextIconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.TextIconApplet.prototype._init.call(this, orientation, panel_height); try { this.set_applet_tooltip(_("Menu")); @@ -701,6 +723,7 @@ MyApplet.prototype = { this._activeContainer = null; this._activeActor = null; this._applicationsBoxWidth = 0; + this.menuIsOpening = false; this.RecentManager = new DocInfo.DocManager(); @@ -708,9 +731,6 @@ MyApplet.prototype = { appsys.connect('installed-changed', Lang.bind(this, this._refreshApps)); AppFavorites.getAppFavorites().connect('changed', Lang.bind(this, this._refreshFavs)); - this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateToggled)); - - this.hover_delay = global.settings.get_int("menu-hover-delay") / 1000; global.settings.connect("changed::menu-hover-delay", Lang.bind(this, function() { this.hover_delay = global.settings.get_int("menu-hover-delay") / 1000; @@ -750,7 +770,6 @@ MyApplet.prototype = { this.menu.actor.add_style_class_name('menu-background'); this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateChanged)); - this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateToggled)); this._display(); }, @@ -782,7 +801,18 @@ MyApplet.prototype = { _onOpenStateChanged: function(menu, open) { if (open) { + this.menuIsOpening = true; this.actor.add_style_pseudo_class('active'); + global.stage.set_key_focus(this.searchEntry); + this._selectedItemIndex = null; + this._activeContainer = null; + this._activeActor = null; + let monitorHeight = Main.layoutManager.primaryMonitor.height; + let applicationsBoxHeight = this.applicationsBox.get_allocation_box().y2-this.applicationsBox.get_allocation_box().y1; + let scrollBoxHeight = (this.leftBox.get_allocation_box().y2-this.leftBox.get_allocation_box().y1) - + (this.searchBox.get_allocation_box().y2-this.searchBox.get_allocation_box().y1); + this.applicationsScrollBox.style = "height: "+scrollBoxHeight+"px;"; + this._select_category(null, this._allAppsCategoryButton); } else { this.actor.remove_style_pseudo_class('active'); if (this.searchActive) { @@ -793,6 +823,7 @@ MyApplet.prototype = { this._previousTreeItemIndex = null; this._previousTreeSelectedActor = null; this._previousSelectedActor = null; + this.closeApplicationsContextMenus(null, false); this._clearAllSelections(); } }, @@ -842,6 +873,7 @@ MyApplet.prototype = { index = this.appBoxIter.getAbsoluteIndexOfChild(item_actor); } else { this._previousSelectedActor = this.categoriesBox.get_child_at_index(index); + this._previousSelectedActor._delegate.isHovered = false; item_actor = this.catBoxIter.getPrevVisible(this._activeActor) index = this.catBoxIter.getAbsoluteIndexOfChild(item_actor); } @@ -852,6 +884,7 @@ MyApplet.prototype = { index = this.appBoxIter.getAbsoluteIndexOfChild(item_actor); } else { this._previousSelectedActor = this.categoriesBox.get_child_at_index(index); + this._previousSelectedActor._delegate.isHovered = false; item_actor = this.catBoxIter.getNextVisible(this._activeActor) index = this.catBoxIter.getAbsoluteIndexOfChild(item_actor); } @@ -874,9 +907,7 @@ MyApplet.prototype = { if (!item_actor || item_actor === this.searchEntry) { return false; } - // if (item_actor !== this._previousSelectedActor) { - item_actor._delegate.emit('enter-event'); - //} + item_actor._delegate.emit('enter-event'); return true; }, @@ -924,31 +955,6 @@ MyApplet.prototype = { this._previousSelectedActor.style_class = "menu-category-button"; } }, - - _onOpenStateToggled: function(menu, open) { - if (open) { - global.stage.set_key_focus(this.searchEntry); - this._selectedItemIndex = null; - this._activeContainer = null; - this._activeActor = null; - let monitorHeight = Main.layoutManager.primaryMonitor.height; - let applicationsBoxHeight = this.applicationsBox.get_allocation_box().y2-this.applicationsBox.get_allocation_box().y1; - let scrollBoxHeight = (this.leftBox.get_allocation_box().y2-this.leftBox.get_allocation_box().y1) - -(this.searchBox.get_allocation_box().y2-this.searchBox.get_allocation_box().y1); - - - - // if (scrollBoxHeight < (0.2*monitorHeight) && (scrollBoxHeight < applicationsBoxHeight)) { - // scrollBoxHeight = Math.min(0.2*monitorHeight, applicationsBoxHeight); - // } - this.applicationsScrollBox.style = "height: "+scrollBoxHeight+"px;"; - } else { - this.closeApplicationsContextMenus(null, false); - //this.resetSearch(); - //this._clearSelections(this.categoriesBox); - //this._clearSelections(this.applicationsBox); - } - }, _refreshApps : function() { this.applicationsBox.destroy_all_children(); @@ -960,22 +966,27 @@ MyApplet.prototype = { this.categoriesBox.destroy_all_children(); this._allAppsCategoryButton = new CategoryButton(null); - this._allAppsCategoryButton.actor.connect('clicked', Lang.bind(this, function() { - this._select_category(null, this._allAppsCategoryButton); - })); - this._addEnterEvent(this._allAppsCategoryButton, Lang.bind(this, function() { - if (!this.searchActive) { - this._allAppsCategoryButton.isHovered = true; - Tweener.addTween(this, { - time: this.hover_delay, - onComplete: function () { - if (this._allAppsCategoryButton.isHovered) { - this._allAppsCategoryButton.actor.style_class = "menu-category-button-selected"; - this._clearPrevCatSelection(this._allAppsCategoryButton.actor); - this._select_category(null, this._allAppsCategoryButton); - } - } - }); + this._addEnterEvent(this._allAppsCategoryButton, Lang.bind(this, function() { + if (!this.searchActive) { + this._allAppsCategoryButton.isHovered = true; + if (this.hover_delay > 0) { + Tweener.addTween(this, { + time: this.hover_delay, + onComplete: function () { + if (this._allAppsCategoryButton.isHovered) { + this._allAppsCategoryButton.actor.style_class = "menu-category-button-selected"; + this._clearPrevCatSelection(this._allAppsCategoryButton.actor); + this._select_category(null, this._allAppsCategoryButton); + } else { + this._allAppsCategoryButton.actor.style_class = "menu-category-button"; + } + } + }); + } else { + this._allAppsCategoryButton.actor.style_class = "menu-category-button-selected"; + this._clearPrevCatSelection(this._allAppsCategoryButton.actor); + this._select_category(null, this._allAppsCategoryButton); + } } })); this._allAppsCategoryButton.actor.connect('leave-event', Lang.bind(this, function () { @@ -1004,22 +1015,27 @@ MyApplet.prototype = { this._loadCategory(dir); if (this.applicationsByCategory[dir.get_menu_id()].length>0){ let categoryButton = new CategoryButton(dir); - categoryButton.actor.connect('clicked', Lang.bind(this, function() { - this._select_category(dir, categoryButton); - })); this._addEnterEvent(categoryButton, Lang.bind(this, function() { if (!this.searchActive) { categoryButton.isHovered = true; - Tweener.addTween(this, { - time: this.hover_delay, - onComplete: function () { - if (categoryButton.isHovered) { - categoryButton.actor.style_class = "menu-category-button-selected"; - this._clearPrevCatSelection(categoryButton.actor); - this._select_category(dir, categoryButton); + if (this.hover_delay > 0) { + Tweener.addTween(this, { + time: this.hover_delay, + onComplete: function () { + if (categoryButton.isHovered) { + categoryButton.actor.style_class = "menu-category-button-selected"; + this._clearPrevCatSelection(categoryButton.actor); + this._select_category(dir, categoryButton); + } else { + categoryButton.actor.style_class = "menu-category-button"; + } } - } - }); + }); + } else { + categoryButton.actor.style_class = "menu-category-button-selected"; + this._clearPrevCatSelection(categoryButton.actor); + this._select_category(dir, categoryButton); + } } })); categoryButton.actor.connect('leave-event', Lang.bind(this, function () { @@ -1049,9 +1065,6 @@ MyApplet.prototype = { // Now generate Places category and places buttons and add to the list if (this.showPlaces) { this.placesButton = new PlaceCategoryButton(); - this.placesButton.actor.connect('clicked', Lang.bind(this, function() { - this._displayButtons(null, -1); - })); this._addEnterEvent(this.placesButton, Lang.bind(this, function() { if (!this.searchActive) { this.placesButton.isHovered = true; @@ -1086,10 +1099,12 @@ MyApplet.prototype = { this._clearPrevAppSelection(button.actor); button.actor.style_class = "menu-application-button-selected"; this._scrollToButton(button); + this.selectedAppDescription.set_text(button.place.id.slice(16)); })); button.actor.connect('leave-event', Lang.bind(this, function() { button.actor.style_class = "menu-application-button"; this._previousSelectedActor = button.actor; + this.selectedAppDescription.set_text(""); })); this._placesButtons.push(button); this.applicationsBox.add_actor(button.actor); @@ -1098,9 +1113,6 @@ MyApplet.prototype = { // Now generate recent category and recent files buttons and add to the list if (this.showRecent) { this.recentButton = new RecentCategoryButton(); - this.recentButton.actor.connect('clicked', Lang.bind(this, function() { - this._displayButtons(null, null, -1); - })); this._addEnterEvent(this.recentButton, Lang.bind(this, function() { if (!this.searchActive) { this.recentButton.isHovered = true; @@ -1125,7 +1137,7 @@ MyApplet.prototype = { })); this.categoriesBox.add_actor(this.recentButton.actor); - for (let id = 0; id < 15 && id < this.RecentManager._infosByTimestamp.length; id++) { + for (let id = 0; id < MAX_RECENT_FILES && id < this.RecentManager._infosByTimestamp.length; id++) { let button = new RecentButton(this, this.RecentManager._infosByTimestamp[id]); this._addEnterEvent(button, Lang.bind(this, function() { this._clearPrevAppSelection(button.actor); @@ -1269,34 +1281,45 @@ MyApplet.prototype = { if (!dupe) { let applicationButton = new ApplicationButton(this, app); applicationButton.actor.connect('realize', Lang.bind(this, this._onApplicationButtonRealized)); - applicationButton.actor.connect('leave-event', Lang.bind(this, function() { - this._previousSelectedActor = applicationButton.actor; - applicationButton.actor.style_class = "menu-application-button"; - this.selectedAppTitle.set_text(""); - this.selectedAppDescription.set_text(""); - })); - this._addEnterEvent(applicationButton, Lang.bind(this, function() { - this.selectedAppTitle.set_text(applicationButton.app.get_name()); - if (applicationButton.app.get_description()) - this.selectedAppDescription.set_text(applicationButton.app.get_description()); - else - this.selectedAppDescription.set_text(""); - this._clearPrevAppSelection(applicationButton.actor); - applicationButton.actor.style_class = "menu-application-button-selected"; - this._scrollToButton(applicationButton); - })); + applicationButton.actor.connect('leave-event', Lang.bind(this, this._appLeaveEvent, applicationButton)); + this._addEnterEvent(applicationButton, Lang.bind(this, this._appEnterEvent, applicationButton)); this._applicationsButtons.push(applicationButton); + applicationButton.category.push(dir.get_menu_id()); this.applicationsByCategory[dir.get_menu_id()].push(app.get_name()); } else { - this.applicationsByCategory[dir.get_menu_id()].push(app.get_name()); + for (let i = 0; i < this._applicationsButtons.length; i++) { + if (this._applicationsButtons[i].app == app) { + this._applicationsButtons[i].category.push(dir.get_menu_id()); + } + } } } } else if (nextType == GMenu.TreeItemType.DIRECTORY) { - this._loadCategory(iter.get_directory(), top_dir); + subdir = iter.get_directory(); + this.applicationsByCategory[subdir.get_menu_id()] = new Array(); + this._loadCategory(subdir, top_dir); } } }, + _appLeaveEvent: function(a, b, applicationButton) { + this._previousSelectedActor = applicationButton.actor; + applicationButton.actor.style_class = "menu-application-button"; + this.selectedAppTitle.set_text(""); + this.selectedAppDescription.set_text(""); + }, + + _appEnterEvent: function(applicationButton) { + this.selectedAppTitle.set_text(applicationButton.app.get_name()); + if (applicationButton.app.get_description()) + this.selectedAppDescription.set_text(applicationButton.app.get_description()); + else + this.selectedAppDescription.set_text(""); + this._clearPrevAppSelection(applicationButton.actor); + applicationButton.actor.style_class = "menu-application-button-selected"; + this._scrollToButton(applicationButton); + }, + find_dupe: function(app) { let ret = false; for (let i = 0; i < this._applicationsButtons.length; i++) { @@ -1438,63 +1461,97 @@ MyApplet.prototype = { } }, - _displayButtons: function(apps, places, recent){ - if (apps) { - if (apps[0] == "all") { - for (let i = 0; i < this._applicationsButtons.length; i++) { - this._applicationsButtons[i].actor.show(); - } + _displayButtons: function(appCategory, places, recent, apps){ + if (appCategory) { + if (appCategory == "all") { + this._applicationsButtons.forEach( function (item, index) { + if (!item.actor.visible) { + item.actor.show(); + } + }); } else { - for (let i = 0; i < this._applicationsButtons.length; i++) { + this._applicationsButtons.forEach( function (item, index) { + if (item.category.indexOf(appCategory) != -1) { + if (!item.actor.visible) { + item.actor.show(); + } + } else { + if (item.actor.visible) { + item.actor.hide(); + } + } + }); + } + } else if (apps) { + for (let i = 0; i < this._applicationsButtons.length; i++) { if (apps.indexOf(this._applicationsButtons[i].name) != -1) { - this._applicationsButtons[i].actor.show(); + if (!this._applicationsButtons[i].actor.visible) { + this._applicationsButtons[i].actor.show(); + } } else { - this._applicationsButtons[i].actor.hide(); + if (this._applicationsButtons[i].actor.visible) { + this._applicationsButtons[i].actor.hide(); + } } - } } } else { - for (let i = 0; i < this._applicationsButtons.length; i++) { - this._applicationsButtons[i].actor.hide(); - } + this._applicationsButtons.forEach( function (item, index) { + if (item.actor.visible) { + item.actor.hide(); + } + }); } if (places) { if (places == -1) { - for (let i = 0; i < this._placesButtons.length; i++) { - this._placesButtons[i].actor.show(); - } + this._placesButtons.forEach( function (item, index) { + item.actor.show(); + }); } else { for (let i = 0; i < this._placesButtons.length; i++) { if (places.indexOf(this._placesButtons[i].button_name) != -1) { - this._placesButtons[i].actor.show(); + if (!this._placesButtons[i].actor.visible) { + this._placesButtons[i].actor.show(); + } } else { - this._placesButtons[i].actor.hide(); + if (this._placesButtons[i].actor.visible) { + this._placesButtons[i].actor.hide(); + } } } } } else { - for (let i = 0; i < this._placesButtons.length; i++) { - this._placesButtons[i].actor.hide(); - } + this._placesButtons.forEach( function (item, index) { + if (item.actor.visible) { + item.actor.hide(); + } + }); } if (recent) { if (recent == -1) { - for (let i = 0; i < this._recentButtons.length; i++) { - this._recentButtons[i].actor.show(); - } + this._recentButtons.forEach( function (item, index) { + if (!item.actor.visible) { + item.actor.show(); + } + }); } else { for (let i = 0; i < this._recentButtons.length; i++) { if (recent.indexOf(this._recentButtons[i].button_name) != -1) { - this._recentButtons[i].actor.show(); + if (!this._recentButtons[i].actor.visible) { + this._recentButtons[i].actor.show(); + } } else { - this._recentButtons[i].actor.hide(); + if (this._recentButtons[i].actor.visible) { + this._recentButtons[i].actor.hide(); + } } } } } else { - for (let i = 0; i < this._recentButtons.length; i++) { - this._recentButtons[i].actor.hide(); - } + this._recentButtons.forEach( function (item, index) { + if (item.actor.visible) { + item.actor.hide(); + } + }); } }, @@ -1523,40 +1580,43 @@ MyApplet.prototype = { }, _onSearchTextChanged: function (se, prop) { - this.searchActive = this.searchEntry.get_text() != ''; - this._clearAllSelections(); - if (this.searchActive) { - this.searchEntry.set_secondary_icon(this._searchActiveIcon); - if (this._searchIconClickedId == 0) { - this._searchIconClickedId = this.searchEntry.connect('secondary-icon-clicked', - Lang.bind(this, function() { - this.resetSearch(); - this._select_category(null, this._allAppsCategoryButton); - })); - } - - this._setCategoriesButtonActive(false); + if (this.menuIsOpening) { + this.menuIsOpening = false; + return; } else { - if (this._searchIconClickedId > 0) - this.searchEntry.disconnect(this._searchIconClickedId); - this._searchIconClickedId = 0; - - this.searchEntry.set_secondary_icon(this._searchInactiveIcon); - this._setCategoriesButtonActive(true); - this._select_category(null, this._allAppsCategoryButton); - } - if (!this.searchActive) { - if (this._searchTimeoutId > 0) { - Mainloop.source_remove(this._searchTimeoutId); - this._searchTimeoutId = 0; + this.searchActive = this.searchEntry.get_text() != ''; + this._clearAllSelections(); + if (this.searchActive) { + this.searchEntry.set_secondary_icon(this._searchActiveIcon); + if (this._searchIconClickedId == 0) { + this._searchIconClickedId = this.searchEntry.connect('secondary-icon-clicked', + Lang.bind(this, function() { + this.resetSearch(); + this._select_category(null, this._allAppsCategoryButton); + })); + } + this._setCategoriesButtonActive(false); + } else { + if (this._searchIconClickedId > 0) + this.searchEntry.disconnect(this._searchIconClickedId); + this._searchIconClickedId = 0; + this.searchEntry.set_secondary_icon(this._searchInactiveIcon); + this._setCategoriesButtonActive(true); + this._select_category(null, this._allAppsCategoryButton); } - return; + if (!this.searchActive) { + if (this._searchTimeoutId > 0) { + Mainloop.source_remove(this._searchTimeoutId); + this._searchTimeoutId = 0; + } + return; + } + if (this._searchTimeoutId > 0) + return; + this._searchTimeoutId = Mainloop.timeout_add(150, Lang.bind(this, this._doSearch)); } - if (this._searchTimeoutId > 0) - return; - this._searchTimeoutId = Mainloop.timeout_add(150, Lang.bind(this, this._doSearch)); }, - + _listBookmarks: function(pattern){ let bookmarks = Main.placesManager.getBookmarks(); var res = new Array(); @@ -1578,9 +1638,9 @@ MyApplet.prototype = { _listApplications: function(category_menu_id, pattern){ var applist = new Array(); if (category_menu_id) { - applist = this.applicationsByCategory[category_menu_id]; + applist = category_menu_id; } else { - applist.push('all'); + applist = "all"; } let res; if (pattern){ @@ -1627,7 +1687,7 @@ MyApplet.prototype = { recentResults.push(this._recentButtons[i].button_name); } - this._displayButtons(appResults, placesResults, recentResults); + this._displayButtons(null, placesResults, recentResults, appResults); this.appBoxIter.reloadVisible(); if (this.appBoxIter.getNumVisibleChildren() > 0) { @@ -1642,7 +1702,7 @@ MyApplet.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js index c782a14dad..fe22419997 100644 --- a/files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js @@ -1595,15 +1595,15 @@ NMMessageTraySource.prototype = { } }; -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { this.menuManager = new PopupMenu.PopupMenuManager(this); @@ -2186,7 +2186,7 @@ MyApplet.prototype = { }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js index 9e07de0a49..8dcfa151dd 100644 --- a/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js @@ -14,15 +14,15 @@ const NotificationDestroyedReason = imports.ui.messageTray.NotificationDestroyed let MT = Main.messageTray; -function MyApplet(metadata, orientation) { - this._init(metadata, orientation); +function MyApplet(metadata, orientation, panel_height) { + this._init(metadata, orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.TextIconApplet.prototype, - _init: function(metadata, orientation) { - Applet.TextIconApplet.prototype._init.call(this, orientation); + _init: function(metadata, orientation, panel_height) { + Applet.TextIconApplet.prototype._init.call(this, orientation, panel_height); try { Gtk.IconTheme.get_default().append_search_path(metadata.path); @@ -52,7 +52,7 @@ MyApplet.prototype = { this.clear_action = new PopupMenu.PopupMenuItem(_("Clear notifications")); this.menu.addMenuItem(this.clear_action); this.clear_action.connect('activate', Lang.bind(this, this._clear_all)); - + this.clear_action.actor.hide(); this.scrollview = new St.ScrollView({ x_fill: true, y_fill: true, y_align: St.Align.START}); this._maincontainer.add(this.scrollview); @@ -78,11 +78,14 @@ MyApplet.prototype = { notification.actor.unparent(); let existing_index = this.notifications.indexOf(notification); if (existing_index != -1) { + notification._inNotificationBin = true; notification.actor.reparent(this._notificationbin); notification.expand(); + notification._timeLabel.show(); this.update_list(); return; } + notification._inNotificationBin = true; this.notifications.push(notification); notification.expand(); this._notificationbin.add(notification.actor) @@ -90,6 +93,7 @@ MyApplet.prototype = { notification.actor.add_style_class_name('notification-applet-padding'); notification.connect('clicked', Lang.bind(this, this._item_clicked)); notification.connect('destroy', Lang.bind(this, this._item_clicked)); + notification._timeLabel.show(); this.update_list(); }, @@ -210,8 +214,8 @@ MyApplet.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(metadata, orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(metadata, orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/add-panel-launcher.glade b/files/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/add-panel-launcher.glade new file mode 100644 index 0000000000..41bcf04c46 --- /dev/null +++ b/files/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/add-panel-launcher.glade @@ -0,0 +1,228 @@ + + + + + False + 5 + Add panel launcher... + False + center + list-add + dialog + + + + False + vertical + 2 + + + False + end + + + Add + False + True + True + True + False + + + + False + True + 0 + + + + + Cancel + False + True + True + True + False + + + + False + True + 1 + + + + + False + True + end + 0 + + + + + 549 + 110 + True + False + + + 430 + 85 + True + False + + + True + False + Name + + + 0 + 0 + 1 + 1 + + + + + True + False + Application + + + 0 + 1 + 1 + 1 + + + + + True + False + Icon + + + 0 + 2 + 1 + 1 + + + + + 300 + 35 + True + True + + + + + 1 + 0 + 1 + 1 + + + + + + + + 300 + 35 + True + True + + + + + 1 + 1 + 1 + 1 + + + + + 300 + 35 + True + True + + + + + 1 + 2 + 1 + 1 + + + + + True + False + start + vertical + False + False + + + + 2 + 1 + 1 + 1 + + + + + True + False + start + vertical + False + False + + + + 2 + 2 + 1 + 1 + + + + + + + 100 + 80 + True + False + gtk-execute + 6 + + + 441 + 11 + + + + + True + True + 1 + + + + + + add_button + cancel_button + + + diff --git a/files/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/add-panel-launcher.py b/files/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/add-panel-launcher.py new file mode 100755 index 0000000000..34cc464cc9 --- /dev/null +++ b/files/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/add-panel-launcher.py @@ -0,0 +1,154 @@ +#! /usr/bin/python -OOt + +from gi.repository import Gtk +from gi.repository import Gdk +from gi.repository import Gio +from os.path import expanduser +from time import sleep as wait +import os +import os.path +import inspect +import sys +import gettext + +gettext.install("cinnamon", "/usr/share/cinnamon/locale") +Settings = Gio.Settings.new("org.cinnamon") + +_ = gettext.gettext + +class Namespace: pass + +iface = Namespace() + +oldDesktopName = "" +newDesktopName = "" +appName = "" +appPath = "" +iconPath = "" + +editMode = len(sys.argv) > 1 +if editMode: + oldDesktopName = sys.argv[1] + appName = sys.argv[2] + appPath = sys.argv[3] + iconPath = sys.argv[4] + +def updatePreviewIcon(name): + global iface + if os.path.exists(name): + iface.preview_icon.set_from_file(name) + else: + iface.preview_icon.set_from_icon_name(name, 6) + +def editOrAddLaunchers(): + makeLauncher() + global Settings, desktopName + desktopFiles = Settings.get_strv('panel-launchers') + if not editMode: + desktopFiles.append(newDesktopName) + else: + i = desktopFiles.index(oldDesktopName) + if i >= 0: + del desktopFiles[i] + desktopFiles.insert(i, newDesktopName) + Settings.set_strv('panel-launchers', desktopFiles) + Gtk.main_quit(None) + +def makeLauncher(): + global appName, appPath, iconPath, custom_launchers_path, newDesktopName + description = _("Custom Launcher") + i = 1 + dir = Gio.file_new_for_path(custom_launchers_path) + if not dir.query_exists(None): + dir.make_directory_with_parents(None) + + file = Gio.file_parse_name(custom_launchers_path + '/cinnamon-custom-launcher-' + str(i) + '.desktop') + while file.query_exists(None): + i = i + 1 + file = Gio.file_parse_name(custom_launchers_path + '/cinnamon-custom-launcher-' + str(i) + '.desktop') + file = open(custom_launchers_path+ '/cinnamon-custom-launcher-' + str(i) + '.desktop', "w") + + desktopEntry = "[Desktop Entry]\nName=" + appName + "\nExec=" + appPath + "\nType=Application\n" + desktopEntry = desktopEntry + "Description=" + description + "\n" + if iconPath == "": + iconPath = "application-x-executable" + desktopEntry += "Icon=" + iconPath + "\n" + print desktopEntry + file.write(desktopEntry) + file.close() + newDesktopName = 'cinnamon-custom-launcher-' + str(i) + '.desktop' + +class Handler: + def onDeleteWindow(self, *args): + Gtk.main_quit(*args) + + def onAdd(self, button): + global appPath, appName + if appPath == "" or appName == "": + return + else: + editOrAddLaunchers() + + def onIconPicked(self, *args): + global iconPath, iface + iconPath = iface.icon_picker.get_uri()[7:] + iface.icon_path.set_text(iconPath) + updatePreviewIcon(iconPath) + + def onAppPicked(self, *args): + global appPath, iface + appPath = iface.app_picker.get_uri()[7:] + iface.file_path.set_text(appPath) + + def onNameChanged(self, *args): + global appName, iface + appName = iface.app_name.get_text().strip() + + def onAppChanged(self, *args): + global appPath, iface + appPath = iface.file_path.get_text().strip() + + def onIconChanged(self, *args): + global iconPath, iface + iconPath = iface.icon_path.get_text().strip() + updatePreviewIcon(iconPath) + +builder = Gtk.Builder() + +userhome = expanduser("~") +custom_launchers_path = userhome + "/.cinnamon/panel-launchers" + +applet_dir = os.path.dirname(inspect.getfile(inspect.currentframe())) +builder.add_from_file(applet_dir + "/add-panel-launcher.glade") + +window = builder.get_object("add-panel-launcher-dialog") +builder.connect_signals(Handler()) + +iface.add_button = builder.get_object("add_button") +iface.cancel_button = builder.get_object("cancel_button") +iface.preview_icon = builder.get_object("icon") +iface.app_name = builder.get_object("app_name") +iface.file_path = builder.get_object("app_path") +iface.icon_path = builder.get_object("icon_path") +iface.app_picker = builder.get_object("app_picker") +iface.icon_picker = builder.get_object("icon_picker") + + +# set static translations (labels, etc..) +builder.get_object("name_label").set_markup(_("Name")) +builder.get_object("application_label").set_markup(_("Application")) +builder.get_object("icon_label").set_markup(_("Icon")) +builder.get_object("cancel_button").set_label(_("Cancel")) +builder.get_object("add-panel-launcher-dialog").set_title(_("Add panel launcher...")) + +if editMode: + iface.app_name.set_text(appName) + iface.file_path.set_text(appPath) + iface.icon_path.set_text(iconPath) + iface.add_button.set_label(_("Update")) + updatePreviewIcon(iconPath) +else: + iface.add_button.set_label(_("Add")) + +window.show_all() +Gtk.main() diff --git a/files/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/applet.js index a4cf23fd9e..7a2d17ec13 100644 --- a/files/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/panel-launchers@cinnamon.org/applet.js @@ -12,6 +12,12 @@ const GLib = imports.gi.GLib; const Tooltips = imports.ui.tooltips; const DND = imports.ui.dnd; const Tweener = imports.ui.tweener; +const Util = imports.misc.util; + +const DEFAULT_ICON_SIZE = 20; +const DEFAULT_ANIM_SIZE = 13; +const ICON_HEIGHT_FACTOR = .8; +const ICON_ANIM_FACTOR = .65; let pressLauncher = null; @@ -19,6 +25,7 @@ function PanelAppLauncherMenu(launcher, orientation) { this._init(launcher, orientation); } +const APPLET_DIR = imports.ui.appletManager._find_applet('panel-launchers@cinnamon.org'); const CUSTOM_LAUNCHERS_PATH = GLib.get_home_dir() + '/.cinnamon/panel-launchers'; PanelAppLauncherMenu.prototype = { @@ -66,12 +73,12 @@ PanelAppLauncherMenu.prototype = { } } -function PanelAppLauncher(launchersBox, app, appinfo, orientation) { - this._init(launchersBox, app, appinfo, orientation); +function PanelAppLauncher(launchersBox, app, appinfo, orientation, panel_height) { + this._init(launchersBox, app, appinfo, orientation, panel_height); } PanelAppLauncher.prototype = { - _init: function(launchersBox, app, appinfo, orientation) { + _init: function(launchersBox, app, appinfo, orientation, panel_height) { this.app = app; this.appinfo = appinfo; this.launchersBox = launchersBox; @@ -85,14 +92,20 @@ PanelAppLauncher.prototype = { this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease)); this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress)); - this._iconBox = new Cinnamon.Slicer({ name: 'panel-launcher-icon' }); + this._iconBox = new St.Bin({ name: 'panel-launcher-icon' }); this._iconBox.connect('style-changed', Lang.bind(this, this._onIconBoxStyleChanged)); this._iconBox.connect('notify::allocation', Lang.bind(this, this._updateIconBoxClip)); this.actor.add_actor(this._iconBox); this._iconBottomClip = 0; - + if (global.settings.get_boolean('panel-scale-text-icons')) { + this.icon_height = Math.floor(panel_height * ICON_HEIGHT_FACTOR); + this.icon_anim_height = Math.floor(panel_height * ICON_ANIM_FACTOR); + } else { + this.icon_height = DEFAULT_ICON_SIZE; + this.icon_anim_height = DEFAULT_ANIM_SIZE; + } this.icon = this._getIconActor(); this._iconBox.set_child(this.icon); @@ -142,21 +155,21 @@ PanelAppLauncher.prototype = { }, _getIconActor: function() { - if (this.is_custom()) return St.TextureCache.get_default().load_gicon(null, this.appinfo.get_icon(), 20); - else return this.app.create_icon_texture(20); + if (this.is_custom()) return St.TextureCache.get_default().load_gicon(null, this.appinfo.get_icon(), this.icon_height); + else return this.app.create_icon_texture(this.icon_height); }, _animateIcon: function(step){ if (step>=3) return; Tweener.addTween(this.icon, - { width: 13, - height: 13, + { width: this.icon_anim_height, + height: this.icon_anim_height, time: 0.2, transition: 'easeOutQuad', onComplete: function(){ Tweener.addTween(this.icon, - { width: 20, - height: 20, + { width: this.icon_height, + height: this.icon_height, time: 0.2, transition: 'easeOutQuad', onComplete: function(){ @@ -244,180 +257,15 @@ PanelAppLauncher.prototype = { } } -function AddLauncherDialog() { - this._init(); -} - -AddLauncherDialog.prototype = { - __proto__: ModalDialog.ModalDialog.prototype, - - _init: function() { - ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'panel-launcher-add-dialog' }); - - let box; - let label; - - let box = new St.BoxLayout({ styleClass: 'panel-launcher-add-dialog-content-box' }); - let leftBox = new St.BoxLayout({vertical: true, styleClass: 'panel-launcher-add-dialog-content-box-left'}); - let rightBox = new St.BoxLayout({vertical: true, styleClass: 'panel-launcher-add-dialog-content-box-right'}); - - label = new St.Label(); - label.set_text(_("Name")); - leftBox.add(label, { x_align: St.Align.START, x_fill: true, x_expand: true }); - this._nameEntry = new St.Entry({ styleClass: 'panel-launcher-add-dialog-entry', can_focus: true }); - rightBox.add(this._nameEntry, { x_align: St.Align.END, x_fill: false, x_expand: false }); - - label = new St.Label(); - label.set_text(_("Command")); - leftBox.add(label, { x_align: St.Align.START, x_fill: true, x_expand: true }); - this._commandEntry = new St.Entry({ styleClass: 'panel-launcher-add-dialog-entry', can_focus: true }); - rightBox.add(this._commandEntry, { x_align: St.Align.END, x_fill: false, x_expand: false }); - - label = new St.Label(); - label.set_text(_("Icon")); - leftBox.add(label, { x_align: St.Align.START, x_fill: true, x_expand: true }); - this._iconEntry = new St.Entry({ styleClass: 'panel-launcher-add-dialog-entry', can_focus: true }); - rightBox.add(this._iconEntry, { x_align: St.Align.END, x_fill: false, x_expand: false }); - - box.add(leftBox); - box.add(rightBox); - this.contentLayout.add(box, { y_align: St.Align.START }); - - this._errorBox = new St.BoxLayout({ style_class: 'run-dialog-error-box' }); - this.contentLayout.add(this._errorBox, { expand: true }); - - let errorIcon = new St.Icon({ icon_name: 'dialog-error', icon_size: 24, style_class: 'run-dialog-error-icon' }); - - this._errorBox.add(errorIcon, { y_align: St.Align.MIDDLE }); - - this._commandError = false; - - this._errorMessage = new St.Label({ style_class: 'run-dialog-error-label' }); - this._errorMessage.clutter_text.line_wrap = true; - - this._errorBox.add(this._errorMessage, { expand: true, - y_align: St.Align.MIDDLE, - y_fill: false }); - - this._errorBox.hide(); - - this.connect('opened', Lang.bind(this, this._onOpened)); - - this._currentLauncher = null; - }, - - _onOpened: function() { - this._nameEntry.grab_key_focus(); - }, - - _validateAdd: function() { - if (this._nameEntry.clutter_text.get_text()==""){ - this._errorMessage.clutter_text.set_text(_("Name cannot be empty!")); - this._errorBox.show(); - return false; - } - if (this._commandEntry.clutter_text.get_text()==""){ - this._errorMessage.clutter_text.set_text(_("Command cannot be empty!")); - this._errorBox.show(); - return false; - } - - - let appid = this._saveNewLauncher(this._nameEntry.clutter_text.get_text(), this._commandEntry.clutter_text.get_text(), _("Custom Launcher"), this._iconEntry.clutter_text.get_text()); - - this.close(); - - if (this._currentLauncher) this.emit("launcher-updated", this._currentLauncher, appid); - else this.emit("launcher-created", appid); - - return true; - }, - - _saveNewLauncher: function(name, command, description, icon){ - let file; - let i; - if (this._currentLauncher && this._currentLauncher.is_custom()){ - file = Gio.file_parse_name(CUSTOM_LAUNCHERS_PATH+'/'+this._currentLauncher.get_id()); - file.delete(null); - }else{ - let dir = Gio.file_new_for_path(CUSTOM_LAUNCHERS_PATH); - if (!dir.query_exists(null)) dir.make_directory_with_parents(null); - i = 1; - file = Gio.file_parse_name(CUSTOM_LAUNCHERS_PATH+'/cinnamon-custom-launcher-'+i+'.desktop'); - while (file.query_exists(null)){ - i++; - file = Gio.file_parse_name(CUSTOM_LAUNCHERS_PATH+'/cinnamon-custom-launcher-'+i+'.desktop'); - } - } - - let desktopEntry = "[Desktop Entry]\nName="+name+"\nExec="+command+"\nType=Application\n"; - if (description) desktopEntry += "Description="+description+"\n"; - if (!icon && this._currentLauncher) icon = this._currentLauncher.get_icon(); - if (!icon) icon = "application-x-executable"; - desktopEntry += "Icon="+icon+"\n"; - - let fp = file.create(0, null); - fp.write(desktopEntry, null); - fp.close(null); - - if (this._currentLauncher && this._currentLauncher.is_custom()) return this._currentLauncher.get_id(); - else return 'cinnamon-custom-launcher-'+i+'.desktop'; - }, - - open: function(timestamp, launcher) { - this._currentLauncher = launcher; - - if (launcher){ - this._commandEntry.clutter_text.set_text(launcher.get_command()); - this._nameEntry.clutter_text.set_text(launcher.get_appname()); - if (launcher.get_icon()) this._iconEntry.clutter_text.set_text(launcher.get_icon()); - this._errorBox.hide(); - this.setButtons([ - { - label: _("Save"), - action: Lang.bind(this, this._validateAdd) - }, - { - label: _("Cancel"), - key: Clutter.KEY_Escape, - action: Lang.bind(this, function(){ - this.close(); - }) - } - ]); - }else{ - this._commandEntry.clutter_text.set_text(''); - this._nameEntry.clutter_text.set_text(''); - this._errorBox.hide(); - this.setButtons([ - { - label: _("Add"), - action: Lang.bind(this, this._validateAdd) - }, - { - label: _("Cancel"), - key: Clutter.KEY_Escape, - action: Lang.bind(this, function(){ - this.close(); - }) - } - ]); - } - - ModalDialog.ModalDialog.prototype.open.call(this, timestamp); - }, -} -Signals.addSignalMethods(AddLauncherDialog.prototype); - -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.Applet.prototype, - _init: function(orientation) { - Applet.Applet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.Applet.prototype._init.call(this, orientation, panel_height); try { this.orientation = orientation; @@ -430,11 +278,7 @@ MyApplet.prototype = { this._settings = new Gio.Settings({ schema: 'org.cinnamon' }); this._settings.connect('changed::panel-launchers', Lang.bind(this, this._onSettingsChanged)); - - this._addLauncherDialog = new AddLauncherDialog(); - this._addLauncherDialog.connect("launcher-created", Lang.bind(this, this._onLauncherCreated)); - this._addLauncherDialog.connect("launcher-updated", Lang.bind(this, this._onLauncherUpdated)); - + this._launchers = new Array(); this.reload(); @@ -460,24 +304,6 @@ MyApplet.prototype = { this.reload(); }, - _onLauncherUpdated: function(obj, launcher, appid){ - let desktopFiles = this._settings.get_strv('panel-launchers'); - let i = this._launchers.indexOf(launcher); - if (i>=0){ - desktopFiles.splice(i, 1); - desktopFiles.splice(i, 0, appid); - this._settings.set_strv('panel-launchers', desktopFiles); - } - }, - - _onLauncherCreated: function(obj, appid){ - if (appid){ - let desktopFiles = this._settings.get_strv('panel-launchers'); - desktopFiles.push(appid); - this._settings.set_strv('panel-launchers', desktopFiles); - } - }, - loadApps: function() { let desktopFiles = this._settings.get_strv('panel-launchers'); let appSys = Cinnamon.AppSystem.get_default(); @@ -491,6 +317,10 @@ MyApplet.prototype = { } return apps; }, + + on_panel_height_changed: function() { + this.reload(); + }, reload: function() { this.myactor.destroy_children(); @@ -499,7 +329,7 @@ MyApplet.prototype = { let apps = this.loadApps(); for (var i in apps){ let app = apps[i]; - let launcher = new PanelAppLauncher(this, app[0], app[1], this.orientation); + let launcher = new PanelAppLauncher(this, app[0], app[1], this.orientation, this._panelHeight); this.myactor.add(launcher.actor); this._launchers.push(launcher); } @@ -532,7 +362,16 @@ MyApplet.prototype = { }, showAddLauncherDialog: function(timestamp, launcher){ - this._addLauncherDialog.open(timestamp, launcher); + if (launcher) { + let cl = APPLET_DIR.get_child('add-panel-launcher.py').get_path() + ' '; + cl += '"' + launcher.get_id() + '" '; + cl += '"' + launcher.get_appname() + '" '; + cl += '"' + launcher.get_command() + '" '; + cl += '"' + launcher.get_icon() + '"'; + Util.spawnCommandLine(cl); + } else { + Util.spawnCommandLine(APPLET_DIR.get_child('add-panel-launcher.py').get_path()); + } }, _clearDragPlaceholder: function() { @@ -640,7 +479,7 @@ MyApplet.prototype = { }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/power@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/power@cinnamon.org/applet.js index 7603904c51..0b5ba2e591 100644 --- a/files/usr/share/cinnamon/applets/power@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/power@cinnamon.org/applet.js @@ -128,16 +128,16 @@ DeviceItem.prototype = { } } -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.TextIconApplet.prototype, - _init: function(orientation) { - Applet.TextIconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.TextIconApplet.prototype._init.call(this, orientation, panel_height); try { this.menuManager = new PopupMenu.PopupMenuManager(this); @@ -302,11 +302,16 @@ MyApplet.prototype = { })); }, + on_panel_height_changed: function() { + this._devicesChanged(); + }, + _devicesChanged: function() { + this.set_applet_icon_symbolic_name('battery-missing'); this._proxy.GetRemote('Icon', Lang.bind(this, function(icon, error) { if (icon) { - let gicon = Gio.icon_new_for_string(icon); - this._applet_icon.gicon = gicon; + let gicon = Gio.icon_new_for_string(icon); + this._applet_icon.gicon = gicon; this.actor.show(); } else { this.menu.close(); @@ -353,7 +358,7 @@ MyApplet.prototype = { }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/recent@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/recent@cinnamon.org/applet.js index b0037b5645..56cc6204c7 100644 --- a/files/usr/share/cinnamon/applets/recent@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/recent@cinnamon.org/applet.js @@ -26,15 +26,15 @@ MyPopupMenuItem.prototype = } }; -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { this.set_applet_icon_symbolic_name("document-open-recent"); @@ -98,7 +98,7 @@ MyApplet.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/removable-drives@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/removable-drives@cinnamon.org/applet.js index 82cafe5b6a..65a6ce8622 100644 --- a/files/usr/share/cinnamon/applets/removable-drives@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/removable-drives@cinnamon.org/applet.js @@ -38,15 +38,15 @@ DriveMenuItem.prototype = { } }; -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { this.set_applet_icon_symbolic_name("drive-harddisk"); @@ -96,7 +96,7 @@ MyApplet.prototype = { }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/scale@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/scale@cinnamon.org/applet.js index 599e23dd6f..f2b86a1acf 100644 --- a/files/usr/share/cinnamon/applets/scale@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/scale@cinnamon.org/applet.js @@ -3,15 +3,15 @@ const Lang = imports.lang; const Main = imports.ui.main; const Gtk = imports.gi.Gtk; -function MyApplet(metadata, orientation) { - this._init(metadata, orientation); +function MyApplet(metadata, orientation, panel_height) { + this._init(metadata, orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(metadata, orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(metadata, orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { Gtk.IconTheme.get_default().append_search_path(metadata.path); @@ -56,7 +56,7 @@ MyApplet.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(metadata, orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(metadata, orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/settings@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/settings@cinnamon.org/applet.js index f5cb34af6a..8fab8064e3 100644 --- a/files/usr/share/cinnamon/applets/settings@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/settings@cinnamon.org/applet.js @@ -13,15 +13,15 @@ function ConfirmDialog(){ this._init(); } -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { this.set_applet_icon_symbolic_name("go-up"); @@ -53,7 +53,7 @@ MyApplet.prototype = { }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/show-desktop@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/show-desktop@cinnamon.org/applet.js index 3899d6bc4b..ea5ef2b14a 100644 --- a/files/usr/share/cinnamon/applets/show-desktop@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/show-desktop@cinnamon.org/applet.js @@ -1,15 +1,15 @@ const Applet = imports.ui.applet; const Lang = imports.lang; -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { this.set_applet_icon_name("desktop"); @@ -43,7 +43,7 @@ MyApplet.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js index 23737830d3..1f22150754 100644 --- a/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js @@ -694,15 +694,15 @@ MediaPlayerLauncher.prototype = { }; -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { this.menuManager = new PopupMenu.PopupMenuManager(this); @@ -1090,7 +1090,7 @@ MyApplet.prototype = { }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; -} \ No newline at end of file +} diff --git a/files/usr/share/cinnamon/applets/systray@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/systray@cinnamon.org/applet.js index ae60c84d64..469a560a81 100644 --- a/files/usr/share/cinnamon/applets/systray@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/systray@cinnamon.org/applet.js @@ -3,28 +3,40 @@ const Main = imports.ui.main; const PanelMenu = imports.ui.panelMenu; const Lang = imports.lang; -function MyApplet(orientation) { - this._init(orientation); +const ICON_SCALE_FACTOR = .88; // for custom panel heights, 22 (default icon size) / 25 (default panel height) + +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.Applet.prototype, - _init: function(orientation) { - Applet.Applet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.Applet.prototype._init.call(this, orientation, panel_height); this.actor.remove_style_class_name("applet-box"); - try { - Main.statusIconDispatcher.connect('status-icon-added', Lang.bind(this, this._onTrayIconAdded)); - Main.statusIconDispatcher.connect('status-icon-removed', Lang.bind(this, this._onTrayIconRemoved)); - Main.statusIconDispatcher.connect('before-redisplay', Lang.bind(this, this._onBeforeRedisplay)); - } - catch (e) { - global.logError(e); - } + this._signals = { added: null, + removed: null, + redisplay: null }; }, on_applet_clicked: function(event) { + }, + on_applet_removed_from_panel: function () { + Main.statusIconDispatcher.disconnect(this._signals.added); + Main.statusIconDispatcher.disconnect(this._signals.removed); + Main.statusIconDispatcher.disconnect(this._signals.redisplay); + }, + + on_applet_added_to_panel: function() { + this._signals.added = Main.statusIconDispatcher.connect('status-icon-added', Lang.bind(this, this._onTrayIconAdded)); + this._signals.removed = Main.statusIconDispatcher.connect('status-icon-removed', Lang.bind(this, this._onTrayIconRemoved)); + this._signals.redisplay = Main.statusIconDispatcher.connect('before-redisplay', Lang.bind(this, this._onBeforeRedisplay)); + }, + + on_panel_height_changed: function() { + Main.statusIconDispatcher.redisplay(); }, _onBeforeRedisplay: function() { @@ -60,7 +72,12 @@ MyApplet.prototype = { if (themeNode.get_length('height')) { height = themeNode.get_length('height'); } - + + if (global.settings.get_boolean('panel-scale-text-icons')) { + width = Math.floor(this._panelHeight * ICON_SCALE_FACTOR); + height = Math.floor(this._panelHeight * ICON_SCALE_FACTOR); + } + if (icon.get_width() == 1 || icon.get_height() == 1 || buggyIcons.indexOf(role) != -1) { icon.set_height(height); } @@ -99,7 +116,7 @@ MyApplet.prototype = { }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/trash@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/trash@cinnamon.org/applet.js index d8fbcfb600..92764db4b2 100644 --- a/files/usr/share/cinnamon/applets/trash@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/trash@cinnamon.org/applet.js @@ -6,15 +6,15 @@ const Lang = imports.lang; const Clutter = imports.gi.Clutter; const Applet = imports.ui.applet; -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { this.set_applet_icon_symbolic_name("user-trash"); @@ -132,7 +132,7 @@ ConfirmEmptyTrashDialog.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/window-list@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/window-list@cinnamon.org/applet.js index cbc06dd6f0..33a32e707f 100644 --- a/files/usr/share/cinnamon/applets/window-list@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/window-list@cinnamon.org/applet.js @@ -11,8 +11,11 @@ const Meta = imports.gi.Meta; const Tooltips = imports.ui.tooltips; const DND = imports.ui.dnd; -const PANEL_ICON_SIZE = 24; +const PANEL_ICON_SIZE = 24; // this is for the spinner when loading +const DEFAULT_ICON_SIZE = 16; // too bad this can't be defined in theme (cinnamon-app.create_icon_texture returns a clutter actor, not a themable object - + // probably something that could be addressed const SPINNER_ANIMATION_TIME = 1; +const ICON_HEIGHT_FACTOR = .64; function AppMenuButtonRightClickMenu(actor, metaWindow, orientation) { @@ -29,7 +32,7 @@ AppMenuButtonRightClickMenu.prototype = { //Main.chrome.addActor(this.actor, { visibleInOverview: true, // affectsStruts: false }); this.actor.hide(); - + this.window_list = actor._delegate._applet._windows; actor.connect('key-press-event', Lang.bind(this, this._onSourceKeyPress)); this.connect('open-state-changed', Lang.bind(this, this._onToggled)); @@ -38,6 +41,12 @@ AppMenuButtonRightClickMenu.prototype = { this.itemCloseWindow = new PopupMenu.PopupMenuItem(_("Close")); this.itemCloseWindow.connect('activate', Lang.bind(this, this._onCloseWindowActivate)); + this.itemCloseAllWindows = new PopupMenu.PopupMenuItem(_("Close all")); + this.itemCloseAllWindows.connect('activate', Lang.bind(this, this._onCloseAllActivate)); + + this.itemCloseOtherWindows = new PopupMenu.PopupMenuItem(_("Close others")); + this.itemCloseOtherWindows.connect('activate', Lang.bind(this, this._onCloseOthersActivate)); + if (metaWindow.minimized) this.itemMinimizeWindow = new PopupMenu.PopupMenuItem(_("Restore")); else @@ -63,10 +72,14 @@ AppMenuButtonRightClickMenu.prototype = { this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this.addMenuItem(this.itemMinimizeWindow); this.addMenuItem(this.itemMaximizeWindow); + this.addMenuItem(this.itemCloseAllWindows); + this.addMenuItem(this.itemCloseOtherWindows); this.addMenuItem(this.itemCloseWindow); } else { this.addMenuItem(this.itemCloseWindow); + this.addMenuItem(this.itemCloseOtherWindows); + this.addMenuItem(this.itemCloseAllWindows); this.addMenuItem(this.itemMaximizeWindow); this.addMenuItem(this.itemMinimizeWindow); this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); @@ -111,6 +124,28 @@ AppMenuButtonRightClickMenu.prototype = { this.destroy(); }, + _onCloseAllActivate: function(actor, event) { + let metas = new Array(); + for (let i = 0; i < this.window_list.length; i++) { + metas.push(this.window_list[i].metaWindow); + } + metas.forEach(Lang.bind(this, function(window) { + window.delete(global.get_current_time()); + })); + }, + + _onCloseOthersActivate: function(actor, event) { + let metas = new Array(); + for (let i = 0; i < this.window_list.length; i++) { + if (this.window_list[i].metaWindow != this.metaWindow) { + metas.push(this.window_list[i].metaWindow); + } + } + metas.forEach(Lang.bind(this, function(window) { + window.delete(global.get_current_time()); + })); + }, + _onMinimizeWindowActivate: function(actor, event){ if (this.metaWindow.minimized) { this.metaWindow.unminimize(global.get_current_time()); @@ -173,15 +208,15 @@ AppMenuButtonRightClickMenu.prototype = { }; -function AppMenuButton(applet, metaWindow, animation, orientation) { - this._init(applet, metaWindow, animation, orientation); +function AppMenuButton(applet, metaWindow, animation, orientation, panel_height) { + this._init(applet, metaWindow, animation, orientation, panel_height); } AppMenuButton.prototype = { // __proto__ : AppMenuButton.prototype, - _init: function(applet, metaWindow, animation, orientation) { + _init: function(applet, metaWindow, animation, orientation, panel_height) { this.actor = new St.Bin({ style_class: 'window-list-item-box', reactive: true, @@ -199,7 +234,7 @@ AppMenuButton.prototype = { this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease)); this.metaWindow = metaWindow; - + this._applet = applet; let bin = new St.Bin({ name: 'appMenu' }); @@ -254,23 +289,25 @@ AppMenuButton.prototype = { this._container.add_actor(this._spinner.actor); this._spinner.actor.lower_bottom(); - let tracker = Cinnamon.WindowTracker.get_default(); - this.app = tracker.get_window_app(this.metaWindow); - let iconSize = 16; - let icon = this.app ? - this.app.create_icon_texture(iconSize) : - new St.Icon({ icon_name: 'application-default-icon', - icon_type: St.IconType.FULLCOLOR, - icon_size: iconSize }); + let tracker = Cinnamon.WindowTracker.get_default(); + this.app = tracker.get_window_app(this.metaWindow); + if (global.settings.get_boolean('panel-scale-text-icons')) { + this.iconSize = Math.round(panel_height * ICON_HEIGHT_FACTOR); + } else { + this.iconSize = DEFAULT_ICON_SIZE; + } + let icon = this.app ? + this.app.create_icon_texture(this.iconSize) : + new St.Icon({ icon_name: 'application-default-icon', + icon_type: St.IconType.FULLCOLOR, + icon_size: this.iconSize }); let title = this.getDisplayTitle(); - if (metaWindow.minimized) this._label.set_text("[" + title + "]"); else this._label.set_text(title); this._iconBox.set_child(icon); - if(animation){ this.startAnimation(); this.stopAnimation(); @@ -290,12 +327,48 @@ AppMenuButton.prototype = { this.on_panel_edit_mode_changed(); global.settings.connect('changed::panel-edit-mode', Lang.bind(this, this.on_panel_edit_mode_changed)); + global.settings.connect('changed::window-list-applet-scroll', Lang.bind(this, this.on_scroll_mode_changed)); + this.window_list = this.actor._delegate._applet._windows; + this.scroll_connector = null; + this.on_scroll_mode_changed(); }, on_panel_edit_mode_changed: function() { this._draggable.inhibit = global.settings.get_boolean("panel-edit-mode"); }, - + + on_scroll_mode_changed: function() { + let scrollable = global.settings.get_boolean("window-list-applet-scroll"); + if (scrollable) { + this.scroll_connector = this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent)); + } else { + if (this.scroll_connector) { + this.actor.disconnect(this.scroll_connector); + this.scroll_connector = null; + } + } + }, + + _onScrollEvent: function(actor, event) { + let direction = event.get_scroll_direction(); + let current; + let num_windows = this.window_list.length; + for (let i = 0; i < num_windows; i++) { + if (this.window_list[i].metaWindow.has_focus()) { + current = i; + break; + } + } + let target; + if (direction == 1) { + target = ((current - 1) >= 0) ? (current - 1) : (num_windows - 1); + } + if (direction == 0) { + target = ((current + 1) <= num_windows - 1) ? (current + 1) : 0; + } + this.window_list[target].metaWindow.activate(global.get_current_time()); + }, + _onDragBegin: function() { this._tooltip.hide(); this._tooltip.preventShow = true; @@ -327,7 +400,7 @@ AppMenuButton.prototype = { let tracker = Cinnamon.WindowTracker.get_default(); let app = tracker.get_window_app(this.metaWindow); if ( app ) { - let icon = app.create_icon_texture(16); + let icon = app.create_icon_texture(this.iconSize); this._iconBox.set_child(icon); } if (this.metaWindow.has_focus() && !this.metaWindow.minimized) { @@ -483,7 +556,7 @@ AppMenuButton.prototype = { } this._iconBox.allocate(childBox, flags); - let iconWidth = 16; + let iconWidth = this.iconSize; [minWidth, minHeight, naturalWidth, naturalHeight] = this._label.get_preferred_size(); @@ -618,15 +691,15 @@ MyAppletBox.prototype = { } } -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.Applet.prototype, - _init: function(orientation) { - Applet.Applet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.Applet.prototype._init.call(this, orientation, panel_height); try { this.orientation = orientation; @@ -710,7 +783,7 @@ MyApplet.prototype = { // this._container.connect('allocate', Lang.bind(Main.panel, this._allocateBoxes)); - global.settings.connect('changed::panel-edit-mode', Lang.bind(this, this.on_panel_edit_mode_changed)); + global.settings.connect('changed::panel-edit-mode', Lang.bind(this, this.on_panel_edit_mode_changed)); } catch (e) { global.logError(e); @@ -726,8 +799,8 @@ MyApplet.prototype = { on_applet_clicked: function(event) { - }, - + }, + on_panel_edit_mode_changed: function() { this.actor.reactive = global.settings.get_boolean("panel-edit-mode"); }, @@ -746,6 +819,10 @@ MyApplet.prototype = { this._windows[i].doFocus(); } }, + + on_panel_height_changed: function() { + this._refreshItems(); + }, _refreshItems: function() { /* "this.myactor.destroy_children()" produces mysterious warnings: @@ -777,7 +854,7 @@ MyApplet.prototype = { for ( let i = 0; i < windows.length; ++i ) { let metaWindow = windows[i]; if (this.isInteresting(metaWindow)) { - let appbutton = new AppMenuButton(this, metaWindow, false, this.orientation); + let appbutton = new AppMenuButton(this, metaWindow, false, this.orientation, this._panelHeight); this._windows.push(appbutton); this.myactor.add(appbutton.actor); } @@ -843,7 +920,7 @@ MyApplet.prototype = { } if ( this.isInteresting(metaWindow) ) { - let appbutton = new AppMenuButton(this, metaWindow, true, this.orientation); + let appbutton = new AppMenuButton(this, metaWindow, true, this.orientation, this._panelHeight); this._windows.push(appbutton); this.myactor.add(appbutton.actor); appbutton.actor.show(); @@ -929,7 +1006,7 @@ MyApplet.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/windows-quick-list@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/windows-quick-list@cinnamon.org/applet.js index 8656574d8c..7a9885ac34 100644 --- a/files/usr/share/cinnamon/applets/windows-quick-list@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/windows-quick-list@cinnamon.org/applet.js @@ -8,15 +8,15 @@ const St = imports.gi.St; const Main = imports.ui.main; const Gtk = imports.gi.Gtk; -function MyApplet(metadata, orientation) { - this._init(metadata, orientation); +function MyApplet(metadata, orientation, panel_height) { + this._init(metadata, orientation, panel_height); }; MyApplet.prototype = { __proto__: Applet.IconApplet.prototype, - _init: function(metadata, orientation) { - Applet.IconApplet.prototype._init.call(this, orientation); + _init: function(metadata, orientation, panel_height) { + Applet.IconApplet.prototype._init.call(this, orientation, panel_height); try { Gtk.IconTheme.get_default().append_search_path(metadata.path); @@ -114,7 +114,7 @@ MyApplet.prototype = { } }; -function main(metadata, orientation) { - let myApplet = new MyApplet(metadata, orientation); +function main(metadata, orientation, panel_height) { + let myApplet = new MyApplet(metadata, orientation, panel_height); return myApplet; } diff --git a/files/usr/share/cinnamon/applets/workspace-switcher@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/workspace-switcher@cinnamon.org/applet.js index 2b33a6b879..c9e3fa763b 100644 --- a/files/usr/share/cinnamon/applets/workspace-switcher@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/workspace-switcher@cinnamon.org/applet.js @@ -2,15 +2,15 @@ const St = imports.gi.St; const Lang = imports.lang; const Applet = imports.ui.applet; -function MyApplet(orientation) { - this._init(orientation); +function MyApplet(orientation, panel_height) { + this._init(orientation, panel_height); } MyApplet.prototype = { __proto__: Applet.Applet.prototype, - _init: function(orientation) { - Applet.Applet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.Applet.prototype._init.call(this, orientation, panel_height); try { this.actor.set_style_class_name("workspace-switcher-box"); @@ -74,6 +74,9 @@ MyApplet.prototype = { let label = new St.Label({ text: text }); this.button[i].set_child(label); this.actor.add(this.button[i]); + if (this._scaleMode) { + this.button[i].set_width(this._panelHeight); + } let index = i; this.button[i].connect('button-release-event', Lang.bind(this, function() { let metaWorkspace = global.screen.get_workspace_by_index(index); @@ -82,6 +85,11 @@ MyApplet.prototype = { } }, + on_panel_height_changed: function() { + this._scaleMode = global.settings.get_boolean('panel-scale-text-icons'); + this._createButtons(); + }, + _updateButtons: function() { for ( let i=0; i 0) { + this._panelHeight = panel_height; + } + this.on_panel_height_changed(); + }, + + on_panel_height_changed: function() { + // Implemented byApplets + }, finalizeContextMenu: function () { - // Add default context menus - if (this._applet_context_menu._getMenuItems().length > 0) { - this._applet_context_menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); + // Add default context menus if we're in panel edit mode, ensure their removal if we're not + let isEditMode = global.settings.get_boolean('panel-edit-mode'); + let items = this._applet_context_menu._getMenuItems(); + if (isEditMode && items.indexOf(this.context_menu_item_remove) == -1) { + this.context_menu_item_remove = new MenuItem(_("Remove this applet"), Gtk.STOCK_REMOVE, Lang.bind(null, AppletManager._removeAppletFromPanel, this._uuid)); + this.context_menu_separator = new PopupMenu.PopupSeparatorMenuItem(); + if (this._applet_context_menu._getMenuItems().length > 0) { + this._applet_context_menu.addMenuItem(this.context_menu_separator); + } + this._applet_context_menu.addMenuItem(this.context_menu_item_remove); + } else { + if (items.indexOf(this.context_menu_separator) != -1) { + this.context_menu_separator.destroy(); + this.context_menu_separator = null; + } + if (items.indexOf(this.context_menu_item_remove) != -1) { + this.context_menu_item_remove.destroy(); + this.context_menu_item_remove = null; + } } - let context_menu_item_remove = new MenuItem(_("Remove this applet"), Gtk.STOCK_REMOVE, Lang.bind(null, AppletManager._removeAppletFromPanel, this._uuid)); - this._applet_context_menu.addMenuItem(context_menu_item_remove); }, - }; -function IconApplet(orientation) { - this._init(orientation); +function IconApplet(orientation, panel_height) { + this._init(orientation, panel_height); } IconApplet.prototype = { __proto__: Applet.prototype, - _init: function(orientation) { - Applet.prototype._init.call(this, orientation); + _init: function(orientation, panel_height) { + Applet.prototype._init.call(this, orientation, panel_height); this._applet_icon_box = new St.Bin(); - this.actor.add(this._applet_icon_box, { y_align: St.Align.MIDDLE, y_fill: false }); + this.actor.add(this._applet_icon_box, { y_align: St.Align.MIDDLE, y_fill: false }); + this.__icon_type = null; + this.__icon_name = null; }, set_applet_icon_name: function (icon_name) { - this._applet_icon = new St.Icon({icon_name: icon_name, icon_size: 22, icon_type: St.IconType.FULLCOLOR, reactive: true, track_hover: true, style_class: 'applet-icon' }); + if (this._scaleMode) { + this._applet_icon = new St.Icon({icon_name: icon_name, icon_size: this._panelHeight * COLOR_ICON_HEIGHT_FACTOR, + icon_type: St.IconType.FULLCOLOR, reactive: true, track_hover: true, style_class: 'applet-icon' }); + } else { + this._applet_icon = new St.Icon({icon_name: icon_name, icon_type: St.IconType.FULLCOLOR, reactive: true, track_hover: true, style_class: 'applet-icon' }); + } this._applet_icon_box.child = this._applet_icon; + this.__icon_type = St.IconType.FULLCOLOR; + this.__icon_name = icon_name; }, set_applet_icon_symbolic_name: function (icon_name) { - this._applet_icon = new St.Icon({icon_name: icon_name, icon_type: St.IconType.SYMBOLIC, reactive: true, track_hover: true, style_class: 'system-status-icon' }); + if (this._scaleMode) { + let height = (this._panelHeight / DEFAULT_PANEL_HEIGHT) * PANEL_SYMBOLIC_ICON_DEFAULT_HEIGHT; + this._applet_icon = new St.Icon({icon_name: icon_name, icon_size: height, icon_type: St.IconType.SYMBOLIC, reactive: true, track_hover: true, style_class: 'system-status-icon' }); + } else { + this._applet_icon = new St.Icon({icon_name: icon_name, icon_type: St.IconType.SYMBOLIC, reactive: true, track_hover: true, style_class: 'system-status-icon' }); + } this._applet_icon_box.child = this._applet_icon; + this.__icon_type = St.IconType.SYMBOLIC; + this.__icon_name = icon_name; }, set_applet_icon_path: function (icon_path) { @@ -237,51 +298,79 @@ IconApplet.prototype = { if (icon_path){ let file = Gio.file_new_for_path(icon_path); let icon_uri = file.get_uri(); - this._applet_icon = St.TextureCache.get_default().load_uri_async(icon_uri, 22, 22); + let square_size = 22; + if (this._scaleMode) { + square_size = Math.floor(this._panelHeight * COLOR_ICON_HEIGHT_FACTOR); + } + this._applet_icon = St.TextureCache.get_default().load_uri_async(icon_uri, square_size, square_size); this._applet_icon_box.child = this._applet_icon; } + this.__icon_type = -1; + this.__icon_name = icon_path; }, + + on_panel_height_changed: function() { + this._scaleMode = global.settings.get_boolean('panel-scale-text-icons'); + if (this._applet_icon_box.child) { + this._applet_icon_box.child.destroy(); + } + switch (this.__icon_type) { + case St.IconType.FULLCOLOR: + this.set_applet_icon_name(this.__icon_name); + break; + case St.IconType.SYMBOLIC: + this.set_applet_icon_symbolic_name(this.__icon_name); + break; + case -1: + this.set_applet_icon_path(this.__icon_name); + break; + default: + break; + } + } }; -function TextApplet(orientation) { - this._init(orientation); +function TextApplet(orientation, panel_height) { + this._init(orientation, panel_height); } TextApplet.prototype = { __proto__: Applet.prototype, - _init: function(orientation) { - Applet.prototype._init.call(this, orientation); - this._applet_label = new St.Label({ reactive: true, track_hover: true, style_class: 'applet-label'}); - this._applet_label.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; + _init: function(orientation, panel_height) { + Applet.prototype._init.call(this, orientation, panel_height); + this._applet_label = new St.Label({ reactive: true, track_hover: true, style_class: 'applet-label'}); + this._label_height = (this._panelHeight / DEFAULT_PANEL_HEIGHT) * PANEL_FONT_DEFAULT_HEIGHT; + this._applet_label.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; this.actor.add(this._applet_label, { y_align: St.Align.MIDDLE, y_fill: false }); }, set_applet_label: function (text) { - this._applet_label.set_text(text); - }, + this._applet_label.clutter_text.set_text(text); + }, on_applet_added_to_panel: function() { } }; -function TextIconApplet(orientation) { - this._init(orientation); +function TextIconApplet(orientation, panel_height) { + this._init(orientation, panel_height); } TextIconApplet.prototype = { __proto__: IconApplet.prototype, - _init: function(orientation) { - IconApplet.prototype._init.call(this, orientation); - this._applet_label = new St.Label({ reactive: true, track_hover: true, style_class: 'applet-label'}); + _init: function(orientation, panel_height) { + IconApplet.prototype._init.call(this, orientation, panel_height); + this._applet_label = new St.Label({ reactive: true, track_hover: true, style_class: 'applet-label'}); + this._label_height = (this._panelHeight / DEFAULT_PANEL_HEIGHT) * PANEL_FONT_DEFAULT_HEIGHT; this._applet_label.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; this.actor.add(this._applet_label, { y_align: St.Align.MIDDLE, y_fill: false }); }, set_applet_label: function (text) { - this._applet_label.set_text(text); + this._applet_label.clutter_text.set_text(text); }, hide_applet_icon: function () { @@ -290,5 +379,5 @@ TextIconApplet.prototype = { on_applet_added_to_panel: function() { - } + } }; diff --git a/js/ui/appletManager.js b/js/ui/appletManager.js index b0a4d5e3a5..25e09a34f1 100644 --- a/js/ui/appletManager.js +++ b/js/ui/appletManager.js @@ -85,7 +85,13 @@ function onEnabledAppletsChanged() { // Applet was removed let directory = _find_applet(uuid); if (directory != null) { - let applet = loadApplet(uuid, directory, orientation); + let applet = loadApplet(uuid, directory, orientation, panel.actor.get_height()); + try { + applet.on_applet_removed_from_panel(); + } catch (e) { + global.logError("Problem with applet: " + uuid + + " on_applet_removed_from_panel method: " + e); + } if (applet._panelLocation != null) { applet._panelLocation.remove_actor(applet.actor); applet._panelLocation = null; @@ -104,7 +110,7 @@ function onEnabledAppletsChanged() { catch(e) { global.logError('Failed to refresh list of applets ' + e); } - + Main.statusIconDispatcher.redisplay(); } @@ -155,7 +161,7 @@ function add_applet_to_panels(appletDefinition) { let directory = _find_applet(uuid); if (directory != null) { // Load the applet - let applet = loadApplet(uuid, directory, orientation); + let applet = loadApplet(uuid, directory, orientation, panel.actor.get_height()); applet._order = order; // Remove it from its previous panel location (if it had one) @@ -186,7 +192,7 @@ function add_applet_to_panels(appletDefinition) { location.add(applet.actor); } - applet._panelLocation = location; + applet._panelLocation = location; for (let i=0; i' + title + ''); this._timeLabel.clutter_text.set_markup(this._timestamp.toLocaleTimeString(this.dateFormat)); + this._timeLabel.hide(); if (Pango.find_base_dir(title, -1) == Pango.Direction.RTL) this._titleDirection = St.TextDirection.RTL; else @@ -846,13 +850,20 @@ Notification.prototype = { titleBox.x2 = titleBoxW; timeBox.x2 = timeBoxW; } - timeBox.y1 = 0; - timeBox.y2 = timeNatH; - titleBox.y1 = timeNatH; - titleBox.y2 = timeNatH + titleNatH; + if (this._inNotificationBin) { + timeBox.y1 = 0; + timeBox.y2 = timeNatH; + titleBox.y1 = timeNatH; + titleBox.y2 = timeNatH + titleNatH; + } else { + titleBox.y1 = 0; + titleBox.y2 = titleNatH; + } this._titleLabel.allocate(titleBox, flags); - this._timeLabel.allocate(timeBox, flags); + if (this._inNotificationBin) { + this._timeLabel.allocate(timeBox, flags); + } this._titleFitsInBannerMode = (titleNatW <= availWidth); let bannerFits = true; @@ -874,8 +885,13 @@ Notification.prototype = { bannerFits = (bannerBox.x1 + bannerNatW <= availWidth); } - bannerBox.y1 = timeNatH; - bannerBox.y2 = timeNatH + titleNatH; + if (this._inNotificationBin) { + bannerBox.y1 = timeNatH; + bannerBox.y2 = timeNatH + titleNatH; + } else { + bannerBox.y1 = 0; + bannerBox.y2 = titleNatH; + } this._bannerLabel.allocate(bannerBox, flags); // Make _bannerLabel visible if the entire notification diff --git a/js/ui/panel.js b/js/ui/panel.js index 488b7e3a41..6185d353e7 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -612,6 +612,7 @@ Panel.prototype = { this._showTimer = false; this._onPanelShowDelayChanged(); this._onPanelHideDelayChanged(); + this._themeFontSize = null; this.actor = new Cinnamon.GenericContainer({ name: 'panel', reactive: true }); @@ -697,6 +698,7 @@ Panel.prototype = { this._setDNDstyle(); global.settings.connect("changed::panel-edit-mode", Lang.bind(this, this._setDNDstyle)); global.settings.connect("changed::panel-resizable", Lang.bind(this, this._onPanelResizableChanged)); + global.settings.connect("changed::panel-scale-text-icons", Lang.bind(this, this._onScaleTextIconsChanged)) this.actor.connect('style-changed', Lang.bind(this, this._onStyleChanged)); }, @@ -779,8 +781,19 @@ Panel.prototype = { else { panelHeight = global.settings.get_int("panel-top-height"); } + if (global.settings.get_boolean("panel-scale-text-icons")) { + if (!this._themeFontSize) { + let themeNode = this.actor.get_theme_node(); + this._themeFontSize = themeNode.get_length("font-size"); + } + let textheight = (panelHeight / Applet.DEFAULT_PANEL_HEIGHT) * Applet.PANEL_FONT_DEFAULT_HEIGHT; + this.actor.set_style('font-size: ' + textheight + 'px;'); + } else { + this.actor.set_style('font-size: ' + this._themeFontSize + 'px;'); + } this.actor.set_height(panelHeight); Main.layoutManager._updateBoxes(); + AppletManager.updateAppletPanelHeights(); }, _onPanelResizableChanged: function() { @@ -804,8 +817,31 @@ Panel.prototype = { panelHeight = 25; } this.actor.set_height(panelHeight); + this.actor.set_style('font-size: ' + this._themeFontSize + 'px;'); Main.layoutManager._updateBoxes(); + AppletManager.updateAppletPanelHeights(); + } + }, + + _onScaleTextIconsChanged: function() { + let panelHeight; + if (this.bottomPosition) { + panelHeight = global.settings.get_int("panel-bottom-height"); + } + else { + panelHeight = global.settings.get_int("panel-top-height"); + } + if (global.settings.get_boolean("panel-scale-text-icons")) { + if (!this._themeFontSize) { + let themeNode = this.actor.get_theme_node(); + this._themeFontSize = themeNode.get_length("font-size"); + } + let textheight = (panelHeight / Applet.DEFAULT_PANEL_HEIGHT) * Applet.PANEL_FONT_DEFAULT_HEIGHT; + this.actor.set_style('font-size: ' + textheight + 'px;'); + } else { + this.actor.set_style('font-size: ' + this._themeFontSize + 'px;'); } + AppletManager.updateAppletPanelHeights(true); }, _onStyleChanged: function() { diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index ad8c83f23a..c9805704a6 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -967,6 +967,7 @@ PopupMenuBase.prototype = { } if (menuItem == this._activeMenuItem) this._activeMenuItem = null; + this.length--; })); }, diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 99a2cb76cd..99a432ad11 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -366,27 +366,28 @@ WindowManager.prototype = { let effect = "none"; let time = 0.25; try{ - effect = global.settings.get_string("desktop-effects-unmaximize-effect"); - transition = global.settings.get_string("desktop-effects-unmaximize-transition"); + effect = global.settings.get_string("desktop-effects-unmaximize-effect"); + transition = global.settings.get_string("desktop-effects-unmaximize-transition"); time = global.settings.get_int("desktop-effects-unmaximize-time") / 1000; } catch(e) { log(e); } - - if (effect == "scale") { - //Not available yet because it doesn't look good.. - this._unmaximizing.push(actor); + + if (effect == "scale") { + + this._unmaximizing.push(actor); - actor.opacity =0; - actor.move_anchor_point_from_gravity(Clutter.Gravity.CENTER); - + let scale_x = targetWidth / actor.width; + let scale_y = targetHeight / actor.height; + let anchor_x = (actor.x - targetX) * actor.width / (targetWidth - actor.width); + let anchor_y = (actor.y - targetY) * actor.height / (targetHeight - actor.height); + + actor.move_anchor_point(anchor_x, anchor_y); + Tweener.addTween(actor, - { x: targetX, - y: targetY, - height: targetHeight, - width: targetWidth, - opacity: 100, + { scale_x: scale_x, + scale_y: scale_y, time: time, transition: transition, onComplete: this._unmaximizeWindowDone, @@ -396,10 +397,11 @@ WindowManager.prototype = { onOverwriteScope: this, onOverwriteParams: [cinnamonwm, actor] }); + } else { cinnamonwm.completed_unmaximize(actor); - } + } }, _unmaximizeWindowDone : function(cinnamonwm, actor) { diff --git a/makepot b/makepot index fa223d3c54..b7bac2d026 100755 --- a/makepot +++ b/makepot @@ -1,3 +1,3 @@ #!/bin/bash -xgettext --language=C --keyword=_ --output=cinnamon.pot src/*.c src/*/*.c js/*/*.js files/usr/share/cinnamon/applets/*/applet.js files/usr/lib/cinnamon-settings/*.py +xgettext --language=C --keyword=_ --output=cinnamon.pot src/*.c src/*/*.c js/*/*.js files/usr/share/cinnamon/applets/*/applet.js files/usr/lib/cinnamon-settings/*.py files/usr/share/cinnamon/applets/*/*.py diff --git a/src/cinnamon-wm.c b/src/cinnamon-wm.c index 1a0c7244ef..555e013bee 100644 --- a/src/cinnamon-wm.c +++ b/src/cinnamon-wm.c @@ -78,7 +78,7 @@ cinnamon_wm_class_init (CinnamonWMClass *klass) 0, NULL, NULL, _cinnamon_marshal_VOID__OBJECT_INT_INT_INT_INT, - G_TYPE_NONE, 1, + G_TYPE_NONE, 5, META_TYPE_WINDOW_ACTOR, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); cinnamon_wm_signals[MAP] = g_signal_new ("map",