Skip to content

Commit

Permalink
Resurrect setting to disable GTK+ completion
Browse files Browse the repository at this point in the history
There's no UI for this: you can use dconf-editor or the gsettings
command-line tool.  Remember to export GSETTINGS_SCHEMA_DIR=. so they
can find the schema.

I'm undecided if there should be UI for this.
  • Loading branch information
mgedmin committed Oct 8, 2015
1 parent 884d944 commit 889c49f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
1 change: 0 additions & 1 deletion NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Changelog
- Report for a custom date range is gone.
- "Complete report in spreadsheet" is gone.
- "Work/slacking stats in spreadsheet" is gone.
- Setting to disable GTK+ completion is gone.
- Setting for editor is gone: the default file association for text
files will be used.
- Settings for mailer is gone: mail sending is internal now.
Expand Down
6 changes: 6 additions & 0 deletions org.gtimelog.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@
<description>URL for editing tasks for the task pane. Will be opened in a browser window if the user asks to edit tasks.</description>
</key>

<key name="gtk-completion" type="b">
<default>true</default>
<summary>Use completion</summary>
<description>If true, the task entry will use the standard GTK+ completion. If false, it'll only use the custom prefix completion on PageUp/PageDown.</description>
</key>

</schema>

</schemalist>
18 changes: 16 additions & 2 deletions src/gtimelog/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ def load_settings(self):
self.gsettings.bind('list-email', self.recipient_entry, 'text', Gio.SettingsBindFlags.DEFAULT)
self.gsettings.bind('report-style', self.report_view, 'report-style', Gio.SettingsBindFlags.DEFAULT)
self.gsettings.bind('remote-task-list', self.app.actions.refresh_tasks, 'enabled', Gio.SettingsBindFlags.DEFAULT)
self.gsettings.bind('gtk-completion', self.task_entry, 'gtk-completion-enabled', Gio.SettingsBindFlags.DEFAULT)
self.gsettings.connect('changed::remote-task-list', self.load_tasks)
self.gsettings.connect('changed::task-list-url', self.load_tasks)
self.gsettings.connect('changed::task-list-edit-url', self.update_edit_tasks_availability)
Expand Down Expand Up @@ -685,6 +686,7 @@ def load_settings(self):
self.gsettings.set_string('task-list-edit-url', arg)
vm = old_settings.virtual_midnight
self.gsettings.set_value('virtual-midnight', GLib.Variant('(ii)', (vm.hour, vm.minute)))
self.gsettings.set_boolean('gtk-completion', bool(old_settings.enable_gtk_completion))
self.gsettings.set_boolean('settings-migrated', True)
log.info(_('Settings from {filename} migrated to GSettings (org.gtimelog)').format(filename=old_settings.get_config_file()))

Expand Down Expand Up @@ -1113,13 +1115,18 @@ class TaskEntry(Gtk.Entry):
type=int, default=1000, nick='Completion limit',
blurb='Maximum number of items in the completion popup')

gtk_completion_enabled = GObject.Property(
type=bool, default=True, nick='Completion enabled',
blurb='GTK+ completion enabled?')

def __init__(self):
Gtk.Entry.__init__(self)
self.set_up_history()
self.set_up_completion()
self.connect('notify::timelog', self.timelog_changed)
self.connect('notify::completion-limit', self.timelog_changed)
self.connect('changed', self.on_changed)
self.connect('notify::gtk-completion-enabled', self.gtk_completion_enabled_changed)

def set_up_history(self):
self.history = []
Expand All @@ -1128,12 +1135,19 @@ def set_up_history(self):
self.history_undo = ''

def set_up_completion(self):
completion = Gtk.EntryCompletion()
completion = self.gtk_completion = Gtk.EntryCompletion()
self.completion_choices = Gtk.ListStore(str)
self.completion_choices_as_set = set()
completion.set_model(self.completion_choices)
completion.set_text_column(0)
self.set_completion(completion)
if self.gtk_completion_enabled:
self.set_completion(completion)

def gtk_completion_enabled_changed(self, *args):
if self.gtk_completion_enabled:
self.set_completion(self.gtk_completion)
else:
self.set_completion(None)

def timelog_changed(self, *args):
mark_time('about to initialize history completion')
Expand Down

0 comments on commit 889c49f

Please sign in to comment.