Commits

michael b committed f476804

Removing unused preferences dialog

Comments (0)

Files changed (7)

data/ui/FsgamerWindow.ui

                         <property name="can_focus">False</property>
                       </object>
                     </child>
-                    <child>
-                      <object class="GtkImageMenuItem" id="mnu_preferences">
-                        <property name="label">gtk-preferences</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                      </object>
-                    </child>
                   </object>
                 </child>
               </object>

data/ui/PreferencesFsgamerDialog.ui

-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <!-- interface-requires gtk+ 3.0 -->
-  <!-- interface-requires preferences_fsgamer_dialog 1.0 -->
-  <object class="PreferencesFsgamerDialog" id="preferences_fsgamer_dialog">
-    <property name="can_focus">False</property>
-    <property name="title" translatable="yes">Fsgamer Preferences</property>
-    <property name="icon">../media/fsgamer.svg</property>
-    <property name="type_hint">normal</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">12</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="btn_help">
-                <property name="label">gtk-help</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-                <property name="secondary">True</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="btn_close">
-                <property name="label">gtk-close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkGrid" id="table1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="row_spacing">6</property>
-            <property name="column_spacing">6</property>
-            <property name="n_rows">1</property>
-            <property name="n_columns">2</property>
-            <child>
-              <object class="GtkEntry" id="example_entry">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hexpand">True</property>
-                <property name="invisible_char">•</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="example_entry_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">_Example entry:</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">example_entry</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <action-widgets>
-      <action-widget response="-11">btn_help</action-widget>
-      <action-widget response="-7">btn_close</action-widget>
-    </action-widgets>
-  </object>
-</interface>

data/ui/preferences_fsgamer_dialog.xml

-<glade-catalog name="preferences_fsgamer_dialog" domain="glade-3" 
-               depends="gtk+" version="1.0">
-  <glade-widget-classes>
-    <glade-widget-class title="Fsgamer Preferences Dialog" name="PreferencesFsgamerDialog" 
-                        generic-name="PreferenceFsgamerDialog" parent="GtkDialog"
-                        icon-name="widget-gtk-dialog"/>
-  </glade-widget-classes>
-
-</glade-catalog>

fsgamer/FsgamerWindow.py

 
 from fsgamer_lib import Window
 from fsgamer.AboutFsgamerDialog import AboutFsgamerDialog
-from fsgamer.PreferencesFsgamerDialog import PreferencesFsgamerDialog
 from fsgamer.ChooseDialog import ChooseDialog
 from fsgamer.FsgrunDialog import FsgrunDialog
 
 import utils
 
 
+OPTION_DEFAULTS = {
+    'notifications_tts': False,
+    'xorg_conf': '',
+}
+
 NO_APP_INSTRUCTIONS = """
 Welcome to FSGamer!
 
         super(FsgamerWindow, self).finish_initializing(builder)
 
         self.AboutDialog = AboutFsgamerDialog
-        self.PreferencesDialog = PreferencesFsgamerDialog
         self.ChooseDialog = ChooseDialog
         self.FsgrunDialog = FsgrunDialog
         self.choose_dialog = None
             self.current_app.delete()
             self.refresh()
             self.current_app = None
-            self.set_nothing_selected()
+        self.set_nothing_selected()
 
     def on_giant_play_button_clicked(self, widget):
         # Do not run directly, start a child process
         self.ui.check_show_menu_icon.handler_unblock_by_func(
                             self.on_check_show_menu_icon_toggled)
 
-    OPTION_DEFAULTS = {
-            'notifications_tts': False,
-        }
 
     def refresh_options(self):
         if not self.current_app:
             return
 
-        for key, default_val in self.OPTION_DEFAULTS.iteritems():
+        for key, default_val in OPTION_DEFAULTS.iteritems():
             val = self.current_app.opts.get(key, default_val)
             name = "option_" + key
             widget = getattr(self.ui, name)
         if not self.current_app:
             return
 
-        for key, default_val in self.OPTION_DEFAULTS.iteritems():
+        for key, default_val in OPTION_DEFAULTS.iteritems():
             name = "option_" + key
             widget = getattr(self.ui, name)
 

fsgamer/PreferencesFsgamerDialog.py

-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-
-# This is your preferences dialog.
-#
-# Define your preferences in
-# data/glib-2.0/schemas/net.launchpad.fsgamer.gschema.xml
-# See http://developer.gnome.org/gio/stable/GSettings.html for more info.
-
-from gi.repository import Gio # pylint: disable=E0611
-
-import gettext
-from gettext import gettext as _
-gettext.textdomain('fsgamer')
-
-import logging
-logger = logging.getLogger('fsgamer')
-
-from fsgamer_lib.PreferencesDialog import PreferencesDialog
-
-class PreferencesFsgamerDialog(PreferencesDialog):
-    __gtype_name__ = "PreferencesFsgamerDialog"
-
-    def finish_initializing(self, builder): # pylint: disable=E1002
-        """Set up the preferences dialog"""
-        super(PreferencesFsgamerDialog, self).finish_initializing(builder)
-
-        # Bind each preference widget to gsettings
-        settings = Gio.Settings("net.launchpad.fsgamer")
-        widget = self.builder.get_object('example_entry')
-        settings.bind("example", widget, "text", Gio.SettingsBindFlags.DEFAULT)
-
-        # Code for other initialization actions should be added here.

fsgamer_lib/PreferencesDialog.py

-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-### BEGIN LICENSE
-# Copyright (C) 2013 Michael Bethencourt michaelpb@gmail.com
-# This program is free software: you can redistribute it and/or modify it 
-# under the terms of the GNU General Public License version 3, as published 
-# by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but 
-# WITHOUT ANY WARRANTY; without even the implied warranties of 
-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
-# PURPOSE.  See the GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License along 
-# with this program.  If not, see <http://www.gnu.org/licenses/>.
-### END LICENSE
-
-"""this dialog adjusts values in gsettings
-"""
-
-from gi.repository import Gtk # pylint: disable=E0611
-import logging
-logger = logging.getLogger('fsgamer_lib')
-
-from . helpers import get_builder, show_uri, get_help_uri
-
-class PreferencesDialog(Gtk.Dialog):
-    __gtype_name__ = "PreferencesDialog"
-
-    def __new__(cls):
-        """Special static method that's automatically called by Python when 
-        constructing a new instance of this class.
-        
-        Returns a fully instantiated PreferencesDialog object.
-        """
-        builder = get_builder('PreferencesFsgamerDialog')
-        new_object = builder.get_object("preferences_fsgamer_dialog")
-        new_object.finish_initializing(builder)
-        return new_object
-
-    def finish_initializing(self, builder):
-        """Called while initializing this instance in __new__
-
-        finish_initalizing should be called after parsing the ui definition
-        and creating a PreferencesDialog object with it in order to
-        finish initializing the start of the new PerferencesFsgamerDialog
-        instance.
-        
-        Put your initialization code in here and leave __init__ undefined.
-        """
-
-        # Get a reference to the builder and set up the signals.
-        self.builder = builder
-        self.ui = builder.get_ui(self, True)
-
-        # code for other initialization actions should be added here
-
-    def on_btn_close_clicked(self, widget, data=None):
-        self.destroy()
-
-    def on_btn_help_clicked(self, widget, data=None):
-        show_uri(self, "ghelp:%s" % get_help_uri('preferences'))
-

fsgamer_lib/Window.py

         # Get a reference to the builder and set up the signals.
         self.builder = builder
         self.ui = builder.get_ui(self, True)
-        self.PreferencesDialog = None # class
-        self.preferences_dialog = None # instance
         self.AboutDialog = None # class
 
-        self.settings = Gio.Settings("net.launchpad.fsgamer")
-        self.settings.connect('changed', self.on_preferences_changed)
-
         # Optional Launchpad integration
         # This shouldn't crash if not found as it is simply used for bug reporting.
         # See https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding
             response = about.run()
             about.destroy()
 
-    def on_mnu_preferences_activate(self, widget, data=None):
-        """Display the preferences window for fsgamer."""
-
-        """ From the PyGTK Reference manual
-           Say for example the preferences dialog is currently open,
-           and the user chooses Preferences from the menu a second time;
-           use the present() method to move the already-open dialog
-           where the user can see it."""
-        if self.preferences_dialog is not None:
-            logger.debug('show existing preferences_dialog')
-            self.preferences_dialog.present()
-        elif self.PreferencesDialog is not None:
-            logger.debug('create new preferences_dialog')
-            self.preferences_dialog = self.PreferencesDialog() # pylint: disable=E1102
-            self.preferences_dialog.connect('destroy', self.on_preferences_dialog_destroyed)
-            self.preferences_dialog.show()
-        # destroy command moved into dialog to allow for a help button
-
     def on_mnu_close_activate(self, widget, data=None):
         """Signal handler for closing the FsgamerWindow."""
         self.destroy()
         # Clean up code for saving application state should be added here.
         Gtk.main_quit()
 
-    def on_preferences_changed(self, settings, key, data=None):
-        logger.debug('preference changed: %s = %s' % (key, str(settings.get_value(key))))
-
-    def on_preferences_dialog_destroyed(self, widget, data=None):
-        '''only affects gui
-        
-        logically there is no difference between the user closing,
-        minimising or ignoring the preferences dialog'''
-        logger.debug('on_preferences_dialog_destroyed')
-        # to determine whether to create or present preferences_dialog
-        self.preferences_dialog = None
-