diff options
author | Kalev Lember <kalevlember@gmail.com> | 2012-05-04 17:16:50 +0300 |
---|---|---|
committer | Brian C. Lane <bcl@redhat.com> | 2012-05-04 14:13:33 -0700 |
commit | 51f1c6620ba7143f9690f6c029e1e7176bb3459a (patch) | |
tree | 7379a88307b43637b41e5ffe46731a436c8fbf5d /data | |
parent | 6475cfd6abd6ff86c8fad4198fbddf1dfb9f7f91 (diff) | |
download | anaconda-51f1c6620ba7143f9690f6c029e1e7176bb3459a.tar.gz anaconda-51f1c6620ba7143f9690f6c029e1e7176bb3459a.tar.xz anaconda-51f1c6620ba7143f9690f6c029e1e7176bb3459a.zip |
liveinst/gnome: Add a welcome screen for use by the Desktop spin
Imported from https://github.com/cosimoc/fedora-welcome
This is for Fedora 17 only. It will be moved into its own package
for Fedora 18.
Diffstat (limited to 'data')
-rw-r--r-- | data/liveinst/Makefile.am | 2 | ||||
-rw-r--r-- | data/liveinst/gnome/Makefile.am | 35 | ||||
-rwxr-xr-x | data/liveinst/gnome/fedora-welcome | 174 | ||||
-rw-r--r-- | data/liveinst/gnome/fedora-welcome.desktop.in | 9 | ||||
-rw-r--r-- | data/liveinst/gnome/install-button.png | bin | 0 -> 11926 bytes |
5 files changed, 219 insertions, 1 deletions
diff --git a/data/liveinst/Makefile.am b/data/liveinst/Makefile.am index 2f51dfa5e..0da8c6c1c 100644 --- a/data/liveinst/Makefile.am +++ b/data/liveinst/Makefile.am @@ -17,7 +17,7 @@ # # Author: David Cantrell <dcantrell@redhat.com> -SUBDIRS = console.apps pam.d +SUBDIRS = console.apps gnome pam.d if IS_LIVEINST_ARCH dist_sbin_SCRIPTS = liveinst diff --git a/data/liveinst/gnome/Makefile.am b/data/liveinst/gnome/Makefile.am new file mode 100644 index 000000000..174a04fc5 --- /dev/null +++ b/data/liveinst/gnome/Makefile.am @@ -0,0 +1,35 @@ +# liveinst/gnome/Makefile.am for anaconda +# +# Copyright (C) 2012 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# Author: Kalev Lember <kalevlember@gmail.com> + +welcomedir = $(datadir)/$(PACKAGE_NAME)/gnome +dist_welcome_DATA = fedora-welcome.desktop install-button.png +dist_welcome_SCRIPTS = fedora-welcome + +EXTRA_DIST = fedora-welcome.desktop.in + +CLEANFILES = fedora-welcome.desktop + +MAINTAINERCLEANFILES = Makefile.in + +intltool_merge_verbose = $(intltool_merge_verbose_$(V)) +intltool_merge_verbose_ = $(intltool_merge_verbose_$(AM_DEFAULT_VERBOSITY)) +intltool_merge_verbose_0 = @echo " MERGE "$@; + +fedora-welcome.desktop: fedora-welcome.desktop.in + $(intltool_merge_verbose)LC_ALL=C intltool-merge -q -d -u $(top_srcdir)/po fedora-welcome.desktop.in fedora-welcome.desktop diff --git a/data/liveinst/gnome/fedora-welcome b/data/liveinst/gnome/fedora-welcome new file mode 100755 index 000000000..878094193 --- /dev/null +++ b/data/liveinst/gnome/fedora-welcome @@ -0,0 +1,174 @@ +#!/usr/bin/env gjs-console + +/* + * Copyright (C) 2012 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Authors: Cosimo Cecchi <cosimoc@redhat.com> + * + */ + +const Gdk = imports.gi.Gdk; +const GdkPixbuf = imports.gi.GdkPixbuf; +const Gio = imports.gi.Gio; +const GLib = imports.gi.GLib; +const Gtk = imports.gi.Gtk; +const Lang = imports.lang; +const Pango = imports.gi.Pango; + +const Gettext = imports.gettext; +const _ = imports.gettext.gettext; + +const LOCALE_DIR = '/usr/share/locale'; + +let anacondaApp = null; + +function makeLabel(label, button) { + let widget = new Gtk.Label(); + + if (button) + widget.set_markup('<b><span size="x-large" color="white">' + label + '</span></b>'); + else { + widget.set_line_wrap(true); + widget.set_justify(Gtk.Justification.CENTER); + widget.set_margin_top(32); + widget.set_margin_bottom(32); + + widget.set_markup('<span size="large" color="white">' + label + '</span>'); + } + + return widget; +} + +const WelcomeWindow = new Lang.Class({ + Name: 'WelcomeWindow', + + _init: function(application) { + this.window = new Gtk.ApplicationWindow({ application: application, + type: Gtk.WindowType.TOPLEVEL, + default_width: 600, + default_height: 550, + title: _("Welcome to Fedora"), + window_position: Gtk.WindowPosition.CENTER }); + this.window.connect('key-press-event', Lang.bind(this, + function(w, event) { + let key = event.get_keyval()[1]; + + if (key == Gdk.KEY_Escape) + this.window.destroy(); + + return false; + })); + + let mainGrid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL, + row_spacing: 16, + vexpand: true, + hexpand: true, + halign: Gtk.Align.CENTER, + valign: Gtk.Align.CENTER }); + this.window.add(mainGrid); + + let buttonBox = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL, + column_spacing: 16, + halign: Gtk.Align.CENTER }); + mainGrid.add(buttonBox); + + let tryContent = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, + spacing: 16 }); + tryContent.add(new Gtk.Image({ icon_name: 'media-cdrom', + pixel_size: 256 })); + tryContent.add(makeLabel(_("Try Fedora"), true)); + + let tryButton = new Gtk.Button({ child: tryContent }); + buttonBox.add(tryButton); + + let installContent = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, + spacing: 16 }); + + // provided by the 'fedora-logos' package + let pix = GdkPixbuf.Pixbuf.new_from_file_at_size( + '/usr/share/icons/Fedora/scalable/apps/anaconda.svg', + 256, 256); + installContent.add(new Gtk.Image({ pixbuf: pix })); + installContent.add(makeLabel(anacondaApp.get_name(), true)); + + let installButton = new Gtk.Button({ child: installContent }); + buttonBox.add(installButton); + + this._label = makeLabel(_("You are currently running Fedora from live media.\nYou can install Fedora now, or choose \"Install to Hard Drive\" in the Activities Overview at any later time."), false); + mainGrid.add(this._label); + + installButton.connect('clicked', Lang.bind(this, + function() { + GLib.spawn_command_line_async('liveinst'); + this.window.destroy(); + })); + + tryButton.connect('clicked', Lang.bind(this, + function() { + buttonBox.destroy(); + this._label.destroy(); + + let image = new Gtk.Image({ file: '/usr/share/anaconda/gnome/install-button.png', + halign: Gtk.Align.CENTER }); + mainGrid.add(image); + + this._label = makeLabel(_("You can choose \"Install to Hard Drive\"\nin the Activities Overview at any later time."), false); + mainGrid.add(this._label); + + let closeLabel = makeLabel(_("Close"), true); + closeLabel.margin = 10; + let button = new Gtk.Button({ child: closeLabel, + halign: Gtk.Align.CENTER }); + button.connect('clicked', Lang.bind(this, + function() { + this.window.destroy(); + })); + mainGrid.add(button); + + mainGrid.show_all(); + })); + } +}); + +Gettext.bindtextdomain('anaconda', LOCALE_DIR); +Gettext.textdomain('anaconda'); + +GLib.set_prgname('fedora-welcome'); +Gtk.init(null, null); +Gtk.Settings.get_default().gtk_application_prefer_dark_theme = true; + +// provided by the 'anaconda' package +anacondaApp = Gio.DesktopAppInfo.new('anaconda.desktop'); +if (!anacondaApp) + anacondaApp = Gio.DesktopAppInfo.new('liveinst.desktop'); + +if (anacondaApp) { + let application = new Gtk.Application({ application_id: 'org.fedoraproject.welcome-screen', + flags: Gio.ApplicationFlags.FLAGS_NONE }); + let welcomeWindow = null; + + application.connect('startup', Lang.bind(this, + function() { + welcomeWindow = new WelcomeWindow(application); + })); + application.connect('activate', Lang.bind(this, + function() { + welcomeWindow.window.show_all(); + })); + + application.run(ARGV); +} diff --git a/data/liveinst/gnome/fedora-welcome.desktop.in b/data/liveinst/gnome/fedora-welcome.desktop.in new file mode 100644 index 000000000..bac0e0a15 --- /dev/null +++ b/data/liveinst/gnome/fedora-welcome.desktop.in @@ -0,0 +1,9 @@ +[Desktop Entry] +_Name=Welcome to Fedora +Exec=/usr/share/anaconda/gnome/fedora-welcome +Icon=/usr/share/icons/Fedora/256x256/places/start-here.png +Terminal=false +Type=Application +StartupNotify=true +NoDisplay=true +X-GNOME-Autostart-enabled=true diff --git a/data/liveinst/gnome/install-button.png b/data/liveinst/gnome/install-button.png Binary files differnew file mode 100644 index 000000000..b7901ff1e --- /dev/null +++ b/data/liveinst/gnome/install-button.png |