Exemplo n.º 1
0
    def do_activate(self):
        """Activates the application.

        """
        self.window = self.props.active_window
        if not self.window:
            self.window = NorkaWindow(application=self, settings=self.settings)
        self.window.present()
Exemplo n.º 2
0
    def do_activate(self):
        """Activates the application.

        """
        self.granite_settings = Granite.Settings.get_default()
        self.gtk_settings = Gtk.Settings.get_default()

        # Setup default theme mode
        if self.settings.get_boolean('prefer-dark-theme'):
            self.gtk_settings.props.gtk_application_prefer_dark_theme = True
        else:
            # Then, we check if the user's preference is for the dark style and set it if it is
            self.gtk_settings.props.gtk_application_prefer_dark_theme = \
                self.granite_settings.props.prefers_color_scheme == Granite.SettingsColorScheme.DARK

        # Finally, we listen to changes in Granite.Settings and update our app if the user changes their preference
        self.granite_settings.connect("notify::prefers-color-scheme",
                                      self.color_scheme_changed)

        self.window = self.props.active_window
        if not self.window:
            self.window = NorkaWindow(application=self, settings=self.settings, storage=self.storage)
        self.window.present()