Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove compact mode, for upstream has now one #59

Merged
merged 2 commits into from
Jun 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions greasemonkey/compact-rooms.css

This file was deleted.

72 changes: 0 additions & 72 deletions gtk/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -211,78 +211,6 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selectable">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">_Compact Rooms</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">compact-rooms-toggle</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="name">subtitle</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">&lt;small&gt;Modify style of rooms to fit more conversation content&lt;/small&gt;</property>
<property name="use_markup">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="compact-rooms-toggle">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
Expand Down
1 change: 0 additions & 1 deletion org.perezdecastro.Revolt.gresources.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/apps/revolt-symbolic.svg</file>
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/status/revolt-status-blink-symbolic.svg</file>
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/status/revolt-status-online-symbolic.svg</file>
<file compressed="true">greasemonkey/compact-rooms.css</file>
</gresource>
</gresources>
4 changes: 0 additions & 4 deletions org.perezdecastro.Revolt.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<summary>Whether to use a header bar. Disabling uses the decorations provided by the window manager.</summary>
<default>true</default>
</key>
<key name="greasemonkey-compact-rooms" type="b">
<summary>Inject user script to make Riot rooms more compact.</summary>
<default>false</default>
</key>

<child name="saved-state" schema="org.perezdecastro.Revolt.State"/>
</schema>
Expand Down
13 changes: 2 additions & 11 deletions revolt/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,17 @@ def _build(self, resource, *names):
return (builder.get_object(name) for name in names)

def __on_app_preferences(self, action, param):
window, url_entry, zoom_factor, zoom_factor_reset, devtools_toggle, compact_rooms_toggle = \
window, url_entry, zoom_factor, zoom_factor_reset, devtools_toggle = \
self._build("gtk/preferences.ui",
"settings-window",
"riot-url-entry",
"zoom-factor",
"zoom-factor-reset",
"dev-tools-toggle",
"compact-rooms-toggle")
"dev-tools-toggle")
self.settings.bind("zoom-factor", zoom_factor, "value",
Gio.SettingsBindFlags.DEFAULT)
self.settings.bind("enable-developer-tools", devtools_toggle, "active",
Gio.SettingsBindFlags.DEFAULT)
self.settings.bind("greasemonkey-compact-rooms", compact_rooms_toggle, "active",
Gio.SettingsBindFlags.DEFAULT)
zoom_factor_reset.connect("clicked", lambda button:
self.settings.set_double("zoom-factor", 1.0))
url_entry.set_text(self.riot_url)
Expand All @@ -128,12 +125,6 @@ def __on__riot_settings(self, action, param):
self.show()
self.window.load_settings_page()

def load_resource(self, relpath):
gfile = Gio.File.new_for_uri("resource://{}/{}".format(
self.get_resource_base_path(), relpath))
success, data, etag = gfile.load_contents()
return data

def show(self):
self.window.show()
self.window.present()
25 changes: 0 additions & 25 deletions revolt/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,8 @@ def __init__(self, application, saved_state):
"enable-write-console-messages-to-stdout",
Gio.SettingsBindFlags.GET)

self.__compact_rooms_css = None
application.settings.connect("changed::greasemonkey-compact-rooms",
self.__on_greasemonkey_compact_rooms_changed)

self.add_accel_group(accelerators.window_keys)

# Force reading the setting once on startup.
self.__on_greasemonkey_compact_rooms_changed(application.settings, "greasemonkey-compact-rooms")

websettings.set_allow_file_access_from_file_urls(True)
websettings.set_allow_modal_dialogs(False) # TODO
websettings.set_enable_fullscreen(False)
Expand All @@ -79,24 +72,6 @@ def __init__(self, application, saved_state):
self.__connect_widgets()
self.__notification_ids = set()

def __on_greasemonkey_compact_rooms_changed(self, settings, key):
enable = settings.get_boolean(key)
if enable == (self.__compact_rooms_css is not None):
return
# TODO: We will need better logic if/when we provide multiple CSS
# snippets. Disabling/enabling one would mean always removing
# all of them, and then re-adding the enabled ones. This works
# for now.
if enable:
css = self.application.load_resource("greasemonkey/compact-rooms.css")
self.__compact_rooms_css = WebKit2.UserStyleSheet(css.decode("utf-8"),
WebKit2.UserContentInjectedFrames.TOP_FRAME,
WebKit2.UserStyleLevel.USER)
self._user_content_manager.add_style_sheet(self.__compact_rooms_css)
else:
self._user_content_manager.remove_all_style_sheets()
self.__compact_rooms_css = None

def do_configure_event(self, event):
result = Gtk.ApplicationWindow.do_configure_event(self, event)
width, height = self.get_size()
Expand Down