From 81c6ff16dda0f3a959842a9b495cb0badda01983 Mon Sep 17 00:00:00 2001 From: Song Wenwu Date: Mon, 13 Jan 2014 20:08:20 +0800 Subject: [PATCH 0001/2033] tk: update to 8.5.15, enable xft support --- pkgs/development/libraries/tk/default.nix | 11 ++++++----- pkgs/top-level/all-packages.nix | 4 +--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/tk/default.nix b/pkgs/development/libraries/tk/default.nix index a45c4217c7b..7d55dd4c7d0 100644 --- a/pkgs/development/libraries/tk/default.nix +++ b/pkgs/development/libraries/tk/default.nix @@ -1,11 +1,11 @@ -{ stdenv, fetchurl, tcl, x11, libX11 }: +{ stdenv, fetchurl, pkgconfig, tcl, libXft }: stdenv.mkDerivation { - name = "tk-8.5.7"; + name = "tk-8.5.15"; src = fetchurl { - url = "mirror://sourceforge/tcl/tk8.5.7-src.tar.gz"; - sha256 = "0c5gsy3nlwl0wn9swz4k4v7phy7nzjl317gca1jykgf4jz9nwdnr"; + url = "mirror://sourceforge/tcl/tk8.5.15-src.tar.gz"; + sha256 = "0grj0k0hljvwiz913pafqibz18fzk9xjxf0nzqrd9zdls036fp41"; }; postInstall = '' @@ -16,7 +16,7 @@ stdenv.mkDerivation { preConfigure = "cd unix"; - buildInputs = [ tcl x11 libX11 ]; + buildInputs = [ pkgconfig tcl libXft ]; inherit tcl; @@ -27,6 +27,7 @@ stdenv.mkDerivation { meta = { description = "A widget toolkit that provides a library of basic elements for building a GUI in many different programming languages"; homepage = http://www.tcl.tk/; + license = stdenv.lib.licenses.tcltk; maintainers = with stdenv.lib.maintainers; [ lovek323 ]; platforms = stdenv.lib.platforms.all; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6ee74ee90e1..32cd77a4c36 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5621,9 +5621,7 @@ let tinyxml2 = callPackage ../development/libraries/tinyxml/2.6.2.nix { }; - tk = callPackage ../development/libraries/tk { - libX11 = xlibs.libX11; - }; + tk = callPackage ../development/libraries/tk { }; tnt = callPackage ../development/libraries/tnt { }; From a2dddb90dc056ddd8b8fd56ef3272c301580307b Mon Sep 17 00:00:00 2001 From: Song Wenwu Date: Mon, 13 Jan 2014 21:05:58 +0800 Subject: [PATCH 0002/2033] puredata: update to 0.45-4 --- pkgs/applications/audio/puredata/default.nix | 25 ++++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/audio/puredata/default.nix b/pkgs/applications/audio/puredata/default.nix index b1df008398d..d0394b72edd 100644 --- a/pkgs/applications/audio/puredata/default.nix +++ b/pkgs/applications/audio/puredata/default.nix @@ -1,23 +1,28 @@ -{ stdenv, fetchurl, alsaLib, autoconf, automake, fftw, gettext, glib -, jackaudio, libX11, libtool, makeWrapper, pkgconfig, tcl, tk +{ stdenv, fetchurl, autoreconfHook, gettext, makeWrapper +, alsaLib, jackaudio, tk }: stdenv.mkDerivation rec { name = "puredata-${version}"; - version = "0.44-0"; + version = "0.45-4"; src = fetchurl { url = "mirror://sourceforge/pure-data/pd-${version}.src.tar.gz"; - sha256 = "031bvqfnlpfx0y5n0l5rmslziqc6jgmk99x1prgh1rmhjhjdnijw"; + sha256 = "1ls2ap5yi2zxvmr247621g4jx0hhfds4j5704a050bn2n3l0va2p"; }; - buildInputs = [ - alsaLib autoconf automake fftw gettext glib jackaudio libX11 - libtool makeWrapper pkgconfig tcl tk - ]; + patchPhase = '' + rm portaudio/configure.in + ''; - preConfigure = '' - ./autogen.sh + nativeBuildInputs = [ autoreconfHook gettext makeWrapper ]; + + buildInputs = [ alsaLib jackaudio ]; + + configureFlags = '' + --enable-alsa + --enable-jack + --disable-portaudio ''; postInstall = '' From b6cc977580526918f8c1abe74985efec14dccbbf Mon Sep 17 00:00:00 2001 From: Song Wenwu Date: Tue, 14 Jan 2014 20:23:44 +0800 Subject: [PATCH 0003/2033] tcl: update to 8.5.15 --- pkgs/development/interpreters/tcl/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/interpreters/tcl/default.nix b/pkgs/development/interpreters/tcl/default.nix index 48755065b99..c9a0fd7546f 100644 --- a/pkgs/development/interpreters/tcl/default.nix +++ b/pkgs/development/interpreters/tcl/default.nix @@ -1,11 +1,11 @@ -{stdenv, fetchurl}: +{ stdenv, fetchurl }: stdenv.mkDerivation { - name = "tcl-8.5.7"; + name = "tcl-8.5.15"; src = fetchurl { - url = mirror://sourceforge/tcl/tcl8.5.7-src.tar.gz; - sha256 = "1wk67qq12bdbaqsi6cxwj6ra8nc8ph1na9rh808kfk6hm18qvlk7"; + url = mirror://sourceforge/tcl/tcl8.5.15-src.tar.gz; + sha256 = "0kl8lbfwy4v4q4461wjmva95h0pgiprykislpw4nnpkrc7jalkpj"; }; preConfigure = "cd unix"; From 299af2ff45f0202067f8925913b203e4c0432f07 Mon Sep 17 00:00:00 2001 From: Song Wenwu Date: Sat, 25 Jan 2014 10:36:20 +0800 Subject: [PATCH 0004/2033] tk: fix issue #1479 --- pkgs/development/libraries/tk/default.nix | 2 ++ .../tk/different-prefix-with-tcl.patch | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 pkgs/development/libraries/tk/different-prefix-with-tcl.patch diff --git a/pkgs/development/libraries/tk/default.nix b/pkgs/development/libraries/tk/default.nix index 7d55dd4c7d0..c7fe3e105d8 100644 --- a/pkgs/development/libraries/tk/default.nix +++ b/pkgs/development/libraries/tk/default.nix @@ -7,6 +7,8 @@ stdenv.mkDerivation { url = "mirror://sourceforge/tcl/tk8.5.15-src.tar.gz"; sha256 = "0grj0k0hljvwiz913pafqibz18fzk9xjxf0nzqrd9zdls036fp41"; }; + + patches = [ ./different-prefix-with-tcl.patch ]; postInstall = '' ln -s $out/bin/wish* $out/bin/wish diff --git a/pkgs/development/libraries/tk/different-prefix-with-tcl.patch b/pkgs/development/libraries/tk/different-prefix-with-tcl.patch new file mode 100644 index 00000000000..bf331b75cae --- /dev/null +++ b/pkgs/development/libraries/tk/different-prefix-with-tcl.patch @@ -0,0 +1,22 @@ +--- tk8.5.15-orig/unix/Makefile.in 2014-01-25 08:57:45.626713122 +0800 ++++ tk8.5.15/unix/Makefile.in 2014-01-25 08:59:35.315341825 +0800 +@@ -995,7 +995,8 @@ + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkVisual.c + + tkWindow.o: $(GENERIC_DIR)/tkWindow.c +- $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkWindow.c ++ $(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \ ++ $(GENERIC_DIR)/tkWindow.c + + tkButton.o: $(GENERIC_DIR)/tkButton.c + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkButton.c +--- tk8.5.15-orig/generic/tkWindow.c 2014-01-25 10:10:03.964476436 +0800 ++++ tk8.5.15/generic/tkWindow.c 2014-01-25 10:08:06.020950933 +0800 +@@ -983,6 +983,7 @@ + + Tcl_SetVar(interp, "tk_patchLevel", TK_PATCH_LEVEL, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "tk_version", TK_VERSION, TCL_GLOBAL_ONLY); ++ Tcl_SetVar(interp, "tk_library", TK_LIBRARY, TCL_GLOBAL_ONLY); + + tsdPtr->numMainWindows++; + return tkwin; From 41775167ac69a001f40c11e2ee9576887e17b8b4 Mon Sep 17 00:00:00 2001 From: Oliver Charles Date: Sun, 2 Feb 2014 14:41:26 +0000 Subject: [PATCH 0005/2033] switch-to-configuration.pl: Interact via DBus Currently switch-to-configuration.pl uses system() calls to interact with DBus. This can be error prone, especially when we are parsing output that could change. In this commit, almost all calls to the systemctl binary have been replaced with equivalent operations via DBus. --- .../activation/switch-to-configuration.pl | 55 ++++++++++++------- nixos/modules/system/activation/top-level.nix | 2 +- 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl index 33ae3aef9fc..91beed1130e 100644 --- a/nixos/modules/system/activation/switch-to-configuration.pl +++ b/nixos/modules/system/activation/switch-to-configuration.pl @@ -4,6 +4,7 @@ use strict; use warnings; use File::Basename; use File::Slurp; +use Net::DBus; use Sys::Syslog qw(:standard :macros); use Cwd 'abs_path'; @@ -59,17 +60,18 @@ syslog(LOG_NOTICE, "switching to system configuration $out"); # virtual console 1 and we restart the "tty1" unit. $SIG{PIPE} = "IGNORE"; +my $dbus = Net::DBus->find; +my $systemdService = $dbus->get_service('org.freedesktop.systemd1'); +my $systemdManager = $systemdService->get_object('/org/freedesktop/systemd1'); + sub getActiveUnits { - # FIXME: use D-Bus or whatever to query this, since parsing the - # output of list-units is likely to break. - my $lines = `@systemd@/bin/systemctl list-units --full`; my $res = {}; - foreach my $line (split '\n', $lines) { - chomp $line; - last if $line eq ""; - $line =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s/ or next; - next if $1 eq "UNIT"; - $res->{$1} = { load => $2, state => $3, substate => $4 }; + foreach my $unit (@{ $systemdManager->ListUnits() }) { + $res->{$unit->[0]} = { + load => $unit->[2], + state => $unit->[3], + substate => $unit->[4] + }; } return $res; } @@ -277,7 +279,7 @@ foreach my $device (keys %$prevSwaps) { if (scalar @unitsToStop > 0) { @unitsToStop = unique(@unitsToStop); print STDERR "stopping the following units: ", join(", ", sort(@unitsToStop)), "\n"; - system("@systemd@/bin/systemctl", "stop", "--", @unitsToStop); # FIXME: ignore errors? + $systemdManager->StopUnit($_, "replace") for @unitsToStop; } print STDERR "NOT restarting the following units: ", join(", ", sort(@unitsToSkip)), "\n" @@ -292,21 +294,22 @@ system("$out/activate", "$out") == 0 or $res = 2; # Restart systemd if necessary. if (abs_path("/proc/1/exe") ne abs_path("@systemd@/lib/systemd/systemd")) { print STDERR "restarting systemd...\n"; - system("@systemd@/bin/systemctl", "daemon-reexec") == 0 or $res = 2; + + $systemdManager->Reexecute(); } # Forget about previously failed services. -system("@systemd@/bin/systemctl", "reset-failed"); +$systemdManager->ResetFailed(); -# Make systemd reload its units. -system("@systemd@/bin/systemctl", "daemon-reload") == 0 or $res = 3; +# Make systemd reload its units +$systemdManager->Reload(); # Restart changed services (those that have to be restarted rather # than stopped and started). my @restart = unique(split('\n', read_file($restartListFile, err_mode => 'quiet') // "")); if (scalar @restart > 0) { print STDERR "restarting the following units: ", join(", ", sort(@restart)), "\n"; - system("@systemd@/bin/systemctl", "restart", "--", @restart) == 0 or $res = 4; + $systemdManager->Restart($_, "replace") for @restart; unlink($restartListFile); } @@ -318,7 +321,7 @@ if (scalar @restart > 0) { # systemd. my @start = unique("default.target", "timers.target", split('\n', read_file($startListFile, err_mode => 'quiet') // "")); print STDERR "starting the following units: ", join(", ", sort(@start)), "\n"; -system("@systemd@/bin/systemctl", "start", "--", @start) == 0 or $res = 4; +$systemdManager->StartUnit($_, "replace") for @start; unlink($startListFile); # Reload units that need it. This includes remounting changed mount @@ -326,19 +329,31 @@ unlink($startListFile); my @reload = unique(split '\n', read_file($reloadListFile, err_mode => 'quiet') // ""); if (scalar @reload > 0) { print STDERR "reloading the following units: ", join(", ", sort(@reload)), "\n"; - system("@systemd@/bin/systemctl", "reload", "--", @reload) == 0 or $res = 4; + $systemdManager->ReloadUnit($_, "replace") for @reload; unlink($reloadListFile); } # Signal dbus to reload its configuration. -system("@systemd@/bin/systemctl", "reload", "dbus.service"); +$systemdManager->ReloadUnit("dbus.service", "replace"); # Print failed and new units. my (@failed, @new, @restarting); my $activeNew = getActiveUnits; while (my ($unit, $state) = each %{$activeNew}) { - push @failed, $unit if $state->{state} eq "failed" || $state->{substate} eq "auto-restart"; - push @new, $unit if $state->{state} ne "failed" && !defined $activePrev->{$unit}; + if ($state->{state} eq "failed") { + push @failed, $unit; + } + elsif ($state->{state} eq "auto-restart") { + # A unit in auto-restart state is a failure *if* it previously failed to start + my $unit = $systemdManager->GetUnit($unit); + + if ($unit->ExecMainStatus ne '0') { + push @failed, $unit; + } + } + elsif ($state->{state} ne "failed" && !defined $activePrev->{$unit}) { + push @new, $unit; + } } print STDERR "the following new units were started: ", join(", ", sort(@new)), "\n" diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index d9891f434cc..30a529988a9 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -108,7 +108,7 @@ let configurationName = config.boot.loader.grub.configurationName; # Needed by switch-to-configuration. - perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl"; + perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.XMLTwig}/lib/perl5/site_perl -I${pkgs.perlPackages.XMLParser}/lib/perl5/site_perl -I${pkgs.perlPackages.NetDBus}/lib/perl5/site_perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl"; }; From a78c6490d70d7b7ebb0b2ba593dcbba2af7ab631 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 23 Feb 2014 23:44:11 +0100 Subject: [PATCH 0006/2033] mingw-w64: Update to new upstream version 3.1.0. Signed-off-by: aszlig --- pkgs/os-specific/windows/mingw-w64/default.nix | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index c358565c455..0d7beb532fe 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -1,23 +1,15 @@ {stdenv, fetchurl, binutilsCross ? null, gccCross ? null, onlyHeaders ? false}: let - name = "mingw-w64-2.0.3"; + name = "mingw-w64-3.1.0"; in stdenv.mkDerivation (rec { inherit name; src = fetchurl { - url = "mirror://sourceforge/mingw-w64/mingw-w64-v2.0.3.tar.gz"; - sha256 = "043jk6z90f9pxs9kfn6ckh2vlnbgcv6yfbp5ybahrj3z58dcijp5"; + url = "mirror://sourceforge/mingw-w64/mingw-w64-v3.1.0.tar.bz2"; + sha256 = "1lhpw381gc59w8b1r9zzdwa9cdi2wx6qx7s6rvajapmbw7ksgrzc"; }; - - # I don't know what's that $host directory about, I put the - # files inside include as usual. - postInstall = '' - rmdir $out/include - mv $out/x86_64-w64-mingw32/* $out - rm -R $out/x86_64-w64-mingw32 - ''; } // (if onlyHeaders then { name = name + "-headers"; From ba8b0e8af9e0ced255cd974101c349ca9d787b89 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 00:28:46 +0100 Subject: [PATCH 0007/2033] binutils-cross: Remove unreferenced package. This package wasn't imported by anything in the package tree and also isn't used for cross-builds. So in order to avoid confusion, it's better to remove it as it is outdated as well. Signed-off-by: aszlig --- .../tools/misc/binutils-cross/builder.sh | 26 ------------------- .../tools/misc/binutils-cross/default.nix | 13 ---------- 2 files changed, 39 deletions(-) delete mode 100644 pkgs/development/tools/misc/binutils-cross/builder.sh delete mode 100644 pkgs/development/tools/misc/binutils-cross/default.nix diff --git a/pkgs/development/tools/misc/binutils-cross/builder.sh b/pkgs/development/tools/misc/binutils-cross/builder.sh deleted file mode 100644 index 29d3b3779b6..00000000000 --- a/pkgs/development/tools/misc/binutils-cross/builder.sh +++ /dev/null @@ -1,26 +0,0 @@ -source $stdenv/setup - -if test $cross = "arm-linux" ; then - configureFlags="--target=arm-linux" -elif test $cross = "mips-linux" ; then - configureFlags="--target=mips-linux" -elif test $cross = "mipsel-linux" ; then - configureFlags="--target=mipsel-linux" -elif test $cross = "sparc-linux" ; then - configureFlags="--target=sparc-linux" -elif test $cross = "powerpc-linux" ; then - configureFlags="--target=powerpc-linux" -elif test $cross = "ppc-linux" ; then - configureFlags="--target=powerpc-linux" -fi - -patchConfigure() { - # Clear the default library search path. - if test "$noSysDirs" = "1"; then - echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt - fi -} - -preConfigure=patchConfigure - -genericBuild diff --git a/pkgs/development/tools/misc/binutils-cross/default.nix b/pkgs/development/tools/misc/binutils-cross/default.nix deleted file mode 100644 index 7d77baced37..00000000000 --- a/pkgs/development/tools/misc/binutils-cross/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{stdenv, fetchurl, noSysDirs, cross}: - -stdenv.mkDerivation { - name = "binutils-2.16.1"; - builder = ./builder.sh; - src = fetchurl { - url = http://ftp.nluug.nl/gnu/binutils/binutils-2.16.1.tar.bz2; - md5 = "6a9d529efb285071dad10e1f3d2b2967"; - }; - inherit noSysDirs; - #configureFlags = if cross=="arm-linux" then "--target=arm-linux" else if cross=="mips-linux" then "--target=mips-linux" else if cross=="sparc-linux" then "--target=sparc-linux"; - inherit cross; -} From 60a2fc1fec78f2653b3ef71b24ec8ae72b99d38b Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 01:07:57 +0100 Subject: [PATCH 0008/2033] openssl: Fix Windows compat in cert-file.patch. In Windows there is no get(e)uid() call available, so the build fails. The patch now checks whether OPENSSL_SYS_WINDOWS is defined and only uses those calls if _not_ on Windows. Signed-off-by: aszlig --- pkgs/development/libraries/openssl/cert-file.patch | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/openssl/cert-file.patch b/pkgs/development/libraries/openssl/cert-file.patch index 6b7a60e9026..26b51c0295e 100644 --- a/pkgs/development/libraries/openssl/cert-file.patch +++ b/pkgs/development/libraries/openssl/cert-file.patch @@ -12,7 +12,7 @@ diff -ru -x '*~' openssl-1.0.0e-orig/crypto/x509/x509_def.c openssl-1.0.0e/crypt #include "cryptlib.h" #include #include -@@ -71,7 +75,19 @@ +@@ -71,7 +75,25 @@ { return(X509_CERT_DIR); } const char *X509_get_default_cert_file(void) @@ -23,9 +23,15 @@ diff -ru -x '*~' openssl-1.0.0e-orig/crypto/x509/x509_def.c openssl-1.0.0e/crypt + if (!init) { + init = 1; + char * s = getenv("OPENSSL_X509_CERT_FILE"); -+ if (s && getuid() == geteuid()) { -+ strncpy(buf, s, sizeof(buf)); -+ buf[sizeof(buf) - 1] = 0; ++ if (s) { ++#ifndef OPENSSL_SYS_WINDOWS ++ if (getuid() == geteuid()) { ++#endif ++ strncpy(buf, s, sizeof(buf)); ++ buf[sizeof(buf) - 1] = 0; ++#ifndef OPENSSL_SYS_WINDOWS ++ } ++#endif + } + } + return buf; From 92c59d37a7e7567567e5e84c7747818850e69d0b Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 02:22:57 +0100 Subject: [PATCH 0009/2033] gcc-cross-wrapper: Enable dontStrip in setup hook. At least for x86_64-w64-mingw32, it doesn't make sense to use the native strip tool for stripping of symbols. To the contrary it results in unusable archive files. Signed-off-by: aszlig --- pkgs/build-support/gcc-cross-wrapper/setup-hook.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh index a7be09283ee..433d36ced43 100644 --- a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh +++ b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh @@ -75,6 +75,9 @@ fi # native compilations. doCheck="" +# Don't strip foreign binaries with native "strip" tool. +dontStrip=1 + # Add the output as an rpath. if test "$NIX_NO_SELF_RPATH" != "1"; then export NIX_CROSS_LDFLAGS="-rpath $out/lib -rpath-link $out/lib $NIX_CROSS_LDFLAGS" From 423be7712bb710f10f2eb8198bae97e5aeb5f1fe Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 02:25:46 +0100 Subject: [PATCH 0010/2033] bzip2/cross: Patch out erroneous path separator. Not sure why this even got into the upstream release, as _all_ other includes use forward slashes. Signed-off-by: aszlig --- pkgs/tools/compression/bzip2/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix index a431cd30a21..55fca6ca3cb 100644 --- a/pkgs/tools/compression/bzip2/default.nix +++ b/pkgs/tools/compression/bzip2/default.nix @@ -14,6 +14,7 @@ stdenv.mkDerivation { crossAttrs = { patchPhase = '' + sed -i -e '//s|\\|/|' bzip2.c sed -i -e 's/CC=gcc/CC=${stdenv.cross.config}-gcc/' \ -e 's/AR=ar/AR=${stdenv.cross.config}-ar/' \ -e 's/RANLIB=ranlib/RANLIB=${stdenv.cross.config}-ranlib/' \ From 4fde72c7d64c78de2e41ba91153cebb907e63100 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 04:43:00 +0100 Subject: [PATCH 0011/2033] mingw-w64: Fix typo in preConfigure hook. D'oh, no wonder the headers are of almost the same size as the main package. Signed-off-by: aszlig --- pkgs/os-specific/windows/mingw-w64/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index 0d7beb532fe..f1c509a5098 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation (rec { } // (if onlyHeaders then { name = name + "-headers"; - preConfingure = '' + preConfigure = '' cd mingw-w64-headers ''; configureFlags = "--without-crt --host=x86_64-w64-mingw32"; From 44cfba79509f6dd98ae306f62f2cc3183bbd1ab1 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 04:44:43 +0100 Subject: [PATCH 0012/2033] mingw-w64-pthreads: Create based on mingw-w64. The winpthreads library is part of the same source package, so let's just override the name and the source directory. Signed-off-by: aszlig --- pkgs/os-specific/windows/mingw-w64/default.nix | 10 +++++++++- pkgs/top-level/all-packages.nix | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index f1c509a5098..c5b6017aae4 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -1,4 +1,7 @@ -{stdenv, fetchurl, binutilsCross ? null, gccCross ? null, onlyHeaders ? false}: +{ stdenv, fetchurl, binutilsCross ? null, gccCross ? null +, onlyHeaders ? false +, onlyPthreads ? false +}: let name = "mingw-w64-3.1.0"; @@ -17,6 +20,11 @@ stdenv.mkDerivation (rec { cd mingw-w64-headers ''; configureFlags = "--without-crt --host=x86_64-w64-mingw32"; +} else if onlyPthreads then { + name = name + "-pthreads"; + preConfigure = '' + cd mingw-w64-libraries/winpthreads + ''; } else { buildInputs = [ gccCross binutilsCross ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 64f2bb688c4..133ef21060c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7191,6 +7191,10 @@ let onlyHeaders = true; }; + mingw_w64_pthreads = callPackage ../os-specific/windows/mingw-w64 { + onlyPthreads = true; + }; + pthreads = callPackage ../os-specific/windows/pthread-w32 { mingw_headers = mingw_headers3; }; From d0142e9b09ef8a30a26d4aad922c78bf8c83a7b7 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 05:01:29 +0100 Subject: [PATCH 0013/2033] pcre/cross: Enable support for winpthreads. That way we're able to build with the JIT compiler enabled. Signed-off-by: aszlig --- pkgs/development/libraries/pcre/default.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix index 51279701d4a..067c3af4387 100644 --- a/pkgs/development/libraries/pcre/default.nix +++ b/pkgs/development/libraries/pcre/default.nix @@ -1,4 +1,8 @@ -{ stdenv, fetchurl, unicodeSupport ? true, cplusplusSupport ? true }: +{ stdenv, fetchurl, unicodeSupport ? true, cplusplusSupport ? true +, windows ? null +}: + +with stdenv.lib; stdenv.mkDerivation rec { name = "pcre-8.34"; @@ -16,12 +20,16 @@ stdenv.mkDerivation rec { --enable-jit ${if unicodeSupport then "--enable-unicode-properties" else ""} ${if !cplusplusSupport then "--disable-cpp" else ""} - '' + stdenv.lib.optionalString stdenv.isDarwin "CXXFLAGS=-O0"; + '' + optionalString stdenv.isDarwin "CXXFLAGS=-O0"; doCheck = with stdenv; !(isCygwin || isFreeBSD); # XXX: test failure on Cygwin # we are running out of stack on both freeBSDs on Hydra + crossAttrs = optionalAttrs (stdenv.cross.config == "x86_64-w64-mingw32") { + buildInputs = [ windows.mingw_w64_pthreads.crossDrv ]; + }; + meta = { homepage = "http://www.pcre.org/"; description = "A library for Perl Compatible Regular Expressions"; @@ -35,7 +43,7 @@ stdenv.mkDerivation rec { PCRE library is free, even for building proprietary software. ''; - platforms = stdenv.lib.platforms.all; - maintainers = [ stdenv.lib.maintainers.simons ]; + platforms = platforms.all; + maintainers = [ maintainers.simons ]; }; } From b9bc42d0f33e5490e8e1fbbf6048f2fc641bc546 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 05:46:04 +0100 Subject: [PATCH 0014/2033] glew/cross: Fix building with mingw-w64. This also cleans up the package expression a bit and we no longer directly override the phases (except patchPhase). Also for cross-builds we're using the stock mingw target and pass CC, LD and STRIP to make, because the mingw-w64 targets of the upstream package are outdated. Signed-off-by: aszlig --- pkgs/development/libraries/glew/default.nix | 24 +++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix index ef81f210d39..b79fa97047b 100644 --- a/pkgs/development/libraries/glew/default.nix +++ b/pkgs/development/libraries/glew/default.nix @@ -1,5 +1,7 @@ { stdenv, fetchurl, mesa_glu, x11, libXmu, libXi }: +with stdenv.lib; + stdenv.mkDerivation rec { name = "glew-1.10.0"; @@ -8,23 +10,33 @@ stdenv.mkDerivation rec { sha256 = "01zki46dr5khzlyywr3cg615bcal32dazfazkf360s1znqh17i4r"; }; - - buildInputs = [ x11 libXmu libXi ]; - propagatedBuildInputs = [ mesa_glu ]; # GL/glew.h includes GL/glu.h + nativeBuildInputs = [ x11 libXmu libXi ]; + propagatedNativeBuildInputs = [ mesa_glu ]; # GL/glew.h includes GL/glu.h patchPhase = '' sed -i 's|lib64|lib|' config/Makefile.linux ''; -buildPhase = "make all"; - installPhase = '' - GLEW_DEST=$out make install.all + buildFlags = [ "all" ]; + installFlags = [ "install.all" ]; + + preInstall = '' + export GLEW_DEST="$out" + ''; + + postInstall = '' mkdir -pv $out/share/doc/glew mkdir -p $out/lib/pkgconfig cp glew*.pc $out/lib/pkgconfig cp -r README.txt LICENSE.txt doc $out/share/doc/glew ''; + crossAttrs.makeFlags = [ + "CC=${stdenv.cross.config}-gcc" + "LD=${stdenv.cross.config}-gcc" + "STRIP=" + ] ++ optional (stdenv.cross.config == "x86_64-w64-mingw32") "SYSTEM=mingw"; + meta = { description = "An OpenGL extension loading library for C(++)"; homepage = http://glew.sourceforge.net/; From fbc307a18322c42db500aaebeaa21e0e93e82162 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 05:55:29 +0100 Subject: [PATCH 0015/2033] SDL/cross: Fix building with mingw-w64. This is to make sure that we don't get Xlibs or alsa in cross builds, because those aren't available on non-Linux/Unix platforms. Also, until we don't have the DirectX SDK packaged, let's disable it during cross builds. Signed-off-by: aszlig --- pkgs/development/libraries/SDL/default.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix index e58397fa9a5..0df130b11fb 100644 --- a/pkgs/development/libraries/SDL/default.nix +++ b/pkgs/development/libraries/SDL/default.nix @@ -19,7 +19,7 @@ let --disable-oss --disable-video-x11-xme --disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared --disable-osmesa-shared - ${if alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""} + ${if attrs.alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""} ''; in stdenv.mkDerivation rec { @@ -32,20 +32,24 @@ stdenv.mkDerivation rec { }; # Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated. - propagatedBuildInputs = stdenv.lib.optionals x11Support [ x11 libXrandr ] ++ + propagatedNativeBuildInputs = + stdenv.lib.optionals x11Support [ x11 libXrandr ] ++ stdenv.lib.optional pulseaudioSupport pulseaudio; - buildInputs = [ pkgconfig audiofile ] ++ + nativeBuildInputs = [ pkgconfig audiofile ] ++ stdenv.lib.optional openglSupport [ mesa ] ++ stdenv.lib.optional alsaSupport alsaLib; # XXX: By default, SDL wants to dlopen() PulseAudio, in which case # we must arrange to add it to its RPATH; however, `patchelf' seems # to fail at doing this, hence `--disable-pulseaudio-shared'. - configureFlags = configureFlagsFun { inherit alsaLib; }; + configureFlags = configureFlagsFun { inherit alsaLib alsaSupport; }; crossAttrs = { - configureFlags = configureFlagsFun { alsaLib = alsaLib.crossDrv; }; + configureFlags = configureFlagsFun { + alsaSupport = stdenv.cross.config != "x86_64-w64-mingw32"; + alsaLib = alsaLib.crossDrv; + } + "--disable-directx"; }; passthru = {inherit openglSupport;}; From 4f69722ee55cd1a685da069e6683f1af9eae645b Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 06:46:07 +0100 Subject: [PATCH 0016/2033] lua52/cross: Allow to cross-compile to mingw-w64. Signed-off-by: aszlig --- pkgs/development/interpreters/lua-5/5.2.nix | 25 ++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/lua-5/5.2.nix b/pkgs/development/interpreters/lua-5/5.2.nix index 70ab0c3bdf8..609c6b3e404 100644 --- a/pkgs/development/interpreters/lua-5/5.2.nix +++ b/pkgs/development/interpreters/lua-5/5.2.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { sha256 = "004zyh9p3lpvbwhyhlmrw6wwcia5abx84q4h2brkn4zdypipvmiz"; }; - buildInputs = [ readline ]; + nativeBuildInputs = [ readline ]; patches = [ dsoPatch ]; @@ -49,6 +49,29 @@ stdenv.mkDerivation rec { EOF ''; + crossAttrs = let + isMingwW64 = stdenv.cross.config == "x86_64-w64-mingw32"; + in { + configurePhase = '' + makeFlagsArray=( + INSTALL_TOP=$out + INSTALL_MAN=$out/share/man/man1 + CC=${stdenv.cross.config}-gcc + STRIP=: + RANLIB=${stdenv.cross.config}-ranlib + V=${majorVersion} + R=${version} + ${stdenv.lib.optionals isMingwW64 "mingw"} + ) + '' + stdenv.lib.optionalString isMingwW64 '' + installFlagsArray=( + TO_BIN="lua.exe luac.exe" + TO_LIB="liblua.a lua52.dll" + INSTALL_DATA="cp -d" + ) + ''; + }; + meta = { homepage = "http://www.lua.org"; description = "Powerful, fast, lightweight, embeddable scripting language"; From c5ab2bfd258501cbe5f440089039aff8e7595e3c Mon Sep 17 00:00:00 2001 From: aszlig Date: Thu, 27 Feb 2014 18:28:32 +0100 Subject: [PATCH 0017/2033] gcc-cross-wrapper: Explicitly add LD program name. This is because autoconf is passing -print-prog-name=ld to the cross-gcc, which in turn assumes a FHS compliant filesystem hierarchy and searches ../../../../$crossConfig/bin/ld for the correct ld. Of course, this won't work on Nix, hence we're explicitly passing the correct LD program name. Signed-off-by: aszlig --- pkgs/build-support/gcc-cross-wrapper/setup-hook.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh index 433d36ced43..497047a73b1 100644 --- a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh +++ b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh @@ -70,6 +70,8 @@ fi if test "$dontSetConfigureCross" != "1"; then configureFlags="$configureFlags --build=$system --host=$crossConfig" + # This is because -print-prog-name tries to search FHS paths. + configureFlags="$configureFlags LD=$crossConfig-ld" fi # Disabling the tests when cross compiling, as usually the tests are meant for # native compilations. From ae0b5d6813362492e744b1ac10e21309bb4e238b Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 3 Mar 2014 22:22:12 +0100 Subject: [PATCH 0018/2033] libgcrypt/cross: Fix build for mingw-w64. Especially for the 64bit mingw target, because libgcrypt contains protected mode assembly. Also, this adds gettext to the crossAttrs of libgpg-error, because it tries to regenerate the MO files. Signed-off-by: aszlig --- pkgs/development/libraries/libgcrypt/1.6.nix | 6 ++++++ pkgs/development/libraries/libgpg-error/default.nix | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libgcrypt/1.6.nix b/pkgs/development/libraries/libgcrypt/1.6.nix index ea981f7ed12..9dc8b8a2317 100644 --- a/pkgs/development/libraries/libgcrypt/1.6.nix +++ b/pkgs/development/libraries/libgcrypt/1.6.nix @@ -24,6 +24,12 @@ stdenv.mkDerivation rec { make check ''; + crossAttrs = let + isCross64 = stdenv.cross.config == "x86_64-w64-mingw32"; + in stdenv.lib.optionalAttrs isCross64 { + configureFlags = [ "--disable-asm" "--disable-padlock-support" ]; + }; + meta = { description = "GNU Libgcrypt, a general-pupose cryptographic library"; diff --git a/pkgs/development/libraries/libgpg-error/default.nix b/pkgs/development/libraries/libgpg-error/default.nix index da142a957ad..8ce9a10701e 100644 --- a/pkgs/development/libraries/libgpg-error/default.nix +++ b/pkgs/development/libraries/libgpg-error/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, bash }: +{ stdenv, fetchurl, bash, gettext }: stdenv.mkDerivation (rec { name = "libgpg-error-1.12"; @@ -8,6 +8,10 @@ stdenv.mkDerivation (rec { sha256 = "0pz58vr12qihq2f0bypjxsb6cf6ajq5258fmfm8s6lvwm3b9xz6a"; }; + # If architecture-dependant MO files aren't available, they're generated + # during build, so we need gettext for cross-builds. + crossAttrs.buildInputs = [ gettext ]; + doCheck = true; meta = { From e64b342fa8fda783a7247e0469943ce728498004 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 3 Mar 2014 22:31:18 +0100 Subject: [PATCH 0019/2033] Use mingw-w64 for 32bit Windows builds as well. Mingw(32) is rather poorly maintaned and has quite a lot of bugs. And because our Windows cross builds were also poorly maintained and most of the cross-tests were broken as well, I'm just taking this step and try to switch to mingw-w64 for everything "cross Windows". Signed-off-by: aszlig --- pkgs/development/compilers/gcc/4.6/default.nix | 6 ++---- pkgs/development/compilers/gcc/4.8/default.nix | 6 ++---- pkgs/development/interpreters/lua-5/5.2.nix | 6 +++--- pkgs/development/libraries/SDL/default.nix | 2 +- pkgs/development/libraries/glew/default.nix | 2 +- pkgs/development/libraries/pcre/default.nix | 2 +- pkgs/development/libraries/qt-4.x/4.8/default.nix | 3 +-- pkgs/os-specific/windows/mingw-w64/default.nix | 2 +- pkgs/top-level/all-packages.nix | 8 ++------ pkgs/top-level/release-cross.nix | 11 +++++------ 10 files changed, 19 insertions(+), 29 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.6/default.nix b/pkgs/development/compilers/gcc/4.6/default.nix index 3ed0f7ad0e6..af111322698 100644 --- a/pkgs/development/compilers/gcc/4.6/default.nix +++ b/pkgs/development/compilers/gcc/4.6/default.nix @@ -159,10 +159,8 @@ let version = "4.6.3"; # In any case, mingw32 g++ linking is broken by default with shared libs, # unless adding "-lsupc++" to any linking command. I don't know why. " --disable-shared" + - (if cross.config == "x86_64-w64-mingw32" then - # To keep ABI compatibility with upstream mingw-w64 - " --enable-fully-dynamic-string" - else "") + # To keep ABI compatibility with upstream mingw-w64 + " --enable-fully-dynamic-string" else (if cross.libc == "uclibc" then # In uclibc cases, libgomp needs an additional '-ldl' # and as I don't know how to pass it, I disable libgomp. diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index aea52593323..e2c887c368f 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -175,10 +175,8 @@ let version = "4.8.2"; # In any case, mingw32 g++ linking is broken by default with shared libs, # unless adding "-lsupc++" to any linking command. I don't know why. " --disable-shared" + - (if cross.config == "x86_64-w64-mingw32" then - # To keep ABI compatibility with upstream mingw-w64 - " --enable-fully-dynamic-string" - else "") + # To keep ABI compatibility with upstream mingw-w64 + " --enable-fully-dynamic-string" else (if cross.libc == "uclibc" then # In uclibc cases, libgomp needs an additional '-ldl' # and as I don't know how to pass it, I disable libgomp. diff --git a/pkgs/development/interpreters/lua-5/5.2.nix b/pkgs/development/interpreters/lua-5/5.2.nix index 609c6b3e404..b8fcbe5f242 100644 --- a/pkgs/development/interpreters/lua-5/5.2.nix +++ b/pkgs/development/interpreters/lua-5/5.2.nix @@ -50,7 +50,7 @@ stdenv.mkDerivation rec { ''; crossAttrs = let - isMingwW64 = stdenv.cross.config == "x86_64-w64-mingw32"; + isMingw = stdenv.cross.libc == "msvcrt"; in { configurePhase = '' makeFlagsArray=( @@ -61,9 +61,9 @@ stdenv.mkDerivation rec { RANLIB=${stdenv.cross.config}-ranlib V=${majorVersion} R=${version} - ${stdenv.lib.optionals isMingwW64 "mingw"} + ${stdenv.lib.optionals isMingw "mingw"} ) - '' + stdenv.lib.optionalString isMingwW64 '' + '' + stdenv.lib.optionalString isMingw '' installFlagsArray=( TO_BIN="lua.exe luac.exe" TO_LIB="liblua.a lua52.dll" diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix index 0df130b11fb..56ac04bebe6 100644 --- a/pkgs/development/libraries/SDL/default.nix +++ b/pkgs/development/libraries/SDL/default.nix @@ -47,7 +47,7 @@ stdenv.mkDerivation rec { crossAttrs = { configureFlags = configureFlagsFun { - alsaSupport = stdenv.cross.config != "x86_64-w64-mingw32"; + alsaSupport = stdenv.cross.libc != "msvcrt"; alsaLib = alsaLib.crossDrv; } + "--disable-directx"; }; diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix index b79fa97047b..32083f96dfd 100644 --- a/pkgs/development/libraries/glew/default.nix +++ b/pkgs/development/libraries/glew/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { "CC=${stdenv.cross.config}-gcc" "LD=${stdenv.cross.config}-gcc" "STRIP=" - ] ++ optional (stdenv.cross.config == "x86_64-w64-mingw32") "SYSTEM=mingw"; + ] ++ optional (stdenv.cross.libc == "msvcrt") "SYSTEM=mingw"; meta = { description = "An OpenGL extension loading library for C(++)"; diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix index 067c3af4387..7138c44da64 100644 --- a/pkgs/development/libraries/pcre/default.nix +++ b/pkgs/development/libraries/pcre/default.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { # XXX: test failure on Cygwin # we are running out of stack on both freeBSDs on Hydra - crossAttrs = optionalAttrs (stdenv.cross.config == "x86_64-w64-mingw32") { + crossAttrs = optionalAttrs (stdenv.cross.libc == "msvcrt") { buildInputs = [ windows.mingw_w64_pthreads.crossDrv ]; }; diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix index 16bd1ee65d2..1bd027f5298 100644 --- a/pkgs/development/libraries/qt-4.x/4.8/default.nix +++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix @@ -148,8 +148,7 @@ stdenv.mkDerivation rec { ''; crossAttrs = let - isMingw = stdenv.cross.config == "i686-pc-mingw32" || - stdenv.cross.config == "x86_64-w64-mingw32"; + isMingw = stdenv.cross.libc == "msvcrt"; in { # I've not tried any case other than i686-pc-mingw32. # -nomake tools: it fails linking some asian language symbols diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index c5b6017aae4..bf15b208e1a 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -19,7 +19,7 @@ stdenv.mkDerivation (rec { preConfigure = '' cd mingw-w64-headers ''; - configureFlags = "--without-crt --host=x86_64-w64-mingw32"; + configureFlags = "--without-crt"; } else if onlyPthreads then { name = name + "-pthreads"; preConfigure = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 133ef21060c..952fe59734d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2419,9 +2419,7 @@ let gccCrossStageStatic = let isMingw = (stdenv.cross.libc == "msvcrt"); - isMingw64 = isMingw && stdenv.cross.config == "x86_64-w64-mingw32"; - libcCross1 = if isMingw64 then windows.mingw_w64_headers else - if isMingw then windows.mingw_headers1 else null; + libcCross1 = if isMingw then windows.mingw_w64_headers else null; in wrapGCCCross { gcc = forceNativeDrv (lib.addMetaAttrs { hydraPlatforms = []; } ( @@ -4235,9 +4233,7 @@ let # We can choose: libcCrossChooser = name : if name == "glibc" then glibcCross else if name == "uclibc" then uclibcCross - else if name == "msvcrt" && stdenv.cross.config == "x86_64-w64-mingw32" then - windows.mingw_w64 - else if name == "msvcrt" then windows.mingw_headers3 + else if name == "msvcrt" then windows.mingw_w64 else throw "Unknown libc"; libcCross = assert crossSystem != null; libcCrossChooser crossSystem.libc; diff --git a/pkgs/top-level/release-cross.nix b/pkgs/top-level/release-cross.nix index 6871567ca8d..cef3d2dffbd 100644 --- a/pkgs/top-level/release-cross.nix +++ b/pkgs/top-level/release-cross.nix @@ -140,11 +140,11 @@ in { crossUltraSparcLinux = mapTestOnCross crossSystem basic; }) // ( -/* Test some cross builds on mingw32 */ +/* Test some cross builds on 32 bit mingw-w64 */ let crossSystem = { - config = "i686-pc-mingw32"; - arch = "x86"; + config = "i686-w64-mingw32"; + arch = "x86"; # Irrelevant libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain platform = {}; }; @@ -161,11 +161,10 @@ in { }; }) // ( -/* Test some cross builds on mingw-w64 */ +/* Test some cross builds on 64 bit mingw-w64 */ let crossSystem = { - # That's the triplet they use in the mingw-w64 docs, - # and it's relevant for nixpkgs conditions. + # That's the triplet they use in the mingw-w64 docs. config = "x86_64-w64-mingw32"; arch = "x86_64"; # Irrelevant libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain From a3cf381435345d25d9deeab8f5684d937cfc83e1 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 3 Mar 2014 22:36:43 +0100 Subject: [PATCH 0020/2033] SDL/cross: Drop --disable-directx. This is no longer needed, because we've already fixed the dynamic cross-linker. Signed-off-by: aszlig --- pkgs/development/libraries/SDL/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix index 56ac04bebe6..89646f2e3e3 100644 --- a/pkgs/development/libraries/SDL/default.nix +++ b/pkgs/development/libraries/SDL/default.nix @@ -49,7 +49,7 @@ stdenv.mkDerivation rec { configureFlags = configureFlagsFun { alsaSupport = stdenv.cross.libc != "msvcrt"; alsaLib = alsaLib.crossDrv; - } + "--disable-directx"; + }; }; passthru = {inherit openglSupport;}; From 5e565754abcfcb726510e2f6c205b5b6bd0e091f Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 02:57:48 +0100 Subject: [PATCH 0021/2033] Add new package "xpwn" from @dborca's fork. This really hase some nice utilities for coping with HFS+ and DMG format. We're going to use it for extracting the xcode DMG, but it could be used for more, even generating DMGs. The reason I'm using the fork instead of the repository from @planetbeing is thet the fork contains a few fixes, especially for dealing with symlinks in HFS+ images. Signed-off-by: aszlig --- pkgs/development/mobile/xpwn/default.nix | 28 ++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/development/mobile/xpwn/default.nix diff --git a/pkgs/development/mobile/xpwn/default.nix b/pkgs/development/mobile/xpwn/default.nix new file mode 100644 index 00000000000..b248107141f --- /dev/null +++ b/pkgs/development/mobile/xpwn/default.nix @@ -0,0 +1,28 @@ +{ stdenv, fetchgit, cmake, zlib, libpng, bzip2, libusb, openssl }: + +stdenv.mkDerivation { + name = "xpwn-0.5.8git"; + + src = fetchgit { + url = "git://github.com/dborca/xpwn.git"; + rev = "4534da88d4e8a32cdc9da9b5326e2cc482c95ef0"; + sha256 = + "1h1ak40fg5bym0hifpii9q2hqdp2m387cwfzb4bl6qq36xpkd6wv"; + }; + + preConfigure = '' + sed -r -i \ + -e 's/(install.*TARGET.*DESTINATION )\.\)/\1bin)/' \ + -e 's!(install.*(FILE|DIR).*DESTINATION )([^)]*)!\1share/xpwn/\3!' \ + */CMakeLists.txt + sed -i -e '/install/d' CMakeLists.txt + ''; + + buildInputs = [ cmake zlib libpng bzip2 libusb openssl ]; + + meta = { + homepage = "http://planetbeing.lighthouseapp.com/projects/15246-xpwn"; + description = "Custom NOR firmware loader/IPSW generator for the iPhone"; + license = stdenv.lib.licenses.gpl3Plus; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6cd584e6f1f..9ab8331bce9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3825,6 +3825,8 @@ let xmlindent = callPackage ../development/web/xmlindent {}; + xpwn = callPackage ../development/mobile/xpwn {}; + xxdiff = callPackage ../development/tools/misc/xxdiff { bison = bison2; }; From 83dd414ca221a8aff18a03b3ef9716fe0ca7d06d Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 03:39:33 +0100 Subject: [PATCH 0022/2033] Add new package for Apple's XCode. This package provides the SDK and standard library needed for cross-compiling to Mac US X. We're using xpwn here to extract the DMG. Also, this version (XCode 5.0.2) only contains the SDKs for version 10.9 and 10.8, so we might need to add requireFile directives for older versions as well. Signed-off-by: aszlig --- pkgs/os-specific/darwin/xcode/default.nix | 37 +++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 39 insertions(+) create mode 100644 pkgs/os-specific/darwin/xcode/default.nix diff --git a/pkgs/os-specific/darwin/xcode/default.nix b/pkgs/os-specific/darwin/xcode/default.nix new file mode 100644 index 00000000000..671e73a0fa5 --- /dev/null +++ b/pkgs/os-specific/darwin/xcode/default.nix @@ -0,0 +1,37 @@ +{ stdenv, requireFile, xpwn }: + +stdenv.mkDerivation rec { + name = "xcode-${version}"; + version = "5.0.2"; + + src = requireFile { + name = "xcode_${version}.dmg"; + url = meta.homepage; + sha256 = "0mrligqkfqwx8cy883pxm4w5w7a17nfh227zdspfll23r9agf32k"; + }; + + phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; + + unpackCmd = let + basePath = "Xcode.app/Contents/Developer/Platforms/MacOSX.platform"; + sdkPath = "${basePath}/Developer/SDKs"; + in '' + ${xpwn}/bin/dmg extract "$curSrc" main.hfs > /dev/null + ${xpwn}/bin/hfsplus main.hfs extractall "${sdkPath}" > /dev/null + ''; + + setSourceRoot = "sourceRoot=MacOSX10.9.sdk"; + + installPhase = '' + ensureDir "$out/share/sysroot" + cp -a * "$out/share/sysroot/" + ln -s "$out/usr/lib" "$out/lib" + ln -s "$out/usr/include" "$out/include" + ''; + + meta = { + homepage = "https://developer.apple.com/downloads/"; + description = "Apple's XCode SDK"; + license = stdenv.lib.licenses.unfree; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9ab8331bce9..93caa5c7796 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6546,6 +6546,8 @@ let cramfsswap = callPackage ../os-specific/linux/cramfsswap { }; + darwin.xcode = callPackage ../os-specific/darwin/xcode { }; + devicemapper = lvm2; dmidecode = callPackage ../os-specific/linux/dmidecode { }; From dd10bb3181928bac42e5213125887d62555d6a3a Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 03:57:48 +0100 Subject: [PATCH 0023/2033] Add a cross-platform port of cctools. This basically is binutils for Mac OS X, but ported to work on (GNU/)Linux and FreeBSD. And it's up-to-date as well! I'm mentioning this, because it was quite hard to find a recent port of it and I just accidentally stumbled on it while trying to do the port by myself. So thanks to @tpoechtrager for doing this. Also, I've added two more patches, which essentially are: * ld-rpath-nonfinal: This allows -rpath to be used for linking non-final builds, which was allowed for earlier versions of cctools and got a check for that in more recent versions. * ld-ignore-rpath-link: Ignores the -rpath-link option, because the cross-wrapper uses it in different places. Unfortunately, the cctools linker doesn't support it, so we might need to implement this later if it's possible (I'm not a Mach-O man^H^H^Hexpert). Signed-off-by: aszlig --- .../darwin/cctools-port/default.nix | 55 +++++++++++++++++++ .../cctools-port/ld-ignore-rpath-link.patch | 16 ++++++ .../cctools-port/ld-rpath-nonfinal.patch | 31 +++++++++++ pkgs/top-level/all-packages.nix | 8 ++- 4 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/darwin/cctools-port/default.nix create mode 100644 pkgs/os-specific/darwin/cctools-port/ld-ignore-rpath-link.patch create mode 100644 pkgs/os-specific/darwin/cctools-port/ld-rpath-nonfinal.patch diff --git a/pkgs/os-specific/darwin/cctools-port/default.nix b/pkgs/os-specific/darwin/cctools-port/default.nix new file mode 100644 index 00000000000..0d40409a994 --- /dev/null +++ b/pkgs/os-specific/darwin/cctools-port/default.nix @@ -0,0 +1,55 @@ +{ stdenv, cross, fetchurl, autoconf, automake, libtool +, libcxx, llvm, clang, openssl, libuuid +}: + +stdenv.mkDerivation rec { + name = "cctools-port-${version}"; + version = "845"; + + src = fetchurl { + url = "https://github.com/tpoechtrager/cctools-port/archive/" + + "cctools-${version}-ld64-136-1.tar.gz"; + sha256 = "06pg6h1g8avgx4j6cfykdpggf490li796gzhhyqn27jsagli307i"; + }; + + buildInputs = [ + autoconf automake libtool libcxx llvm clang openssl libuuid + ]; + + patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch ]; + + enableParallelBuilding = true; + + postPatch = '' + patchShebangs tools + sed -i -e 's/which/type -P/' tools/*.sh + sed -i -e 's|clang++|& -I${libcxx}/include/c++/v1|' cctools/autogen.sh + + # Workaround for https://www.sourceware.org/bugzilla/show_bug.cgi?id=11157 + cat > cctools/include/unistd.h < 0 ) { +- if ( !minOS(ld::mac10_5, ld::iOS_2_0) ) +- throw "-rpath can only be used when targeting Mac OS X 10.5 or later"; +- switch ( fOutputKind ) { +- case Options::kDynamicExecutable: +- case Options::kDynamicLibrary: +- case Options::kDynamicBundle: +- break; +- case Options::kStaticExecutable: +- case Options::kObjectFile: +- case Options::kDyld: +- case Options::kPreload: +- case Options::kKextBundle: +- throw "-rpath can only be used when creating a dynamic final linked image"; +- } +- } +- ++ if ( fRPaths.size() > 0 && !minOS(ld::mac10_5, ld::iOS_2_0) ) ++ throw "-rpath can only be used when targeting Mac OS X 10.5 or later"; ++ + if ( fPositionIndependentExecutable ) { + switch ( fOutputKind ) { + case Options::kDynamicExecutable: diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 93caa5c7796..dfe977678ff 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6546,7 +6546,13 @@ let cramfsswap = callPackage ../os-specific/linux/cramfsswap { }; - darwin.xcode = callPackage ../os-specific/darwin/xcode { }; + darwin = { + cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools-port { + cross = assert crossSystem != null; crossSystem; + }); + + xcode = callPackage ../os-specific/darwin/xcode {}; + }; devicemapper = lvm2; From 9a0a85827c3bc903d7c82f251fa129e91f457e85 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 04:10:34 +0100 Subject: [PATCH 0024/2033] gcc-4.8: Hook in cross-darwin libc and binutils. Let's finally hook everything into the existing cross-building infrastructure. We're using --with-sysroot instead of --with-headers here, because the XCode SDK contains references to /usr/lib. I've tried to patch those references, but unfortunately (at least with install_name_tool) it isn't possible to change those refernces in stub dylibs. So after bugging @tpoechtrager with annoying questions (thanks again), I think my initial approach (patching the SDK itself and/or regenerating the dylib stubs) was way to complicated so I ended up with this implementation. Also, I've added a condition to binutilsCross to use cctools if the libc is set to libSystem. This might need some cleanups someday, mainly to figure out how to properly bridge cctools and binutils. So, as an example on how to cross-compile GNU Hello to Darwin, you can use something like this: (import { crossSystem = { config = "x86_64-apple-darwin13"; arch = "x86_64"; libc = "libSystem"; platform = {}; }; }).hello.crossDrv Signed-off-by: aszlig --- pkgs/development/compilers/gcc/4.8/default.nix | 10 ++++++++-- pkgs/top-level/all-packages.nix | 17 +++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index aea52593323..8a8a80c090a 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -117,7 +117,8 @@ let version = "4.8.2"; withMode; /* Cross-gcc settings */ - crossMingw = (cross != null && cross.libc == "msvcrt"); + crossMingw = cross != null && cross.libc == "msvcrt"; + crossDarwin = cross != null && cross.libc == "libSystem"; crossConfigureFlags = let gccArch = stdenv.cross.gcc.arch or null; gccCpu = stdenv.cross.gcc.cpu or null; @@ -161,7 +162,12 @@ let version = "4.8.2"; " --disable-shared" + " --disable-decimal-float" # libdecnumber requires libc else - " --with-headers=${libcCross}/include" + + (if crossDarwin then + " --with-sysroot=${libcCross}/share/sysroot" + + " --with-as=${binutilsCross}/bin/${cross.config}-as" + + " --with-ld=${binutilsCross}/bin/${cross.config}-ld" + else + " --with-headers=${libcCross}/include") + " --enable-__cxa_atexit" + " --enable-long-long" + (if crossMingw then diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dfe977678ff..f65d493b9d6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2430,8 +2430,10 @@ let gccCrossStageStatic = let isMingw = (stdenv.cross.libc == "msvcrt"); isMingw64 = isMingw && stdenv.cross.config == "x86_64-w64-mingw32"; + isDarwin = stdenv.cross.libc == "libSystem"; libcCross1 = if isMingw64 then windows.mingw_w64_headers else - if isMingw then windows.mingw_headers1 else null; + if isMingw then windows.mingw_headers1 else + if isDarwin then darwin.xcode else null; in wrapGCCCross { gcc = forceNativeDrv (lib.addMetaAttrs { hydraPlatforms = []; } ( @@ -3452,11 +3454,13 @@ let gold = false; }); - binutilsCross = lowPrio (forceNativeDrv (import ../development/tools/misc/binutils { - inherit stdenv fetchurl zlib; - noSysDirs = true; - cross = assert crossSystem != null; crossSystem; - })); + binutilsCross = + if crossSystem != null && crossSystem.libc == "libSystem" then darwin.cctools + else lowPrio (forceNativeDrv (import ../development/tools/misc/binutils { + inherit stdenv fetchurl zlib; + noSysDirs = true; + cross = assert crossSystem != null; crossSystem; + })); bison2 = callPackage ../development/tools/parsing/bison/2.x.nix { }; bison3 = callPackage ../development/tools/parsing/bison/3.x.nix { }; @@ -4249,6 +4253,7 @@ let else if name == "msvcrt" && stdenv.cross.config == "x86_64-w64-mingw32" then windows.mingw_w64 else if name == "msvcrt" then windows.mingw_headers3 + else if name == "libSystem" then darwin.xcode else throw "Unknown libc"; libcCross = assert crossSystem != null; libcCrossChooser crossSystem.libc; From 46e90f76c6d73a8ecd33cb8e3bfaff50b20f32e0 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 21:36:43 +0100 Subject: [PATCH 0025/2033] tzdata: Provide lib as an additional output. We're already using tzcode inside tzdata, so let's make it available as an output here. The reason we need it is in order to compile OpenCFLite. Signed-off-by: aszlig --- pkgs/data/misc/tzdata/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/data/misc/tzdata/default.nix b/pkgs/data/misc/tzdata/default.nix index da043da0967..57b1dddbda5 100644 --- a/pkgs/data/misc/tzdata/default.nix +++ b/pkgs/data/misc/tzdata/default.nix @@ -17,13 +17,17 @@ stdenv.mkDerivation rec { ]; sourceRoot = "."; + outputs = [ "out" "lib" ]; - makeFlags = "TOPDIR=$(out) TZDIR=$(out)/share/zoneinfo ETCDIR=$(TMPDIR)/etc LIBDIR=$(TMPDIR)/lib MANDIR=$(TMPDIR)/man AWK=awk"; + makeFlags = "TOPDIR=$(out) TZDIR=$(out)/share/zoneinfo ETCDIR=$(TMPDIR)/etc LIBDIR=$(lib)/lib MANDIR=$(TMPDIR)/man AWK=awk"; postInstall = '' mv $out/share/zoneinfo-posix $out/share/zoneinfo/posix mv $out/share/zoneinfo-leaps $out/share/zoneinfo/right + + ensureDir "$lib/include" + cp tzfile.h "$lib/include/tzfile.h" ''; meta = { From a9ef42f33ca4ea209c810ee42bf801eb485c68ad Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 21:41:56 +0100 Subject: [PATCH 0026/2033] gcc-4.8: Add ObjC and ObjC++ support for Darwin. Cross-compiling stuff against Mac OS X's CoreFoundation won't work without ObjC support, and we don't want to compile commandline utilities only, right? Signed-off-by: aszlig --- pkgs/development/compilers/gcc/4.8/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 8a8a80c090a..92bfdb683bb 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -352,6 +352,7 @@ stdenv.mkDerivation ({ ++ optional langAda "ada" ++ optional langVhdl "vhdl" ++ optional langGo "go" + ++ optionals crossDarwin [ "objc" "obj-c++" ] ) ) } From c0d55fcc6ab1ac2c634e2b518440b26378b7abd7 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 21:46:09 +0100 Subject: [PATCH 0027/2033] xcode: Provide the commandline toolchain as well. This toolchain contains Mach-O binaries and might not be useful in the first place, but there are programs like dsymutil, where Apple didn't release the source code, so we need a Mach-O loader... Signed-off-by: aszlig --- pkgs/os-specific/darwin/xcode/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/darwin/xcode/default.nix b/pkgs/os-specific/darwin/xcode/default.nix index 671e73a0fa5..5c8e7a3ef6c 100644 --- a/pkgs/os-specific/darwin/xcode/default.nix +++ b/pkgs/os-specific/darwin/xcode/default.nix @@ -11,6 +11,7 @@ stdenv.mkDerivation rec { }; phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; + outputs = [ "out" "toolchain" ]; unpackCmd = let basePath = "Xcode.app/Contents/Developer/Platforms/MacOSX.platform"; @@ -25,8 +26,15 @@ stdenv.mkDerivation rec { installPhase = '' ensureDir "$out/share/sysroot" cp -a * "$out/share/sysroot/" - ln -s "$out/usr/lib" "$out/lib" - ln -s "$out/usr/include" "$out/include" + ln -s "$out/share/sysroot/usr/lib" "$out/lib" + ln -s "$out/share/sysroot/usr/include" "$out/include" + + ensureDir "$toolchain" + pushd "$toolchain" + ${xpwn}/bin/hfsplus "$(dirs +1)/../main.hfs" extractall \ + Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr \ + > /dev/null + popd ''; meta = { From 53a267e535381e33e7c6f0eabda56a8b04027e36 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 21:59:26 +0100 Subject: [PATCH 0028/2033] darwin: Add new package opencflite. This provides a port of Mac OS X's CoreFoundation and is needed if we want to be able to run dsymutil using maloader. Signed-off-by: aszlig --- .../os-specific/darwin/opencflite/default.nix | 21 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 pkgs/os-specific/darwin/opencflite/default.nix diff --git a/pkgs/os-specific/darwin/opencflite/default.nix b/pkgs/os-specific/darwin/opencflite/default.nix new file mode 100644 index 00000000000..a2408bfc5c8 --- /dev/null +++ b/pkgs/os-specific/darwin/opencflite/default.nix @@ -0,0 +1,21 @@ +{ stdenv, fetchurl, icu, libuuid, tzdata }: + +stdenv.mkDerivation rec { + name = "opencflite-${version}"; + version = "476.19.0"; + + src = fetchurl { + url = "mirror://sourceforge/opencflite/${name}.tar.gz"; + sha256 = "0jgmzs0ycl930hmzcvx0ykryik56704yw62w394q1q3xw5kkjn9v"; + }; + + configureFlags = [ "--with-uuid=${libuuid}" ]; + buildInputs = [ icu tzdata.lib ]; + enableParallelBuilding = true; + + meta = { + description = "Cross platform port of the OS X CoreFoundation"; + homepage = "http://sourceforge.net/projects/opencflite/"; + license = stdenv.lib.licenses.apsl20; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f65d493b9d6..514f5c24b32 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6556,6 +6556,8 @@ let cross = assert crossSystem != null; crossSystem; }); + opencflite = callPackage ../os-specific/darwin/opencflite {}; + xcode = callPackage ../os-specific/darwin/xcode {}; }; From 45cd9994bc01641d0ed9ed9691cfdfa15fb87a54 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:02:46 +0100 Subject: [PATCH 0029/2033] darwin: Add new package maloader. This is the mentioned Mach-O loader that we're yoing to use to execute Apple's proprietary binaries. Signed-off-by: aszlig --- pkgs/os-specific/darwin/maloader/default.nix | 36 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 6 +++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/darwin/maloader/default.nix diff --git a/pkgs/os-specific/darwin/maloader/default.nix b/pkgs/os-specific/darwin/maloader/default.nix new file mode 100644 index 00000000000..f5bfe890735 --- /dev/null +++ b/pkgs/os-specific/darwin/maloader/default.nix @@ -0,0 +1,36 @@ +{ stdenv, fetchgit, opencflite, clang, libcxx }: + +stdenv.mkDerivation { + name = "maloader-0git"; + + src = fetchgit { + url = "git://github.com/shinh/maloader.git"; + rev = "5f220393e0b7b9ad0cf1aba0e89df2b42a1f0442"; + sha256 = "07j9b7n0grrbxxyn2h8pnk6pa8b370wq5z5zwbds8dlhi7q37rhn"; + }; + + postPatch = '' + sed -i \ + -e '/if.*loadLibMac.*mypath/s|mypath|"'"$out/lib/"'"|' \ + -e 's|libCoreFoundation\.so|${opencflite}/lib/&|' \ + ld-mac.cc + ''; + + NIX_CFLAGS_COMPILE = "-I${libcxx}/include/c++/v1"; + buildInputs = [ clang libcxx ]; + buildFlags = [ "USE_LIBCXX=1" "release" ]; + + installPhase = '' + install -vD libmac.so "$out/lib/libmac.so" + + for bin in extract macho2elf ld-mac; do + install -vD "$bin" "$out/bin/$bin" + done + ''; + + meta = { + description = "Mach-O loader for Linux"; + homepage = "https://github.com/shinh/maloader"; + license = stdenv.lib.licenses.bsd2; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 514f5c24b32..c6ea2cbc3fe 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6551,11 +6551,15 @@ let cramfsswap = callPackage ../os-specific/linux/cramfsswap { }; - darwin = { + darwin = rec { cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools-port { cross = assert crossSystem != null; crossSystem; }); + maloader = callPackage ../os-specific/darwin/maloader { + inherit opencflite; + }; + opencflite = callPackage ../os-specific/darwin/opencflite {}; xcode = callPackage ../os-specific/darwin/xcode {}; From 3940b219882f873314cd36c261cf807e94fa5f3b Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:08:51 +0100 Subject: [PATCH 0030/2033] cctools-port: Pass through wrapped XCToolchain. At the moment, this includes only dyldinfo, dwarfdump and dsymutil, but we'll see whether we need more of these utilities later. Tho reason those are wrapped in cctools-port is because it is the binutils used to cross-compile for Mac OS X. Signed-off-by: aszlig --- pkgs/os-specific/darwin/cctools-port/default.nix | 11 ++++++++++- pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/darwin/cctools-port/default.nix b/pkgs/os-specific/darwin/cctools-port/default.nix index 0d40409a994..cdc259c1e2a 100644 --- a/pkgs/os-specific/darwin/cctools-port/default.nix +++ b/pkgs/os-specific/darwin/cctools-port/default.nix @@ -1,5 +1,6 @@ { stdenv, cross, fetchurl, autoconf, automake, libtool , libcxx, llvm, clang, openssl, libuuid +, maloader, makeWrapper, xctoolchain }: stdenv.mkDerivation rec { @@ -13,7 +14,7 @@ stdenv.mkDerivation rec { }; buildInputs = [ - autoconf automake libtool libcxx llvm clang openssl libuuid + autoconf automake libtool libcxx llvm clang openssl libuuid makeWrapper ]; patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch ]; @@ -47,6 +48,14 @@ stdenv.mkDerivation rec { "--target=${cross.config}" ]; + postInstall = '' + for tool in dyldinfo dwarfdump dsymutil; do + makeWrapper "${maloader}/bin/ld-mac" "$out/bin/${cross.config}-$tool" \ + --add-flags "${xctoolchain}/bin/$tool" + ln -s "$out/bin/${cross.config}-$tool" "$out/bin/$tool" + done + ''; + meta = { homepage = "http://www.opensource.apple.com/source/cctools/"; description = "Mac OS X Compiler Tools (cross-platform port)"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c6ea2cbc3fe..9109e1e5952 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6554,6 +6554,8 @@ let darwin = rec { cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools-port { cross = assert crossSystem != null; crossSystem; + inherit maloader; + xctoolchain = xcode.toolchain; }); maloader = callPackage ../os-specific/darwin/maloader { From 745c4779305490816682bb95b319923d27c4a8fe Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:17:04 +0100 Subject: [PATCH 0031/2033] lua5.2/cross: Fix build for Darwin. The ld from cctools doesn't like the -soname argument, so let's strip it off for now until we have a binutils <-> cctools bridge. Signed-off-by: aszlig --- pkgs/development/interpreters/lua-5/5.2.nix | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkgs/development/interpreters/lua-5/5.2.nix b/pkgs/development/interpreters/lua-5/5.2.nix index 70ab0c3bdf8..c496d14083e 100644 --- a/pkgs/development/interpreters/lua-5/5.2.nix +++ b/pkgs/development/interpreters/lua-5/5.2.nix @@ -49,6 +49,30 @@ stdenv.mkDerivation rec { EOF ''; + crossAttrs = let + isDarwin = stdenv.cross.libc == "libSystem"; + in { + configurePhase = '' + makeFlagsArray=( + INSTALL_TOP=$out + INSTALL_MAN=$out/share/man/man1 + CC=${stdenv.cross.config}-gcc + STRIP=: + RANLIB=${stdenv.cross.config}-ranlib + V=${majorVersion} + R=${version} + ${stdenv.lib.optionalString isDarwin '' + AR="${stdenv.cross.config}-ar rcu" + macosx + ''} + ) + ''; + } // stdenv.lib.optionalAttrs isDarwin { + postPatch = '' + sed -i -e 's/-Wl,-soname[^ ]* *//' src/Makefile + ''; + }; + meta = { homepage = "http://www.lua.org"; description = "Powerful, fast, lightweight, embeddable scripting language"; From 3d73bf6c57d9406accfdbe89a46f38c492364ec3 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:22:21 +0100 Subject: [PATCH 0032/2033] glew/cross: Fix build for Darwin. The Makefile still contained calls to install with the -s (strip) option, which we don't want because it uses the native strip utility and we're going to crossStrip in fixupPhase later anyway. Signed-off-by: aszlig --- pkgs/development/libraries/glew/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix index ef81f210d39..1106a013949 100644 --- a/pkgs/development/libraries/glew/default.nix +++ b/pkgs/development/libraries/glew/default.nix @@ -1,5 +1,7 @@ { stdenv, fetchurl, mesa_glu, x11, libXmu, libXi }: +with stdenv.lib; + stdenv.mkDerivation rec { name = "glew-1.10.0"; @@ -14,6 +16,9 @@ stdenv.mkDerivation rec { patchPhase = '' sed -i 's|lib64|lib|' config/Makefile.linux + ${optionalString (stdenv ? cross) '' + sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile + ''} ''; buildPhase = "make all"; @@ -25,6 +30,13 @@ buildPhase = "make all"; cp -r README.txt LICENSE.txt doc $out/share/doc/glew ''; + crossAttrs.makeFlags = [ + "CC=${stdenv.cross.config}-gcc" + "LD=${stdenv.cross.config}-gcc" + "AR=${stdenv.cross.config}-ar" + "STRIP=" + ] ++ optional (stdenv.cross.libc == "libSystem") "SYSTEM=darwin"; + meta = { description = "An OpenGL extension loading library for C(++)"; homepage = http://glew.sourceforge.net/; From 30962765e07336eecfe959d5834f8d4eecc56df4 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:27:54 +0100 Subject: [PATCH 0033/2033] openssl/cross: Fix build for Darwin. This is just a minor fix, because when using "darwin64-x86_64-cc" for config.openssl.system, the OpenSSL build scripts try to compile with $prefix-cc, which is not available with the gcc-cross-wrapper. Signed-off-by: aszlig --- pkgs/development/libraries/openssl/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix index 7d7ccacd14a..4dd63078d66 100644 --- a/pkgs/development/libraries/openssl/default.nix +++ b/pkgs/development/libraries/openssl/default.nix @@ -91,6 +91,8 @@ stdenv.mkDerivation { rm $out/bin/c_rehash $out/ssl/misc/CA.pl $out/ssl/misc/tsget ''; configureScript = "./Configure"; + } // stdenv.lib.optionalAttrs (opensslCrossSystem == "darwin64-x86_64-cc") { + CC = "gcc"; }; meta = { From 8c053312b5633c0e180edff68335b3652cc5c6df Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:30:13 +0100 Subject: [PATCH 0034/2033] zlib/cross: Fix build for Darwin. Provide the correct cross ranlib, because native ranlib will fail. Signed-off-by: aszlig --- pkgs/development/libraries/zlib/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix index 0d4abaf25e0..37675e4a5bc 100644 --- a/pkgs/development/libraries/zlib/default.nix +++ b/pkgs/development/libraries/zlib/default.nix @@ -36,6 +36,8 @@ stdenv.mkDerivation rec { "-f" "win32/Makefile.gcc" "PREFIX=${stdenv.cross.config}-" ] ++ (if static then [] else [ "SHARED_MODE=1" ]); + } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") { + makeFlags = [ "RANLIB=${stdenv.cross.config}-ranlib" ]; }; # zlib doesn't like the automatic --disable-shared from the Cygwin stdenv. From 2d17335f6869f88e5bbcef4f1c7a3329e5860ccb Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 12 Mar 2014 06:21:17 +0100 Subject: [PATCH 0035/2033] gcc-cross-wrapper: Allow to pass US X min version. This allows to pass a new attribute osxMinVersion to crossSystem, which specifies the minimum Mac OS X version you want to be compatible to. Signed-off-by: aszlig --- pkgs/build-support/gcc-cross-wrapper/builder.sh | 4 ++++ pkgs/build-support/gcc-cross-wrapper/default.nix | 1 + 2 files changed, 5 insertions(+) diff --git a/pkgs/build-support/gcc-cross-wrapper/builder.sh b/pkgs/build-support/gcc-cross-wrapper/builder.sh index 5a5bd45a8f8..18d26b3e945 100644 --- a/pkgs/build-support/gcc-cross-wrapper/builder.sh +++ b/pkgs/build-support/gcc-cross-wrapper/builder.sh @@ -26,6 +26,10 @@ if test -z "$nativeLibc"; then fi fi + if [ -n "$osxMinVersion" ]; then + cflagsCompile="$cflagsCompile -mmacosx-version-min=$osxMinVersion" + fi + echo "$cflagsCompile -B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags echo "-L$libc/lib -rpath $libc/lib -rpath-link $libc/lib" > $out/nix-support/libc-ldflags diff --git a/pkgs/build-support/gcc-cross-wrapper/default.nix b/pkgs/build-support/gcc-cross-wrapper/default.nix index b2e30be10ef..d3494b83a87 100644 --- a/pkgs/build-support/gcc-cross-wrapper/default.nix +++ b/pkgs/build-support/gcc-cross-wrapper/default.nix @@ -46,6 +46,7 @@ stdenv.mkDerivation { addFlags = ./add-flags; inherit nativeTools nativeLibc nativePrefix gcc libc binutils; crossConfig = if cross != null then cross.config else null; + osxMinVersion = cross.osxMinVersion or null; gccLibs = if gcc != null then gccLibs else null; name = chosenName; langC = if nativeTools then true else gcc.langC; From 5e95800f267a848e4a75591363872c5eb10f3ee5 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 12 Mar 2014 06:25:54 +0100 Subject: [PATCH 0036/2033] openssl: Use Darwin patch for cross-builds too. Might be better to have something like stdenv.isDarwinTarget, which can be used to test for native Darwin _and_ cross-built Darwin as a target. Signed-off-by: aszlig --- pkgs/development/libraries/openssl/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix index 4dd63078d66..39e6cb3692d 100644 --- a/pkgs/development/libraries/openssl/default.nix +++ b/pkgs/development/libraries/openssl/default.nix @@ -8,7 +8,9 @@ let (throw "openssl needs its platform name cross building" null) stdenv.cross; - patchesCross = isCross: + patchesCross = isCross: let + isDarwin = stdenv.isDarwin || (isCross && stdenv.cross.libc == "libSystem"); + in [ # Allow the location of the X509 certificate file (the CA # bundle) to be set through the environment variable # ‘OPENSSL_X509_CERT_FILE’. This is necessary because the @@ -29,7 +31,7 @@ let ./kfreebsd-gnu.patch ] - ++ stdenv.lib.optional stdenv.isDarwin ./darwin-arch.patch; + ++ stdenv.lib.optional isDarwin ./darwin-arch.patch; in From f73851710ebe3d951fb98ee286f42e4398243333 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 12 Mar 2014 06:28:21 +0100 Subject: [PATCH 0037/2033] audiofile: Use alsaLib for native Linux only. Using ALSA for non-Linux systems really doesn't make much sense, so using buildNativeInputs to ensure it won't be used for cross-builds. Of course, if you're cross-building to Linux, the dependency won't be used, but right now we don't have a good way to easily check whether the cross target is Linux. Signed-off-by: aszlig --- pkgs/development/libraries/audiofile/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/audiofile/default.nix b/pkgs/development/libraries/audiofile/default.nix index a5fd80dc0db..c8fb8c53dc0 100644 --- a/pkgs/development/libraries/audiofile/default.nix +++ b/pkgs/development/libraries/audiofile/default.nix @@ -3,7 +3,7 @@ stdenv.mkDerivation rec { name = "audiofile-0.3.6"; - buildInputs = stdenv.lib.optional (!stdenv.isDarwin) alsaLib; + nativeBuildInputs = stdenv.lib.optional stdenv.isLinux alsaLib; src = fetchurl { url = "http://audiofile.68k.org/${name}.tar.gz"; From cdaced58aec376965e3e5ee422e098df526e4726 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 12 Mar 2014 06:34:42 +0100 Subject: [PATCH 0038/2033] libpng12/cross: Don't add zlib for Darwin builds. Cross builds for Darwin already include the CoreFoundation and the libraries from XCode, so zlib already exists on that platform. Signed-off-by: aszlig --- pkgs/development/libraries/libpng/12.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libpng/12.nix b/pkgs/development/libraries/libpng/12.nix index 031e2aa1a91..b7fad76acaa 100644 --- a/pkgs/development/libraries/libpng/12.nix +++ b/pkgs/development/libraries/libpng/12.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, zlib, xz }: -assert zlib != null; +assert !(stdenv ? cross) -> zlib != null; stdenv.mkDerivation rec { name = "libpng-1.2.50"; @@ -16,6 +16,11 @@ stdenv.mkDerivation rec { passthru = { inherit zlib; }; + crossAttrs = stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") { + propagatedBuildInputs = []; + passthru = {}; + }; + meta = { description = "The official reference implementation for the PNG file format"; homepage = http://www.libpng.org/pub/png/libpng.html; From 6998a866a86e934d13c29078963ebfa59fe0f438 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 12 Mar 2014 06:36:34 +0100 Subject: [PATCH 0039/2033] SDL: Refactor package and fix Darwin cross-builds. First of all, this needs two upstream patches for supporting OS X 10.9, also the cross-gcc doesn't accept -fpascal-strings, so drop the flag. And except putting all configure flags into a multiline string, we're now using a list, which is easier when it comes to handling optional components. As X isn't used on recent Mac OS X versions and Windows, I'm temporarily using --without-x for cross-builds until we have a better way to check for those things. Also, don't add audiofile to buildInputs if we're cross-compiling for MinGW. Signed-off-by: aszlig --- pkgs/development/libraries/SDL/default.nix | 43 +++++++++++++++------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix index e58397fa9a5..476ec73ba18 100644 --- a/pkgs/development/libraries/SDL/default.nix +++ b/pkgs/development/libraries/SDL/default.nix @@ -7,21 +7,13 @@ # OSS is no longer supported, for it's much crappier than ALSA and # PulseAudio. -assert alsaSupport || pulseaudioSupport; +assert !(stdenv ? cross) -> alsaSupport || pulseaudioSupport; assert openglSupport -> (mesa != null && x11Support); assert x11Support -> (x11 != null && libXrandr != null); assert alsaSupport -> alsaLib != null; assert pulseaudioSupport -> pulseaudio != null; -let - configureFlagsFun = attrs: '' - --disable-oss --disable-video-x11-xme - --disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared - --disable-osmesa-shared - ${if alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""} - ''; -in stdenv.mkDerivation rec { version = "1.2.15"; name = "SDL-${version}"; @@ -35,17 +27,42 @@ stdenv.mkDerivation rec { propagatedBuildInputs = stdenv.lib.optionals x11Support [ x11 libXrandr ] ++ stdenv.lib.optional pulseaudioSupport pulseaudio; - buildInputs = [ pkgconfig audiofile ] ++ + buildInputs = let + notMingw = !(stdenv ? cross) || stdenv.cross.libc != "msvcrt"; + in stdenv.lib.optional notMingw audiofile; + + nativeBuildInputs = [ pkgconfig ] ++ stdenv.lib.optional openglSupport [ mesa ] ++ stdenv.lib.optional alsaSupport alsaLib; # XXX: By default, SDL wants to dlopen() PulseAudio, in which case # we must arrange to add it to its RPATH; however, `patchelf' seems # to fail at doing this, hence `--disable-pulseaudio-shared'. - configureFlags = configureFlagsFun { inherit alsaLib; }; + configureFlags = [ + "--disable-oss" + "--disable-video-x11-xme" + "--disable-x11-shared" + "--disable-alsa-shared" + "--enable-rpath" + "--disable-pulseaudio-shared" + "--disable-osmesa-shared" + ] ++ stdenv.lib.optionals (stdenv ? cross) ([ + "--without-x" + ] ++ stdenv.lib.optional alsaSupport "--with-alsa-prefix=${alsaLib}/lib"); - crossAttrs = { - configureFlags = configureFlagsFun { alsaLib = alsaLib.crossDrv; }; + crossAttrs =stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") { + patches = let + f = rev: sha256: fetchurl { + url = "http://hg.libsdl.org/SDL/raw-rev/${rev}"; + inherit sha256; + }; + in [ + (f "e9466ead70e5" "0ygir3k83d0vxp7s3k48jn3j8n2bnv9wm6613wpx3ybnjrxabrip") + (f "bbfb41c13a87" "17v29ybjifvka19m8qf14rjc43nfdwk9v9inaizznarhb17amlnv") + ]; + postPatch = '' + sed -i -e 's/ *-fpascal-strings//' configure + ''; }; passthru = {inherit openglSupport;}; From 5eb3dd8a1b952aba821aa55557232ee443dc19bb Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 12 Mar 2014 06:42:05 +0100 Subject: [PATCH 0040/2033] cmake: Add patch for fixing Darwin cross-builds. This is an upstream patch and will eventually get into the next release. Signed-off-by: aszlig --- pkgs/development/tools/build-managers/cmake/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix index 9ce69374cd8..42277b22036 100644 --- a/pkgs/development/tools/build-managers/cmake/default.nix +++ b/pkgs/development/tools/build-managers/cmake/default.nix @@ -26,7 +26,13 @@ stdenv.mkDerivation rec { patches = # Don't search in non-Nix locations such as /usr, but do search in # Nixpkgs' Glibc. - optional (stdenv ? glibc) ./search-path.patch; + optional (stdenv ? glibc) ./search-path.patch ++ + optional (stdenv ? cross) (fetchurl { + name = "fix-darwin-cross-compile.patch"; + url = "http://public.kitware.com/Bug/file_download.php?" + + "file_id=4981&type=bug"; + sha256 = "16acmdr27adma7gs9rs0dxdiqppm15vl3vv3agy7y8s94wyh4ybv"; + }); buildInputs = [ curl expat zlib bzip2 libarchive ] ++ optional useNcurses ncurses From a6621202af47c826bd731ebefcbe5f573dc16ddd Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 12 Mar 2014 06:43:57 +0100 Subject: [PATCH 0041/2033] xcode: Drop use of weak_import on enumerators. GCC doesn't support attributes on enumerators, which could pose a problem but fortunately not in this case. Here a __attribute__((weak_import)) is used, which doesn't make much sense for enumerators anyway (noone will die because the corresponding enumerator won't be referenced either in older OS X versions). Signed-off-by: aszlig --- pkgs/os-specific/darwin/xcode/default.nix | 13 ++++++++++--- .../darwin/xcode/gcc-fix-enum-attributes.patch | 13 +++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 pkgs/os-specific/darwin/xcode/gcc-fix-enum-attributes.patch diff --git a/pkgs/os-specific/darwin/xcode/default.nix b/pkgs/os-specific/darwin/xcode/default.nix index 5c8e7a3ef6c..5d4546d63bf 100644 --- a/pkgs/os-specific/darwin/xcode/default.nix +++ b/pkgs/os-specific/darwin/xcode/default.nix @@ -1,6 +1,10 @@ { stdenv, requireFile, xpwn }: -stdenv.mkDerivation rec { +with stdenv.lib; + +let + osxVersion = "10.9"; +in stdenv.mkDerivation rec { name = "xcode-${version}"; version = "5.0.2"; @@ -10,9 +14,10 @@ stdenv.mkDerivation rec { sha256 = "0mrligqkfqwx8cy883pxm4w5w7a17nfh227zdspfll23r9agf32k"; }; - phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; + phases = [ "unpackPhase" "patchPhase" "installPhase" "fixupPhase" ]; outputs = [ "out" "toolchain" ]; + unpackCmd = let basePath = "Xcode.app/Contents/Developer/Platforms/MacOSX.platform"; sdkPath = "${basePath}/Developer/SDKs"; @@ -21,7 +26,9 @@ stdenv.mkDerivation rec { ${xpwn}/bin/hfsplus main.hfs extractall "${sdkPath}" > /dev/null ''; - setSourceRoot = "sourceRoot=MacOSX10.9.sdk"; + setSourceRoot = "sourceRoot=MacOSX${osxVersion}.sdk"; + + patches = optional (osxVersion == "10.9") ./gcc-fix-enum-attributes.patch; installPhase = '' ensureDir "$out/share/sysroot" diff --git a/pkgs/os-specific/darwin/xcode/gcc-fix-enum-attributes.patch b/pkgs/os-specific/darwin/xcode/gcc-fix-enum-attributes.patch new file mode 100644 index 00000000000..1e1895c2894 --- /dev/null +++ b/pkgs/os-specific/darwin/xcode/gcc-fix-enum-attributes.patch @@ -0,0 +1,13 @@ +diff --git a/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h b/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h +index fa0c290..7da7e0c 100644 +--- a/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h ++++ b/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h +@@ -13,7 +13,7 @@ typedef NS_ENUM(NSInteger, NSUserNotificationActivationType) { + NSUserNotificationActivationTypeNone = 0, + NSUserNotificationActivationTypeContentsClicked = 1, + NSUserNotificationActivationTypeActionButtonClicked = 2, +- NSUserNotificationActivationTypeReplied NS_AVAILABLE(10_9, NA) = 3 ++ NSUserNotificationActivationTypeReplied = 3 + } NS_ENUM_AVAILABLE(10_8, NA); + + NS_CLASS_AVAILABLE(10_8, NA) From a445199db42a99560ae15838444a67bc19498cc1 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 12 Mar 2014 09:12:10 +0100 Subject: [PATCH 0042/2033] xcode: Update to new version 5.1. This version just got released two days ago, while we were working for cross-builds on 5.0.2. From the release notes it shouldn't introduce any incompatibilities. Signed-off-by: aszlig --- pkgs/os-specific/darwin/xcode/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/darwin/xcode/default.nix b/pkgs/os-specific/darwin/xcode/default.nix index 5d4546d63bf..b80682b7550 100644 --- a/pkgs/os-specific/darwin/xcode/default.nix +++ b/pkgs/os-specific/darwin/xcode/default.nix @@ -6,12 +6,12 @@ let osxVersion = "10.9"; in stdenv.mkDerivation rec { name = "xcode-${version}"; - version = "5.0.2"; + version = "5.1"; src = requireFile { name = "xcode_${version}.dmg"; url = meta.homepage; - sha256 = "0mrligqkfqwx8cy883pxm4w5w7a17nfh227zdspfll23r9agf32k"; + sha256 = "0zkggbmsfc5w53j1ncbpayvnn1vzpyzyjjjzhawq1jjfq465bfvh"; }; phases = [ "unpackPhase" "patchPhase" "installPhase" "fixupPhase" ]; From 23b43c6a9bc58a81fb5273409381e36d7a8679fd Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 12 Mar 2014 10:55:51 +0100 Subject: [PATCH 0043/2033] gcc-4.8: Use --with-as/ld for MinGW-w64 as well. On MinGW, we're passing these programs to the configure script, but this obviously won't work for non-autoconf-based projects. Signed-off-by: aszlig --- pkgs/development/compilers/gcc/4.8/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 96207b6ca42..a7443209038 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -162,12 +162,13 @@ let version = "4.8.2"; " --disable-shared" + " --disable-decimal-float" # libdecnumber requires libc else - (if crossDarwin then - " --with-sysroot=${libcCross}/share/sysroot" + + (if crossDarwin then " --with-sysroot=${libcCross}/share/sysroot" + else " --with-headers=${libcCross}/include") + + # Ensure that -print-prog-name is able to find the correct programs. + (stdenv.lib.optionalString (crossMingw || crossDarwin) ( " --with-as=${binutilsCross}/bin/${cross.config}-as" + " --with-ld=${binutilsCross}/bin/${cross.config}-ld" - else - " --with-headers=${libcCross}/include") + + )) + " --enable-__cxa_atexit" + " --enable-long-long" + (if crossMingw then From b25ac9ea5567ea64c687c89111c26e1f5f1035b8 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 12 Mar 2014 10:58:55 +0100 Subject: [PATCH 0044/2033] gcc-cross-wrapper: Revert adding LD program name. This reverts commit c5ab2bfd258501cbe5f440089039aff8e7595e3c. As mentioned in the previous commit, this is now no longer needed. Signed-off-by: aszlig --- pkgs/build-support/gcc-cross-wrapper/setup-hook.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh index 497047a73b1..433d36ced43 100644 --- a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh +++ b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh @@ -70,8 +70,6 @@ fi if test "$dontSetConfigureCross" != "1"; then configureFlags="$configureFlags --build=$system --host=$crossConfig" - # This is because -print-prog-name tries to search FHS paths. - configureFlags="$configureFlags LD=$crossConfig-ld" fi # Disabling the tests when cross compiling, as usually the tests are meant for # native compilations. From 5cc4f3a260fa5a1c11bd23772fbffd0c1430a29f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Wed, 12 Mar 2014 13:35:24 +0100 Subject: [PATCH 0045/2033] Unbreak channel (fix license attribute in python-packages.nix) (cherry picked from commit 844d246d2dd0b148d5a6c6fc8cb6a0b77b190a62) --- pkgs/top-level/python-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index fae34f3747a..f408b317091 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8628,7 +8628,7 @@ rec { meta = { homepage = http://www.libvirt.org/; description = "libvirt Python bindings"; - license = pkgs.lib.license.lgpl2; + license = pkgs.lib.licenses.lgpl2; }; }; From 58e0383d93a68ab8c347be401b6029d1fa470f6e Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Sun, 12 Jan 2014 23:39:14 +0100 Subject: [PATCH 0046/2033] Add node-webkit, app runtime based on Chromium and node.js --- .../development/tools/node-webkit/default.nix | 55 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++ 2 files changed, 59 insertions(+) create mode 100644 pkgs/development/tools/node-webkit/default.nix diff --git a/pkgs/development/tools/node-webkit/default.nix b/pkgs/development/tools/node-webkit/default.nix new file mode 100644 index 00000000000..326e5322846 --- /dev/null +++ b/pkgs/development/tools/node-webkit/default.nix @@ -0,0 +1,55 @@ +{ stdenv, fetchurl, buildEnv, makeWrapper +, xlibs, alsaLib, dbus, glib, gtk, atk, pango, freetype, fontconfig +, gdk_pixbuf, cairo, zlib, nss, nssTools, nspr, gconf, expat, udev}: +let + bits = if stdenv.system == "x86_64-linux" then "x64" + else "ia32"; + + nwEnv = buildEnv { + name = "node-webkit-env"; + paths = [ + xlibs.libX11 xlibs.libXrender glib gtk atk pango cairo gdk_pixbuf + freetype fontconfig xlibs.libXcomposite alsaLib xlibs.libXdamage xlibs.libXext + xlibs.libXfixes nss nspr gconf expat dbus udev stdenv.gcc.gcc + ]; + }; + +in stdenv.mkDerivation rec { + name = "node-webkit-${version}"; + version = "0.8.4"; + + src = fetchurl { + url = "https://s3.amazonaws.com/node-webkit/v${version}/node-webkit-v${version}-linux-${bits}.tar.gz"; + sha256 = if bits == "x64" then + "91229edfb03349306c5ce101fdab2de55f7473cc7c36367e9611a0527d2ef591" else + "b0b29b4e75cd4b1aaecf7f4716216edcfc5947516744e2eaeae38bec1d03cea1"; + }; + + patchPhase = '' + patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" nw + patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" nwsnapshot + ''; + + installPhase = let + LD_LIBRARY_PATH = "${nwEnv}/lib:${nwEnv}/lib64:$out/share/node-webkit"; + in '' + ensureDir $out/bin + ensureDir $out/share/node-webkit + cp -R * $out/share/node-webkit + + ln -s ${udev}/lib/libudev.so $out/share/node-webkit/libudev.so.0 + + makeWrapper $out/share/node-webkit/nw $out/bin/nw --prefix LD_LIBRARY_PATH : "${LD_LIBRARY_PATH}" + makeWrapper $out/share/node-webkit/nwsnapshot $out/bin/nwsnapshot --prefix LD_LIBRARY_PATH : "${LD_LIBRARY_PATH}" + ''; + + buildInputs = [ makeWrapper ]; + + meta = with stdenv.lib; { + description = "An app runtime based on Chromium and node.js"; + homepage = https://github.com/rogerwang/node-webkit; + platforms = ["i686-linux" "x86_64-linux"]; + maintainers = [ maintainers.offline ]; + license = licenses.bsd3; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 46a41ed4545..ad210052659 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3799,6 +3799,10 @@ let ninja = callPackage ../development/tools/build-managers/ninja { }; + node_webkit = callPackage ../development/tools/node-webkit { + gconf = pkgs.gnome.GConf; + }; + noweb = callPackage ../development/tools/literate-programming/noweb { }; omake = callPackage ../development/tools/ocaml/omake { }; From 5533e05ca151a1763b57b86e212968b7f6bddf17 Mon Sep 17 00:00:00 2001 From: "ambrop7@gmail.com" Date: Sun, 16 Mar 2014 13:32:39 +0100 Subject: [PATCH 0047/2033] Chromium: Add desktop entry. --- .../networking/browsers/chromium/default.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index baf67371769..6b57acc2d35 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, makeWrapper, ninja, which +{ stdenv, fetchurl, makeWrapper, ninja, which, makeDesktopItem # default dependencies , bzip2, flac, speex @@ -155,6 +155,17 @@ let libExecPath = "$out/libexec/${packageName}"; sandboxPath = "${sandbox}/bin/${packageName}_sandbox"; + desktopItem = makeDesktopItem { + name = "Chromium"; + exec = "chromium"; + icon = "chromium"; + comment = "An open source web browser from Google"; + desktopName = "Chromium"; + genericName = "Web browser"; + mimeType = "text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/mailto;x-scheme-handler/webcal"; + categories = "Network;WebBrowser"; + }; + in stdenv.mkDerivation rec { name = "${packageName}-${src.version}"; inherit packageName src; @@ -266,6 +277,9 @@ in stdenv.mkDerivation rec { mkdir -vp "$logo_output_path" cp -v "$icon_file" "$logo_output_path/${packageName}.png" done + + mkdir -vp "$out/share/applications" + cp -v "${desktopItem}/share/applications/"* "$out/share/applications" ''; passthru = { From 59124ddf95488c5de645c2e95f29c3c2349e85ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Date: Sun, 30 Mar 2014 07:59:32 +0800 Subject: [PATCH 0048/2033] vimprobable2: update to 1.4.2 --- .../applications/networking/browsers/vimprobable2/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/browsers/vimprobable2/default.nix b/pkgs/applications/networking/browsers/vimprobable2/default.nix index 2a44449c750..f315f9ffa1a 100644 --- a/pkgs/applications/networking/browsers/vimprobable2/default.nix +++ b/pkgs/applications/networking/browsers/vimprobable2/default.nix @@ -2,11 +2,11 @@ pkgconfig, webkit, gsettings_desktop_schemas }: stdenv.mkDerivation rec { - version = "1.2.1"; + version = "1.4.2"; name = "vimprobable2-${version}"; src = fetchurl { url = "mirror://sourceforge/vimprobable/vimprobable2_${version}.tar.bz2"; - sha256 = "19zx1k3s2gnhzzd2wpyqsk151w9p52ifl64xaz9a6qkgvrxlli8p"; + sha256 = "13jdximksh9r3cgd2f8vms0pbsn3x0gxvyqdqiw16xp5fmdx5kzr"; }; # Nixos default ca bundle From d14b9e9850b300208a0ab2d4387addf555273012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Date: Sun, 30 Mar 2014 09:02:07 +0800 Subject: [PATCH 0049/2033] get rid of old webkit and webkit_gtk2 packages --- .../libraries/webkit/bison26.patch | 515 ------------------ pkgs/development/libraries/webkit/default.nix | 106 ---- pkgs/development/libraries/webkit/gtk2.nix | 109 ---- .../libraries/webkit/src-for-default.nix | 10 - .../libraries/webkit/src-for-gtk2.nix | 10 - .../libraries/webkit/src-for-svn.nix | 9 - .../libraries/webkit/src-info-for-default.nix | 6 - .../libraries/webkit/src-info-for-svn.nix | 6 - pkgs/top-level/all-packages.nix | 32 +- pkgs/top-level/python-packages.nix | 2 +- pkgs/top-level/release-python.nix | 1 - 11 files changed, 5 insertions(+), 801 deletions(-) delete mode 100644 pkgs/development/libraries/webkit/bison26.patch delete mode 100644 pkgs/development/libraries/webkit/default.nix delete mode 100644 pkgs/development/libraries/webkit/gtk2.nix delete mode 100644 pkgs/development/libraries/webkit/src-for-default.nix delete mode 100644 pkgs/development/libraries/webkit/src-for-gtk2.nix delete mode 100644 pkgs/development/libraries/webkit/src-for-svn.nix delete mode 100644 pkgs/development/libraries/webkit/src-info-for-default.nix delete mode 100644 pkgs/development/libraries/webkit/src-info-for-svn.nix diff --git a/pkgs/development/libraries/webkit/bison26.patch b/pkgs/development/libraries/webkit/bison26.patch deleted file mode 100644 index 95898adeb8a..00000000000 --- a/pkgs/development/libraries/webkit/bison26.patch +++ /dev/null @@ -1,515 +0,0 @@ -Index: /trunk/Source/WebCore/ChangeLog -=================================================================== ---- /trunk/Source/WebCore/ChangeLog (revision 124098) -+++ /trunk/Source/WebCore/ChangeLog (revision 124099) -@@ -1,2 +1,27 @@ -+2012-07-30 Alexis Menard -+ -+ Build fix with newer bison 2.6. -+ https://bugs.webkit.org/show_bug.cgi?id=92264 -+ -+ Reviewed by Adam Barth. -+ -+ As stated in http://www.gnu.org/software/bison/manual/html_node/Table-of-Symbols.html -+ YYLEX_PARAM and YYPARSE_PARAM are depecreated since version 1.875. So far all Mac OS -+ version I had access to as well as recent Linux runs at least version 2.3 so it's safe -+ to use the replacement of these deprecated macros in favor of %lex-param and %parse-param. -+ As announced http://lists.gnu.org/archive/html/info-gnu/2012-07/msg00011.html with the release -+ of version 2.6 YYLEX_PARAM and YYPARSE_PARAM are not supported anymore. -+ -+ No new tests : build fix and the patch should not trigger any regressions -+ -+ * css/CSSGrammar.y: -+ * css/CSSParser.cpp: -+ * xml/XPathGrammar.y: Refactored a bit to not use an intermediate PARSER define. -+ * xml/XPathParser.cpp: bison 2.6 declare xpathyyparse in the .h file now, i.e. XPathGrammar.h -+ therefore including this file within the namespace {} declarations leads to xpathyyparse being -+ defined part of WebCore::XPath namespaces but the actual implementation of xpathyyparse is in XPathGrammar.cpp -+ (generated) and not implemented within the WebCore::XPath so it lead to linking issues. Last, XPathGrammar.h needs -+ to be included after the other includes as it uses some XPath types. It breaks the style but CSSParser.cpp is doing the same. -+ - 2012-07-30 Sadrul Habib Chowdhury - -Index: /trunk/Source/WebCore/css/CSSParser.cpp -=================================================================== ---- /trunk/Source/WebCore/css/CSSParser.cpp (revision 124098) -+++ /trunk/Source/WebCore/css/CSSParser.cpp (revision 124099) -@@ -115,5 +115,5 @@ - #endif - --extern int cssyyparse(void* parser); -+extern int cssyyparse(WebCore::CSSParser*); - - using namespace std; -Index: /trunk/Source/WebCore/css/CSSGrammar.y -=================================================================== ---- /trunk/Source/WebCore/css/CSSGrammar.y (revision 124098) -+++ /trunk/Source/WebCore/css/CSSGrammar.y (revision 124099) -@@ -54,11 +54,10 @@ - #define YYDEBUG 0 - --// FIXME: Replace with %parse-param { CSSParser* parser } once we can depend on bison 2.x --#define YYPARSE_PARAM parser --#define YYLEX_PARAM parser -- - %} - - %pure_parser -+ -+%parse-param { CSSParser* parser } -+%lex-param { CSSParser* parser } - - %union { -@@ -90,5 +89,5 @@ - %{ - --static inline int cssyyerror(const char*) -+static inline int cssyyerror(void*, const char*) - { - return 1; -Index: /trunk/Source/WebCore/xml/XPathParser.cpp -=================================================================== ---- /trunk/Source/WebCore/xml/XPathParser.cpp (revision 124098) -+++ /trunk/Source/WebCore/xml/XPathParser.cpp (revision 124099) -@@ -33,22 +33,19 @@ - #include "XPathException.h" - #include "XPathNSResolver.h" -+#include "XPathPath.h" - #include "XPathStep.h" - #include - #include - --int xpathyyparse(void*); -- -+using namespace WebCore; - using namespace WTF; - using namespace Unicode; -- --namespace WebCore { --namespace XPath { -- --class LocationPath; -- --#include "XPathGrammar.h" -+using namespace XPath; -+ -+extern int xpathyyparse(WebCore::XPath::Parser*); -+#include "XPathGrammar.h" - - Parser* Parser::currentParser = 0; -- -+ - enum XMLCat { NameStart, NameCont, NotPartOfName }; - -@@ -631,4 +628,2 @@ - } - --} --} -Index: /trunk/Source/WebCore/xml/XPathGrammar.y -=================================================================== ---- /trunk/Source/WebCore/xml/XPathGrammar.y (revision 124098) -+++ /trunk/Source/WebCore/xml/XPathGrammar.y (revision 124099) -@@ -35,4 +35,5 @@ - #include "XPathPath.h" - #include "XPathPredicate.h" -+#include "XPathStep.h" - #include "XPathVariableReference.h" - #include -@@ -45,6 +46,4 @@ - #define YYDEBUG 0 - #define YYMAXDEPTH 10000 --#define YYPARSE_PARAM parserParameter --#define PARSER static_cast(parserParameter) - - using namespace WebCore; -@@ -54,4 +53,5 @@ - - %pure_parser -+%parse-param { WebCore::XPath::Parser* parser } - - %union -@@ -72,5 +72,5 @@ - - static int xpathyylex(YYSTYPE* yylval) { return Parser::current()->lex(yylval); } --static void xpathyyerror(const char*) { } -+static void xpathyyerror(void*, const char*) { } - - %} -@@ -119,5 +119,5 @@ - OrExpr - { -- PARSER->m_topExpr = $1; -+ parser->m_topExpr = $1; - } - ; -@@ -139,5 +139,5 @@ - { - $$ = new LocationPath; -- PARSER->registerParseNode($$); -+ parser->registerParseNode($$); - } - | -@@ -151,5 +151,5 @@ - $$ = $2; - $$->insertFirstStep($1); -- PARSER->unregisterParseNode($1); -+ parser->unregisterParseNode($1); - } - ; -@@ -160,6 +160,6 @@ - $$ = new LocationPath; - $$->appendStep($1); -- PARSER->unregisterParseNode($1); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->registerParseNode($$); - } - | -@@ -167,5 +167,5 @@ - { - $$->appendStep($3); -- PARSER->unregisterParseNode($3); -+ parser->unregisterParseNode($3); - } - | -@@ -174,6 +174,6 @@ - $$->appendStep($2); - $$->appendStep($3); -- PARSER->unregisterParseNode($2); -- PARSER->unregisterParseNode($3); -+ parser->unregisterParseNode($2); -+ parser->unregisterParseNode($3); - } - ; -@@ -184,9 +184,9 @@ - if ($2) { - $$ = new Step(Step::ChildAxis, *$1, *$2); -- PARSER->deletePredicateVector($2); -+ parser->deletePredicateVector($2); - } else - $$ = new Step(Step::ChildAxis, *$1); -- PARSER->deleteNodeTest($1); -- PARSER->registerParseNode($$); -+ parser->deleteNodeTest($1); -+ parser->registerParseNode($$); - } - | -@@ -195,6 +195,6 @@ - String localName; - String namespaceURI; -- if (!PARSER->expandQName(*$1, localName, namespaceURI)) { -- PARSER->m_gotNamespaceError = true; -+ if (!parser->expandQName(*$1, localName, namespaceURI)) { -+ parser->m_gotNamespaceError = true; - YYABORT; - } -@@ -202,9 +202,9 @@ - if ($2) { - $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI), *$2); -- PARSER->deletePredicateVector($2); -+ parser->deletePredicateVector($2); - } else - $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI)); -- PARSER->deleteString($1); -- PARSER->registerParseNode($$); -+ parser->deleteString($1); -+ parser->registerParseNode($$); - } - | -@@ -213,9 +213,9 @@ - if ($3) { - $$ = new Step($1, *$2, *$3); -- PARSER->deletePredicateVector($3); -+ parser->deletePredicateVector($3); - } else - $$ = new Step($1, *$2); -- PARSER->deleteNodeTest($2); -- PARSER->registerParseNode($$); -+ parser->deleteNodeTest($2); -+ parser->registerParseNode($$); - } - | -@@ -224,6 +224,6 @@ - String localName; - String namespaceURI; -- if (!PARSER->expandQName(*$2, localName, namespaceURI)) { -- PARSER->m_gotNamespaceError = true; -+ if (!parser->expandQName(*$2, localName, namespaceURI)) { -+ parser->m_gotNamespaceError = true; - YYABORT; - } -@@ -231,9 +231,9 @@ - if ($3) { - $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI), *$3); -- PARSER->deletePredicateVector($3); -+ parser->deletePredicateVector($3); - } else - $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI)); -- PARSER->deleteString($2); -- PARSER->registerParseNode($$); -+ parser->deleteString($2); -+ parser->registerParseNode($$); - } - | -@@ -260,6 +260,6 @@ - $$ = new Step::NodeTest(Step::NodeTest::CommentNodeTest); - -- PARSER->deleteString($1); -- PARSER->registerNodeTest($$); -+ parser->deleteString($1); -+ parser->registerNodeTest($$); - } - | -@@ -267,6 +267,6 @@ - { - $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest); -- PARSER->deleteString($1); -- PARSER->registerNodeTest($$); -+ parser->deleteString($1); -+ parser->registerNodeTest($$); - } - | -@@ -274,7 +274,7 @@ - { - $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest, $3->stripWhiteSpace()); -- PARSER->deleteString($1); -- PARSER->deleteString($3); -- PARSER->registerNodeTest($$); -+ parser->deleteString($1); -+ parser->deleteString($3); -+ parser->registerNodeTest($$); - } - ; -@@ -294,6 +294,6 @@ - $$ = new Vector; - $$->append(new Predicate($1)); -- PARSER->unregisterParseNode($1); -- PARSER->registerPredicateVector($$); -+ parser->unregisterParseNode($1); -+ parser->registerPredicateVector($$); - } - | -@@ -301,5 +301,5 @@ - { - $$->append(new Predicate($2)); -- PARSER->unregisterParseNode($2); -+ parser->unregisterParseNode($2); - } - ; -@@ -316,5 +316,5 @@ - { - $$ = new Step(Step::DescendantOrSelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest)); -- PARSER->registerParseNode($$); -+ parser->registerParseNode($$); - } - ; -@@ -324,5 +324,5 @@ - { - $$ = new Step(Step::SelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest)); -- PARSER->registerParseNode($$); -+ parser->registerParseNode($$); - } - | -@@ -330,5 +330,5 @@ - { - $$ = new Step(Step::ParentAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest)); -- PARSER->registerParseNode($$); -+ parser->registerParseNode($$); - } - ; -@@ -338,6 +338,6 @@ - { - $$ = new VariableReference(*$1); -- PARSER->deleteString($1); -- PARSER->registerParseNode($$); -+ parser->deleteString($1); -+ parser->registerParseNode($$); - } - | -@@ -350,6 +350,6 @@ - { - $$ = new StringExpression(*$1); -- PARSER->deleteString($1); -- PARSER->registerParseNode($$); -+ parser->deleteString($1); -+ parser->registerParseNode($$); - } - | -@@ -357,6 +357,6 @@ - { - $$ = new Number($1->toDouble()); -- PARSER->deleteString($1); -- PARSER->registerParseNode($$); -+ parser->deleteString($1); -+ parser->registerParseNode($$); - } - | -@@ -370,6 +370,6 @@ - if (!$$) - YYABORT; -- PARSER->deleteString($1); -- PARSER->registerParseNode($$); -+ parser->deleteString($1); -+ parser->registerParseNode($$); - } - | -@@ -379,7 +379,7 @@ - if (!$$) - YYABORT; -- PARSER->deleteString($1); -- PARSER->deleteExpressionVector($3); -- PARSER->registerParseNode($$); -+ parser->deleteString($1); -+ parser->deleteExpressionVector($3); -+ parser->registerParseNode($$); - } - ; -@@ -390,6 +390,6 @@ - $$ = new Vector; - $$->append($1); -- PARSER->unregisterParseNode($1); -- PARSER->registerExpressionVector($$); -+ parser->unregisterParseNode($1); -+ parser->registerExpressionVector($$); - } - | -@@ -397,5 +397,5 @@ - { - $$->append($3); -- PARSER->unregisterParseNode($3); -+ parser->unregisterParseNode($3); - } - ; -@@ -413,7 +413,7 @@ - $$->addSubExpression($1); - $$->addSubExpression($3); -- PARSER->unregisterParseNode($1); -- PARSER->unregisterParseNode($3); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->unregisterParseNode($3); -+ parser->registerParseNode($$); - } - ; -@@ -431,7 +431,7 @@ - $3->setAbsolute(true); - $$ = new Path(static_cast($1), $3); -- PARSER->unregisterParseNode($1); -- PARSER->unregisterParseNode($3); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->unregisterParseNode($3); -+ parser->registerParseNode($$); - } - | -@@ -441,8 +441,8 @@ - $3->setAbsolute(true); - $$ = new Path(static_cast($1), $3); -- PARSER->unregisterParseNode($1); -- PARSER->unregisterParseNode($2); -- PARSER->unregisterParseNode($3); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->unregisterParseNode($2); -+ parser->unregisterParseNode($3); -+ parser->registerParseNode($$); - } - ; -@@ -454,7 +454,7 @@ - { - $$ = new Filter($1, *$2); -- PARSER->unregisterParseNode($1); -- PARSER->deletePredicateVector($2); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->deletePredicateVector($2); -+ parser->registerParseNode($$); - } - ; -@@ -466,7 +466,7 @@ - { - $$ = new LogicalOp(LogicalOp::OP_Or, $1, $3); -- PARSER->unregisterParseNode($1); -- PARSER->unregisterParseNode($3); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->unregisterParseNode($3); -+ parser->registerParseNode($$); - } - ; -@@ -478,7 +478,7 @@ - { - $$ = new LogicalOp(LogicalOp::OP_And, $1, $3); -- PARSER->unregisterParseNode($1); -- PARSER->unregisterParseNode($3); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->unregisterParseNode($3); -+ parser->registerParseNode($$); - } - ; -@@ -490,7 +490,7 @@ - { - $$ = new EqTestOp($2, $1, $3); -- PARSER->unregisterParseNode($1); -- PARSER->unregisterParseNode($3); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->unregisterParseNode($3); -+ parser->registerParseNode($$); - } - ; -@@ -502,7 +502,7 @@ - { - $$ = new EqTestOp($2, $1, $3); -- PARSER->unregisterParseNode($1); -- PARSER->unregisterParseNode($3); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->unregisterParseNode($3); -+ parser->registerParseNode($$); - } - ; -@@ -514,7 +514,7 @@ - { - $$ = new NumericOp(NumericOp::OP_Add, $1, $3); -- PARSER->unregisterParseNode($1); -- PARSER->unregisterParseNode($3); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->unregisterParseNode($3); -+ parser->registerParseNode($$); - } - | -@@ -522,7 +522,7 @@ - { - $$ = new NumericOp(NumericOp::OP_Sub, $1, $3); -- PARSER->unregisterParseNode($1); -- PARSER->unregisterParseNode($3); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->unregisterParseNode($3); -+ parser->registerParseNode($$); - } - ; -@@ -534,7 +534,7 @@ - { - $$ = new NumericOp($2, $1, $3); -- PARSER->unregisterParseNode($1); -- PARSER->unregisterParseNode($3); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($1); -+ parser->unregisterParseNode($3); -+ parser->registerParseNode($$); - } - ; -@@ -547,6 +547,6 @@ - $$ = new Negative; - $$->addSubExpression($2); -- PARSER->unregisterParseNode($2); -- PARSER->registerParseNode($$); -+ parser->unregisterParseNode($2); -+ parser->registerParseNode($$); - } - ; diff --git a/pkgs/development/libraries/webkit/default.nix b/pkgs/development/libraries/webkit/default.nix deleted file mode 100644 index ef4d259cb02..00000000000 --- a/pkgs/development/libraries/webkit/default.nix +++ /dev/null @@ -1,106 +0,0 @@ -args : with args; -let - s = import ./src-for-default.nix; # 1.8.3 needs newer gtk3, wait for x-updates - version = lib.attrByPath ["version"] s.version args; -in -rec { - src = fetchurl { - url = s.url; - sha256 = s.hash; - }; - - buildInputs = with xlibs; [ - pkgconfig libtool intltool autoconf automake gperf bison flex - gtk3 gtk2 glib atk cairo pango fontconfig freetype libsoup gtkdoc - libjpeg libpng libtiff libxml2 libxslt sqlite icu curl - which libproxy geoclue enchant python ruby perl - mesa libXt libXrender renderproto libXcomposite compositeproto - libXdamage damageproto kbproto - ]; - - propagatedBuildInputs = [ - gstreamer gst_plugins_base gst_ffmpeg gst_plugins_good - ]; - - configureFlags = [ - # "--enable-3D-transforms" # no longer recognized - "--enable-web-sockets" - "--enable-web-timing" - - # https://bugs.webkit.org/show_bug.cgi?id=55294 - "--enable-image-resizer" - - "--enable-geolocation" - - # Not implemented? - # "--enable-web-audio" - - "--enable-mathml" - - #"--enable-wml" - - # https://bugs.webkit.org/show_bug.cgi?id=45110 - #"--enable-indexed-database" - - # Doesn't work in release... - #"--enable-xhtmlmp" - - # "--enable-input-speech" - - #"--enable-file-writer" # no longer recognized - "--enable-blob" - - # https://bugs.webkit.org/show_bug.cgi?id=59430 - # "--enable-directory-upload" - - # https://bugs.webkit.org/show_bug.cgi?id=58443 - # "--enable-file-system" - - "--enable-dependency-tracking" # to fix parallel building - ]; - - # instead of enableParallelBuilding = true; - makeFlags = "-j$NIX_BUILD_CORES"; - - /* doConfigure should be specified separately */ - phaseNames = ["doPatch" "fixConfigure" /* "paranoidFixComments" */ "doConfigure" (doPatchShebangs ".") - "doReplaceUsrBin" "doMakeInstall" "doAddPrograms"]; - - patches = [ ./bison26.patch ]; # http://trac.webkit.org/changeset/124099 - patchFlags = "-p2"; - - #doCheck = true; # tests still have problems - - doReplaceUsrBin = fullDepEntry ('' - for i in $(find . -name '*.pl') $(find . -name '*.pm'); do - sed -e 's@/usr/bin/gcc@gcc@' -i $i - done - '') ["minInit" "doUnpack"]; - - doAddPrograms = fullDepEntry ('' - mkdir -p $out/bin - for i in Programs/.libs/* Programs/*; do - cp $i $out/bin/webkit-program-$(basename $i) || true - done - '') ["minInit" "doMake" "defEnsureDir"]; - - paranoidFixComments = fullDepEntry ('' - sed -re 's@( |^)//.*@/* & */@' -i $(find . -name '*.c' -o -name '*.h') - '') ["minInit" "doUnpack"]; - - # See http://archive.linuxfromscratch.org/mail-archives/blfs-dev/2012-April/022893.html - fixConfigure = fullDepEntry ('' - sed -i -e 's/=GSTREAMER_0_10_REQUIRED_VERSION/=\$GSTREAMER_0_10_REQUIRED_VERSION/' \ - -e 's/=GSTREAMER_0_10_PLUGINS_BASE_REQUIRED_VERSION/=\$GSTREAMER_0_10_PLUGINS_BASE_REQUIRED_VERSION/' \ - configure{,.ac} - '') ["minInit" "doUnpack"]; - - name = s.name; - meta = { - description = "WebKit - a fast and correct HTML renderer"; - maintainers = [stdenv.lib.maintainers.raskin]; - }; - passthru = { - inherit gstreamer gst_plugins_base gst_plugins_good gst_ffmpeg libsoup; - }; -} diff --git a/pkgs/development/libraries/webkit/gtk2.nix b/pkgs/development/libraries/webkit/gtk2.nix deleted file mode 100644 index c2e3b9b06dd..00000000000 --- a/pkgs/development/libraries/webkit/gtk2.nix +++ /dev/null @@ -1,109 +0,0 @@ - -args : with args; -let - s = import ./src-for-gtk2.nix; - version = lib.attrByPath ["version"] s.version args; -in -rec { - src = fetchurl { - url = s.url; - sha256 = s.hash; - }; - - buildInputs = with xlibs; [ - pkgconfig libtool intltool autoconf automake gperf bison flex - gtk2 glib atk cairo pango fontconfig freetype libsoup gtkdoc - libjpeg libpng libtiff libxml2 libxslt sqlite icu curl - which libproxy geoclue enchant python ruby perl - mesa libXt libXrender renderproto libXcomposite compositeproto - libXdamage damageproto kbproto - ]; - - propagatedBuildInputs = [ - gstreamer gst_plugins_base gst_ffmpeg gst_plugins_good - ]; - - configureFlags = [ - "--with-gtk=2.0" - - # "--enable-3D-transforms" # no longer recognized - "--enable-web-sockets" - "--enable-web-timing" - - # https://bugs.webkit.org/show_bug.cgi?id=55294 - "--enable-image-resizer" - - "--enable-geolocation" - - # Not implemented? - # "--enable-web-audio" - - "--enable-mathml" - - #"--enable-wml" - - # https://bugs.webkit.org/show_bug.cgi?id=45110 - #"--enable-indexed-database" - - # Doesn't work in release... - #"--enable-xhtmlmp" - - # "--enable-input-speech" - - #"--enable-file-writer" # no longer recognized - "--enable-blob" - - # https://bugs.webkit.org/show_bug.cgi?id=59430 - # "--enable-directory-upload" - - # https://bugs.webkit.org/show_bug.cgi?id=58443 - # "--enable-file-system" - - "--enable-dependency-tracking" # to fix parallel building - ]; - - # instead of enableParallelBuilding = true; - makeFlags = "-j$NIX_BUILD_CORES"; - - /* doConfigure should be specified separately */ - phaseNames = ["doPatch" "fixConfigure" /* "paranoidFixComments" */ "doConfigure" (doPatchShebangs ".") - "doReplaceUsrBin" "doMakeInstall" "doAddPrograms"]; - - patches = [ ./bison26.patch ]; # http://trac.webkit.org/changeset/124099 - patchFlags = "-p2"; - - #doCheck = true; # tests still have problems - - doReplaceUsrBin = fullDepEntry ('' - for i in $(find . -name '*.pl') $(find . -name '*.pm'); do - sed -e 's@/usr/bin/gcc@gcc@' -i $i - done - '') ["minInit" "doUnpack"]; - - doAddPrograms = fullDepEntry ('' - mkdir -p $out/bin - for i in Programs/.libs/* Programs/*; do - cp $i $out/bin/webkit-program-$(basename $i) || true - done - '') ["minInit" "doMake" "defEnsureDir"]; - - paranoidFixComments = fullDepEntry ('' - sed -re 's@( |^)//.*@/* & */@' -i $(find . -name '*.c' -o -name '*.h') - '') ["minInit" "doUnpack"]; - - # See http://archive.linuxfromscratch.org/mail-archives/blfs-dev/2012-April/022893.html - fixConfigure = fullDepEntry ('' - sed -i -e 's/=GSTREAMER_0_10_REQUIRED_VERSION/=\$GSTREAMER_0_10_REQUIRED_VERSION/' \ - -e 's/=GSTREAMER_0_10_PLUGINS_BASE_REQUIRED_VERSION/=\$GSTREAMER_0_10_PLUGINS_BASE_REQUIRED_VERSION/' \ - configure{,.ac} - '') ["minInit" "doUnpack"]; - - name = s.name; - meta = { - description = "WebKit - a fast and correct HTML renderer"; - maintainers = [stdenv.lib.maintainers.raskin]; - }; - passthru = { - inherit gstreamer gst_plugins_base gst_plugins_good gst_ffmpeg libsoup; - }; -} diff --git a/pkgs/development/libraries/webkit/src-for-default.nix b/pkgs/development/libraries/webkit/src-for-default.nix deleted file mode 100644 index 65bcd435096..00000000000 --- a/pkgs/development/libraries/webkit/src-for-default.nix +++ /dev/null @@ -1,10 +0,0 @@ -rec { - version="1.8.1"; - name="webkit-1.8.1"; - hash="0a1v3v8dp2cl332qr51j4fpl0rwpgxbf29hn3zdim9hcniv6l4ls"; - url="http://webkitgtk.org/releases/webkit-1.8.1.tar.xz"; - advertisedUrl="http://webkitgtk.org/releases/webkit-1.8.1.tar.xz"; - - -} - diff --git a/pkgs/development/libraries/webkit/src-for-gtk2.nix b/pkgs/development/libraries/webkit/src-for-gtk2.nix deleted file mode 100644 index 65bcd435096..00000000000 --- a/pkgs/development/libraries/webkit/src-for-gtk2.nix +++ /dev/null @@ -1,10 +0,0 @@ -rec { - version="1.8.1"; - name="webkit-1.8.1"; - hash="0a1v3v8dp2cl332qr51j4fpl0rwpgxbf29hn3zdim9hcniv6l4ls"; - url="http://webkitgtk.org/releases/webkit-1.8.1.tar.xz"; - advertisedUrl="http://webkitgtk.org/releases/webkit-1.8.1.tar.xz"; - - -} - diff --git a/pkgs/development/libraries/webkit/src-for-svn.nix b/pkgs/development/libraries/webkit/src-for-svn.nix deleted file mode 100644 index f90bafbf6dc..00000000000 --- a/pkgs/development/libraries/webkit/src-for-svn.nix +++ /dev/null @@ -1,9 +0,0 @@ -rec { - version="r86499"; - name="webkit-r86499"; - hash="04sfwri81x2d9y3z0v7rhrr40vn0bxcbnhb8a0gymqkwa1ngpzmp"; - url="http://builds.nightly.webkit.org/files/trunk/src/WebKit-r86499.tar.bz2"; - advertisedUrl="http://builds.nightly.webkit.org/files/trunk/src/WebKit-r86499.tar.bz2"; - - -} diff --git a/pkgs/development/libraries/webkit/src-info-for-default.nix b/pkgs/development/libraries/webkit/src-info-for-default.nix deleted file mode 100644 index c4e5b8a6fd6..00000000000 --- a/pkgs/development/libraries/webkit/src-info-for-default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - downloadPage = "http://webkitgtk.org/?page=download"; - versionExtractorSedScript = "s/.*-([.0-9]+)[.].*/\\1/"; - versionReferenceCreator = "s/-([.0-9.]+)[.]/-\${version}./"; - baseName = "webkit"; -} diff --git a/pkgs/development/libraries/webkit/src-info-for-svn.nix b/pkgs/development/libraries/webkit/src-info-for-svn.nix deleted file mode 100644 index 994cae544cb..00000000000 --- a/pkgs/development/libraries/webkit/src-info-for-svn.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - downloadPage = "http://nightly.webkit.org/"; - versionExtractorSedScript = "s/.*-(r[0-9]+)[.].*/\\1/"; - versionReferenceCreator = "s/-(r[0-9.]+)[.]/-\${version}./"; - baseName = "webkit"; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e3b34243d4d..31456b94cbd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5909,28 +5909,7 @@ let wayland = callPackage ../development/libraries/wayland { }; - webkit = - builderDefsPackage ../development/libraries/webkit { - inherit gtk2; # for plugins etc. even with gtk3, see Gentoo ebuild - inherit gtk3 glib atk cairo pango fontconfig freetype; - inherit (gnome) gtkdoc libsoup; - inherit pkgconfig libtool intltool autoconf automake gperf flex - libjpeg libpng libtiff libxml2 libxslt sqlite icu curl - which libproxy geoclue enchant python ruby perl mesa xlibs; - inherit gstreamer gst_plugins_base gst_ffmpeg gst_plugins_good; - bison = bison2; - }; - - webkit_gtk2 = - builderDefsPackage ../development/libraries/webkit/gtk2.nix { - inherit gtk2 glib atk cairo pango fontconfig freetype; - inherit (gnome) gtkdoc libsoup; - inherit pkgconfig libtool intltool autoconf automake gperf flex - libjpeg libpng libtiff libxml2 libxslt sqlite icu curl - which libproxy geoclue enchant python ruby perl mesa xlibs; - inherit gstreamer gst_plugins_base gst_ffmpeg gst_plugins_good; - bison = bison2; - }; + webkit = webkitgtk; webkitgtk = callPackage ../development/libraries/webkitgtk { harfbuzz = harfbuzz.override { @@ -9064,8 +9043,7 @@ let }); surf = callPackage ../applications/misc/surf { - libsoup = gnome.libsoup; - webkit = webkit_gtk2; + webkit = webkitgtk2; }; svk = perlPackages.SVK; @@ -10612,8 +10590,7 @@ let vimPlugins = callPackage ../misc/vim-plugins { }; vimprobable2 = callPackage ../applications/networking/browsers/vimprobable2 { - inherit (gnome) libsoup; - webkit = webkit_gtk2; + webkit = webkitgtk2; }; vimprobable2Wrapper = wrapFirefox @@ -10621,8 +10598,7 @@ let }; vimb = callPackage ../applications/networking/browsers/vimb { - inherit (gnome) libsoup; - webkit = webkit_gtk2; + webkit = webkitgtk2; }; vimbWrapper = wrapFirefox { diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 5a4be8d1704..4605a2dadd7 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5848,7 +5848,7 @@ rec { }; buildInputs = with pkgs; [ - pkgconfig python gtk2 pygtk libxml2 libxslt libsoup webkit_gtk2 icu + pkgconfig python gtk2 pygtk libxml2 libxslt libsoup webkitgtk2 icu ]; meta = { diff --git a/pkgs/top-level/release-python.nix b/pkgs/top-level/release-python.nix index 8eb08d25983..dfdbb1db8bd 100644 --- a/pkgs/top-level/release-python.nix +++ b/pkgs/top-level/release-python.nix @@ -1724,7 +1724,6 @@ let wavesurfer = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; }; wdfs = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; }; webkit = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; }; - webkit_gtk2 = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; }; weechat = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; }; welkin = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; }; wesnoth = { type = "job"; systems = ["x86_64-linux"]; schedulingPriority = 4; }; From 6e7fe59bb13a2e3bf05516c559fbf4272a0331d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Date: Sun, 30 Mar 2014 09:52:36 +0800 Subject: [PATCH 0050/2033] uzbl: build with webkitgtk2, cleanup --- .../networking/browsers/uzbl/default.nix | 71 ++++++++----------- pkgs/top-level/all-packages.nix | 8 +-- 2 files changed, 33 insertions(+), 46 deletions(-) diff --git a/pkgs/applications/networking/browsers/uzbl/default.nix b/pkgs/applications/networking/browsers/uzbl/default.nix index 4c6458d909f..ba9c8bde37a 100644 --- a/pkgs/applications/networking/browsers/uzbl/default.nix +++ b/pkgs/applications/networking/browsers/uzbl/default.nix @@ -1,45 +1,36 @@ -a : -let - fetchgit = a.fetchgit; +{ stdenv, fetchurl, pkgconfig, python, makeWrapper +, webkit, glib_networking, gsettings_desktop_schemas +}: - buildInputs = with a; [ - libsoup pkgconfig webkit gtk makeWrapper - kbproto glib pango cairo gdk_pixbuf atk - python3 - ]; -in -rec { - src = fetchgit { - url = "https://github.com/Dieterbe/uzbl.git"; - rev = "refs/tags/2012.05.14"; - sha256 = "1crvikb0qqsx5qb003i4w7ywh72psl37gjslrj5hx2fd2f215l0l"; - }; +stdenv.mkDerivation rec { + name = "uzbl-20120514"; - name = "uzbl-git"; - - inherit buildInputs; - configureFlags = []; - - /* doConfigure should be removed if not needed */ - phaseNames = ["addInputs" "setVars" "doMakeInstall" "doWrap"]; - - setVars = a.noDepEntry ('' - export NIX_LDFLAGS="$NIX_LDFLAGS -L${a.libX11}/lib -lX11" - ''); - - doWrap = a.makeManyWrappers "$out/bin/uzbl-core" - '' - --prefix GST_PLUGIN_PATH : ${a.webkit.gstreamer}/lib/gstreamer-* \ - --prefix GST_PLUGIN_PATH : ${a.webkit.gst_plugins_base}/lib/gstreamer-* \ - --prefix GST_PLUGIN_PATH : ${a.webkit.gst_plugins_good}/lib/gstreamer-* \ - --prefix GST_PLUGIN_PATH : ${a.webkit.gst_ffmpeg}/lib/gstreamer-* \ - --prefix GIO_EXTRA_MODULES : ${a.glib_networking}/lib/gio/modules - ''; - - installFlags = "PREFIX=$out PYINSTALL_EXTRA=\"--prefix=$out\""; - - meta = { + meta = with stdenv.lib; { description = "Tiny externally controllable webkit browser"; - maintainers = [a.lib.maintainers.raskin]; + homepage = "http://uzbl.org/"; + license = licenses.gpl3; + platforms = platforms.linux; + maintainers = with maintainers; [ raskin ]; }; + + src = fetchurl { + name = "${name}.tar.gz"; + url = "https://github.com/uzbl/uzbl/archive/2012.05.14.tar.gz"; + sha256 = "1flpf0rg0c3n9bjifr37zxljn9yxslg8vkll7ghkm341x76cbkwn"; + }; + + preConfigure = '' + makeFlags="$makeFlags PREFIX=$out" + makeFlags="$makeFlags PYINSTALL_EXTRA=--prefix=$out" + ''; + + postInstall = '' + wrapProgram $out/bin/uzbl-core \ + --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \ + --prefix XDG_DATA_DIRS : "${gsettings_desktop_schemas}/share:$out/share" + ''; + + nativeBuildInputs = [ pkgconfig python makeWrapper ]; + + buildInputs = [ webkit ]; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 31456b94cbd..6aec2cf19a2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9162,12 +9162,8 @@ let uwimap = callPackage ../tools/networking/uwimap { }; - uzbl = builderDefsPackage (import ../applications/networking/browsers/uzbl) { - inherit pkgconfig webkit makeWrapper glib_networking python3; - inherit glib pango cairo gdk_pixbuf atk; - inherit (xlibs) libX11 kbproto; - inherit (gnome) libsoup; - gtk = gtk3; + uzbl = callPackage ../applications/networking/browsers/uzbl { + webkit = webkitgtk2; }; vanitygen = callPackage ../applications/misc/vanitygen { }; From 42ef963cd221a5fb294a844c7af40e1a00738815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sat, 15 Mar 2014 17:00:10 +0100 Subject: [PATCH 0051/2033] libarchive: *permanently* fix patch source and hash Unfortunately github's *.patch URIs contain version of git generating them, which changes from time to time. It seems that *.diff doesn't suffer from that. Conflicts: pkgs/development/libraries/libarchive/default.nix --- pkgs/development/libraries/libarchive/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libarchive/default.nix b/pkgs/development/libraries/libarchive/default.nix index b7b001e44eb..5e728d9b3dd 100644 --- a/pkgs/development/libraries/libarchive/default.nix +++ b/pkgs/development/libraries/libarchive/default.nix @@ -13,8 +13,8 @@ stdenv.mkDerivation rec { }; patches = [(fetchurl { - url = "https://github.com/libarchive/libarchive/commit/22531545514043e04633e1c015c7540b9de9dbe4.patch"; - sha256 = "0c1a0prlpq5nn7zgs7cqvw9xnmhkkc8l0mpsip86k1lafircqhzh"; + url = "https://github.com/libarchive/libarchive/commit/22531545514043e04633e1c015c7540b9de9dbe4.diff"; + sha256 = "1466ddrkdh2r8idmj3v7fk2gwnhc1kdxvyczdpnqms0qlmas6fj5"; name = "CVE-2013-0211.patch"; })]; From 4eefc983a2d4e2d7ac2bbe7cf8bc393fa8da3aaa Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Tue, 1 Apr 2014 01:34:07 +0200 Subject: [PATCH 0052/2033] xcode: fix hash --- pkgs/os-specific/darwin/xcode/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os-specific/darwin/xcode/default.nix b/pkgs/os-specific/darwin/xcode/default.nix index b80682b7550..73585d59c0b 100644 --- a/pkgs/os-specific/darwin/xcode/default.nix +++ b/pkgs/os-specific/darwin/xcode/default.nix @@ -11,7 +11,7 @@ in stdenv.mkDerivation rec { src = requireFile { name = "xcode_${version}.dmg"; url = meta.homepage; - sha256 = "0zkggbmsfc5w53j1ncbpayvnn1vzpyzyjjjzhawq1jjfq465bfvh"; + sha256 = "70bb550cc14eca80b9825f4ae9bfbf7f076bb75777311be428bc30a7eb7a6f7e"; }; phases = [ "unpackPhase" "patchPhase" "installPhase" "fixupPhase" ]; From c3524a8dd6cb3cc03a65a486290b29f97ba469d0 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Tue, 1 Apr 2014 01:37:10 +0200 Subject: [PATCH 0053/2033] optipng: use system libpng & zlib, fix cross builds and add support for static builds --- pkgs/development/libraries/libpng/12.nix | 2 ++ pkgs/tools/graphics/optipng/default.nix | 22 +++++++++++++++++++++- pkgs/top-level/all-packages.nix | 4 +++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libpng/12.nix b/pkgs/development/libraries/libpng/12.nix index b7fad76acaa..7c9ef3d20b1 100644 --- a/pkgs/development/libraries/libpng/12.nix +++ b/pkgs/development/libraries/libpng/12.nix @@ -21,6 +21,8 @@ stdenv.mkDerivation rec { passthru = {}; }; + configureFlags = "--enable-static"; + meta = { description = "The official reference implementation for the PNG file format"; homepage = http://www.libpng.org/pub/png/libpng.html; diff --git a/pkgs/tools/graphics/optipng/default.nix b/pkgs/tools/graphics/optipng/default.nix index 1b2fc6dbb90..1984ab7b1de 100644 --- a/pkgs/tools/graphics/optipng/default.nix +++ b/pkgs/tools/graphics/optipng/default.nix @@ -1,7 +1,9 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, libpng, static ? false }: # This package comes with its own copy of zlib, libpng and pngxtern +with stdenv.lib; + stdenv.mkDerivation rec { name = "optipng-0.7.4"; @@ -10,6 +12,24 @@ stdenv.mkDerivation rec { sha256 = "1zrphbz17rhhfl1l95q5s979rrhifbwczl2xj1fdrnq5jid5s2sj"; }; + buildInputs = [ libpng ]; + + LDFLAGS = optional static "-static"; + configureFlags = "--with-system-zlib --with-system-libpng"; + + crossAttrs = { + CC="${stdenv.cross.config}-gcc"; + LD="${stdenv.cross.config}-gcc"; + AR="${stdenv.cross.config}-ar"; + RANLIB="${stdenv.cross.config}-ranlib"; + configurePhase = '' + ./configure -prefix="$out" --with-system-zlib --with-system-libpng + ''; + postInstall = optional (stdenv.cross.libc == "msvcrt") '' + mv "$out"/bin/optipng "$out"/bin/optipng.exe + ''; + }; + meta = { homepage = http://optipng.sourceforge.net/; description = "A PNG optimizer"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c959f2c6b65..3dad42210bd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1596,7 +1596,9 @@ let openvpn = callPackage ../tools/networking/openvpn { }; - optipng = callPackage ../tools/graphics/optipng { }; + optipng = callPackage ../tools/graphics/optipng { + libpng = libpng12; + }; oslrd = callPackage ../tools/networking/oslrd { }; From 65cc76c44ac81191cc0b82cef58d1ad698a24412 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Tue, 1 Apr 2014 01:55:32 +0200 Subject: [PATCH 0054/2033] libjpeg_original: add optional static builds --- pkgs/development/libraries/libjpeg/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libjpeg/default.nix b/pkgs/development/libraries/libjpeg/default.nix index 63d698dda18..d7a1bcb4638 100644 --- a/pkgs/development/libraries/libjpeg/default.nix +++ b/pkgs/development/libraries/libjpeg/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, static ? false }: + +with stdenv.lib; stdenv.mkDerivation { name = "libjpeg-8d"; @@ -7,6 +9,8 @@ stdenv.mkDerivation { url = http://www.ijg.org/files/jpegsrc.v8d.tar.gz; sha256 = "1cz0dy05mgxqdgjf52p54yxpyy95rgl30cnazdrfmw7hfca9n0h0"; }; + + configureFlags = optional static "--enable-static --disable-shared"; meta = { homepage = http://www.ijg.org/; From 776203453f8b338db35b2cf23eeff3b4be8af51c Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Tue, 1 Apr 2014 01:56:05 +0200 Subject: [PATCH 0055/2033] gifsicle: add optional static builds, make gifview optional --- pkgs/tools/graphics/gifsicle/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/graphics/gifsicle/default.nix b/pkgs/tools/graphics/gifsicle/default.nix index f3f17692df8..debc340ee4c 100644 --- a/pkgs/tools/graphics/gifsicle/default.nix +++ b/pkgs/tools/graphics/gifsicle/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchurl, xproto, libXt, libX11 }: +{ stdenv, fetchurl, xproto, libXt, libX11, gifview ? false, static ? false }: + +with stdenv.lib; stdenv.mkDerivation { name = "gifsicle-1.78"; @@ -8,7 +10,9 @@ stdenv.mkDerivation { sha256 = "0dzp5sg82klji4lbj1m4cyg9fb3l837gkipdx657clib97klyv53"; }; - buildInputs = [ xproto libXt libX11 ]; + buildInputs = optional gifview [ xproto libXt libX11 ]; + + LDFLAGS = optional static "-static"; meta = { description = "Command-line tool for creating, editing, and getting information about GIF images and animations"; From ede097adcb7716e45b277cd2be14c8e3bd361939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Date: Tue, 1 Apr 2014 11:11:46 +0800 Subject: [PATCH 0056/2033] miro: build with webkitgtk2 --- pkgs/applications/video/miro/default.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/video/miro/default.nix b/pkgs/applications/video/miro/default.nix index 14aeca62a71..528eeff7e23 100644 --- a/pkgs/applications/video/miro/default.nix +++ b/pkgs/applications/video/miro/default.nix @@ -1,7 +1,7 @@ { stdenv, fetchurl, python, buildPythonPackage, pythonPackages, pkgconfig -, pyrex096, ffmpeg, boost, glib, pygobject, gtk2, webkit_gtk2, libsoup, pygtk +, pyrex096, ffmpeg, boost, glib, pygobject, gtk2, webkitgtk2, libsoup, pygtk , taglib, pysqlite, pycurl, mutagen, pycairo, pythonDBus, pywebkitgtk -, libtorrentRasterbar +, libtorrentRasterbar, glib_networking, gsettings_desktop_schemas , gst_python, gst_plugins_base, gst_plugins_good, gst_ffmpeg }: @@ -22,9 +22,6 @@ buildPythonPackage rec { patches = [ ./gconf.patch ]; postPatch = '' - sed -i -e '2i import os; os.environ["GST_PLUGIN_PATH"] = \\\ - '"'$GST_PLUGIN_PATH'" miro.real - sed -i -e 's/\$(shell which python)/python/' Makefile sed -i -e 's|/usr/bin/||' -e 's|/usr||' \ -e 's/BUILD_TIME[^,]*/BUILD_TIME=0/' setup.py @@ -55,10 +52,14 @@ buildPythonPackage rec { postInstall = '' mv "$out/bin/miro.real" "$out/bin/miro" + wrapProgram "$out/bin/miro" \ + --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH" \ + --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \ + --prefix XDG_DATA_DIRS : "${gsettings_desktop_schemas}/share:$out/share" ''; buildInputs = [ - pkgconfig pyrex096 ffmpeg boost glib pygobject gtk2 webkit_gtk2 libsoup + pkgconfig pyrex096 ffmpeg boost glib pygobject gtk2 webkitgtk2 libsoup pygtk taglib ]; From 0feb117c209baf1a77e90f922c7d1d98c708b2c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sat, 12 Apr 2014 10:44:17 +0200 Subject: [PATCH 0057/2033] tk: attempt to fix build on darwin It complained about missing fontconfig symbols. Also fix some white-space. --- pkgs/development/libraries/tk/default.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/tk/default.nix b/pkgs/development/libraries/tk/default.nix index c7fe3e105d8..2757a254385 100644 --- a/pkgs/development/libraries/tk/default.nix +++ b/pkgs/development/libraries/tk/default.nix @@ -1,25 +1,26 @@ -{ stdenv, fetchurl, pkgconfig, tcl, libXft }: +{ stdenv, fetchurl, pkgconfig, tcl, libXft, fontconfig }: stdenv.mkDerivation { name = "tk-8.5.15"; - + src = fetchurl { url = "mirror://sourceforge/tcl/tk8.5.15-src.tar.gz"; sha256 = "0grj0k0hljvwiz913pafqibz18fzk9xjxf0nzqrd9zdls036fp41"; }; patches = [ ./different-prefix-with-tcl.patch ]; - + postInstall = '' ln -s $out/bin/wish* $out/bin/wish ''; - + configureFlags = "--with-tcl=${tcl}/lib"; - + preConfigure = "cd unix"; - buildInputs = [ pkgconfig tcl libXft ]; - + buildInputs = [ pkgconfig tcl libXft ] + ++ stdenv.lib.optional stdenv.isDarwin fontconfig; + inherit tcl; passthru = { From c4eadfbac59c0ed4646c6da0a6305424a010d92e Mon Sep 17 00:00:00 2001 From: taku0 Date: Sun, 13 Apr 2014 00:29:14 +0900 Subject: [PATCH 0058/2033] add thunderbird-bin: the binary package for Thunderbird mail client --- .../mailreaders/thunderbird-bin/default.nix | 264 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 8 + 2 files changed, 272 insertions(+) create mode 100644 pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix diff --git a/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix b/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix new file mode 100644 index 00000000000..1e8a7e301ed --- /dev/null +++ b/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix @@ -0,0 +1,264 @@ +{ stdenv, fetchurl, config +, gconf +, alsaLib +, at_spi2_atk +, atk +, cairo +, cups +, curl +, dbus_glib +, dbus_libs +, fontconfig +, freetype +, gdk_pixbuf +, glib +, glibc +, gst_plugins_base +, gstreamer +, gtk +, kerberos +, libX11 +, libXScrnSaver +, libXext +, libXinerama +, libXrender +, libXt +, libcanberra +, libgnome +, libgnomeui +, mesa +, nspr +, nss +, pango +}: + +let + version = "24.4.0"; + + sources = [ + { locale = "ar"; arch = "linux-x86_64"; sha256 = "dd570da273c047e0b4bf29a7ed4bb4356dcbdd8de62ecb65fcddfecaf156966f"; } + { locale = "ar"; arch = "linux-i686"; sha256 = "f96c30ad874adf10608f818e0d986070b2a577de4d9aeb6c8dc7ea1ccd6e72f1"; } + { locale = "ast"; arch = "linux-x86_64"; sha256 = "8a50ff6a4f0d2bf68f989c2d3e0bca75c9fbcfc73c37b6cc16d935c1e3c1a9cf"; } + { locale = "ast"; arch = "linux-i686"; sha256 = "ace08104be64c038f5337e5178a79cb3f909c233f8722f7d54db04aef87935f9"; } + { locale = "be"; arch = "linux-x86_64"; sha256 = "793c07b33e861a5e29ce906a9764d980a82238b7c078391b96480592f526f323"; } + { locale = "be"; arch = "linux-i686"; sha256 = "98f2a5390572df625e0600ab224d5171d0357e187a3743ad72ec94d31533d993"; } + { locale = "bg"; arch = "linux-i686"; sha256 = "7d2fbb1ecad6e7a81c481a6697429809dc76809bba537ab8bc576b19ba5938f5"; } + { locale = "bg"; arch = "linux-x86_64"; sha256 = "a0a551d1790969b11ad2dcfc277f487645abff2497f2e9104235e77c45e5120c"; } + { locale = "bn-BD"; arch = "linux-x86_64"; sha256 = "cb2a5549c3cdc9e159181cb9417c7f53158820f722e48d3ce2e4dcf10dea32d2"; } + { locale = "bn-BD"; arch = "linux-i686"; sha256 = "e395d07fb7b13443ccc97433d38a8845969cf854ace807950a364319c17861d6"; } + { locale = "br"; arch = "linux-i686"; sha256 = "8637d47dfb9b685a1034f5449d3481a5c62f74158f1a6318fe94504ad779dbb2"; } + { locale = "br"; arch = "linux-x86_64"; sha256 = "f36f6d2041a110ffc621249e6d92ec09f3b2bb7a1cf08b7892a0eb998b8a2bb3"; } + { locale = "ca"; arch = "linux-x86_64"; sha256 = "427a09458fe0d631a360b871db637d33bc0ad443ec443b7193db409321ab72da"; } + { locale = "ca"; arch = "linux-i686"; sha256 = "8531078cb31cb3035fdfd7397159cd42a6439868e954e1c9bd6eb7f9cd564bdb"; } + { locale = "cs"; arch = "linux-x86_64"; sha256 = "6fea39c9416357ec2902ed3dff84650a683dbe136790fa83cbca5d8bf869dc48"; } + { locale = "cs"; arch = "linux-i686"; sha256 = "c9e8d50e04dccd647ef7a566e68a3fe8374f86e9c1b7fe2001e3690270c5e7b9"; } + { locale = "da"; arch = "linux-x86_64"; sha256 = "41debf8c221063c4a5eafc3b769aabada6f3cebf35a354b7837c2ad737fa9b0f"; } + { locale = "da"; arch = "linux-i686"; sha256 = "77aa022e8c58dc60595f4600849da795faea4c20da6d5514f57e1b0033cda27c"; } + { locale = "de"; arch = "linux-x86_64"; sha256 = "05ec3d776de6060a82eea595b022b73c05ab7016419be5989929bd10ae282d27"; } + { locale = "de"; arch = "linux-i686"; sha256 = "471288d8660536508fe04b236eb72a7c245d27cadd59841a9bab0e73db271005"; } + { locale = "el"; arch = "linux-x86_64"; sha256 = "901c0097fb8072a37787a77758a0d6a2ced66acdf5a3588a0a6df3584034c309"; } + { locale = "el"; arch = "linux-i686"; sha256 = "da658a5f18a7162d513f8e0aac8d1648b18404bac7888a2f66c850f2084a54c5"; } + { locale = "en-GB"; arch = "linux-i686"; sha256 = "61c637e3b63a10d3c3eff91e9dcbd8558887a41d8e359aa637541bc4424a328a"; } + { locale = "en-GB"; arch = "linux-x86_64"; sha256 = "dcf399192062a7e3075125f550b0889fb4943c595814b8f6e755e9aa7e4656b1"; } + { locale = "en-US"; arch = "linux-i686"; sha256 = "376ab51e3c424db7e235b2e94494d48ce2fa9a8f1fbf5ef5cf9e367bbaf7422d"; } + { locale = "en-US"; arch = "linux-x86_64"; sha256 = "57917aa608131da4d569e791fc8167f4df54975b74c64d6df641858400dd4c1b"; } + { locale = "es-AR"; arch = "linux-x86_64"; sha256 = "47ecdb633bf1b246df84e796395a668fd98ac52a82177507da010b0174aa74d8"; } + { locale = "es-AR"; arch = "linux-i686"; sha256 = "9155d96fb14795bc5a22e10105ba0226a7b9c87a4d6ffa5cf7835dc77d69fa30"; } + { locale = "es-ES"; arch = "linux-i686"; sha256 = "3c41656512f1859b28abdf81d356dd90b720efd489d7021270114a9d28c54b38"; } + { locale = "es-ES"; arch = "linux-x86_64"; sha256 = "bad476b65d71744b9562a8548ca6cd608da92e62f45057688fef29ac77eb060e"; } + { locale = "et"; arch = "linux-i686"; sha256 = "06fdb2df4bcca189736fc6ae2fee6ba87f6b19d0b64f21bdb2b07e478fe6a0ba"; } + { locale = "et"; arch = "linux-x86_64"; sha256 = "f110d0940905e2cbe4ab14c1370ff88e533e030fb5a408bf4f06f517351d5979"; } + { locale = "eu"; arch = "linux-x86_64"; sha256 = "02bbb72fea711772d0dba0137641acb9f0293313a552e554443118324737fba4"; } + { locale = "eu"; arch = "linux-i686"; sha256 = "3a94fc161e98282691d668b68b3a8e7bf035dc87ec0d07be6eb1844b2a79cd39"; } + { locale = "fi"; arch = "linux-i686"; sha256 = "3f9c44306991554cf48fee4da86dec6ab06cb863baa8157d7adf29f6f8b0119f"; } + { locale = "fi"; arch = "linux-x86_64"; sha256 = "9883bfa54e331c17338bdf7e835a0a0f71a9366ad99ddc0fda12fd9d062f071b"; } + { locale = "fr"; arch = "linux-x86_64"; sha256 = "60e59c9b9ac78cba5604a051784a8721f84bfd10899d9575a4591ae4e5c48afc"; } + { locale = "fr"; arch = "linux-i686"; sha256 = "d16908d799fe667032d317b01db91cdfcd0b23654061203df84f5cb67d6ae837"; } + { locale = "fy-NL"; arch = "linux-x86_64"; sha256 = "21e209179135fd97207e878c415d112e6c01bd7686f45eef2891cd8508dd8f9c"; } + { locale = "fy-NL"; arch = "linux-i686"; sha256 = "c8463a38d5fc454ad80a519a9828c1c8808688aa140b5d5276b53a659ae7bf7d"; } + { locale = "ga-IE"; arch = "linux-x86_64"; sha256 = "22d6d90cd7490e36ef5df2106ba84bcd49038cecf70a60cebd4bf552a01bfdd7"; } + { locale = "ga-IE"; arch = "linux-i686"; sha256 = "5a7fcc013bcd09d327e40e5b0001057067f9e509e52f38681893f1a16cf8520a"; } + { locale = "gd"; arch = "linux-i686"; sha256 = "14c7d9a846a5d2a409089a16afdc97309d6818f97097d73757245b29cdeb73ae"; } + { locale = "gd"; arch = "linux-x86_64"; sha256 = "e4d3b093da2d80e2a2c02be8d03831c6a89e8969d3261a39f153a6d96f20c7eb"; } + { locale = "gl"; arch = "linux-i686"; sha256 = "73515b65314f8aa28fdb8708e821c01ba6edab5474e5140266b8ee8c0206807f"; } + { locale = "gl"; arch = "linux-x86_64"; sha256 = "7dd646cde4969243178237ea7fdf7b3c7c369e735a42f21292e8fcc3bce2c6ac"; } + { locale = "he"; arch = "linux-x86_64"; sha256 = "3fdf3750727f47628ffe4e7b28e8b7f180194be5985f4a10c703d3322a563e55"; } + { locale = "he"; arch = "linux-i686"; sha256 = "e4385cded8a13776890320780c6aa265c9562a6301f8f5ee7f4fbeb4aa54acf8"; } + { locale = "hr"; arch = "linux-x86_64"; sha256 = "ada94d6612f20642e6294a17334afb8d31b419132e725618a376728a6028454e"; } + { locale = "hr"; arch = "linux-i686"; sha256 = "bcbb85910f983145ff8df79574087cebaac6537600aa9a479f55298a7d6bc1c2"; } + { locale = "hu"; arch = "linux-i686"; sha256 = "0f41a925ee5c3ad59f24a6b59eed066d1fb37ea8ec81ab4bac70280437be2589"; } + { locale = "hu"; arch = "linux-x86_64"; sha256 = "9038e0358bb63a147835cacf91a7e7db888fc7b93662cca4919110e2a5daed76"; } + { locale = "hy-AM"; arch = "linux-i686"; sha256 = "24af2ffa71d5810f8e947de27e77a70310c22dc1cc89640b67416fe74a4a14b3"; } + { locale = "hy-AM"; arch = "linux-x86_64"; sha256 = "62cfce68247f5afd2c68a97ed230b515c1515ecd279a753bf9c728c552683f6c"; } + { locale = "id"; arch = "linux-i686"; sha256 = "a5e2d72cb0841848cd5a947d4cda2e84db1eae97a0735974690176ccd966eeea"; } + { locale = "id"; arch = "linux-x86_64"; sha256 = "f1d539fe69b8121205c5411096554cab41ae4f42a2018af6ba020a2d8fe660dc"; } + { locale = "is"; arch = "linux-i686"; sha256 = "6eacbd0b4b9f47f67818d6021600b5dddc79d2a38edac5c47f61ac039ed5cdb6"; } + { locale = "is"; arch = "linux-x86_64"; sha256 = "fcc86ac738b190012d38d32c6cee3c35d57f6a3b80867c0107f4b8a2717961bb"; } + { locale = "it"; arch = "linux-x86_64"; sha256 = "9b668a501c7da55c630761dbf89ae8fe2e32038af8ce4c10fc646eae7c2d08e2"; } + { locale = "it"; arch = "linux-i686"; sha256 = "f610b7d4a34635e7c3b5c355873b65558537224d5a241b92605a49499ba4d5e6"; } + { locale = "ja"; arch = "linux-i686"; sha256 = "185ee26eb9a33ba534805b5b3547b3524bf11c94614adc252f7d17b41279d312"; } + { locale = "ja"; arch = "linux-x86_64"; sha256 = "1be85c39fa8b09a6bc2b11a47d04f0447628c3ed8a775d27c8e04577627ed63e"; } + { locale = "ko"; arch = "linux-i686"; sha256 = "e868d431d77b419bae6fcc7e1e137815ca8cbad6673074469005c606023d7983"; } + { locale = "ko"; arch = "linux-x86_64"; sha256 = "fa4db6ff8047a5e11411e507df4f84baac5511a1709d5685a2a6e8da0d2e1f25"; } + { locale = "lt"; arch = "linux-i686"; sha256 = "40c1eeabbd9d877750bee7f5f4a6b6f2108aa364ace8eefff26806a5bafca5eb"; } + { locale = "lt"; arch = "linux-x86_64"; sha256 = "4bdff4418bc0c9acc7d3b00ccc6500d51e65a501c2438e99e22c03bbeb36dfff"; } + { locale = "nb-NO"; arch = "linux-i686"; sha256 = "541b5f434e6354bb6a4c50abb828a49383b1d1a9fb31d6b99c1f052ef73bc2f2"; } + { locale = "nb-NO"; arch = "linux-x86_64"; sha256 = "9e954408406762e55fd40487cad589c876285145931f8a12ff6ced29d9583cde"; } + { locale = "nl"; arch = "linux-i686"; sha256 = "06a57772563456d5283b9a36b9e6cbb5efb4f33e4ea29ac2446055e0a965b8c9"; } + { locale = "nl"; arch = "linux-x86_64"; sha256 = "42a8d995ac906c7fb4a1952db62d1717aa7c4660a2e7e794da3aae6aaac6f9c9"; } + { locale = "nn-NO"; arch = "linux-i686"; sha256 = "6fed1e74c6323d2909caf471ca733df46224afcb0c632d5fa0f0d80d6157efd3"; } + { locale = "nn-NO"; arch = "linux-x86_64"; sha256 = "c29d8ff69ec2a8b5f508b7c56cd8679fe3b322f7e2e87f10303fd8bca1b93230"; } + { locale = "pa-IN"; arch = "linux-i686"; sha256 = "a69a7ceb4fa85cc43c367f1ddebafa76808e83d3044c158287a5923b82fc3093"; } + { locale = "pa-IN"; arch = "linux-x86_64"; sha256 = "e38e75976891204fde647d389b6c89c807d378a534d6e04582024755a3cb6139"; } + { locale = "pl"; arch = "linux-x86_64"; sha256 = "39a0d3f865c462b5d3ae569825befd61dbf3ee5a6b2b81d3b9d31f4c98cf7b72"; } + { locale = "pl"; arch = "linux-i686"; sha256 = "3ccedf1ad79135d825f762dd09da88be23901591b27ea7e61a887d5398284a46"; } + { locale = "pt-BR"; arch = "linux-x86_64"; sha256 = "ea29e40d41442ab373855acd7b40927fc5a0408f9d3bb4a0c6a2021cd8b0fca2"; } + { locale = "pt-BR"; arch = "linux-i686"; sha256 = "f6170909b6527e935584673a17d1245c33142a755a9db45dda2de240871fc6c0"; } + { locale = "pt-PT"; arch = "linux-i686"; sha256 = "15531f4e4652d533fd8cb8d3be8b5e24717240160d885629eecc7f08d8cd0701"; } + { locale = "pt-PT"; arch = "linux-x86_64"; sha256 = "9100cdf6ba87959dfbdf756c925f6a2f35fc0c6ed453625a23eccc48f0bdf331"; } + { locale = "rm"; arch = "linux-x86_64"; sha256 = "9bd00e4e2634e9f922d6c1d4ef82dcba53f88fa6d7d1986037665a42109d39d2"; } + { locale = "rm"; arch = "linux-i686"; sha256 = "e2ca3832625efa908c6d88627960e1d98255d14095a36033cddaa50065172da0"; } + { locale = "ro"; arch = "linux-x86_64"; sha256 = "676120061a33c1bbbd381ea1d84b271c6e21d4a531ba776f67f7a02fd91fb99e"; } + { locale = "ro"; arch = "linux-i686"; sha256 = "c69d6b8a8de474e460c89ba442e25aa39fe761225f7c4b12eb1df88021a6b6c3"; } + { locale = "ru"; arch = "linux-x86_64"; sha256 = "5a6af10060b8ea8acd3955a4056765574873e9341e4627ddcbf9811724f5eac0"; } + { locale = "ru"; arch = "linux-i686"; sha256 = "92ce7cb5db9d94e291d7275b8817640c68dc061a3947317cba76ceb263a4b614"; } + { locale = "si"; arch = "linux-i686"; sha256 = "39849a4d38a96ebca9727b65093c36d8d50cadddcdea7ea404ee4aeff10fec0d"; } + { locale = "si"; arch = "linux-x86_64"; sha256 = "fa42ef419e173181166c6797e37571df6b7c25797a5caf8ca44c34b4f2faacdb"; } + { locale = "sk"; arch = "linux-x86_64"; sha256 = "2c9c81db8c15116e6061de0b44dcb34579ce305ca30af284cf9eac52630fef55"; } + { locale = "sk"; arch = "linux-i686"; sha256 = "b253607b29565169d74c491772ba2887c3e2c0dfcc3a7cedf91afa0bb073ff72"; } + { locale = "sl"; arch = "linux-x86_64"; sha256 = "03e7781cd0c3fef0596e55ba8a711ef8b8f300e48297ef3cad7885b2b118864f"; } + { locale = "sl"; arch = "linux-i686"; sha256 = "18fe799b1b675e5513ddf9edbe845bfaaafd67162e9d34250a31d0ee05bc9bba"; } + { locale = "sq"; arch = "linux-i686"; sha256 = "4fd1be2d2c6a703544b82bf977ea63df3e295c16c9ea97573ee57945e07639ee"; } + { locale = "sq"; arch = "linux-x86_64"; sha256 = "e96f7302d47897c3fc58a2777aed666aca29641500e912cee1bc59406df8e500"; } + { locale = "sr"; arch = "linux-x86_64"; sha256 = "ede709c9e6014edbc543511d99a61acfb0d40b796ed5ab42267ae7f8efb6583c"; } + { locale = "sr"; arch = "linux-i686"; sha256 = "fbfc0d476817c7076a72fd6fe2519c6a347fb062f696a8fe0c969182750d1d11"; } + { locale = "sv-SE"; arch = "linux-i686"; sha256 = "d30dda991111ae5bbf7252d889cef53258317d3570e56360db3d7676a8fc7602"; } + { locale = "sv-SE"; arch = "linux-x86_64"; sha256 = "eba61a1417ba4cb4885732d2eb621f5a385b4b433f706d52bd1b401d2298985e"; } + { locale = "ta-LK"; arch = "linux-i686"; sha256 = "92dc3a2aaf30c5bb16462ee7d73a5df6f8b5d2d1530f5d1fb4b90460e84dc77f"; } + { locale = "ta-LK"; arch = "linux-x86_64"; sha256 = "e5db15f32c819d3b0e670ac975d7afc118915abeaf4a9f0a02a5b67c490605d7"; } + { locale = "tr"; arch = "linux-x86_64"; sha256 = "0c689f622a0770a0b0d8f87d35513f9fbc110ca507d0b8b3bd426f763a0f77c4"; } + { locale = "tr"; arch = "linux-i686"; sha256 = "f49e5f3bf1b4616f52e82c480f9a4752269f393d79de2274fc0562cfe9fef1ea"; } + { locale = "uk"; arch = "linux-x86_64"; sha256 = "06100c2a82b3c31ea85f1f1d8856db62f2a73142fd1263e3db5df679f8843d8f"; } + { locale = "uk"; arch = "linux-i686"; sha256 = "8358a935935215fea5eb75c69cf63bb5fc5c22bcce76939cfb804f3ee9f89e54"; } + { locale = "vi"; arch = "linux-i686"; sha256 = "16a0f71efcf71640234501e3c8a3bd1befe15e1bb0bacc83ff590d6c780a0e5b"; } + { locale = "vi"; arch = "linux-x86_64"; sha256 = "d5d0371ade5603cb725d6677983df037da06acb13207550b8a1a88c2948e992b"; } + { locale = "zh-CN"; arch = "linux-x86_64"; sha256 = "287b1fda3bb2d8d27ea22ea4c8c21d7ee0b3a5d439ea32e72dfc882fd64c5765"; } + { locale = "zh-CN"; arch = "linux-i686"; sha256 = "3bddd9f4e742ad80bb6d35f3db8ea50cd496ad1be06003e67b4fcc290945bab8"; } + { locale = "zh-TW"; arch = "linux-x86_64"; sha256 = "5a5cb16f45d1c3ccd9e0fd0b21a7b55e90b49f0b37cd550bd89cb6c00d92046c"; } + { locale = "zh-TW"; arch = "linux-i686"; sha256 = "aea52fd5f8d8d5b720e1fde907b9a7b7638b384b71d01295b08749df06c578bc"; } + ]; + + arch = if stdenv.system == "i686-linux" + then "linux-i686" + else "linux-x86_64"; + + isPrefixOf = prefix: string: + builtins.substring 0 (builtins.stringLength prefix) string == prefix; + + sourceMatches = locale: source: + (isPrefixOf source.locale locale) && source.arch == arch; + + systemLocale = config.i18n.defaultLocale or "en-US"; + + defaultSource = stdenv.lib.findFirst (sourceMatches "en-US") {} sources; + + source = stdenv.lib.findFirst (sourceMatches systemLocale) defaultSource sources; + +in + +stdenv.mkDerivation { + name = "thunderbird-bin-${version}"; + + src = fetchurl { + url = "http://download-installer.cdn.mozilla.net/pub/thunderbird/releases/${version}/${source.arch}/${source.locale}/thunderbird-${version}.tar.bz2"; + inherit (source) sha256; + }; + + phases = "unpackPhase installPhase"; + + libPath = stdenv.lib.makeLibraryPath + [ stdenv.gcc.gcc + gconf + alsaLib + at_spi2_atk + atk + cairo + cups + curl + dbus_glib + dbus_libs + fontconfig + freetype + gdk_pixbuf + glib + glibc + gst_plugins_base + gstreamer + gtk + kerberos + libX11 + libXScrnSaver + libXext + libXinerama + libXrender + libXt + libcanberra + libgnome + libgnomeui + mesa + nspr + nss + pango + ] + ":" + stdenv.lib.makeSearchPath "lib64" [ + stdenv.gcc.gcc + ]; + + installPhase = + '' + mkdir -p "$prefix/usr/lib/thunderbird-bin-${version}" + cp -r * "$prefix/usr/lib/thunderbird-bin-${version}" + + mkdir -p "$out/bin" + ln -s "$prefix/usr/lib/thunderbird-bin-${version}/thunderbird" "$out/bin/" + + for executable in \ + thunderbird mozilla-xremote-client thunderbird-bin plugin-container \ + updater + do + patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \ + "$out/usr/lib/thunderbird-bin-${version}/$executable" + done + + for executable in \ + thunderbird mozilla-xremote-client thunderbird-bin plugin-container \ + updater libxul.so + do + patchelf --set-rpath "$libPath" \ + "$out/usr/lib/thunderbird-bin-${version}/$executable" + done + + # Create a desktop item. + mkdir -p $out/share/applications + cat > $out/share/applications/thunderbird.desktop < Date: Sun, 13 Apr 2014 03:28:20 +0200 Subject: [PATCH 0059/2033] keepassx: Renamed KeePassX 2.0 to keepassx2. --- pkgs/applications/misc/keepassx/2.0.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/misc/keepassx/2.0.nix b/pkgs/applications/misc/keepassx/2.0.nix index 6d54032bb38..1a79af7cb57 100644 --- a/pkgs/applications/misc/keepassx/2.0.nix +++ b/pkgs/applications/misc/keepassx/2.0.nix @@ -1,7 +1,7 @@ { stdenv, fetchurl, cmake, libgcrypt, qt4, xlibs, ... }: stdenv.mkDerivation { - name = "keepassx-2.0alpha5"; + name = "keepassx2-2.0alpha5"; src = fetchurl { url = "https://github.com/keepassx/keepassx/archive/2.0-alpha5.tar.gz"; sha256 = "1vxj306zhrr38mvsy3vpjlg6d0xwlcvsi3l69nhhwzkccsc4smfm"; From a3155a0e2ac7bc875e6bdbcbd44c336714cfc0da Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Sat, 12 Apr 2014 21:20:16 -0500 Subject: [PATCH 0060/2033] nixos: add a UID for Hydra Otherwise the Hydra module can't be used when mutableUsers = false; Signed-off-by: Austin Seipp --- nixos/modules/misc/ids.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index c6581fee551..664aed7fbc9 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -129,6 +129,7 @@ foundationdb = 118; newrelic = 119; starbound = 120; + hydra = 121; # When adding a uid, make sure it doesn't match an existing gid. From 324ade465805466be9bcfa5b29dcfa7af60505c9 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 11 Apr 2014 11:31:50 -0700 Subject: [PATCH 0061/2033] Patch python27 for CVE-2014-1912. --- .../python/2.7/CVE-2014-1912.patch | 57 +++++++++++++++++++ .../interpreters/python/2.7/default.nix | 4 ++ 2 files changed, 61 insertions(+) create mode 100644 pkgs/development/interpreters/python/2.7/CVE-2014-1912.patch diff --git a/pkgs/development/interpreters/python/2.7/CVE-2014-1912.patch b/pkgs/development/interpreters/python/2.7/CVE-2014-1912.patch new file mode 100644 index 00000000000..95399bf7607 --- /dev/null +++ b/pkgs/development/interpreters/python/2.7/CVE-2014-1912.patch @@ -0,0 +1,57 @@ +# Edited from Mercurial patch: deleted the NEWS hunk, since it didn't apply cleanly. +# It added the following line to NEWS: +# - Issue #20246: Fix buffer overflow in socket.recvfrom_into. + +# HG changeset patch +# User Benjamin Peterson +# Date 1389671978 18000 +# Node ID 87673659d8f7ba1623cd4914f09ad3d2ade034e9 +# Parent 2631d33ee7fbd5f0288931ef37872218d511d2e8 +complain when nbytes > buflen to fix possible buffer overflow (closes #20246) + +diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py +--- a/Lib/test/test_socket.py ++++ b/Lib/test/test_socket.py +@@ -1620,6 +1620,16 @@ class BufferIOTest(SocketConnectedTest): + + _testRecvFromIntoMemoryview = _testRecvFromIntoArray + ++ def testRecvFromIntoSmallBuffer(self): ++ # See issue #20246. ++ buf = bytearray(8) ++ self.assertRaises(ValueError, self.cli_conn.recvfrom_into, buf, 1024) ++ ++ def _testRecvFromIntoSmallBuffer(self): ++ with test_support.check_py3k_warnings(): ++ buf = buffer(MSG*2048) ++ self.serv_conn.send(buf) ++ + + TIPC_STYPE = 2000 + TIPC_LOWER = 200 +diff --git a/Misc/ACKS b/Misc/ACKS +--- a/Misc/ACKS ++++ b/Misc/ACKS +@@ -979,6 +979,7 @@ Eric V. Smith + Christopher Smith + Gregory P. Smith + Roy Smith ++Ryan Smith-Roberts + Rafal Smotrzyk + Dirk Soede + Paul Sokolovsky +diff --git a/Misc/NEWS b/Misc/NEWS +--- a/Modules/socketmodule.c ++++ b/Modules/socketmodule.c +@@ -2742,6 +2742,10 @@ sock_recvfrom_into(PySocketSockObject *s + if (recvlen == 0) { + /* If nbytes was not specified, use the buffer's length */ + recvlen = buflen; ++ } else if (recvlen > buflen) { ++ PyErr_SetString(PyExc_ValueError, ++ "nbytes is greater than the length of the buffer"); ++ goto error; + } + + readlen = sock_recvfrom_guts(s, buf.buf, recvlen, flags, &addr); + diff --git a/pkgs/development/interpreters/python/2.7/default.nix b/pkgs/development/interpreters/python/2.7/default.nix index e9277ce2daf..eeadc3c8cc7 100644 --- a/pkgs/development/interpreters/python/2.7/default.nix +++ b/pkgs/development/interpreters/python/2.7/default.nix @@ -28,6 +28,10 @@ let # patch python to put zero timestamp into pyc # if DETERMINISTIC_BUILD env var is set ./deterministic-build.patch + + # See http://bugs.python.org/issue20246 + # This will be fixed in 2.7.7. + ./CVE-2014-1912.patch ]; postPatch = stdenv.lib.optionalString (stdenv.gcc.libc != null) '' From 21cb9c24f00f78862920a58e1936a4ee1e1eeba5 Mon Sep 17 00:00:00 2001 From: James Cook Date: Sat, 12 Apr 2014 15:49:02 -0700 Subject: [PATCH 0062/2033] Patch python32 for CVE-2014-1912. --- .../python/3.2/CVE-2014-1912.patch | 57 +++++++++++++++++++ .../interpreters/python/3.2/default.nix | 6 ++ 2 files changed, 63 insertions(+) create mode 100644 pkgs/development/interpreters/python/3.2/CVE-2014-1912.patch diff --git a/pkgs/development/interpreters/python/3.2/CVE-2014-1912.patch b/pkgs/development/interpreters/python/3.2/CVE-2014-1912.patch new file mode 100644 index 00000000000..c69efd17f96 --- /dev/null +++ b/pkgs/development/interpreters/python/3.2/CVE-2014-1912.patch @@ -0,0 +1,57 @@ +# Edited from Mercurial patch: deleted the NEWS hunk, since it didn't apply cleanly. +# It added the following line to NEWS: +# - Issue #20246: Fix buffer overflow in socket.recvfrom_into. + + +# HG changeset patch +# User Benjamin Peterson +# Date 1389671978 18000 +# Node ID 9c56217e5c793685eeaf0ee224848c402bdf1e4c +# Parent 2b5cd6d4d149dea6c6941b7e07ada248b29fc9f6 +complain when nbytes > buflen to fix possible buffer overflow (closes #20246) + +diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py +--- a/Lib/test/test_socket.py ++++ b/Lib/test/test_socket.py +@@ -1968,6 +1968,14 @@ class BufferIOTest(SocketConnectedTest): + + _testRecvFromIntoMemoryview = _testRecvFromIntoArray + ++ def testRecvFromIntoSmallBuffer(self): ++ # See issue #20246. ++ buf = bytearray(8) ++ self.assertRaises(ValueError, self.cli_conn.recvfrom_into, buf, 1024) ++ ++ def _testRecvFromIntoSmallBuffer(self): ++ self.serv_conn.send(MSG*2048) ++ + + TIPC_STYPE = 2000 + TIPC_LOWER = 200 +diff --git a/Misc/ACKS b/Misc/ACKS +--- a/Misc/ACKS ++++ b/Misc/ACKS +@@ -1020,6 +1020,7 @@ Eric V. Smith + Christopher Smith + Gregory P. Smith + Roy Smith ++Ryan Smith-Roberts + Rafal Smotrzyk + Dirk Soede + Paul Sokolovsky +diff --git a/Misc/NEWS b/Misc/NEWS +--- a/Modules/socketmodule.c ++++ b/Modules/socketmodule.c +@@ -2598,6 +2598,11 @@ sock_recvfrom_into(PySocketSockObject *s + if (recvlen == 0) { + /* If nbytes was not specified, use the buffer's length */ + recvlen = buflen; ++ } else if (recvlen > buflen) { ++ PyBuffer_Release(&pbuf); ++ PyErr_SetString(PyExc_ValueError, ++ "nbytes is greater than the length of the buffer"); ++ return NULL; + } + + readlen = sock_recvfrom_guts(s, buf, recvlen, flags, &addr); + diff --git a/pkgs/development/interpreters/python/3.2/default.nix b/pkgs/development/interpreters/python/3.2/default.nix index 03f2d392bd1..c103b0f59cd 100644 --- a/pkgs/development/interpreters/python/3.2/default.nix +++ b/pkgs/development/interpreters/python/3.2/default.nix @@ -32,6 +32,12 @@ stdenv.mkDerivation { sha256 = "0pxs234g08v3lar09lvzxw4vqdpwkbqmvkv894j2w7aklskcjd6v"; }; + patches = + [ + # See http://bugs.python.org/issue20246 + ./CVE-2014-1912.patch + ]; + NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s"; preConfigure = '' From 2661400d2a404581556d09f06e988fcfe5e0805d Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Sun, 13 Apr 2014 00:47:14 -0500 Subject: [PATCH 0063/2033] cgit: bump git version to 1.9.2 This also updates the download URL to use kernel.org Signed-off-by: Austin Seipp --- .../version-management/git-and-tools/cgit/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/version-management/git-and-tools/cgit/default.nix b/pkgs/applications/version-management/git-and-tools/cgit/default.nix index 8a1201815ae..47fa80cb901 100644 --- a/pkgs/applications/version-management/git-and-tools/cgit/default.nix +++ b/pkgs/applications/version-management/git-and-tools/cgit/default.nix @@ -4,7 +4,8 @@ }: stdenv.mkDerivation rec { - name = "cgit-0.10.1"; + name = "cgit-${version}"; + version = "0.10.1"; src = fetchurl { url = "http://git.zx2c4.com/cgit/snapshot/${name}.tar.xz"; @@ -15,9 +16,11 @@ stdenv.mkDerivation rec { # The cgit-0.10 Makefile has GIT_VER = 1.8.5, so use that version. # IMPORTANT: Remember to check which git version cgit needs on every version # bump. + # NOTE: as of 0.10.1, the git version is compatible from 1.9.0 to + # 1.9.2 (see the repository history) gitSrc = fetchurl { - url = https://git-core.googlecode.com/files/git-1.8.5.tar.gz; - sha256 = "08vbq8y3jx1da417hkqmrkdkysac1sqjvrjmaj1v56dmkghm43w7"; + url = "https://www.kernel.org/pub/software/scm/git/git-1.9.2.tar.xz"; + sha256 = "1x4rb06vw4ckdflmn01r5l9spvn7cng4i5mm3sbd0n8cz0n6xz13"; }; buildInputs = [ From 7fed418b249a33d96cd4d657099e7438515408ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benno=20F=C3=BCnfst=C3=BCck?= Date: Sun, 13 Apr 2014 10:19:30 +0200 Subject: [PATCH 0064/2033] haskell: add monad-extras --- .../libraries/haskell/monad-extras/default.nix | 17 +++++++++++++++++ pkgs/top-level/haskell-packages.nix | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 pkgs/development/libraries/haskell/monad-extras/default.nix diff --git a/pkgs/development/libraries/haskell/monad-extras/default.nix b/pkgs/development/libraries/haskell/monad-extras/default.nix new file mode 100644 index 00000000000..9a66c5ab983 --- /dev/null +++ b/pkgs/development/libraries/haskell/monad-extras/default.nix @@ -0,0 +1,17 @@ +{ cabal, mmorph, monadControl, stm, transformers, transformersBase +}: + +cabal.mkDerivation (self: { + pname = "monad-extras"; + version = "0.5.7"; + sha256 = "0dqj3n3ki679b6z5y7qw084chbahlqmj2vgj7yx0v552bl0ylzyj"; + buildDepends = [ + mmorph monadControl stm transformers transformersBase + ]; + meta = { + homepage = "http://github.com/jwiegley/monad-extras"; + description = "Extra utility functions for working with monads"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 7f708438fc7..22b9be810be 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -1745,6 +1745,8 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x monadcryptorandom = callPackage ../development/libraries/haskell/monadcryptorandom {}; + monadExtras = callPackage ../development/libraries/haskell/monad-extras {}; + monadloc = callPackage ../development/libraries/haskell/monadloc {}; monadLoops = callPackage ../development/libraries/haskell/monad-loops {}; From d1f875c6af7240e63a6ad765b323e8a1c92d31af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 10:46:10 +0200 Subject: [PATCH 0065/2033] lttng project: update from 2.3.0 to 2.4.1 (And update liburcu to 0.8.4 according to release notes for lttng 2.4.x.) In addition to new features and bug fixes, version 2.4.x is needed to build against Linux 3.12 (our new stable kernel). --- pkgs/development/libraries/liburcu/default.nix | 4 ++-- pkgs/development/tools/misc/lttng-tools/default.nix | 4 ++-- pkgs/development/tools/misc/lttng-ust/default.nix | 4 ++-- pkgs/os-specific/linux/lttng-modules/default.nix | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/liburcu/default.nix b/pkgs/development/libraries/liburcu/default.nix index 44daabe6a73..e7f627f62f7 100644 --- a/pkgs/development/libraries/liburcu/default.nix +++ b/pkgs/development/libraries/liburcu/default.nix @@ -1,12 +1,12 @@ { stdenv, fetchurl }: stdenv.mkDerivation rec { - version = "0.8.1"; + version = "0.8.4"; name = "liburcu-${version}"; src = fetchurl { url = "http://lttng.org/files/urcu/userspace-rcu-${version}.tar.bz2"; - sha256 = "07p0lh43j7i1606m4l1dxm195z6fcfz74fmx7q2d7mrhn2bzc240"; + sha256 = "04py48xphylb246mpkzvld0yprj5h7cyv6pydr8b25aax5bs3h4n"; }; meta = with stdenv.lib; { diff --git a/pkgs/development/tools/misc/lttng-tools/default.nix b/pkgs/development/tools/misc/lttng-tools/default.nix index 1d223d83a65..541385d8bec 100644 --- a/pkgs/development/tools/misc/lttng-tools/default.nix +++ b/pkgs/development/tools/misc/lttng-tools/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, popt, libuuid, liburcu, lttngUst, kmod }: stdenv.mkDerivation rec { - name = "lttng-tools-2.3.0"; + name = "lttng-tools-2.4.1"; src = fetchurl { url = "https://lttng.org/files/lttng-tools/${name}.tar.bz2"; - sha256 = "16j55xqrh00mjbcvdmdkfxchavi7jsxlpnfjqc1g1d3x65ss9wri"; + sha256 = "1v9f7a3c2shwgn4g759bblgr27h9ql9sfq71r1mbkf8rd235g2jr"; }; buildInputs = [ popt libuuid liburcu lttngUst ]; diff --git a/pkgs/development/tools/misc/lttng-ust/default.nix b/pkgs/development/tools/misc/lttng-ust/default.nix index 014a97a9158..0cba211f28b 100644 --- a/pkgs/development/tools/misc/lttng-ust/default.nix +++ b/pkgs/development/tools/misc/lttng-ust/default.nix @@ -12,11 +12,11 @@ # Debian builds with std.h (systemtap). stdenv.mkDerivation rec { - name = "lttng-ust-2.3.0"; + name = "lttng-ust-2.4.1"; src = fetchurl { url = "https://lttng.org/files/lttng-ust/${name}.tar.bz2"; - sha256 = "1hazjybrppyaakvfp1bs92vx0n2sgcsw0m6i5hwq7xq8vij7cj4q"; + sha256 = "1nx9b1haiylajzjy03wgfcy85nwg578c6gy8ip55y8cabjrw0hp1"; }; buildInputs = [ liburcu ]; diff --git a/pkgs/os-specific/linux/lttng-modules/default.nix b/pkgs/os-specific/linux/lttng-modules/default.nix index 1673472036f..8e20bf1e3d3 100644 --- a/pkgs/os-specific/linux/lttng-modules/default.nix +++ b/pkgs/os-specific/linux/lttng-modules/default.nix @@ -1,12 +1,12 @@ { stdenv, fetchurl, kernel }: stdenv.mkDerivation rec { - pname = "lttng-modules-2.3.0"; + pname = "lttng-modules-2.4.1"; name = "${pname}-${kernel.version}"; src = fetchurl { url = "https://lttng.org/files/lttng-modules/${pname}.tar.bz2"; - sha256 = "0l9fbmpsjvm5pbrc6axy8chdp21j4b8fm0hmjhpk658ll0iixmpb"; + sha256 = "1qn1qm8lwqw9ri9wfkf6k3d58gl9rwffmpbpkwx21v1fw95zi92k"; }; patches = [ ./lttng-fix-build-error-on-linux-3.2.patch ]; From 6989b9a3f90949f5e14bd946b7aa4e1ea658bb5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 10:46:14 +0200 Subject: [PATCH 0066/2033] babeltrace: update from 1.1.1 to 1.2.1 --- pkgs/development/tools/misc/babeltrace/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/misc/babeltrace/default.nix b/pkgs/development/tools/misc/babeltrace/default.nix index d19bb24eb37..aa8e70b5edc 100644 --- a/pkgs/development/tools/misc/babeltrace/default.nix +++ b/pkgs/development/tools/misc/babeltrace/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, pkgconfig, glib, libuuid, popt }: stdenv.mkDerivation rec { - name = "babeltrace-1.1.1"; + name = "babeltrace-1.2.1"; src = fetchurl { url = "http://www.efficios.com/files/babeltrace/${name}.tar.bz2"; - sha256 = "04jc1yd3aaq59fmpzswzc78cywpq7wzjfqdlsg7xc76ivb8cggfz"; + sha256 = "1pwg0y57iy4c8wynb6bj7f6bxaiclmxcm4f3nllpw9brhbdzygc1"; }; buildInputs = [ pkgconfig glib libuuid popt ]; From 0096bb677a391151c3864c927fc26f37c397d30f Mon Sep 17 00:00:00 2001 From: Roelof Wobben Date: Sun, 13 Apr 2014 11:19:02 +0200 Subject: [PATCH 0067/2033] new package: cinnamon-settings-daemon (close #2205) With tiny changes from @vcunat. --- pkgs/desktops/cinnamon/automount-plugin.patch | 448 ++ .../cinnamon/cinnamon-settings-daemon.nix | 52 + pkgs/desktops/cinnamon/dpms.patch | 30 + pkgs/desktops/cinnamon/keyboard.patch | 4729 +++++++++++++++++ pkgs/desktops/cinnamon/systemd-support.patch | 536 ++ pkgs/top-level/all-packages.nix | 4 +- 6 files changed, 5798 insertions(+), 1 deletion(-) create mode 100644 pkgs/desktops/cinnamon/automount-plugin.patch create mode 100644 pkgs/desktops/cinnamon/cinnamon-settings-daemon.nix create mode 100644 pkgs/desktops/cinnamon/dpms.patch create mode 100644 pkgs/desktops/cinnamon/keyboard.patch create mode 100644 pkgs/desktops/cinnamon/systemd-support.patch diff --git a/pkgs/desktops/cinnamon/automount-plugin.patch b/pkgs/desktops/cinnamon/automount-plugin.patch new file mode 100644 index 00000000000..3d90da99f08 --- /dev/null +++ b/pkgs/desktops/cinnamon/automount-plugin.patch @@ -0,0 +1,448 @@ + +diff -Naur cinnamon-settings-daemon-2.0.1.orig/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in cinnamon-settings-daemon-2.0.1/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in +--- cinnamon-settings-daemon-2.0.6.orig/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in 2013-11-03 10:50:04.000000000 -0500 ++++ cinnamon-settings-daemon-2.0.6/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in 2013-11-05 15:33:21.112912392 -0500 +@@ -2,6 +2,7 @@ + + + ++ + + + +@@ -42,6 +43,18 @@ + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in cinnamon-settings-daemon startup queue + ++ ++ ++ ++ true ++ <_summary>Activation of this plugin ++ <_description>Whether this plugin would be activated by cinnamon-settings-daemon or not ++ ++ ++ 97 ++ <_summary>Priority to use for this plugin ++ <_description>Priority to use for this plugin in cinnamon-settings-daemon startup queue ++ + + + +diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/automount.cinnamon-settings-plugin.in cinnamon-settings-daemon-2.0.1/plugins/automount/automount.cinnamon-settings-plugin.in +--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/automount.cinnamon-settings-plugin.in 1970-01-01 01:00:00.000000000 +0100 ++++ cinnamon-settings-daemon-2.0.1/plugins/automount/automount.cinnamon-settings-plugin.in 2013-10-08 22:35:10.771472456 +0200 +@@ -0,0 +1,8 @@ ++[Cinnamon Settings Plugin] ++Module=automount ++IAge=0 ++_Name=Automount ++_Description=Automounter plugin ++Authors=Tomas Bzatek ++Copyright=Copyright © 2010 Red Hat, Inc. ++Website= +diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.c cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.c +--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.c 2013-10-02 16:13:56.000000000 +0200 ++++ cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,65 +0,0 @@ +-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- +- * +- * Copyright (C) 2010 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, Suite 500, Boston, MA 02110-1335 USA +- * +- * Author: Tomas Bzatek +- */ +- +-#include "config.h" +- +-#include +-#include +-#include +-#include +- +-#include "csd-automount-manager.h" +- +-int +-main (int argc, +- char **argv) +-{ +- GMainLoop *loop; +- CsdAutomountManager *manager; +- GError *error = NULL; +- +- g_type_init (); +- gtk_init (&argc, &argv); +- +- bindtextdomain (GETTEXT_PACKAGE, CINNAMON_SETTINGS_LOCALEDIR); +- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +- textdomain (GETTEXT_PACKAGE); +- +- loop = g_main_loop_new (NULL, FALSE); +- manager = csd_automount_manager_new (); +- +- csd_automount_manager_start (manager, &error); +- +- if (error != NULL) { +- g_printerr ("Unable to start the mount manager: %s", +- error->message); +- +- g_error_free (error); +- _exit (1); +- } +- +- g_main_loop_run (loop); +- +- csd_automount_manager_stop (manager); +- g_main_loop_unref (loop); +- +- return 0; +-} +diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in +--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in 2013-10-02 16:13:56.000000000 +0200 ++++ cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in 1970-01-01 01:00:00.000000000 +0100 +@@ -1,12 +0,0 @@ +-[Desktop Entry] +-_Name=Mount Helper +-_Comment=Automount and autorun plugged devices +-Exec=@LIBEXECDIR@/cinnamon-fallback-mount-helper +-Icon=drive-optical +-Terminal=false +-Type=Application +-Categories= +-NoDisplay=true +-OnlyShowIn=GNOME; +-X-GNOME-Autostart-Notify=true +- +diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.c cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.c +--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.c 1970-01-01 01:00:00.000000000 +0100 ++++ cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.c 2013-10-08 22:35:10.771472456 +0200 +@@ -0,0 +1,106 @@ ++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- ++ * ++ * Copyright (C) 2010 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ * Author: Tomas Bzatek ++ */ ++ ++#include "config.h" ++ ++#include ++#include ++ ++#include "cinnamon-settings-plugin.h" ++#include "csd-automount-plugin.h" ++#include "csd-automount-manager.h" ++ ++struct CsdAutomountPluginPrivate { ++ CsdAutomountManager *manager; ++}; ++ ++#define CSD_AUTOMOUNT_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPluginPrivate)) ++ ++CINNAMON_SETTINGS_PLUGIN_REGISTER (CsdAutomountPlugin, csd_automount_plugin) ++ ++static void ++csd_automount_plugin_init (CsdAutomountPlugin *plugin) ++{ ++ plugin->priv = CSD_AUTOMOUNT_PLUGIN_GET_PRIVATE (plugin); ++ ++ g_debug ("Automount plugin initializing"); ++ ++ plugin->priv->manager = csd_automount_manager_new (); ++} ++ ++static void ++csd_automount_plugin_finalize (GObject *object) ++{ ++ CsdAutomountPlugin *plugin; ++ ++ g_return_if_fail (object != NULL); ++ g_return_if_fail (CSD_IS_AUTOMOUNT_PLUGIN (object)); ++ ++ g_debug ("Automount plugin finalizing"); ++ ++ plugin = CSD_AUTOMOUNT_PLUGIN (object); ++ ++ g_return_if_fail (plugin->priv != NULL); ++ ++ if (plugin->priv->manager != NULL) { ++ g_object_unref (plugin->priv->manager); ++ } ++ ++ G_OBJECT_CLASS (csd_automount_plugin_parent_class)->finalize (object); ++} ++ ++static void ++impl_activate (CinnamonSettingsPlugin *plugin) ++{ ++ gboolean res; ++ GError *error; ++ ++ g_debug ("Activating automount plugin"); ++ ++ error = NULL; ++ res = csd_automount_manager_start (CSD_AUTOMOUNT_PLUGIN (plugin)->priv->manager, &error); ++ if (! res) { ++ g_warning ("Unable to start automount manager: %s", error->message); ++ g_error_free (error); ++ } ++} ++ ++static void ++impl_deactivate (CinnamonSettingsPlugin *plugin) ++{ ++ g_debug ("Deactivating automount plugin"); ++ csd_automount_manager_stop (CSD_AUTOMOUNT_PLUGIN (plugin)->priv->manager); ++} ++ ++static void ++csd_automount_plugin_class_init (CsdAutomountPluginClass *klass) ++{ ++ GObjectClass *object_class = G_OBJECT_CLASS (klass); ++ CinnamonSettingsPluginClass *plugin_class = CINNAMON_SETTINGS_PLUGIN_CLASS (klass); ++ ++ object_class->finalize = csd_automount_plugin_finalize; ++ ++ plugin_class->activate = impl_activate; ++ plugin_class->deactivate = impl_deactivate; ++ ++ g_type_class_add_private (klass, sizeof (CsdAutomountPluginPrivate)); ++} ++ +diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.h cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.h +--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.h 1970-01-01 01:00:00.000000000 +0100 ++++ cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.h 2013-10-08 22:35:10.771472456 +0200 +@@ -0,0 +1,60 @@ ++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- ++ * ++ * Copyright (C) 2010 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ * Author: Tomas Bzatek ++ */ ++ ++#ifndef __CSD_AUTOMOUNT_PLUGIN_H__ ++#define __CSD_AUTOMOUNT_PLUGIN_H__ ++ ++#include ++#include ++#include ++ ++#include "cinnamon-settings-plugin.h" ++ ++G_BEGIN_DECLS ++ ++#define CSD_TYPE_AUTOMOUNT_PLUGIN (csd_automount_plugin_get_type ()) ++#define CSD_AUTOMOUNT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPlugin)) ++#define CSD_AUTOMOUNT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPluginClass)) ++#define CSD_IS_AUTOMOUNT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CSD_TYPE_AUTOMOUNT_PLUGIN)) ++#define CSD_IS_AUTOMOUNT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CSD_TYPE_AUTOMOUNT_PLUGIN)) ++#define CSD_AUTOMOUNT_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPluginClass)) ++ ++typedef struct CsdAutomountPluginPrivate CsdAutomountPluginPrivate; ++ ++typedef struct ++{ ++ CinnamonSettingsPlugin parent; ++ CsdAutomountPluginPrivate *priv; ++} CsdAutomountPlugin; ++ ++typedef struct ++{ ++ CinnamonSettingsPluginClass parent_class; ++} CsdAutomountPluginClass; ++ ++GType csd_automount_plugin_get_type (void) G_GNUC_CONST; ++ ++/* All the plugins must implement this function */ ++G_MODULE_EXPORT GType register_cinnamon_settings_plugin (GTypeModule *module); ++ ++G_END_DECLS ++ ++#endif /* __CSD_AUTOMOUNT_PLUGIN_H__ */ +diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/Makefile.am cinnamon-settings-daemon-2.0.1/plugins/automount/Makefile.am +--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/Makefile.am 2013-10-02 16:13:56.000000000 +0200 ++++ cinnamon-settings-daemon-2.0.1/plugins/automount/Makefile.am 2013-10-08 22:48:19.240865461 +0200 +@@ -1,38 +1,87 @@ +-libexec_PROGRAMS = cinnamon-fallback-mount-helper ++NULL = + +-cinnamon_fallback_mount_helper_SOURCES = \ +- cinnamon-fallback-mount-helper.c \ +- csd-automount-manager.c \ +- csd-automount-manager.h \ +- csd-autorun.c \ +- csd-autorun.h ++plugin_name = automount + +-cinnamon_fallback_mount_helper_CPPFLAGS = \ ++libexec_PROGRAMS = csd-test-automount ++ ++csd_test_automount_SOURCES = \ ++ test-automount.c \ ++ csd-automount-manager.h \ ++ csd-automount-manager.c \ ++ csd-autorun.c \ ++ csd-autorun.h \ ++ $(NULL) ++ ++csd_test_automount_CPPFLAGS = \ + -I$(top_srcdir)/cinnamon-settings-daemon \ ++ -I$(top_srcdir)/plugins/common \ + -DCINNAMON_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +-cinnamon_fallback_mount_helper_CFLAGS = \ ++csd_test_automount_CFLAGS = \ ++ $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(SYSTEMD_CFLAGS) \ + $(AUTOMOUNT_CFLAGS) ++ $(AM_CFLAGS) ++ ++csd_test_automount_LDADD = \ ++ $(top_builddir)/cinnamon-settings-daemon/libcsd.la \ ++ $(SETTINGS_PLUGIN_LIBS) \ ++ $(SYSTEMD_LIBS) \ ++ $(AUTOMOUNT_LIBS) \ ++ $(NULL) ++ ++plugin_LTLIBRARIES = \ ++ libautomount.la \ ++ $(NULL) ++ ++libautomount_la_SOURCES = \ ++ csd-automount-plugin.h \ ++ csd-automount-plugin.c \ ++ csd-automount-manager.h \ ++ csd-automount-manager.c \ ++ csd-autorun.c \ ++ csd-autorun.h \ ++ $(NULL) ++ ++libautomount_la_CPPFLAGS = \ ++ -I$(top_srcdir)/cinnamon-settings-daemon \ ++ -DCINNAMON_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ ++ $(AM_CPPFLAGS) ++ ++libautomount_la_CFLAGS = \ ++ $(SETTINGS_PLUGIN_CFLAGS) \ ++ $(SYSTEMD_CFLAGS) \ ++ $(AUTOMOUNT_CFLAGS) \ ++ $(AM_CFLAGS) ++ ++libautomount_la_LDFLAGS = \ ++ $(CSD_PLUGIN_LDFLAGS) \ ++ $(NULL) + +-cinnamon_fallback_mount_helper_LDADD = \ ++libautomount_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(SYSTEMD_LIBS) \ + $(AUTOMOUNT_LIBS) \ +- $(top_builddir)/cinnamon-settings-daemon/libcsd.la ++ $(NULL) + +-autostartdir = $(datadir)/applications +-autostart_in_files = cinnamon-fallback-mount-helper.desktop.in +-autostart_in_in_files = cinnamon-fallback-mount-helper.desktop.in.in +-autostart_DATA = $(autostart_in_files:.desktop.in=.desktop) ++plugin_in_files = \ ++ automount.cinnamon-settings-plugin.in \ ++ $(NULL) + +-$(autostart_in_files): $(autostart_in_in_files) +- @sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ ++plugin_DATA = $(plugin_in_files:.cinnamon-settings-plugin.in=.cinnamon-settings-plugin) + +-@INTLTOOL_DESKTOP_RULE@ ++EXTRA_DIST = \ ++ $(plugin_in_files) \ ++ $(NULL) + +-EXTRA_DIST = $(autostart_in_in_files) ++CLEANFILES = \ ++ $(plugin_DATA) \ ++ $(NULL) + +-CLEANFILES = $(autostart_DATA) $(autostart_in_files) ++DISTCLEANFILES = \ ++ $(plugin_DATA) \ ++ $(NULL) ++ ++@CSD_INTLTOOL_PLUGIN_RULE@ +diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/test-automount.c cinnamon-settings-daemon-2.0.1/plugins/automount/test-automount.c +--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/test-automount.c 1970-01-01 01:00:00.000000000 +0100 ++++ cinnamon-settings-daemon-2.0.1/plugins/automount/test-automount.c 2013-10-08 22:42:53.759486525 +0200 +@@ -0,0 +1,7 @@ ++#define NEW csd_automount_manager_new ++#define START csd_automount_manager_start ++#define STOP csd_automount_manager_stop ++#define MANAGER CsdAutomountManager ++#include "csd-automount-manager.h" ++ ++#include "test-plugin.h" +diff -Naur cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.in cinnamon-settings-daemon-2.0.1/po/POTFILES.in +--- cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.in 2013-10-02 16:13:56.000000000 +0200 ++++ cinnamon-settings-daemon-2.0.1/po/POTFILES.in 2013-10-08 22:35:10.771472456 +0200 +@@ -18,8 +18,9 @@ + plugins/a11y-keyboard/csd-a11y-preferences-dialog.c + [type: gettext/glade]plugins/a11y-keyboard/csd-a11y-preferences-dialog.ui + [type: gettext/ini]plugins/a11y-settings/a11y-settings.cinnamon-settings-plugin.in +-plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in ++[type: gettext/ini]plugins/automount/automount.cinnamon-settings-plugin.in + plugins/automount/csd-automount-manager.c ++plugins/automount/csd-automount-plugin.c + plugins/automount/csd-autorun.c + [type: gettext/ini]plugins/background/background.cinnamon-settings-plugin.in + [type: gettext/ini]plugins/clipboard/clipboard.cinnamon-settings-plugin.in +diff -Naur cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.skip cinnamon-settings-daemon-2.0.1/po/POTFILES.skip +--- cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.skip 2013-10-02 16:13:56.000000000 +0200 ++++ cinnamon-settings-daemon-2.0.1/po/POTFILES.skip 2013-10-08 22:37:20.224645009 +0200 +@@ -20,6 +20,5 @@ + data/org.cinnamon.settings-daemon.plugins.updates.gschema.xml.in + data/org.cinnamon.settings-daemon.plugins.xrandr.gschema.xml.in + data/org.cinnamon.settings-daemon.plugins.xsettings.gschema.xml.in +-plugins/automount/gnome-fallback-mount-helper.desktop.in + plugins/power/org.cinnamon.settings-daemon.plugins.power.policy.in + plugins/wacom/org.cinnamon.settings-daemon.plugins.wacom.policy.in diff --git a/pkgs/desktops/cinnamon/cinnamon-settings-daemon.nix b/pkgs/desktops/cinnamon/cinnamon-settings-daemon.nix new file mode 100644 index 00000000000..c397a9758e2 --- /dev/null +++ b/pkgs/desktops/cinnamon/cinnamon-settings-daemon.nix @@ -0,0 +1,52 @@ + +{ stdenv, fetchurl, pkgconfig, autoreconfHook, glib, gettext, gnome_common, cinnamon-desktop, intltool, gtk3, +libnotify, lcms2, libxklavier, libgnomekbd, libcanberra, pulseaudio, upower, libcanberra_gtk3, colord, +systemd, libxslt, docbook_xsl, makeWrapper, gsettings_desktop_schemas}: + +let + version = "2.0.10"; +in +stdenv.mkDerivation { + name = "cinnamon-settings-daemon-${version}"; + + src = fetchurl { + url = "http://github.com/linuxmint/cinnamon-settings-daemon/archive/${version}.tar.gz"; + sha256 = "10r75xsngb7ipv9fy07dyfb256bqybzcxbwny60sgjhrksk3v9mg"; + }; + + NIX_CFLAGS_COMPILE = "-I${glib}/include/gio-unix-2.0"; + + configureFlags = "--enable-systemd" ; + + patches = [ ./systemd-support.patch ./automount-plugin.patch ./dpms.patch]; + + buildInputs = [ + pkgconfig autoreconfHook + glib gettext gnome_common + intltool gtk3 libnotify lcms2 + libgnomekbd libxklavier colord + libcanberra pulseaudio upower + libcanberra_gtk3 cinnamon-desktop + systemd libxslt docbook_xsl makeWrapper + gsettings_desktop_schemas + ]; + + preBuild = "patchShebangs ./scripts"; + + #ToDo: missing org.cinnamon.gschema.xml, probably not packaged yet + postFixup = '' + for f in "$out"/libexec/*; do + wrapProgram "$f" --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" + done + ''; + + + meta = { + homepage = "http://cinnamon.linuxmint.com"; + description = "The cinnamon session files" ; + + platforms = stdenv.lib.platforms.linux; + maintainers = [ stdenv.lib.maintainers.roelof ]; + }; +} + diff --git a/pkgs/desktops/cinnamon/dpms.patch b/pkgs/desktops/cinnamon/dpms.patch new file mode 100644 index 00000000000..a73f33dc618 --- /dev/null +++ b/pkgs/desktops/cinnamon/dpms.patch @@ -0,0 +1,30 @@ + +-- a/plugins/power/csd-power-manager.c ++++ b/plugins/power/csd-power-manager.c +@@ -33,6 +33,8 @@ + #include + #include + ++#include ++ + #define GNOME_DESKTOP_USE_UNSTABLE_API + #include + +@@ -3967,6 +3790,17 @@ csd_power_manager_start (CsdPowerManager + /* set the initial dim time that can adapt for the user */ + refresh_idle_dim_settings (manager); + ++ /* Make sure that Xorg's DPMS extension never gets in our way. The defaults seem to have changed in Xorg 1.14 ++ * being "0" by default to being "600" by default ++ * https://bugzilla.gnome.org/show_bug.cgi?id=709114 ++ */ ++ gdk_error_trap_push (); ++ int dummy; ++ if (DPMSQueryExtension(GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &dummy, &dummy)) { ++ DPMSSetTimeouts (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), 0, 0, 0); ++ } ++ gdk_error_trap_pop_ignored (); ++ + manager->priv->xscreensaver_watchdog_timer_id = g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT, + disable_builtin_screensaver, + NULL); diff --git a/pkgs/desktops/cinnamon/keyboard.patch b/pkgs/desktops/cinnamon/keyboard.patch new file mode 100644 index 00000000000..f67d961ff58 --- /dev/null +++ b/pkgs/desktops/cinnamon/keyboard.patch @@ -0,0 +1,4729 @@ + +diff -uNrp a/cinnamon-settings-daemon/main.c b/cinnamon-settings-daemon/main.c +--- a/cinnamon-settings-daemon/main.c 2013-08-24 18:04:31.000000000 +0100 ++++ b/cinnamon-settings-daemon/main.c 2013-08-25 16:36:02.000000000 +0100 +@@ -319,6 +319,29 @@ set_legacy_ibus_env_vars (GDBusProxy *pr + } + #endif + ++static void ++got_session_proxy (GObject *source_object, ++ GAsyncResult *res, ++ gpointer user_data) ++{ ++ GDBusProxy *proxy; ++ GError *error = NULL; ++ ++ proxy = g_dbus_proxy_new_finish (res, &error); ++ if (proxy == NULL) { ++ g_debug ("Could not connect to the Session manager: %s", error->message); ++ g_error_free (error); ++ } else { ++ set_locale (proxy); ++#ifdef HAVE_IBUS ++ /* This will register with cinnamon-session after calling Setenv. */ ++ set_legacy_ibus_env_vars (proxy); ++#else ++ register_with_gnome_session (proxy); ++#endif ++ } ++} ++ + static gboolean + on_term_signal_pipe_closed (GIOChannel *source, + GIOCondition condition, +@@ -368,6 +391,16 @@ set_session_over_handler (GDBusConnectio + { + g_assert (bus != NULL); + ++ g_dbus_proxy_new (bus, ++ G_DBUS_PROXY_FLAGS_NONE, ++ NULL, ++ GNOME_SESSION_DBUS_NAME, ++ GNOME_SESSION_DBUS_OBJECT, ++ GNOME_SESSION_DBUS_INTERFACE, ++ NULL, ++ (GAsyncReadyCallback) got_session_proxy, ++ NULL); ++ + watch_for_term_signal (manager); + } + +@@ -390,56 +423,6 @@ name_lost_handler (GDBusConnection *conn + gtk_main_quit (); + } + +-static gboolean +-do_register_client (gpointer user_data) +-{ +- GDBusProxy *proxy = (GDBusProxy *) user_data; +- g_assert (proxy != NULL); +- +- const char *startup_id = g_getenv ("DESKTOP_AUTOSTART_ID"); +- g_dbus_proxy_call (proxy, +- "RegisterClient", +- g_variant_new ("(ss)", "cinnamon-settings-daemon", startup_id ? startup_id : ""), +- G_DBUS_CALL_FLAGS_NONE, +- -1, +- NULL, +- (GAsyncReadyCallback) on_client_registered, +- manager); +- +- return FALSE; +-} +- +-static void +-queue_register_client (void) +-{ +- GDBusConnection *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); +- if (!bus) +- return; +- +- GError *error = NULL; +- GDBusProxy *proxy = g_dbus_proxy_new_sync (bus, +- G_DBUS_PROXY_FLAGS_NONE, +- NULL, +- GNOME_SESSION_DBUS_NAME, +- GNOME_SESSION_DBUS_OBJECT, +- GNOME_SESSION_DBUS_INTERFACE, +- NULL, +- &error); +- g_object_unref (bus); +- +- if (proxy == NULL) { +- g_debug ("Could not connect to the Session manager: %s", error->message); +- g_error_free (error); +- return; +- } +- +- /* Register the daemon with cinnamon-session */ +- g_signal_connect (G_OBJECT (proxy), "g-signal", +- G_CALLBACK (on_session_over), NULL); +- +- g_idle_add_full (G_PRIORITY_DEFAULT, do_register_client, proxy, NULL); +-} +- + static void + bus_register (void) + { +@@ -541,8 +524,6 @@ main (int argc, char *argv[]) + + notify_init ("cinnamon-settings-daemon"); + +- queue_register_client (); +- + bus_register (); + + cinnamon_settings_profile_start ("cinnamon_settings_manager_new"); +diff -uNrp a/configure.ac b/configure.ac +--- a/configure.ac 2013-08-24 18:04:31.000000000 +0100 ++++ b/configure.ac 2013-08-25 16:36:02.000000000 +0100 +@@ -53,6 +53,7 @@ UPOWER_GLIB_REQUIRED_VERSION=0.9.1 + PA_REQUIRED_VERSION=0.9.16 + UPOWER_REQUIRED_VERSION=0.9.11 + GTK_XINPUT_2_3_VERSION=3.7.8 ++IBUS_REQUIRED_VERSION=1.4.2 + + #EXTRA_COMPILE_WARNINGS(yes) + +@@ -199,8 +200,21 @@ dnl ------------------------------------ + dnl - Keyboard plugin stuff + dnl --------------------------------------------------------------------------- + +-LIBGNOMEKBD_REQUIRED=2.91.1 +-PKG_CHECK_MODULES(KEYBOARD, [libgnomekbdui >= $LIBGNOMEKBD_REQUIRED libgnomekbd >= $LIBGNOMEKBD_REQUIRED libxklavier >= 5.0 kbproto]) ++AC_ARG_ENABLE(ibus, ++ AS_HELP_STRING([--disable-ibus], ++ [Disable IBus support]), ++ enable_ibus=$enableval, ++ enable_ibus=yes) ++ ++if test "x$enable_ibus" = "xyes" ; then ++ IBUS_MODULE="ibus-1.0 >= $IBUS_REQUIRED_VERSION" ++ AC_DEFINE(HAVE_IBUS, 1, [Defined if IBus support is enabled]) ++else ++ IBUS_MODULE= ++fi ++AM_CONDITIONAL(HAVE_IBUS, test "x$enable_ibus" == "xyes") ++ ++PKG_CHECK_MODULES(KEYBOARD, xkbfile $IBUS_MODULE cinnamon-desktop >= $CINNAMON_DESKTOP_REQUIRED_VERSION) + + dnl --------------------------------------------------------------------------- + dnl - Housekeeping plugin stuff +diff -uNrp a/data/org.cinnamon.settings-daemon.plugins.media-keys.gschema.xml.in.in b/data/org.cinnamon.settings-daemon.plugins.media-keys.gschema.xml.in.in +--- a/data/org.cinnamon.settings-daemon.plugins.media-keys.gschema.xml.in.in 2013-08-24 18:04:31.000000000 +0100 ++++ b/data/org.cinnamon.settings-daemon.plugins.media-keys.gschema.xml.in.in 2013-08-25 16:36:02.000000000 +0100 +@@ -175,6 +175,15 @@ + <_summary>Magnifier zoom out + <_description>Binding for the magnifier to zoom out + ++ ++ '' ++ <_summary>Switch input source ++ <_description>Binding to select the next input source ++ ++ ++ '' ++ <_summary>Switch input source backward ++ <_description>Binding to select the previous input source ++ + +- +- ++ +\ No newline at end of file +diff -uNrp a/plugins/keyboard/csd-keyboard-manager.c b/plugins/keyboard/csd-keyboard-manager.c +--- a/plugins/keyboard/csd-keyboard-manager.c 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/keyboard/csd-keyboard-manager.c 2013-08-25 16:36:02.000000000 +0100 +@@ -40,19 +40,22 @@ + + #include + #include ++#include ++ ++#define GNOME_DESKTOP_USE_UNSTABLE_API ++#include ++ ++#ifdef HAVE_IBUS ++#include ++#endif + + #include "cinnamon-settings-profile.h" + #include "csd-keyboard-manager.h" ++#include "csd-input-helper.h" + #include "csd-enums.h" + +-#include "csd-keyboard-xkb.h" +- + #define CSD_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CSD_TYPE_KEYBOARD_MANAGER, CsdKeyboardManagerPrivate)) + +-#ifndef HOST_NAME_MAX +-# define HOST_NAME_MAX 255 +-#endif +- + #define CSD_KEYBOARD_DIR "org.cinnamon.settings-daemon.peripherals.keyboard" + + #define KEY_REPEAT "repeat" +@@ -60,6 +63,7 @@ + #define KEY_INTERVAL "repeat-interval" + #define KEY_DELAY "delay" + #define KEY_CLICK_VOLUME "click-volume" ++#define KEY_REMEMBER_NUMLOCK_STATE "remember-numlock-state" + #define KEY_NUMLOCK_STATE "numlock-state" + + #define KEY_BELL_VOLUME "bell-volume" +@@ -67,27 +71,560 @@ + #define KEY_BELL_DURATION "bell-duration" + #define KEY_BELL_MODE "bell-mode" + +-#define LIBGNOMEKBD_KEYBOARD_DIR "org.gnome.libgnomekbd.keyboard" +-#define LIBGNOMEKBD_KEY_LAYOUTS "layouts" ++#define KEY_SWITCHER "input-sources-switcher" ++ ++#define GNOME_DESKTOP_INTERFACE_DIR "org.cinnamon.desktop.interface" ++ ++#define KEY_GTK_IM_MODULE "gtk-im-module" ++#define GTK_IM_MODULE_SIMPLE "gtk-im-context-simple" ++#define GTK_IM_MODULE_IBUS "ibus" ++ ++#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.cinnamon.desktop.input-sources" ++ ++#define KEY_CURRENT_INPUT_SOURCE "current" ++#define KEY_INPUT_SOURCES "sources" ++#define KEY_KEYBOARD_OPTIONS "xkb-options" ++ ++#define INPUT_SOURCE_TYPE_XKB "xkb" ++#define INPUT_SOURCE_TYPE_IBUS "ibus" ++ ++#define DEFAULT_LANGUAGE "en_US" + + struct CsdKeyboardManagerPrivate + { + guint start_idle_id; + GSettings *settings; +- GSettings *libgnomekbd_settings; +- gboolean have_xkb; ++ GSettings *input_sources_settings; ++ GSettings *interface_settings; ++ GnomeXkbInfo *xkb_info; ++#ifdef HAVE_IBUS ++ IBusBus *ibus; ++ GHashTable *ibus_engines; ++ GHashTable *ibus_xkb_engines; ++ GCancellable *ibus_cancellable; ++ gboolean session_is_fallback; ++#endif + gint xkb_event_base; + CsdNumLockState old_state; ++ GdkDeviceManager *device_manager; ++ guint device_added_id; ++ guint device_removed_id; ++ ++ gboolean input_sources_switcher_spawned; ++ GPid input_sources_switcher_pid; + }; + + static void csd_keyboard_manager_class_init (CsdKeyboardManagerClass *klass); + static void csd_keyboard_manager_init (CsdKeyboardManager *keyboard_manager); + static void csd_keyboard_manager_finalize (GObject *object); ++static gboolean apply_input_sources_settings (GSettings *settings, ++ gpointer keys, ++ gint n_keys, ++ CsdKeyboardManager *manager); ++static void set_gtk_im_module (CsdKeyboardManager *manager, ++ const gchar *new_module); + + G_DEFINE_TYPE (CsdKeyboardManager, csd_keyboard_manager, G_TYPE_OBJECT) + + static gpointer manager_object = NULL; + ++static void ++init_builder_with_sources (GVariantBuilder *builder, ++ GSettings *settings) ++{ ++ const gchar *type; ++ const gchar *id; ++ GVariantIter iter; ++ GVariant *sources; ++ ++ sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); ++ ++ g_variant_builder_init (builder, G_VARIANT_TYPE ("a(ss)")); ++ ++ g_variant_iter_init (&iter, sources); ++ while (g_variant_iter_next (&iter, "(&s&s)", &type, &id)) ++ g_variant_builder_add (builder, "(ss)", type, id); ++ ++ g_variant_unref (sources); ++} ++ ++static gboolean ++schema_is_installed (const gchar *name) ++{ ++ const gchar * const *schemas; ++ const gchar * const *s; ++ ++ schemas = g_settings_list_schemas (); ++ for (s = schemas; *s; ++s) ++ if (g_str_equal (*s, name)) ++ return TRUE; ++ ++ return FALSE; ++} ++ ++#ifdef HAVE_IBUS ++static void ++clear_ibus (CsdKeyboardManager *manager) ++{ ++ CsdKeyboardManagerPrivate *priv = manager->priv; ++ ++ g_cancellable_cancel (priv->ibus_cancellable); ++ g_clear_object (&priv->ibus_cancellable); ++ g_clear_pointer (&priv->ibus_engines, g_hash_table_destroy); ++ g_clear_pointer (&priv->ibus_xkb_engines, g_hash_table_destroy); ++ g_clear_object (&priv->ibus); ++} ++ ++static gchar * ++make_xkb_source_id (const gchar *engine_id) ++{ ++ gchar *id; ++ gchar *p; ++ gint n_colons = 0; ++ ++ /* engine_id is like "xkb:layout:variant:lang" where ++ * 'variant' and 'lang' might be empty */ ++ ++ engine_id += 4; ++ ++ for (p = (gchar *)engine_id; *p; ++p) ++ if (*p == ':') ++ if (++n_colons == 2) ++ break; ++ if (!*p) ++ return NULL; ++ ++ id = g_strndup (engine_id, p - engine_id + 1); ++ ++ id[p - engine_id] = '\0'; ++ ++ /* id is "layout:variant" where 'variant' might be empty */ ++ ++ for (p = id; *p; ++p) ++ if (*p == ':') { ++ if (*(p + 1) == '\0') ++ *p = '\0'; ++ else ++ *p = '+'; ++ break; ++ } ++ ++ /* id is "layout+variant" or "layout" */ ++ ++ return id; ++} ++ ++static void ++fetch_ibus_engines_result (GObject *object, ++ GAsyncResult *result, ++ CsdKeyboardManager *manager) ++{ ++ CsdKeyboardManagerPrivate *priv = manager->priv; ++ GList *list, *l; ++ GError *error = NULL; ++ ++ /* engines shouldn't be there yet */ ++ g_return_if_fail (priv->ibus_engines == NULL); ++ ++ g_clear_object (&priv->ibus_cancellable); ++ ++ list = ibus_bus_list_engines_async_finish (priv->ibus, ++ result, ++ &error); ++ if (!list && error) { ++ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) ++ g_warning ("Couldn't finish IBus request: %s", error->message); ++ g_error_free (error); ++ ++ clear_ibus (manager); ++ return; ++ } ++ ++ /* Maps IBus engine ids to engine description objects */ ++ priv->ibus_engines = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); ++ /* Maps XKB source id strings to engine description objects */ ++ priv->ibus_xkb_engines = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); ++ ++ for (l = list; l; l = l->next) { ++ IBusEngineDesc *engine = l->data; ++ const gchar *engine_id = ibus_engine_desc_get_name (engine); ++ ++ g_hash_table_replace (priv->ibus_engines, (gpointer)engine_id, engine); ++ ++ if (strncmp ("xkb:", engine_id, 4) == 0) { ++ gchar *xkb_source_id = make_xkb_source_id (engine_id); ++ if (xkb_source_id) ++ g_hash_table_replace (priv->ibus_xkb_engines, ++ xkb_source_id, ++ engine); ++ } ++ } ++ g_list_free (list); ++ ++ apply_input_sources_settings (priv->input_sources_settings, NULL, 0, manager); ++} ++ ++static void ++fetch_ibus_engines (CsdKeyboardManager *manager) ++{ ++ CsdKeyboardManagerPrivate *priv = manager->priv; ++ ++ /* engines shouldn't be there yet */ ++ g_return_if_fail (priv->ibus_engines == NULL); ++ g_return_if_fail (priv->ibus_cancellable == NULL); ++ ++ priv->ibus_cancellable = g_cancellable_new (); ++ ++ ibus_bus_list_engines_async (priv->ibus, ++ -1, ++ priv->ibus_cancellable, ++ (GAsyncReadyCallback)fetch_ibus_engines_result, ++ manager); ++} ++ ++static void ++maybe_start_ibus (CsdKeyboardManager *manager, ++ GVariant *sources) ++{ ++ gboolean need_ibus = FALSE; ++ GVariantIter iter; ++ const gchar *type; ++ ++ if (manager->priv->session_is_fallback) ++ return; ++ ++ g_variant_iter_init (&iter, sources); ++ while (g_variant_iter_next (&iter, "(&s&s)", &type, NULL)) ++ if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) { ++ need_ibus = TRUE; ++ break; ++ } ++ ++ if (!need_ibus) ++ return; ++ ++ if (!manager->priv->ibus) { ++ ibus_init (); ++ manager->priv->ibus = ibus_bus_new (); ++ g_signal_connect_swapped (manager->priv->ibus, "connected", ++ G_CALLBACK (fetch_ibus_engines), manager); ++ g_signal_connect_swapped (manager->priv->ibus, "disconnected", ++ G_CALLBACK (clear_ibus), manager); ++ } ++ /* IBus doesn't export API in the session bus. The only thing ++ * we have there is a well known name which we can use as a ++ * sure-fire way to activate it. */ ++ g_bus_unwatch_name (g_bus_watch_name (G_BUS_TYPE_SESSION, ++ IBUS_SERVICE_IBUS, ++ G_BUS_NAME_WATCHER_FLAGS_AUTO_START, ++ NULL, ++ NULL, ++ NULL, ++ NULL)); ++} ++ ++static void ++got_session_name (GObject *object, ++ GAsyncResult *res, ++ CsdKeyboardManager *manager) ++{ ++ GVariant *result, *variant; ++ GDBusConnection *connection = G_DBUS_CONNECTION (object); ++ CsdKeyboardManagerPrivate *priv = manager->priv; ++ const gchar *session_name = NULL; ++ GError *error = NULL; ++ ++ /* IBus shouldn't have been touched yet */ ++ g_return_if_fail (priv->ibus == NULL); ++ ++ g_clear_object (&priv->ibus_cancellable); ++ ++ result = g_dbus_connection_call_finish (connection, res, &error); ++ if (!result) { ++ g_warning ("Couldn't get session name: %s", error->message); ++ g_error_free (error); ++ goto out; ++ } ++ ++ g_variant_get (result, "(v)", &variant); ++ g_variant_unref (result); ++ ++ g_variant_get (variant, "&s", &session_name); ++ ++ if (g_strcmp0 (session_name, "gnome") == 0) ++ manager->priv->session_is_fallback = FALSE; ++ ++ g_variant_unref (variant); ++ out: ++ apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager); ++ g_object_unref (connection); ++} ++ ++static void ++got_bus (GObject *object, ++ GAsyncResult *res, ++ CsdKeyboardManager *manager) ++{ ++ GDBusConnection *connection; ++ CsdKeyboardManagerPrivate *priv = manager->priv; ++ GError *error = NULL; ++ ++ /* IBus shouldn't have been touched yet */ ++ g_return_if_fail (priv->ibus == NULL); ++ ++ g_clear_object (&priv->ibus_cancellable); ++ ++ connection = g_bus_get_finish (res, &error); ++ if (!connection) { ++ g_warning ("Couldn't get session bus: %s", error->message); ++ g_error_free (error); ++ apply_input_sources_settings (priv->input_sources_settings, NULL, 0, manager); ++ return; ++ } ++ ++ priv->ibus_cancellable = g_cancellable_new (); ++ ++ g_dbus_connection_call (connection, ++ "org.gnome.SessionManager", ++ "/org/gnome/SessionManager", ++ "org.freedesktop.DBus.Properties", ++ "Get", ++ g_variant_new ("(ss)", ++ "org.gnome.SessionManager", ++ "SessionName"), ++ NULL, ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ priv->ibus_cancellable, ++ (GAsyncReadyCallback)got_session_name, ++ manager); ++} ++ ++static void ++set_ibus_engine_finish (GObject *object, ++ GAsyncResult *res, ++ CsdKeyboardManager *manager) ++{ ++ gboolean result; ++ IBusBus *ibus = IBUS_BUS (object); ++ CsdKeyboardManagerPrivate *priv = manager->priv; ++ GError *error = NULL; ++ ++ g_clear_object (&priv->ibus_cancellable); ++ ++ result = ibus_bus_set_global_engine_async_finish (ibus, res, &error); ++ if (!result) { ++ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) ++ g_warning ("Couldn't set IBus engine: %s", error->message); ++ g_error_free (error); ++ } ++} ++ ++static void ++set_ibus_engine (CsdKeyboardManager *manager, ++ const gchar *engine_id) ++{ ++ CsdKeyboardManagerPrivate *priv = manager->priv; ++ ++ g_return_if_fail (priv->ibus != NULL); ++ g_return_if_fail (priv->ibus_engines != NULL); ++ ++ g_cancellable_cancel (priv->ibus_cancellable); ++ g_clear_object (&priv->ibus_cancellable); ++ priv->ibus_cancellable = g_cancellable_new (); ++ ++ ibus_bus_set_global_engine_async (priv->ibus, ++ engine_id, ++ -1, ++ priv->ibus_cancellable, ++ (GAsyncReadyCallback)set_ibus_engine_finish, ++ manager); ++} ++ ++static void ++set_ibus_xkb_engine (CsdKeyboardManager *manager, ++ const gchar *xkb_id) ++{ ++ IBusEngineDesc *engine; ++ CsdKeyboardManagerPrivate *priv = manager->priv; ++ ++ if (!priv->ibus_xkb_engines) ++ return; ++ ++ engine = g_hash_table_lookup (priv->ibus_xkb_engines, xkb_id); ++ if (!engine) ++ return; ++ ++ set_ibus_engine (manager, ibus_engine_desc_get_name (engine)); ++} ++ ++/* XXX: See upstream bug: ++ * https://codereview.appspot.com/6586075/ */ ++static gchar * ++layout_from_ibus_layout (const gchar *ibus_layout) ++{ ++ const gchar *p; ++ ++ /* we get something like "layout(variant)[option1,option2]" */ ++ ++ p = ibus_layout; ++ while (*p) { ++ if (*p == '(' || *p == '[') ++ break; ++ p += 1; ++ } ++ ++ return g_strndup (ibus_layout, p - ibus_layout); ++} ++ ++static gchar * ++variant_from_ibus_layout (const gchar *ibus_layout) ++{ ++ const gchar *a, *b; ++ ++ /* we get something like "layout(variant)[option1,option2]" */ ++ ++ a = ibus_layout; ++ while (*a) { ++ if (*a == '(') ++ break; ++ a += 1; ++ } ++ if (!*a) ++ return NULL; ++ ++ a += 1; ++ b = a; ++ while (*b) { ++ if (*b == ')') ++ break; ++ b += 1; ++ } ++ if (!*b) ++ return NULL; ++ ++ return g_strndup (a, b - a); ++} ++ ++static gchar ** ++options_from_ibus_layout (const gchar *ibus_layout) ++{ ++ const gchar *a, *b; ++ GPtrArray *opt_array; ++ ++ /* we get something like "layout(variant)[option1,option2]" */ ++ ++ a = ibus_layout; ++ while (*a) { ++ if (*a == '[') ++ break; ++ a += 1; ++ } ++ if (!*a) ++ return NULL; ++ ++ opt_array = g_ptr_array_new (); ++ ++ do { ++ a += 1; ++ b = a; ++ while (*b) { ++ if (*b == ',' || *b == ']') ++ break; ++ b += 1; ++ } ++ if (!*b) ++ goto out; ++ ++ g_ptr_array_add (opt_array, g_strndup (a, b - a)); ++ ++ a = b; ++ } while (*a && *a == ','); ++ ++out: ++ g_ptr_array_add (opt_array, NULL); ++ return (gchar **) g_ptr_array_free (opt_array, FALSE); ++} ++ ++static const gchar * ++engine_from_locale (void) ++{ ++ const gchar *locale; ++ const gchar *locale_engine[][2] = { ++ { "as_IN", "m17n:as:phonetic" }, ++ { "bn_IN", "m17n:bn:inscript" }, ++ { "gu_IN", "m17n:gu:inscript" }, ++ { "hi_IN", "m17n:hi:inscript" }, ++ { "ja_JP", "anthy" }, ++ { "kn_IN", "m17n:kn:kgp" }, ++ { "ko_KR", "hangul" }, ++ { "mai_IN", "m17n:mai:inscript" }, ++ { "ml_IN", "m17n:ml:inscript" }, ++ { "mr_IN", "m17n:mr:inscript" }, ++ { "or_IN", "m17n:or:inscript" }, ++ { "pa_IN", "m17n:pa:inscript" }, ++ { "sd_IN", "m17n:sd:inscript" }, ++ { "ta_IN", "m17n:ta:tamil99" }, ++ { "te_IN", "m17n:te:inscript" }, ++ { "zh_CN", "pinyin" }, ++ { "zh_HK", "cangjie3" }, ++ { "zh_TW", "chewing" }, ++ }; ++ gint i; ++ ++ locale = setlocale (LC_CTYPE, NULL); ++ if (!locale) ++ return NULL; ++ ++ for (i = 0; i < G_N_ELEMENTS (locale_engine); ++i) ++ if (g_str_has_prefix (locale, locale_engine[i][0])) ++ return locale_engine[i][1]; ++ ++ return NULL; ++} ++ ++static void ++add_ibus_sources_from_locale (GSettings *settings) ++{ ++ const gchar *locale_engine; ++ GVariantBuilder builder; ++ ++ locale_engine = engine_from_locale (); ++ if (!locale_engine) ++ return; ++ ++ init_builder_with_sources (&builder, settings); ++ g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_IBUS, locale_engine); ++ g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); ++} ++ ++static void ++convert_ibus (GSettings *settings) ++{ ++ GVariantBuilder builder; ++ GSettings *ibus_settings; ++ gchar **engines, **e; ++ ++ if (!schema_is_installed ("org.freedesktop.ibus.general")) ++ return; ++ ++ init_builder_with_sources (&builder, settings); ++ ++ ibus_settings = g_settings_new ("org.freedesktop.ibus.general"); ++ engines = g_settings_get_strv (ibus_settings, "preload-engines"); ++ for (e = engines; *e; ++e) { ++ if (g_str_has_prefix (*e, "xkb:")) ++ continue; ++ g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_IBUS, *e); ++ } ++ ++ g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); ++ ++ g_strfreev (engines); ++ g_object_unref (ibus_settings); ++} ++#endif /* HAVE_IBUS */ ++ + static gboolean + xkb_set_keyboard_autorepeat_rate (guint delay, guint interval) + { +@@ -97,32 +634,33 @@ xkb_set_keyboard_autorepeat_rate (guint + interval); + } + +-static void +-numlock_xkb_init (CsdKeyboardManager *manager) ++static gboolean ++check_xkb_extension (CsdKeyboardManager *manager) + { + Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); +- gboolean have_xkb; + int opcode, error_base, major, minor; ++ gboolean have_xkb; + + have_xkb = XkbQueryExtension (dpy, + &opcode, + &manager->priv->xkb_event_base, + &error_base, + &major, +- &minor) +- && XkbUseExtension (dpy, &major, &minor); ++ &minor); ++ return have_xkb; ++} + +- if (have_xkb) { +- XkbSelectEventDetails (dpy, +- XkbUseCoreKbd, +- XkbStateNotifyMask, +- XkbModifierLockMask, +- XkbModifierLockMask); +- } else { +- g_warning ("XKB extension not available"); +- } ++static void ++xkb_init (CsdKeyboardManager *manager) ++{ ++ Display *dpy; + +- manager->priv->have_xkb = have_xkb; ++ dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); ++ XkbSelectEventDetails (dpy, ++ XkbUseCoreKbd, ++ XkbStateNotify, ++ XkbModifierLockMask, ++ XkbModifierLockMask); + } + + static unsigned +@@ -143,19 +681,32 @@ numlock_set_xkb_state (CsdNumLockState n + XkbLockModifiers (dpy, XkbUseCoreKbd, num_mask, new_state == CSD_NUM_LOCK_STATE_ON ? num_mask : 0); + } + ++static const char * ++num_lock_state_to_string (CsdNumLockState numlock_state) ++{ ++ switch (numlock_state) { ++ case CSD_NUM_LOCK_STATE_UNKNOWN: ++ return "CSD_NUM_LOCK_STATE_UNKNOWN"; ++ case CSD_NUM_LOCK_STATE_ON: ++ return "CSD_NUM_LOCK_STATE_ON"; ++ case CSD_NUM_LOCK_STATE_OFF: ++ return "CSD_NUM_LOCK_STATE_OFF"; ++ default: ++ return "UNKNOWN"; ++ } ++} ++ + static GdkFilterReturn +-numlock_xkb_callback (GdkXEvent *xev_, +- GdkEvent *gdkev_, +- gpointer user_data) ++xkb_events_filter (GdkXEvent *xev_, ++ GdkEvent *gdkev_, ++ gpointer user_data) + { + XEvent *xev = (XEvent *) xev_; + XkbEvent *xkbev = (XkbEvent *) xev; + CsdKeyboardManager *manager = (CsdKeyboardManager *) user_data; + +- if (xev->type != manager->priv->xkb_event_base) +- return GDK_FILTER_CONTINUE; +- +- if (xkbev->any.xkb_type != XkbStateNotify) ++ if (xev->type != manager->priv->xkb_event_base || ++ xkbev->any.xkb_type != XkbStateNotify) + return GDK_FILTER_CONTINUE; + + if (xkbev->state.changed & XkbModifierLockMask) { +@@ -166,6 +717,9 @@ numlock_xkb_callback (GdkXEvent *xev_, + numlock_state = (num_mask & locked_mods) ? CSD_NUM_LOCK_STATE_ON : CSD_NUM_LOCK_STATE_OFF; + + if (numlock_state != manager->priv->old_state) { ++ g_debug ("New num-lock state '%s' != Old num-lock state '%s'", ++ num_lock_state_to_string (numlock_state), ++ num_lock_state_to_string (manager->priv->old_state)); + g_settings_set_enum (manager->priv->settings, + KEY_NUMLOCK_STATE, + numlock_state); +@@ -177,57 +731,509 @@ numlock_xkb_callback (GdkXEvent *xev_, + } + + static void +-numlock_install_xkb_callback (CsdKeyboardManager *manager) ++install_xkb_filter (CsdKeyboardManager *manager) + { +- if (!manager->priv->have_xkb) +- return; +- + gdk_window_add_filter (NULL, +- numlock_xkb_callback, ++ xkb_events_filter, + manager); + } + +-static guint +-_csd_settings_get_uint (GSettings *settings, +- const char *key) ++static void ++remove_xkb_filter (CsdKeyboardManager *manager) + { +- guint value; ++ gdk_window_remove_filter (NULL, ++ xkb_events_filter, ++ manager); ++} + +- g_settings_get (settings, key, "u", &value); +- return value; ++static void ++free_xkb_component_names (XkbComponentNamesRec *p) ++{ ++ g_return_if_fail (p != NULL); ++ ++ free (p->keymap); ++ free (p->keycodes); ++ free (p->types); ++ free (p->compat); ++ free (p->symbols); ++ free (p->geometry); ++ ++ g_free (p); ++} ++ ++static void ++upload_xkb_description (const gchar *rules_file_path, ++ XkbRF_VarDefsRec *var_defs, ++ XkbComponentNamesRec *comp_names) ++{ ++ Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); ++ XkbDescRec *xkb_desc; ++ gchar *rules_file; ++ ++ /* Upload it to the X server using the same method as setxkbmap */ ++ xkb_desc = XkbGetKeyboardByName (display, ++ XkbUseCoreKbd, ++ comp_names, ++ XkbGBN_AllComponentsMask, ++ XkbGBN_AllComponentsMask & ++ (~XkbGBN_GeometryMask), True); ++ if (!xkb_desc) { ++ g_warning ("Couldn't upload new XKB keyboard description"); ++ return; ++ } ++ ++ XkbFreeKeyboard (xkb_desc, 0, True); ++ ++ rules_file = g_path_get_basename (rules_file_path); ++ ++ if (!XkbRF_SetNamesProp (display, rules_file, var_defs)) ++ g_warning ("Couldn't update the XKB root window property"); ++ ++ g_free (rules_file); ++} ++ ++static gchar * ++language_code_from_locale (const gchar *locale) ++{ ++ if (!locale || !locale[0] || !locale[1]) ++ return NULL; ++ ++ if (!locale[2] || locale[2] == '_' || locale[2] == '.') ++ return g_strndup (locale, 2); ++ ++ if (!locale[3] || locale[3] == '_' || locale[3] == '.') ++ return g_strndup (locale, 3); ++ ++ return NULL; ++} ++ ++static gchar * ++build_xkb_group_string (const gchar *user, ++ const gchar *locale, ++ const gchar *latin) ++{ ++ gchar *string; ++ gsize length = 0; ++ guint commas = 2; ++ ++ if (latin) ++ length += strlen (latin); ++ else ++ commas -= 1; ++ ++ if (locale) ++ length += strlen (locale); ++ else ++ commas -= 1; ++ ++ length += strlen (user) + commas + 1; ++ ++ string = malloc (length); ++ ++ if (locale && latin) ++ sprintf (string, "%s,%s,%s", user, locale, latin); ++ else if (locale) ++ sprintf (string, "%s,%s", user, locale); ++ else if (latin) ++ sprintf (string, "%s,%s", user, latin); ++ else ++ sprintf (string, "%s", user); ++ ++ return string; ++} ++ ++static gboolean ++layout_equal (const gchar *layout_a, ++ const gchar *variant_a, ++ const gchar *layout_b, ++ const gchar *variant_b) ++{ ++ return !g_strcmp0 (layout_a, layout_b) && !g_strcmp0 (variant_a, variant_b); + } + + static void +-apply_settings (GSettings *settings, +- const char *key, +- CsdKeyboardManager *manager) ++replace_layout_and_variant (CsdKeyboardManager *manager, ++ XkbRF_VarDefsRec *xkb_var_defs, ++ const gchar *layout, ++ const gchar *variant) + { ++ /* Toolkits need to know about both a latin layout to handle ++ * accelerators which are usually defined like Ctrl+C and a ++ * layout with the symbols for the language used in UI strings ++ * to handle mnemonics like Alt+Ф, so we try to find and add ++ * them in XKB group slots after the layout which the user ++ * actually intends to type with. */ ++ const gchar *latin_layout = "us"; ++ const gchar *latin_variant = ""; ++ const gchar *locale_layout = NULL; ++ const gchar *locale_variant = NULL; ++ const gchar *locale; ++ gchar *language; ++ ++ if (!layout) ++ return; ++ ++ if (!variant) ++ variant = ""; ++ ++ locale = setlocale (LC_MESSAGES, NULL); ++ /* If LANG is empty, default to en_US */ ++ if (!locale) ++ language = g_strdup (DEFAULT_LANGUAGE); ++ else ++ language = language_code_from_locale (locale); ++ ++ if (!language) ++ language = language_code_from_locale (DEFAULT_LANGUAGE); ++ ++ gnome_xkb_info_get_layout_info_for_language (manager->priv->xkb_info, ++ language, ++ NULL, ++ NULL, ++ NULL, ++ &locale_layout, ++ &locale_variant); ++ g_free (language); ++ ++ /* We want to minimize the number of XKB groups if we have ++ * duplicated layout+variant pairs. ++ * ++ * Also, if a layout doesn't have a variant we still have to ++ * include it in the variants string because the number of ++ * variants must agree with the number of layouts. For ++ * instance: ++ * ++ * layouts: "us,ru,us" ++ * variants: "dvorak,," ++ */ ++ if (layout_equal (latin_layout, latin_variant, locale_layout, locale_variant) || ++ layout_equal (latin_layout, latin_variant, layout, variant)) { ++ latin_layout = NULL; ++ latin_variant = NULL; ++ } ++ ++ if (layout_equal (locale_layout, locale_variant, layout, variant)) { ++ locale_layout = NULL; ++ locale_variant = NULL; ++ } ++ ++ free (xkb_var_defs->layout); ++ xkb_var_defs->layout = build_xkb_group_string (layout, locale_layout, latin_layout); ++ ++ free (xkb_var_defs->variant); ++ xkb_var_defs->variant = build_xkb_group_string (variant, locale_variant, latin_variant); ++} ++ ++static gchar * ++build_xkb_options_string (gchar **options) ++{ ++ gchar *string; ++ ++ if (*options) { ++ gint i; ++ gsize len; ++ gchar *ptr; ++ ++ /* First part, getting length */ ++ len = 1 + strlen (options[0]); ++ for (i = 1; options[i] != NULL; i++) ++ len += strlen (options[i]); ++ len += (i - 1); /* commas */ ++ ++ /* Second part, building string */ ++ string = malloc (len); ++ ptr = g_stpcpy (string, *options); ++ for (i = 1; options[i] != NULL; i++) { ++ ptr = g_stpcpy (ptr, ","); ++ ptr = g_stpcpy (ptr, options[i]); ++ } ++ } else { ++ string = malloc (1); ++ *string = '\0'; ++ } ++ ++ return string; ++} ++ ++static gchar ** ++append_options (gchar **a, ++ gchar **b) ++{ ++ gchar **c, **p; ++ ++ if (!a && !b) ++ return NULL; ++ else if (!a) ++ return g_strdupv (b); ++ else if (!b) ++ return g_strdupv (a); ++ ++ c = g_new0 (gchar *, g_strv_length (a) + g_strv_length (b) + 1); ++ p = c; ++ ++ while (*a) { ++ *p = g_strdup (*a); ++ p += 1; ++ a += 1; ++ } ++ while (*b) { ++ *p = g_strdup (*b); ++ p += 1; ++ b += 1; ++ } ++ ++ return c; ++} ++ ++static void ++add_xkb_options (CsdKeyboardManager *manager, ++ XkbRF_VarDefsRec *xkb_var_defs, ++ gchar **extra_options) ++{ ++ gchar **options; ++ gchar **settings_options; ++ ++ settings_options = g_settings_get_strv (manager->priv->input_sources_settings, ++ KEY_KEYBOARD_OPTIONS); ++ options = append_options (settings_options, extra_options); ++ g_strfreev (settings_options); ++ ++ free (xkb_var_defs->options); ++ xkb_var_defs->options = build_xkb_options_string (options); ++ ++ g_strfreev (options); ++} ++ ++static void ++apply_xkb_settings (CsdKeyboardManager *manager, ++ const gchar *layout, ++ const gchar *variant, ++ gchar **options) ++{ ++ XkbRF_RulesRec *xkb_rules; ++ XkbRF_VarDefsRec *xkb_var_defs; ++ gchar *rules_file_path; ++ ++ gnome_xkb_info_get_var_defs (&rules_file_path, &xkb_var_defs); ++ ++ add_xkb_options (manager, xkb_var_defs, options); ++ replace_layout_and_variant (manager, xkb_var_defs, layout, variant); ++ ++ gdk_error_trap_push (); ++ ++ xkb_rules = XkbRF_Load (rules_file_path, NULL, True, True); ++ if (xkb_rules) { ++ XkbComponentNamesRec *xkb_comp_names; ++ xkb_comp_names = g_new0 (XkbComponentNamesRec, 1); ++ ++ XkbRF_GetComponents (xkb_rules, xkb_var_defs, xkb_comp_names); ++ upload_xkb_description (rules_file_path, xkb_var_defs, xkb_comp_names); ++ ++ free_xkb_component_names (xkb_comp_names); ++ XkbRF_Free (xkb_rules, True); ++ } else { ++ g_warning ("Couldn't load XKB rules"); ++ } ++ ++ if (gdk_error_trap_pop ()) ++ g_warning ("Error loading XKB rules"); ++ ++ gnome_xkb_info_free_var_defs (xkb_var_defs); ++ g_free (rules_file_path); ++} ++ ++static void ++set_gtk_im_module (CsdKeyboardManager *manager, ++ const gchar *new_module) ++{ ++ CsdKeyboardManagerPrivate *priv = manager->priv; ++ gchar *current_module; ++ ++ current_module = g_settings_get_string (priv->interface_settings, ++ KEY_GTK_IM_MODULE); ++ if (!g_str_equal (current_module, new_module)) ++ g_settings_set_string (priv->interface_settings, ++ KEY_GTK_IM_MODULE, ++ new_module); ++ g_free (current_module); ++} ++ ++static gboolean ++apply_input_sources_settings (GSettings *settings, ++ gpointer keys, ++ gint n_keys, ++ CsdKeyboardManager *manager) ++{ ++ CsdKeyboardManagerPrivate *priv = manager->priv; ++ GVariant *sources; ++ guint current; ++ guint n_sources; ++ const gchar *type = NULL; ++ const gchar *id = NULL; ++ gchar *layout = NULL; ++ gchar *variant = NULL; ++ gchar **options = NULL; ++ ++ sources = g_settings_get_value (priv->input_sources_settings, KEY_INPUT_SOURCES); ++ current = g_settings_get_uint (priv->input_sources_settings, KEY_CURRENT_INPUT_SOURCE); ++ n_sources = g_variant_n_children (sources); ++ ++ if (n_sources < 1) ++ goto exit; ++ ++ if (current >= n_sources) { ++ g_settings_set_uint (priv->input_sources_settings, ++ KEY_CURRENT_INPUT_SOURCE, ++ n_sources - 1); ++ goto exit; ++ } ++ ++#ifdef HAVE_IBUS ++ maybe_start_ibus (manager, sources); ++#endif ++ ++ g_variant_get_child (sources, current, "(&s&s)", &type, &id); ++ ++ if (g_str_equal (type, INPUT_SOURCE_TYPE_XKB)) { ++ const gchar *l, *v; ++ gnome_xkb_info_get_layout_info (priv->xkb_info, id, NULL, NULL, &l, &v); ++ ++ layout = g_strdup (l); ++ variant = g_strdup (v); ++ ++ if (!layout || !layout[0]) { ++ g_warning ("Couldn't find XKB input source '%s'", id); ++ goto exit; ++ } ++ set_gtk_im_module (manager, GTK_IM_MODULE_SIMPLE); ++#ifdef HAVE_IBUS ++ set_ibus_xkb_engine (manager, id); ++#endif ++ } else if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) { ++#ifdef HAVE_IBUS ++ IBusEngineDesc *engine_desc = NULL; ++ ++ if (priv->session_is_fallback) ++ goto exit; ++ ++ if (priv->ibus_engines) ++ engine_desc = g_hash_table_lookup (priv->ibus_engines, id); ++ else ++ goto exit; /* we'll be called again when ibus is up and running */ ++ ++ if (engine_desc) { ++ const gchar *ibus_layout; ++ ibus_layout = ibus_engine_desc_get_layout (engine_desc); ++ ++ if (ibus_layout) { ++ layout = layout_from_ibus_layout (ibus_layout); ++ variant = variant_from_ibus_layout (ibus_layout); ++ options = options_from_ibus_layout (ibus_layout); ++ } ++ } else { ++ g_warning ("Couldn't find IBus input source '%s'", id); ++ goto exit; ++ } ++ ++ set_gtk_im_module (manager, GTK_IM_MODULE_IBUS); ++ set_ibus_engine (manager, id); ++#else ++ g_warning ("IBus input source type specified but IBus support was not compiled"); ++#endif ++ } else { ++ g_warning ("Unknown input source type '%s'", type); ++ } ++ ++ exit: ++ apply_xkb_settings (manager, layout, variant, options); ++ g_variant_unref (sources); ++ g_free (layout); ++ g_free (variant); ++ g_strfreev (options); ++ /* Prevent individual "changed" signal invocations since we ++ don't need them. */ ++ return TRUE; ++} ++ ++static void ++apply_bell (CsdKeyboardManager *manager) ++{ ++ GSettings *settings; + XKeyboardControl kbdcontrol; +- gboolean repeat; + gboolean click; +- guint interval; +- guint delay; +- int click_volume; + int bell_volume; + int bell_pitch; + int bell_duration; + CsdBellMode bell_mode; +- gboolean rnumlock; +- +- if (g_strcmp0 (key, KEY_NUMLOCK_STATE) == 0) +- return; ++ int click_volume; + +- repeat = g_settings_get_boolean (settings, KEY_REPEAT); ++ g_debug ("Applying the bell settings"); ++ settings = manager->priv->settings; + click = g_settings_get_boolean (settings, KEY_CLICK); +- interval = _csd_settings_get_uint (settings, KEY_INTERVAL); +- delay = _csd_settings_get_uint (settings, KEY_DELAY); + click_volume = g_settings_get_int (settings, KEY_CLICK_VOLUME); ++ + bell_pitch = g_settings_get_int (settings, KEY_BELL_PITCH); + bell_duration = g_settings_get_int (settings, KEY_BELL_DURATION); + + bell_mode = g_settings_get_enum (settings, KEY_BELL_MODE); + bell_volume = (bell_mode == CSD_BELL_MODE_ON) ? 50 : 0; + ++ /* as percentage from 0..100 inclusive */ ++ if (click_volume < 0) { ++ click_volume = 0; ++ } else if (click_volume > 100) { ++ click_volume = 100; ++ } ++ kbdcontrol.key_click_percent = click ? click_volume : 0; ++ kbdcontrol.bell_percent = bell_volume; ++ kbdcontrol.bell_pitch = bell_pitch; ++ kbdcontrol.bell_duration = bell_duration; ++ ++ gdk_error_trap_push (); ++ XChangeKeyboardControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), ++ KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration, ++ &kbdcontrol); ++ ++ XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); ++ gdk_error_trap_pop_ignored (); ++} ++ ++static void ++apply_numlock (CsdKeyboardManager *manager) ++{ ++ GSettings *settings; ++ gboolean rnumlock; ++ ++ g_debug ("Applying the num-lock settings"); ++ settings = manager->priv->settings; ++ rnumlock = g_settings_get_boolean (settings, KEY_REMEMBER_NUMLOCK_STATE); ++ manager->priv->old_state = g_settings_get_enum (manager->priv->settings, KEY_NUMLOCK_STATE); ++ ++ gdk_error_trap_push (); ++ if (rnumlock) { ++ g_debug ("Remember num-lock is set, so applying setting '%s'", ++ num_lock_state_to_string (manager->priv->old_state)); ++ numlock_set_xkb_state (manager->priv->old_state); ++ } ++ ++ XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); ++ gdk_error_trap_pop_ignored (); ++} ++ ++static void ++apply_repeat (CsdKeyboardManager *manager) ++{ ++ GSettings *settings; ++ gboolean repeat; ++ guint interval; ++ guint delay; ++ ++ g_debug ("Applying the repeat settings"); ++ settings = manager->priv->settings; ++ repeat = g_settings_get_boolean (settings, KEY_REPEAT); ++ interval = g_settings_get_uint (settings, KEY_INTERVAL); ++ delay = g_settings_get_uint (settings, KEY_DELAY); ++ + gdk_error_trap_push (); + if (repeat) { + gboolean rate_set = FALSE; +@@ -243,124 +1249,319 @@ apply_settings (GSettings *sett + XAutoRepeatOff (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); + } + +- /* as percentage from 0..100 inclusive */ +- if (click_volume < 0) { +- click_volume = 0; +- } else if (click_volume > 100) { +- click_volume = 100; ++ XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); ++ gdk_error_trap_pop_ignored (); ++} ++ ++static void ++apply_all_settings (CsdKeyboardManager *manager) ++{ ++ apply_repeat (manager); ++ apply_bell (manager); ++ apply_numlock (manager); ++} ++ ++static void ++set_input_sources_switcher (CsdKeyboardManager *manager, ++ gboolean state) ++{ ++ if (state) { ++ GError *error = NULL; ++ char *args[2]; ++ ++ if (manager->priv->input_sources_switcher_spawned) ++ set_input_sources_switcher (manager, FALSE); ++ ++ args[0] = LIBEXECDIR "/csd-input-sources-switcher"; ++ args[1] = NULL; ++ ++ g_spawn_async (NULL, args, NULL, ++ 0, NULL, NULL, ++ &manager->priv->input_sources_switcher_pid, &error); ++ ++ manager->priv->input_sources_switcher_spawned = (error == NULL); ++ ++ if (error) { ++ g_warning ("Couldn't spawn %s: %s", args[0], error->message); ++ g_error_free (error); ++ } ++ } else if (manager->priv->input_sources_switcher_spawned) { ++ kill (manager->priv->input_sources_switcher_pid, SIGHUP); ++ g_spawn_close_pid (manager->priv->input_sources_switcher_pid); ++ manager->priv->input_sources_switcher_spawned = FALSE; + } +- kbdcontrol.key_click_percent = click ? click_volume : 0; +- kbdcontrol.bell_percent = bell_volume; +- kbdcontrol.bell_pitch = bell_pitch; +- kbdcontrol.bell_duration = bell_duration; +- XChangeKeyboardControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), +- KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration, +- &kbdcontrol); ++} + +- if (g_strcmp0 (key, "remember-numlock-state") == 0 || key == NULL) { +- rnumlock = g_settings_get_boolean (settings, "remember-numlock-state"); ++static gboolean ++enable_switcher (CsdKeyboardManager *manager) ++{ ++ CsdInputSourcesSwitcher switcher; + +- manager->priv->old_state = g_settings_get_enum (manager->priv->settings, KEY_NUMLOCK_STATE); ++ switcher = g_settings_get_enum (manager->priv->settings, KEY_SWITCHER); + +- if (manager->priv->have_xkb && rnumlock) +- numlock_set_xkb_state (manager->priv->old_state); ++ return switcher != CSD_INPUT_SOURCES_SWITCHER_OFF; ++} ++ ++static void ++settings_changed (GSettings *settings, ++ const char *key, ++ CsdKeyboardManager *manager) ++{ ++ if (g_strcmp0 (key, KEY_CLICK) == 0|| ++ g_strcmp0 (key, KEY_CLICK_VOLUME) == 0 || ++ g_strcmp0 (key, KEY_BELL_PITCH) == 0 || ++ g_strcmp0 (key, KEY_BELL_DURATION) == 0 || ++ g_strcmp0 (key, KEY_BELL_MODE) == 0) { ++ g_debug ("Bell setting '%s' changed, applying bell settings", key); ++ apply_bell (manager); ++ } else if (g_strcmp0 (key, KEY_REMEMBER_NUMLOCK_STATE) == 0) { ++ g_debug ("Remember Num-Lock state '%s' changed, applying num-lock settings", key); ++ apply_numlock (manager); ++ } else if (g_strcmp0 (key, KEY_NUMLOCK_STATE) == 0) { ++ g_debug ("Num-Lock state '%s' changed, will apply at next startup", key); ++ } else if (g_strcmp0 (key, KEY_REPEAT) == 0 || ++ g_strcmp0 (key, KEY_INTERVAL) == 0 || ++ g_strcmp0 (key, KEY_DELAY) == 0) { ++ g_debug ("Key repeat setting '%s' changed, applying key repeat settings", key); ++ apply_repeat (manager); ++ } else if (g_strcmp0 (key, KEY_SWITCHER) == 0) { ++ set_input_sources_switcher (manager, enable_switcher (manager)); ++ } else { ++ g_warning ("Unhandled settings change, key '%s'", key); + } + +- XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); +- gdk_error_trap_pop_ignored (); + } + +-void +-csd_keyboard_manager_apply_settings (CsdKeyboardManager *manager) ++static void ++device_added_cb (GdkDeviceManager *device_manager, ++ GdkDevice *device, ++ CsdKeyboardManager *manager) + { +- apply_settings (manager->priv->settings, NULL, manager); ++ GdkInputSource source; ++ ++ source = gdk_device_get_source (device); ++ if (source == GDK_SOURCE_KEYBOARD) { ++ g_debug ("New keyboard plugged in, applying all settings"); ++ apply_all_settings (manager); ++ apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager); ++ run_custom_command (device, COMMAND_DEVICE_ADDED); ++ } + } + + static void +-apply_libgnomekbd_settings (GSettings *settings, +- const char *key, +- CsdKeyboardManager *manager) ++device_removed_cb (GdkDeviceManager *device_manager, ++ GdkDevice *device, ++ CsdKeyboardManager *manager) + { +- gchar **layouts; ++ GdkInputSource source; + +- layouts = g_settings_get_strv (settings, LIBGNOMEKBD_KEY_LAYOUTS); ++ source = gdk_device_get_source (device); ++ if (source == GDK_SOURCE_KEYBOARD) { ++ run_custom_command (device, COMMAND_DEVICE_REMOVED); ++ } ++} + +- /* Get accounts daemon */ +- GDBusProxy *proxy = NULL; +- GDBusProxy *user = NULL; +- GVariant *variant = NULL; +- GError *error = NULL; +- gchar *object_path = NULL; ++static void ++set_devicepresence_handler (CsdKeyboardManager *manager) ++{ ++ GdkDeviceManager *device_manager; + +- proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, +- G_DBUS_PROXY_FLAGS_NONE, +- NULL, +- "org.freedesktop.Accounts", +- "/org/freedesktop/Accounts", +- "org.freedesktop.Accounts", +- NULL, +- &error); ++ device_manager = gdk_display_get_device_manager (gdk_display_get_default ()); + +- if (proxy == NULL) { +- g_warning ("Failed to contact accounts service: %s", error->message); +- g_error_free (error); +- goto bail; ++ manager->priv->device_added_id = g_signal_connect (G_OBJECT (device_manager), "device-added", ++ G_CALLBACK (device_added_cb), manager); ++ manager->priv->device_removed_id = g_signal_connect (G_OBJECT (device_manager), "device-removed", ++ G_CALLBACK (device_removed_cb), manager); ++ manager->priv->device_manager = device_manager; ++} ++ ++static void ++create_sources_from_current_xkb_config (GSettings *settings) ++{ ++ GVariantBuilder builder; ++ XkbRF_VarDefsRec *xkb_var_defs; ++ gchar *tmp; ++ gchar **layouts = NULL; ++ gchar **variants = NULL; ++ guint i, n; ++ ++ gnome_xkb_info_get_var_defs (&tmp, &xkb_var_defs); ++ g_free (tmp); ++ ++ if (xkb_var_defs->layout) ++ layouts = g_strsplit (xkb_var_defs->layout, ",", 0); ++ if (xkb_var_defs->variant) ++ variants = g_strsplit (xkb_var_defs->variant, ",", 0); ++ ++ gnome_xkb_info_free_var_defs (xkb_var_defs); ++ ++ if (!layouts) ++ goto out; ++ ++ if (variants && variants[0]) ++ n = MIN (g_strv_length (layouts), g_strv_length (variants)); ++ else ++ n = g_strv_length (layouts); ++ ++ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)")); ++ for (i = 0; i < n && layouts[i][0]; ++i) { ++ if (variants && variants[i] && variants[i][0]) ++ tmp = g_strdup_printf ("%s+%s", layouts[i], variants[i]); ++ else ++ tmp = g_strdup (layouts[i]); ++ ++ g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_XKB, tmp); ++ g_free (tmp); + } ++ g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); ++out: ++ g_strfreev (layouts); ++ g_strfreev (variants); ++} + +- variant = g_dbus_proxy_call_sync (proxy, +- "FindUserByName", +- g_variant_new ("(s)", g_get_user_name ()), +- G_DBUS_CALL_FLAGS_NONE, +- -1, +- NULL, +- &error); ++static void ++convert_libgnomekbd_options (GSettings *settings) ++{ ++ GPtrArray *opt_array; ++ GSettings *libgnomekbd_settings; ++ gchar **options, **o; + +- if (variant == NULL) { +- g_warning ("Could not contact accounts service to look up '%s': %s", +- g_get_user_name (), error->message); +- g_error_free (error); +- goto bail; ++ if (!schema_is_installed ("org.gnome.libgnomekbd.keyboard")) ++ return; ++ ++ opt_array = g_ptr_array_new_with_free_func (g_free); ++ ++ libgnomekbd_settings = g_settings_new ("org.gnome.libgnomekbd.keyboard"); ++ options = g_settings_get_strv (libgnomekbd_settings, "options"); ++ ++ for (o = options; *o; ++o) { ++ gchar **strv; ++ ++ strv = g_strsplit (*o, "\t", 2); ++ if (strv[0] && strv[1]) { ++ /* We don't want the group switcher because ++ * it's incompatible with the way we use XKB ++ * groups. */ ++ if (!g_str_has_prefix (strv[1], "grp:")) ++ g_ptr_array_add (opt_array, g_strdup (strv[1])); ++ } ++ g_strfreev (strv); + } ++ g_ptr_array_add (opt_array, NULL); + +- g_variant_get (variant, "(o)", &object_path); +- user = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, +- G_DBUS_PROXY_FLAGS_NONE, +- NULL, +- "org.freedesktop.Accounts", +- object_path, +- "org.freedesktop.Accounts.User", +- NULL, +- &error); +- g_free (object_path); ++ g_settings_set_strv (settings, KEY_KEYBOARD_OPTIONS, (const gchar * const*) opt_array->pdata); + +- if (user == NULL) { +- g_warning ("Could not create proxy for user '%s': %s", +- g_variant_get_string (variant, NULL), error->message); +- g_error_free (error); +- goto bail; ++ g_strfreev (options); ++ g_object_unref (libgnomekbd_settings); ++ g_ptr_array_free (opt_array, TRUE); ++} ++ ++static void ++convert_libgnomekbd_layouts (GSettings *settings) ++{ ++ GVariantBuilder builder; ++ GSettings *libgnomekbd_settings; ++ gchar **layouts, **l; ++ ++ if (!schema_is_installed ("org.gnome.libgnomekbd.keyboard")) ++ return; ++ ++ init_builder_with_sources (&builder, settings); ++ ++ libgnomekbd_settings = g_settings_new ("org.gnome.libgnomekbd.keyboard"); ++ layouts = g_settings_get_strv (libgnomekbd_settings, "layouts"); ++ ++ for (l = layouts; *l; ++l) { ++ gchar *id; ++ gchar **strv; ++ ++ strv = g_strsplit (*l, "\t", 2); ++ if (strv[0] && !strv[1]) ++ id = g_strdup (strv[0]); ++ else if (strv[0] && strv[1]) ++ id = g_strdup_printf ("%s+%s", strv[0], strv[1]); ++ else ++ id = NULL; ++ ++ if (id) ++ g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_XKB, id); ++ ++ g_free (id); ++ g_strfreev (strv); + } +- g_variant_unref (variant); + +- variant = g_dbus_proxy_call_sync (user, +- "SetXKeyboardLayouts", +- g_variant_new ("(^as)", layouts), +- G_DBUS_CALL_FLAGS_NONE, +- -1, +- NULL, +- &error); ++ g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); ++ ++ g_strfreev (layouts); ++ g_object_unref (libgnomekbd_settings); ++} + +- if (variant == NULL) { +- g_warning ("Failed to set the keyboard layouts: %s", error->message); ++static void ++maybe_convert_old_settings (GSettings *settings) ++{ ++ GVariant *sources; ++ gchar **options; ++ gchar *stamp_dir_path = NULL; ++ gchar *stamp_file_path = NULL; ++ GError *error = NULL; ++ ++ stamp_dir_path = g_build_filename (g_get_user_data_dir (), PACKAGE_NAME, NULL); ++ if (g_mkdir_with_parents (stamp_dir_path, 0755)) { ++ g_warning ("Failed to create directory %s: %s", stamp_dir_path, g_strerror (errno)); ++ goto out; ++ } ++ ++ stamp_file_path = g_build_filename (stamp_dir_path, "input-sources-converted", NULL); ++ if (g_file_test (stamp_file_path, G_FILE_TEST_EXISTS)) ++ goto out; ++ ++ sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); ++ if (g_variant_n_children (sources) < 1) { ++ convert_libgnomekbd_layouts (settings); ++#ifdef HAVE_IBUS ++ convert_ibus (settings); ++#endif ++ } ++ g_variant_unref (sources); ++ ++ options = g_settings_get_strv (settings, KEY_KEYBOARD_OPTIONS); ++ if (g_strv_length (options) < 1) ++ convert_libgnomekbd_options (settings); ++ g_strfreev (options); ++ ++ if (!g_file_set_contents (stamp_file_path, "", 0, &error)) { ++ g_warning ("%s", error->message); + g_error_free (error); +- goto bail; + } ++out: ++ g_free (stamp_file_path); ++ g_free (stamp_dir_path); ++} + +-bail: +- if (proxy != NULL) +- g_object_unref (proxy); +- if (variant != NULL) +- g_variant_unref (variant); +- g_strfreev (layouts); ++static void ++maybe_create_input_sources (CsdKeyboardManager *manager) ++{ ++ GSettings *settings; ++ GVariant *sources; ++ ++ settings = manager->priv->input_sources_settings; ++ ++ if (g_getenv ("RUNNING_UNDER_GDM")) { ++ create_sources_from_current_xkb_config (settings); ++ return; ++ } ++ ++ maybe_convert_old_settings (settings); ++ ++ /* if we still don't have anything do some educated guesses */ ++ sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); ++ if (g_variant_n_children (sources) < 1) { ++ create_sources_from_current_xkb_config (settings); ++#ifdef HAVE_IBUS ++ add_ibus_sources_from_locale (settings); ++#endif ++ } ++ g_variant_unref (sources); + } + + static gboolean +@@ -370,26 +1571,41 @@ start_keyboard_idle_cb (CsdKeyboardManag + + g_debug ("Starting keyboard manager"); + +- manager->priv->have_xkb = 0; + manager->priv->settings = g_settings_new (CSD_KEYBOARD_DIR); +- manager->priv->libgnomekbd_settings = g_settings_new (LIBGNOMEKBD_KEYBOARD_DIR); + +- /* Essential - xkb initialization should happen before */ +- csd_keyboard_xkb_init (manager); ++ xkb_init (manager); + +- numlock_xkb_init (manager); ++ set_devicepresence_handler (manager); + ++ manager->priv->input_sources_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); ++ manager->priv->interface_settings = g_settings_new (GNOME_DESKTOP_INTERFACE_DIR); ++ manager->priv->xkb_info = gnome_xkb_info_new (); ++ ++ maybe_create_input_sources (manager); ++ ++#ifdef HAVE_IBUS ++ /* We don't want to touch IBus until we are sure this isn't a ++ fallback session. */ ++ manager->priv->session_is_fallback = TRUE; ++ manager->priv->ibus_cancellable = g_cancellable_new (); ++ g_bus_get (G_BUS_TYPE_SESSION, ++ manager->priv->ibus_cancellable, ++ (GAsyncReadyCallback)got_bus, ++ manager); ++#else ++ apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager); ++#endif + /* apply current settings before we install the callback */ +- csd_keyboard_manager_apply_settings (manager); ++ g_debug ("Started the keyboard plugin, applying all settings"); ++ apply_all_settings (manager); + + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", +- G_CALLBACK (apply_settings), manager); +- +- apply_libgnomekbd_settings (manager->priv->libgnomekbd_settings, NULL, manager); +- g_signal_connect (G_OBJECT (manager->priv->libgnomekbd_settings), "changed", +- G_CALLBACK (apply_libgnomekbd_settings), manager); ++ G_CALLBACK (settings_changed), manager); ++ g_signal_connect (G_OBJECT (manager->priv->input_sources_settings), "change-event", ++ G_CALLBACK (apply_input_sources_settings), manager); + +- numlock_install_xkb_callback (manager); ++ install_xkb_filter (manager); ++ set_input_sources_switcher (manager, enable_switcher (manager)); + + cinnamon_settings_profile_end (NULL); + +@@ -404,6 +1620,11 @@ csd_keyboard_manager_start (CsdKeyboardM + { + cinnamon_settings_profile_start (NULL); + ++ if (check_xkb_extension (manager) == FALSE) { ++ g_debug ("XKB is not supported, not applying any settings"); ++ return TRUE; ++ } ++ + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_keyboard_idle_cb, manager); + + cinnamon_settings_profile_end (NULL); +@@ -418,37 +1639,24 @@ csd_keyboard_manager_stop (CsdKeyboardMa + + g_debug ("Stopping keyboard manager"); + +- if (p->settings != NULL) { +- g_object_unref (p->settings); +- p->settings = NULL; +- } ++ g_clear_object (&p->settings); ++ g_clear_object (&p->input_sources_settings); ++ g_clear_object (&p->interface_settings); ++ g_clear_object (&p->xkb_info); + +- if (p->libgnomekbd_settings != NULL) { +- g_object_unref (p->libgnomekbd_settings); +- p->libgnomekbd_settings = NULL; +- } ++#ifdef HAVE_IBUS ++ clear_ibus (manager); ++#endif + +- if (p->have_xkb) { +- gdk_window_remove_filter (NULL, +- numlock_xkb_callback, +- manager); ++ if (p->device_manager != NULL) { ++ g_signal_handler_disconnect (p->device_manager, p->device_added_id); ++ g_signal_handler_disconnect (p->device_manager, p->device_removed_id); ++ p->device_manager = NULL; + } + +- csd_keyboard_xkb_shutdown (); +-} +- +-static GObject * +-csd_keyboard_manager_constructor (GType type, +- guint n_construct_properties, +- GObjectConstructParam *construct_properties) +-{ +- CsdKeyboardManager *keyboard_manager; +- +- keyboard_manager = CSD_KEYBOARD_MANAGER (G_OBJECT_CLASS (csd_keyboard_manager_parent_class)->constructor (type, +- n_construct_properties, +- construct_properties)); ++ remove_xkb_filter (manager); + +- return G_OBJECT (keyboard_manager); ++ set_input_sources_switcher (manager, FALSE); + } + + static void +@@ -456,7 +1664,6 @@ csd_keyboard_manager_class_init (CsdKeyb + { + GObjectClass *object_class = G_OBJECT_CLASS (klass); + +- object_class->constructor = csd_keyboard_manager_constructor; + object_class->finalize = csd_keyboard_manager_finalize; + + g_type_class_add_private (klass, sizeof (CsdKeyboardManagerPrivate)); +diff -uNrp a/plugins/keyboard/csd-keyboard-manager.h b/plugins/keyboard/csd-keyboard-manager.h +--- a/plugins/keyboard/csd-keyboard-manager.h 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/keyboard/csd-keyboard-manager.h 2013-08-25 16:36:02.000000000 +0100 +@@ -51,7 +51,6 @@ CsdKeyboardManager * csd_keyboard_ + gboolean csd_keyboard_manager_start (CsdKeyboardManager *manager, + GError **error); + void csd_keyboard_manager_stop (CsdKeyboardManager *manager); +-void csd_keyboard_manager_apply_settings (CsdKeyboardManager *manager); + + G_END_DECLS + +diff -uNrp a/plugins/keyboard/csd-keyboard-plugin.h b/plugins/keyboard/csd-keyboard-plugin.h +--- a/plugins/keyboard/csd-keyboard-plugin.h 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/keyboard/csd-keyboard-plugin.h 2013-08-25 16:36:02.000000000 +0100 +@@ -52,7 +52,7 @@ typedef struct + GType csd_keyboard_plugin_get_type (void) G_GNUC_CONST; + + /* All the plugins must implement this function */ +-G_MODULE_EXPORT GType register_cinnamon_settings_plugin (GTypeModule *module); ++G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + + G_END_DECLS + +diff -uNrp a/plugins/keyboard/csd-keyboard-xkb.c b/plugins/keyboard/csd-keyboard-xkb.c +--- a/plugins/keyboard/csd-keyboard-xkb.c 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/keyboard/csd-keyboard-xkb.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,579 +0,0 @@ +-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- +- * +- * Copyright (C) 2001 Udaltsoft +- * +- * Written by Sergey V. Oudaltsov +- * +- * 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, 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 - Suite 500, Boston, MA +- * 02110-1335, USA. +- */ +- +-#include "config.h" +- +-#include +-#include +- +-#include +-#include +-#include +-#include +- +-#include +- +-#include +-#include +-#include +-#include +-#include +- +-#include "csd-keyboard-xkb.h" +-#include "delayed-dialog.h" +-#include "cinnamon-settings-profile.h" +- +-#define SETTINGS_KEYBOARD_DIR "org.cinnamon.settings-daemon.plugins.keyboard" +- +-static CsdKeyboardManager *manager = NULL; +- +-static XklEngine *xkl_engine; +-static XklConfigRegistry *xkl_registry = NULL; +- +-static GkbdDesktopConfig current_config; +-static GkbdKeyboardConfig current_kbd_config; +- +-/* never terminated */ +-static GkbdKeyboardConfig initial_sys_kbd_config; +- +-static gboolean inited_ok = FALSE; +- +-static GSettings *settings_desktop = NULL; +-static GSettings *settings_keyboard = NULL; +- +-static PostActivationCallback pa_callback = NULL; +-static void *pa_callback_user_data = NULL; +- +-static GtkStatusIcon *icon = NULL; +- +-static GHashTable *preview_dialogs = NULL; +- +-static void +-activation_error (void) +-{ +- char const *vendor; +- GtkWidget *dialog; +- +- vendor = +- ServerVendor (GDK_DISPLAY_XDISPLAY +- (gdk_display_get_default ())); +- +- /* VNC viewers will not work, do not barrage them with warnings */ +- if (NULL != vendor && NULL != strstr (vendor, "VNC")) +- return; +- +- dialog = gtk_message_dialog_new_with_markup (NULL, +- 0, +- GTK_MESSAGE_ERROR, +- GTK_BUTTONS_CLOSE, +- _ +- ("Error activating XKB configuration.\n" +- "There can be various reasons for that.\n\n" +- "If you report this situation as a bug, include the results of\n" +- " • %s\n" +- " • %s\n" +- " • %s\n" +- " • %s"), +- "xprop -root | grep XKB", +- "gsettings get org.gnome.libgnomekbd.keyboard model", +- "gsettings get org.gnome.libgnomekbd.keyboard layouts", +- "gsettings get org.gnome.libgnomekbd.keyboard options"); +- g_signal_connect (dialog, "response", +- G_CALLBACK (gtk_widget_destroy), NULL); +- csd_delayed_show_dialog (dialog); +-} +- +-static gboolean +-ensure_xkl_registry (void) +-{ +- if (!xkl_registry) { +- xkl_registry = +- xkl_config_registry_get_instance (xkl_engine); +- /* load all materials, unconditionally! */ +- if (!xkl_config_registry_load (xkl_registry, TRUE)) { +- g_object_unref (xkl_registry); +- xkl_registry = NULL; +- return FALSE; +- } +- } +- +- return TRUE; +-} +- +-static void +-apply_desktop_settings (void) +-{ +- if (!inited_ok) +- return; +- +- csd_keyboard_manager_apply_settings (manager); +- gkbd_desktop_config_load (¤t_config); +- /* again, probably it would be nice to compare things +- before activating them */ +- gkbd_desktop_config_activate (¤t_config); +-} +- +-static void +-popup_menu_launch_capplet () +-{ +- GAppInfo *info; +- GdkAppLaunchContext *ctx; +- GError *error = NULL; +- +- info = +- g_app_info_create_from_commandline +- ("cinnamon-settings region", NULL, 0, &error); +- +- if (info != NULL) { +- ctx = +- gdk_display_get_app_launch_context +- (gdk_display_get_default ()); +- +- if (g_app_info_launch (info, NULL, +- G_APP_LAUNCH_CONTEXT (ctx), &error) == FALSE) { +- g_warning +- ("Could not execute keyboard properties capplet: [%s]\n", +- error->message); +- g_error_free (error); +- } +- +- g_object_unref (info); +- g_object_unref (ctx); +- } +- +-} +- +-static void +-show_layout_destroy (GtkWidget * dialog, gint group) +-{ +- g_hash_table_remove (preview_dialogs, GINT_TO_POINTER (group)); +-} +- +-static void +-popup_menu_show_layout () +-{ +- GtkWidget *dialog; +- XklEngine *engine = +- xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY +- (gdk_display_get_default ())); +- XklState *xkl_state = xkl_engine_get_current_state (engine); +- +- gchar **group_names = gkbd_status_get_group_names (); +- +- gpointer p = g_hash_table_lookup (preview_dialogs, +- GINT_TO_POINTER +- (xkl_state->group)); +- +- if (xkl_state->group < 0 +- || xkl_state->group >= g_strv_length (group_names)) { +- return; +- } +- +- if (p != NULL) { +- /* existing window */ +- gtk_window_present (GTK_WINDOW (p)); +- return; +- } +- +- if (!ensure_xkl_registry ()) +- return; +- +- dialog = gkbd_keyboard_drawing_dialog_new (); +- gkbd_keyboard_drawing_dialog_set_group (dialog, xkl_registry, xkl_state->group); +- +- g_signal_connect (dialog, "destroy", +- G_CALLBACK (show_layout_destroy), +- GINT_TO_POINTER (xkl_state->group)); +- g_hash_table_insert (preview_dialogs, +- GINT_TO_POINTER (xkl_state->group), dialog); +- gtk_widget_show_all (dialog); +-} +- +-static void +-popup_menu_set_group (gint group_number, gboolean only_menu) +-{ +- +- XklEngine *engine = gkbd_status_get_xkl_engine (); +- +- XklState *st = xkl_engine_get_current_state(engine); +- Window cur; +- st->group = group_number; +- xkl_engine_allow_one_switch_to_secondary_group (engine); +- cur = xkl_engine_get_current_window (engine); +- if (cur != (Window) NULL) { +- xkl_debug (150, "Enforcing the state %d for window %lx\n", +- st->group, cur); +- +- xkl_engine_save_state (engine, +- xkl_engine_get_current_window +- (engine), st); +-/* XSetInputFocus( GDK_DISPLAY(), cur, RevertToNone, CurrentTime );*/ +- } else { +- xkl_debug (150, +- "??? Enforcing the state %d for unknown window\n", +- st->group); +- /* strange situation - bad things can happen */ +- } +- if (!only_menu) +- xkl_engine_lock_group (engine, st->group); +-} +- +-static void +-popup_menu_set_group_cb (GtkMenuItem * item, gpointer param) +-{ +- gint group_number = GPOINTER_TO_INT (param); +- +- popup_menu_set_group(group_number, FALSE); +-} +- +- +-static GtkMenu * +-create_status_menu (void) +-{ +- GtkMenu *popup_menu = GTK_MENU (gtk_menu_new ()); +- int i = 0; +- +- GtkMenu *groups_menu = GTK_MENU (gtk_menu_new ()); +- gchar **current_name = gkbd_status_get_group_names (); +- +- GtkWidget *item = gtk_menu_item_new_with_mnemonic (_("_Layouts")); +- gtk_widget_show (item); +- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); +- gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), +- GTK_WIDGET (groups_menu)); +- +- item = gtk_menu_item_new_with_mnemonic (_("Show _Keyboard Layout...")); +- gtk_widget_show (item); +- g_signal_connect (item, "activate", popup_menu_show_layout, NULL); +- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); +- +- /* translators note: +- * This is the name of the cinnamon-settings "region" panel */ +- item = gtk_menu_item_new_with_mnemonic (_("Region and Language Settings")); +- gtk_widget_show (item); +- g_signal_connect (item, "activate", popup_menu_launch_capplet, NULL); +- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); +- +- for (i = 0; current_name && *current_name; i++, current_name++) { +- +- gchar *image_file = gkbd_status_get_image_filename (i); +- +- if (image_file == NULL) { +- item = +- gtk_menu_item_new_with_label (*current_name); +- } else { +- GdkPixbuf *pixbuf = +- gdk_pixbuf_new_from_file_at_size (image_file, +- 24, 24, +- NULL); +- GtkWidget *img = +- gtk_image_new_from_pixbuf (pixbuf); +- item = +- gtk_image_menu_item_new_with_label +- (*current_name); +- gtk_widget_show (img); +- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM +- (item), img); +- gtk_image_menu_item_set_always_show_image +- (GTK_IMAGE_MENU_ITEM (item), TRUE); +- g_free (image_file); +- } +- gtk_widget_show (item); +- gtk_menu_shell_append (GTK_MENU_SHELL (groups_menu), item); +- g_signal_connect (item, "activate", +- G_CALLBACK (popup_menu_set_group_cb), +- GINT_TO_POINTER (i)); +- } +- +- return popup_menu; +-} +- +-static void +-status_icon_popup_menu_cb (GtkStatusIcon * icon, guint button, guint time) +-{ +- GtkMenu *popup_menu = create_status_menu (); +- +- gtk_menu_popup (popup_menu, NULL, NULL, +- gtk_status_icon_position_menu, +- (gpointer) icon, button, time); +-} +- +-static void +-show_hide_icon () +-{ +- if (g_strv_length (current_kbd_config.layouts_variants) > 1) { +- if (icon == NULL) { +- xkl_debug (150, "Creating keyboard status icon\n"); +- icon = gkbd_status_new (); +- g_signal_connect (icon, "popup-menu", +- G_CALLBACK +- (status_icon_popup_menu_cb), +- NULL); +- +- } +- } else { +- if (icon != NULL) { +- xkl_debug (150, "Destroying icon\n"); +- g_object_unref (icon); +- icon = NULL; +- } +- } +-} +- +-static gboolean +-try_activating_xkb_config_if_new (GkbdKeyboardConfig * +- current_sys_kbd_config) +-{ +- /* Activate - only if different! */ +- if (!gkbd_keyboard_config_equals +- (¤t_kbd_config, current_sys_kbd_config)) { +- if (gkbd_keyboard_config_activate (¤t_kbd_config)) { +- if (pa_callback != NULL) { +- (*pa_callback) (pa_callback_user_data); +- return TRUE; +- } +- } else { +- return FALSE; +- } +- } +- return TRUE; +-} +- +-static gboolean +-filter_xkb_config (void) +-{ +- XklConfigItem *item; +- gchar *lname; +- gchar *vname; +- gchar **lv; +- gboolean any_change = FALSE; +- +- xkl_debug (100, "Filtering configuration against the registry\n"); +- if (!ensure_xkl_registry ()) +- return FALSE; +- +- lv = current_kbd_config.layouts_variants; +- item = xkl_config_item_new (); +- while (*lv) { +- xkl_debug (100, "Checking [%s]\n", *lv); +- if (gkbd_keyboard_config_split_items (*lv, &lname, &vname)) { +- gboolean should_be_dropped = FALSE; +- g_snprintf (item->name, sizeof (item->name), "%s", +- lname); +- if (!xkl_config_registry_find_layout +- (xkl_registry, item)) { +- xkl_debug (100, "Bad layout [%s]\n", +- lname); +- should_be_dropped = TRUE; +- } else if (vname) { +- g_snprintf (item->name, +- sizeof (item->name), "%s", +- vname); +- if (!xkl_config_registry_find_variant +- (xkl_registry, lname, item)) { +- xkl_debug (100, +- "Bad variant [%s(%s)]\n", +- lname, vname); +- should_be_dropped = TRUE; +- } +- } +- if (should_be_dropped) { +- gkbd_strv_behead (lv); +- any_change = TRUE; +- continue; +- } +- } +- lv++; +- } +- g_object_unref (item); +- return any_change; +-} +- +-static void +-apply_xkb_settings (void) +-{ +- GkbdKeyboardConfig current_sys_kbd_config; +- +- if (!inited_ok) +- return; +- +- gkbd_keyboard_config_init (¤t_sys_kbd_config, xkl_engine); +- +- gkbd_keyboard_config_load (¤t_kbd_config, +- &initial_sys_kbd_config); +- +- gkbd_keyboard_config_load_from_x_current (¤t_sys_kbd_config, +- NULL); +- +- if (!try_activating_xkb_config_if_new (¤t_sys_kbd_config)) { +- if (filter_xkb_config ()) { +- if (!try_activating_xkb_config_if_new +- (¤t_sys_kbd_config)) { +- g_warning +- ("Could not activate the filtered XKB configuration"); +- activation_error (); +- } +- } else { +- g_warning +- ("Could not activate the XKB configuration"); +- activation_error (); +- } +- } else +- xkl_debug (100, +- "Actual KBD configuration was not changed: redundant notification\n"); +- +- gkbd_keyboard_config_term (¤t_sys_kbd_config); +- show_hide_icon (); +-} +- +-static void +-csd_keyboard_xkb_analyze_sysconfig (void) +-{ +- if (!inited_ok) +- return; +- +- gkbd_keyboard_config_init (&initial_sys_kbd_config, xkl_engine); +- gkbd_keyboard_config_load_from_x_initial (&initial_sys_kbd_config, +- NULL); +-} +- +-void +-csd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun, +- void *user_data) +-{ +- pa_callback = fun; +- pa_callback_user_data = user_data; +-} +- +-static GdkFilterReturn +-csd_keyboard_xkb_evt_filter (GdkXEvent * xev, GdkEvent * event) +-{ +- XEvent *xevent = (XEvent *) xev; +- xkl_engine_filter_events (xkl_engine, xevent); +- return GDK_FILTER_CONTINUE; +-} +- +-/* When new Keyboard is plugged in - reload the settings */ +-static void +-csd_keyboard_new_device (XklEngine * engine) +-{ +- apply_desktop_settings (); +- apply_xkb_settings (); +-} +- +-void +-csd_keyboard_xkb_init (CsdKeyboardManager * kbd_manager) +-{ +- Display *display = +- GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); +- cinnamon_settings_profile_start (NULL); +- +- gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), +- DATADIR G_DIR_SEPARATOR_S +- "icons"); +- +- manager = kbd_manager; +- cinnamon_settings_profile_start ("xkl_engine_get_instance"); +- xkl_engine = xkl_engine_get_instance (display); +- cinnamon_settings_profile_end ("xkl_engine_get_instance"); +- if (xkl_engine) { +- inited_ok = TRUE; +- +- gkbd_desktop_config_init (¤t_config, xkl_engine); +- gkbd_keyboard_config_init (¤t_kbd_config, +- xkl_engine); +- xkl_engine_backup_names_prop (xkl_engine); +- csd_keyboard_xkb_analyze_sysconfig (); +- +- settings_desktop = g_settings_new (GKBD_DESKTOP_SCHEMA); +- settings_keyboard = g_settings_new (GKBD_KEYBOARD_SCHEMA); +- g_signal_connect (settings_desktop, "changed", +- (GCallback) apply_desktop_settings, +- NULL); +- g_signal_connect (settings_keyboard, "changed", +- (GCallback) apply_xkb_settings, NULL); +- +- gdk_window_add_filter (NULL, (GdkFilterFunc) +- csd_keyboard_xkb_evt_filter, NULL); +- +- if (xkl_engine_get_features (xkl_engine) & +- XKLF_DEVICE_DISCOVERY) +- g_signal_connect (xkl_engine, "X-new-device", +- G_CALLBACK +- (csd_keyboard_new_device), NULL); +- +- cinnamon_settings_profile_start ("xkl_engine_start_listen"); +- xkl_engine_start_listen (xkl_engine, +- XKLL_MANAGE_LAYOUTS | +- XKLL_MANAGE_WINDOW_STATES); +- cinnamon_settings_profile_end ("xkl_engine_start_listen"); +- +- cinnamon_settings_profile_start ("apply_desktop_settings"); +- apply_desktop_settings (); +- cinnamon_settings_profile_end ("apply_desktop_settings"); +- cinnamon_settings_profile_start ("apply_xkb_settings"); +- apply_xkb_settings (); +- cinnamon_settings_profile_end ("apply_xkb_settings"); +- } +- preview_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal); +- +- cinnamon_settings_profile_end (NULL); +-} +- +-void +-csd_keyboard_xkb_shutdown (void) +-{ +- if (!inited_ok) +- return; +- +- pa_callback = NULL; +- pa_callback_user_data = NULL; +- manager = NULL; +- +- if (preview_dialogs != NULL) +- g_hash_table_destroy (preview_dialogs); +- +- if (!inited_ok) +- return; +- +- xkl_engine_stop_listen (xkl_engine, +- XKLL_MANAGE_LAYOUTS | +- XKLL_MANAGE_WINDOW_STATES); +- +- gdk_window_remove_filter (NULL, (GdkFilterFunc) +- csd_keyboard_xkb_evt_filter, NULL); +- +- g_object_unref (settings_desktop); +- settings_desktop = NULL; +- g_object_unref (settings_keyboard); +- settings_keyboard = NULL; +- +- if (xkl_registry) { +- g_object_unref (xkl_registry); +- } +- +- g_object_unref (xkl_engine); +- +- xkl_engine = NULL; +- +- inited_ok = FALSE; +-} +diff -uNrp a/plugins/keyboard/csd-keyboard-xkb.h b/plugins/keyboard/csd-keyboard-xkb.h +--- a/plugins/keyboard/csd-keyboard-xkb.h 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/keyboard/csd-keyboard-xkb.h 1970-01-01 01:00:00.000000000 +0100 +@@ -1,39 +0,0 @@ +-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- +- * cinnamon-settings-keyboard-xkb.h +- * +- * Copyright (C) 2001 Udaltsoft +- * +- * Written by Sergey V. Oudaltsov +- * +- * 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, 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 - Suite 500, Boston, MA +- * 02110-1335, USA. +- */ +- +-#ifndef __CSD_KEYBOARD_XKB_H +-#define __CSD_KEYBOARD_XKB_H +- +-#include +-#include "csd-keyboard-manager.h" +- +-void csd_keyboard_xkb_init (CsdKeyboardManager *manager); +-void csd_keyboard_xkb_shutdown (void); +- +-typedef void (*PostActivationCallback) (void *userData); +- +-void +-csd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun, +- void *userData); +- +-#endif +diff -uNrp a/plugins/keyboard/delayed-dialog.c b/plugins/keyboard/delayed-dialog.c +--- a/plugins/keyboard/delayed-dialog.c 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/keyboard/delayed-dialog.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,128 +0,0 @@ +-/* +- * Copyright © 2006 Novell, 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, 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 - Suite 500, Boston, MA +- * 02110-1335, USA. +- */ +- +-#include +-#include +- +-#include +-#include +- +-#include "delayed-dialog.h" +- +-static gboolean delayed_show_timeout (gpointer data); +-static GdkFilterReturn message_filter (GdkXEvent *xevent, +- GdkEvent *event, +- gpointer data); +- +-static GSList *dialogs = NULL; +- +-/** +- * csd_delayed_show_dialog: +- * @dialog: the dialog +- * +- * Shows the dialog as with gtk_widget_show(), unless a window manager +- * hasn't been started yet, in which case it will wait up to 5 seconds +- * for that to happen before showing the dialog. +- **/ +-void +-csd_delayed_show_dialog (GtkWidget *dialog) +-{ +- GdkDisplay *display = gtk_widget_get_display (dialog); +- Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); +- GdkScreen *screen = gtk_widget_get_screen (dialog); +- char selection_name[10]; +- Atom selection_atom; +- +- /* We can't use gdk_selection_owner_get() for this, because +- * it's an unknown out-of-process window. +- */ +- snprintf (selection_name, sizeof (selection_name), "WM_S%d", +- gdk_screen_get_number (screen)); +- selection_atom = XInternAtom (xdisplay, selection_name, True); +- if (selection_atom && +- XGetSelectionOwner (xdisplay, selection_atom) != None) { +- gtk_widget_show (dialog); +- return; +- } +- +- dialogs = g_slist_prepend (dialogs, dialog); +- +- gdk_window_add_filter (NULL, message_filter, NULL); +- +- g_timeout_add (5000, delayed_show_timeout, NULL); +-} +- +-static gboolean +-delayed_show_timeout (gpointer data) +-{ +- GSList *l; +- +- for (l = dialogs; l; l = l->next) +- gtk_widget_show (l->data); +- g_slist_free (dialogs); +- dialogs = NULL; +- +- /* FIXME: There's no gdk_display_remove_client_message_filter */ +- +- return FALSE; +-} +- +-static GdkFilterReturn +-message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data) +-{ +- XClientMessageEvent *evt; +- char *selection_name; +- int screen; +- GSList *l, *next; +- +- if (((XEvent *)xevent)->type != ClientMessage) +- return GDK_FILTER_CONTINUE; +- +- evt = (XClientMessageEvent *)xevent; +- +- if (evt->message_type != XInternAtom (evt->display, "MANAGER", FALSE)) +- return GDK_FILTER_CONTINUE; +- +- selection_name = XGetAtomName (evt->display, evt->data.l[1]); +- +- if (strncmp (selection_name, "WM_S", 4) != 0) { +- XFree (selection_name); +- return GDK_FILTER_CONTINUE; +- } +- +- screen = atoi (selection_name + 4); +- +- for (l = dialogs; l; l = next) { +- GtkWidget *dialog = l->data; +- next = l->next; +- +- if (gdk_screen_get_number (gtk_widget_get_screen (dialog)) == screen) { +- gtk_widget_show (dialog); +- dialogs = g_slist_remove (dialogs, dialog); +- } +- } +- +- if (!dialogs) { +- gdk_window_remove_filter (NULL, message_filter, NULL); +- } +- +- XFree (selection_name); +- +- return GDK_FILTER_CONTINUE; +-} +diff -uNrp a/plugins/keyboard/delayed-dialog.h b/plugins/keyboard/delayed-dialog.h +--- a/plugins/keyboard/delayed-dialog.h 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/keyboard/delayed-dialog.h 1970-01-01 01:00:00.000000000 +0100 +@@ -1,32 +0,0 @@ +-/* +- * Copyright © 2006 Novell, 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, 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 - Suite 500, Boston, MA +- * 02110-1335, USA. +- */ +- +- +-#ifndef __DELAYED_DIALOG_H +-#define __DELAYED_DIALOG_H +- +-#include +- +-G_BEGIN_DECLS +- +-void csd_delayed_show_dialog (GtkWidget *dialog); +- +-G_END_DECLS +- +-#endif +diff -uNrp a/plugins/keyboard/gkbd-configuration.c b/plugins/keyboard/gkbd-configuration.c +--- a/plugins/keyboard/gkbd-configuration.c 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/keyboard/gkbd-configuration.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,350 +0,0 @@ +-/* +- * Copyright (C) 2010 Canonical Ltd. +- * +- * Authors: Jan Arne Petersen +- * +- * Based on gkbd-status.c by Sergey V. Udaltsov +- * +- * This library 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 of the License, or (at your option) any later version. +- * +- * This library 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 library; if not, write to the +- * Free Software Foundation, Inc., 51 Franklin Street - Suite 500, +- * Boston, MA 02110-1335, USA. +- */ +- +-#include +- +-#include +-#include +-#include +- +-#include +-#include +- +-#include "gkbd-configuration.h" +- +-struct _GkbdConfigurationPrivate { +- XklEngine *engine; +- XklConfigRegistry *registry; +- +- GkbdDesktopConfig cfg; +- GkbdIndicatorConfig ind_cfg; +- GkbdKeyboardConfig kbd_cfg; +- +- gchar **full_group_names; +- gchar **short_group_names; +- +- gulong state_changed_handler; +- gulong config_changed_handler; +-}; +- +-enum { +- SIGNAL_CHANGED, +- SIGNAL_GROUP_CHANGED, +- LAST_SIGNAL +-}; +- +-static guint signals[LAST_SIGNAL] = { 0, }; +- +-#define GKBD_CONFIGURATION_GET_PRIVATE(o) \ +- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GKBD_TYPE_CONFIGURATION, GkbdConfigurationPrivate)) +- +-G_DEFINE_TYPE (GkbdConfiguration, gkbd_configuration, G_TYPE_OBJECT) +- +-/* Should be called once for all widgets */ +-static void +-gkbd_configuration_cfg_changed (GSettings *settings, +- const char *key, +- GkbdConfiguration * configuration) +-{ +- GkbdConfigurationPrivate *priv = configuration->priv; +- +- xkl_debug (100, +- "General configuration changed in GSettings - reiniting...\n"); +- gkbd_desktop_config_load (&priv->cfg); +- gkbd_desktop_config_activate (&priv->cfg); +- +- g_signal_emit (configuration, +- signals[SIGNAL_CHANGED], 0); +-} +- +-/* Should be called once for all widgets */ +-static void +-gkbd_configuration_ind_cfg_changed (GSettings *settings, +- const char *key, +- GkbdConfiguration * configuration) +-{ +- GkbdConfigurationPrivate *priv = configuration->priv; +- xkl_debug (100, +- "Applet configuration changed in GSettings - reiniting...\n"); +- gkbd_indicator_config_load (&priv->ind_cfg); +- +- gkbd_indicator_config_free_image_filenames (&priv->ind_cfg); +- gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, +- &priv->kbd_cfg); +- +- gkbd_indicator_config_activate (&priv->ind_cfg); +- +- g_signal_emit (configuration, +- signals[SIGNAL_CHANGED], 0); +-} +- +-static void +-gkbd_configuration_load_group_names (GkbdConfiguration * configuration, +- XklConfigRec * xklrec) +-{ +- GkbdConfigurationPrivate *priv = configuration->priv; +- +- if (!gkbd_desktop_config_load_group_descriptions (&priv->cfg, +- priv->registry, +- (const char **) xklrec->layouts, +- (const char **) xklrec->variants, +- &priv->short_group_names, +- &priv->full_group_names)) { +- /* We just populate no short names (remain NULL) - +- * full names are going to be used anyway */ +- gint i, total_groups = +- xkl_engine_get_num_groups (priv->engine); +- xkl_debug (150, "group descriptions loaded: %d!\n", +- total_groups); +- priv->full_group_names = +- g_new0 (char *, total_groups + 1); +- +- if (xkl_engine_get_features (priv->engine) & +- XKLF_MULTIPLE_LAYOUTS_SUPPORTED) { +- for (i = 0; priv->kbd_cfg.layouts_variants[i]; i++) { +- priv->full_group_names[i] = +- g_strdup ((char *) priv->kbd_cfg.layouts_variants[i]); +- } +- } else { +- for (i = total_groups; --i >= 0;) { +- priv->full_group_names[i] = +- g_strdup_printf ("Group %d", i); +- } +- } +- } +-} +- +-/* Should be called once for all widgets */ +-static void +-gkbd_configuration_kbd_cfg_callback (XklEngine *engine, +- GkbdConfiguration *configuration) +-{ +- GkbdConfigurationPrivate *priv = configuration->priv; +- XklConfigRec *xklrec = xkl_config_rec_new (); +- xkl_debug (100, +- "XKB configuration changed on X Server - reiniting...\n"); +- +- gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg, +- xklrec); +- +- gkbd_indicator_config_free_image_filenames (&priv->ind_cfg); +- gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, +- &priv->kbd_cfg); +- +- g_strfreev (priv->full_group_names); +- priv->full_group_names = NULL; +- +- g_strfreev (priv->short_group_names); +- priv->short_group_names = NULL; +- +- gkbd_configuration_load_group_names (configuration, +- xklrec); +- +- g_signal_emit (configuration, +- signals[SIGNAL_CHANGED], +- 0); +- +- g_object_unref (G_OBJECT (xklrec)); +-} +- +-/* Should be called once for all applets */ +-static void +-gkbd_configuration_state_callback (XklEngine * engine, +- XklEngineStateChange changeType, +- gint group, gboolean restore, +- GkbdConfiguration * configuration) +-{ +- xkl_debug (150, "group is now %d, restore: %d\n", group, restore); +- +- if (changeType == GROUP_CHANGED) { +- g_signal_emit (configuration, +- signals[SIGNAL_GROUP_CHANGED], 0, +- group); +- } +-} +- +-static void +-gkbd_configuration_init (GkbdConfiguration *configuration) +-{ +- GkbdConfigurationPrivate *priv; +- XklConfigRec *xklrec = xkl_config_rec_new (); +- +- priv = GKBD_CONFIGURATION_GET_PRIVATE (configuration); +- configuration->priv = priv; +- +- priv->engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); +- if (priv->engine == NULL) { +- xkl_debug (0, "Libxklavier initialization error"); +- return; +- } +- +- priv->state_changed_handler = +- g_signal_connect (priv->engine, "X-state-changed", +- G_CALLBACK (gkbd_configuration_state_callback), +- configuration); +- priv->config_changed_handler = +- g_signal_connect (priv->engine, "X-config-changed", +- G_CALLBACK (gkbd_configuration_kbd_cfg_callback), +- configuration); +- +- gkbd_desktop_config_init (&priv->cfg, priv->engine); +- gkbd_keyboard_config_init (&priv->kbd_cfg, priv->engine); +- gkbd_indicator_config_init (&priv->ind_cfg, priv->engine); +- +- gkbd_desktop_config_load (&priv->cfg); +- gkbd_desktop_config_activate (&priv->cfg); +- +- priv->registry = xkl_config_registry_get_instance (priv->engine); +- xkl_config_registry_load (priv->registry, +- priv->cfg.load_extra_items); +- +- gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg, +- xklrec); +- +- gkbd_indicator_config_load (&priv->ind_cfg); +- +- gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, +- &priv->kbd_cfg); +- +- gkbd_indicator_config_activate (&priv->ind_cfg); +- +- gkbd_configuration_load_group_names (configuration, +- xklrec); +- g_object_unref (G_OBJECT (xklrec)); +- +- gkbd_desktop_config_start_listen (&priv->cfg, +- G_CALLBACK (gkbd_configuration_cfg_changed), +- configuration); +- gkbd_indicator_config_start_listen (&priv->ind_cfg, +- G_CALLBACK (gkbd_configuration_ind_cfg_changed), +- configuration); +- xkl_engine_start_listen (priv->engine, +- XKLL_TRACK_KEYBOARD_STATE); +- +- xkl_debug (100, "Initiating the widget startup process for %p\n", +- configuration); +-} +- +-static void +-gkbd_configuration_finalize (GObject * obj) +-{ +- GkbdConfiguration *configuration = GKBD_CONFIGURATION (obj); +- GkbdConfigurationPrivate *priv = configuration->priv; +- +- xkl_debug (100, +- "Starting the gnome-kbd-configuration widget shutdown process for %p\n", +- configuration); +- +- xkl_engine_stop_listen (priv->engine, +- XKLL_TRACK_KEYBOARD_STATE); +- +- gkbd_desktop_config_stop_listen (&priv->cfg); +- gkbd_indicator_config_stop_listen (&priv->ind_cfg); +- +- gkbd_indicator_config_term (&priv->ind_cfg); +- gkbd_keyboard_config_term (&priv->kbd_cfg); +- gkbd_desktop_config_term (&priv->cfg); +- +- if (g_signal_handler_is_connected (priv->engine, +- priv->state_changed_handler)) { +- g_signal_handler_disconnect (priv->engine, +- priv->state_changed_handler); +- priv->state_changed_handler = 0; +- } +- if (g_signal_handler_is_connected (priv->engine, +- priv->config_changed_handler)) { +- g_signal_handler_disconnect (priv->engine, +- priv->config_changed_handler); +- priv->config_changed_handler = 0; +- } +- +- g_object_unref (priv->registry); +- priv->registry = NULL; +- g_object_unref (priv->engine); +- priv->engine = NULL; +- +- G_OBJECT_CLASS (gkbd_configuration_parent_class)->finalize (obj); +-} +- +-static void +-gkbd_configuration_class_init (GkbdConfigurationClass * klass) +-{ +- GObjectClass *object_class = G_OBJECT_CLASS (klass); +- +- /* Initing vtable */ +- object_class->finalize = gkbd_configuration_finalize; +- +- /* Signals */ +- signals[SIGNAL_CHANGED] = g_signal_new ("changed", +- GKBD_TYPE_CONFIGURATION, +- G_SIGNAL_RUN_LAST, +- 0, +- NULL, NULL, +- g_cclosure_marshal_VOID__VOID, +- G_TYPE_NONE, +- 0); +- signals[SIGNAL_GROUP_CHANGED] = g_signal_new ("group-changed", +- GKBD_TYPE_CONFIGURATION, +- G_SIGNAL_RUN_LAST, +- 0, +- NULL, NULL, +- g_cclosure_marshal_VOID__INT, +- G_TYPE_NONE, +- 1, +- G_TYPE_INT); +- +- g_type_class_add_private (klass, sizeof (GkbdConfigurationPrivate)); +-} +- +-GkbdConfiguration * +-gkbd_configuration_get (void) +-{ +- static gpointer instance = NULL; +- +- if (!instance) { +- instance = g_object_new (GKBD_TYPE_CONFIGURATION, NULL); +- g_object_add_weak_pointer (instance, &instance); +- } else { +- g_object_ref (instance); +- } +- +- return instance; +-} +- +-XklEngine * +-gkbd_configuration_get_xkl_engine (GkbdConfiguration *configuration) +-{ +- return configuration->priv->engine; +-} +- +-const char * const * +-gkbd_configuration_get_group_names (GkbdConfiguration *configuration) +-{ +- return configuration->priv->full_group_names; +-} +- +-const char * const * +-gkbd_configuration_get_short_group_names (GkbdConfiguration *configuration) +-{ +- return configuration->priv->short_group_names; +-} +diff -uNrp a/plugins/keyboard/gkbd-configuration.h b/plugins/keyboard/gkbd-configuration.h +--- a/plugins/keyboard/gkbd-configuration.h 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/keyboard/gkbd-configuration.h 1970-01-01 01:00:00.000000000 +0100 +@@ -1,65 +0,0 @@ +-/* +- * Copyright (C) 2010 Canonical Ltd. +- * +- * Authors: Jan Arne Petersen +- * +- * Based on gkbd-status.h by Sergey V. Udaltsov +- * +- * This library 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 of the License, or (at your option) any later version. +- * +- * This library 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 library; if not, write to the +- * Free Software Foundation, Inc., 51 Franklin Street - Suite 500, +- * Boston, MA 02110-1335, USA. +- */ +- +-#ifndef __GKBD_CONFIGURATION_H__ +-#define __GKBD_CONFIGURATION_H__ +- +-#include +- +-#include +- +-G_BEGIN_DECLS +- +-typedef struct _GkbdConfiguration GkbdConfiguration; +-typedef struct _GkbdConfigurationPrivate GkbdConfigurationPrivate; +-typedef struct _GkbdConfigurationClass GkbdConfigurationClass; +- +-#define GKBD_TYPE_CONFIGURATION (gkbd_configuration_get_type ()) +-#define GKBD_CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfiguration)) +-#define GKBD_INDCATOR_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfigurationClass)) +-#define GKBD_IS_CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKBD_TYPE_CONFIGURATION)) +-#define GKBD_IS_CONFIGURATION_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), GKBD_TYPE_CONFIGURATION)) +-#define GKBD_CONFIGURATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfigurationClass)) +- +-struct _GkbdConfiguration { +- GObject parent; +- +- GkbdConfigurationPrivate *priv; +-}; +- +-struct _GkbdConfigurationClass { +- GObjectClass parent_class; +-}; +- +-extern GType gkbd_configuration_get_type (void); +- +-extern GkbdConfiguration *gkbd_configuration_get (void); +- +-extern XklEngine *gkbd_configuration_get_xkl_engine (GkbdConfiguration *configuration); +- +-extern const char * const *gkbd_configuration_get_group_names (GkbdConfiguration *configuration); +-extern const char * const *gkbd_configuration_get_short_group_names (GkbdConfiguration *configuration); +- +-G_END_DECLS +- +-#endif +diff -uNrp a/plugins/keyboard/.indent.pro b/plugins/keyboard/.indent.pro +--- a/plugins/keyboard/.indent.pro 1970-01-01 01:00:00.000000000 +0100 ++++ b/plugins/keyboard/.indent.pro 2013-08-25 16:36:02.000000000 +0100 +@@ -0,0 +1,2 @@ ++-kr -i8 -pcs -lps -psl ++ +diff -uNrp a/plugins/keyboard/Makefile.am b/plugins/keyboard/Makefile.am +--- a/plugins/keyboard/Makefile.am 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/keyboard/Makefile.am 2013-08-25 16:36:02.000000000 +0100 +@@ -20,25 +20,20 @@ libkeyboard_la_SOURCES = \ + csd-keyboard-plugin.c \ + csd-keyboard-manager.h \ + csd-keyboard-manager.c \ +- csd-keyboard-xkb.h \ +- csd-keyboard-xkb.c \ +- delayed-dialog.h \ +- delayed-dialog.c \ +- gkbd-configuration.c \ +- gkbd-configuration.h \ + $(NULL) + + libkeyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/cinnamon-settings-daemon \ + -I$(top_srcdir)/data \ ++ -I$(top_srcdir)/plugins/common \ + -DDATADIR=\""$(pkgdatadir)"\" \ ++ -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DCINNAMON_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + + libkeyboard_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ +- $(APPINDICATOR_CFLAGS) \ + $(KEYBOARD_CFLAGS) \ + $(AM_CFLAGS) + +@@ -46,19 +41,63 @@ libkeyboard_la_LDFLAGS = \ + $(CSD_PLUGIN_LDFLAGS) \ + $(NULL) + +-libkeyboard_la_LIBADD = \ +- $(SETTINGS_PLUGIN_LIBS) \ +- $(XF86MISC_LIBS) \ +- $(KEYBOARD_LIBS) \ +- $(APPINDICATOR_LIBS) \ ++libkeyboard_la_LIBADD = \ ++ $(top_builddir)/plugins/common/libcommon.la \ ++ $(SETTINGS_PLUGIN_LIBS) \ ++ $(XF86MISC_LIBS) \ ++ $(KEYBOARD_LIBS) \ + $(NULL) + ++libexec_PROGRAMS = csd-test-keyboard ++csd_test_keyboard_SOURCES = \ ++ test-keyboard.c \ ++ csd-keyboard-manager.h \ ++ csd-keyboard-manager.c \ ++ $(NULL) ++ ++csd_test_keyboard_CFLAGS = $(libkeyboard_la_CFLAGS) ++csd_test_keyboard_CPPFLAGS = $(libkeyboard_la_CPPFLAGS) ++csd_test_keyboard_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/cinnamon-settings-daemon/libcsd.la ++ + plugin_in_files = \ + keyboard.cinnamon-settings-plugin.in \ + $(NULL) + + plugin_DATA = $(plugin_in_files:.cinnamon-settings-plugin.in=.cinnamon-settings-plugin) + ++if HAVE_IBUS ++noinst_PROGRAMS = test-keyboard-ibus-utils ++test_keyboard_ibus_utils_SOURCES = test-keyboard-ibus-utils.c ++test_keyboard_ibus_utils_CFLAGS = $(libkeyboard_la_CFLAGS) ++test_keyboard_ibus_utils_CPPFLAGS = $(libkeyboard_la_CPPFLAGS) ++test_keyboard_ibus_utils_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/cinnamon-settings-daemon/libcsd.la ++ ++check-local: test-keyboard-ibus-utils ++ $(builddir)/test-keyboard-ibus-utils > /dev/null ++endif ++ ++libexec_PROGRAMS += csd-input-sources-switcher ++ ++csd_input_sources_switcher_SOURCES = \ ++ csd-input-sources-switcher.c \ ++ $(NULL) ++ ++csd_input_sources_switcher_CPPFLAGS = \ ++ -I$(top_srcdir)/data \ ++ -I$(top_srcdir)/plugins/common \ ++ $(AM_CPPFLAGS) \ ++ $(NULL) ++ ++csd_input_sources_switcher_CFLAGS = \ ++ $(SETTINGS_PLUGIN_CFLAGS) \ ++ $(AM_CFLAGS) \ ++ $(NULL) ++ ++csd_input_sources_switcher_LDADD = \ ++ $(top_builddir)/plugins/common/libcommon.la \ ++ $(SETTINGS_PLUGIN_LIBS) \ ++ $(NULL) ++ + EXTRA_DIST = \ + $(icons_DATA) \ + $(plugin_in_files) \ +diff -uNrp a/plugins/keyboard/test-keyboard.c b/plugins/keyboard/test-keyboard.c +--- a/plugins/keyboard/test-keyboard.c 1970-01-01 01:00:00.000000000 +0100 ++++ b/plugins/keyboard/test-keyboard.c 2013-08-25 16:36:02.000000000 +0100 +@@ -0,0 +1,7 @@ ++#define NEW csd_keyboard_manager_new ++#define START csd_keyboard_manager_start ++#define STOP csd_keyboard_manager_stop ++#define MANAGER CsdKeyboardManager ++#include "csd-keyboard-manager.h" ++ ++#include "test-plugin.h" +diff -uNrp a/plugins/keyboard/test-keyboard-ibus-utils.c b/plugins/keyboard/test-keyboard-ibus-utils.c +--- a/plugins/keyboard/test-keyboard-ibus-utils.c 1970-01-01 01:00:00.000000000 +0100 ++++ b/plugins/keyboard/test-keyboard-ibus-utils.c 2013-08-25 16:36:02.000000000 +0100 +@@ -0,0 +1,116 @@ ++#include "csd-keyboard-manager.c" ++ ++static void ++test_make_xkb_source_id (void) ++{ ++ gint i; ++ const gchar *test_strings[][2] = { ++ /* input output */ ++ { "xkb:aa:bb:cc", "aa+bb" }, ++ { "xkb:aa:bb:", "aa+bb" }, ++ { "xkb:aa::cc", "aa" }, ++ { "xkb:aa::", "aa" }, ++ { "xkb::bb:cc", "+bb" }, ++ { "xkb::bb:", "+bb" }, ++ { "xkb:::cc", "" }, ++ { "xkb:::", "" }, ++ }; ++ ++ for (i = 0; i < G_N_ELEMENTS (test_strings); ++i) ++ g_assert_cmpstr (make_xkb_source_id (test_strings[i][0]), ==, test_strings[i][1]); ++} ++ ++static void ++test_layout_from_ibus_layout (void) ++{ ++ gint i; ++ const gchar *test_strings[][2] = { ++ /* input output */ ++ { "", "" }, ++ { "a", "a" }, ++ { "a(", "a" }, ++ { "a[", "a" }, ++ }; ++ ++ for (i = 0; i < G_N_ELEMENTS (test_strings); ++i) ++ g_assert_cmpstr (layout_from_ibus_layout (test_strings[i][0]), ==, test_strings[i][1]); ++} ++ ++static void ++test_variant_from_ibus_layout (void) ++{ ++ gint i; ++ const gchar *test_strings[][2] = { ++ /* input output */ ++ { "", NULL }, ++ { "a", NULL }, ++ { "(", NULL }, ++ { "()", "" }, ++ { "(b)", "b" }, ++ { "a(", NULL }, ++ { "a()", "" }, ++ { "a(b)", "b" }, ++ }; ++ ++ for (i = 0; i < G_N_ELEMENTS (test_strings); ++i) ++ g_assert_cmpstr (variant_from_ibus_layout (test_strings[i][0]), ==, test_strings[i][1]); ++} ++ ++static void ++test_options_from_ibus_layout (void) ++{ ++ gint i, j; ++ gchar *output_0[] = { ++ NULL ++ }; ++ gchar *output_1[] = { ++ "", ++ NULL ++ }; ++ gchar *output_2[] = { ++ "b", ++ NULL ++ }; ++ gchar *output_3[] = { ++ "b", "", ++ NULL ++ }; ++ gchar *output_4[] = { ++ "b", "c", ++ NULL ++ }; ++ const gpointer tests[][2] = { ++ /* input output */ ++ { "", NULL }, ++ { "a", NULL }, ++ { "a[", output_0 }, ++ { "a[]", output_1 }, ++ { "a[b]", output_2 }, ++ { "a[b,]", output_3 }, ++ { "a[b,c]", output_4 }, ++ }; ++ ++ for (i = 0; i < G_N_ELEMENTS (tests); ++i) { ++ if (tests[i][1] == NULL) { ++ g_assert (options_from_ibus_layout (tests[i][0]) == NULL); ++ } else { ++ gchar **strv_a = options_from_ibus_layout (tests[i][0]); ++ gchar **strv_b = tests[i][1]; ++ ++ g_assert (g_strv_length (strv_a) == g_strv_length (strv_b)); ++ for (j = 0; j < g_strv_length (strv_a); ++j) ++ g_assert_cmpstr (strv_a[j], ==, strv_b[j]); ++ } ++ } ++} ++ ++int ++main (void) ++{ ++ test_make_xkb_source_id (); ++ test_layout_from_ibus_layout (); ++ test_variant_from_ibus_layout (); ++ test_options_from_ibus_layout (); ++ ++ return 0; ++} +diff -uNrp a/plugins/keyboard/xxx/csd-keyboard-xkb.c b/plugins/keyboard/xxx/csd-keyboard-xkb.c +--- a/plugins/keyboard/xxx/csd-keyboard-xkb.c 1970-01-01 01:00:00.000000000 +0100 ++++ b/plugins/keyboard/xxx/csd-keyboard-xkb.c 2013-08-25 16:36:02.000000000 +0100 +@@ -0,0 +1,579 @@ ++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- ++ * ++ * Copyright (C) 2001 Udaltsoft ++ * ++ * Written by Sergey V. Oudaltsov ++ * ++ * 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, 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 - Suite 500, Boston, MA ++ * 02110-1335, USA. ++ */ ++ ++#include "config.h" ++ ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "csd-keyboard-xkb.h" ++#include "delayed-dialog.h" ++#include "cinnamon-settings-profile.h" ++ ++#define SETTINGS_KEYBOARD_DIR "org.cinnamon.settings-daemon.plugins.keyboard" ++ ++static CsdKeyboardManager *manager = NULL; ++ ++static XklEngine *xkl_engine; ++static XklConfigRegistry *xkl_registry = NULL; ++ ++static GkbdDesktopConfig current_config; ++static GkbdKeyboardConfig current_kbd_config; ++ ++/* never terminated */ ++static GkbdKeyboardConfig initial_sys_kbd_config; ++ ++static gboolean inited_ok = FALSE; ++ ++static GSettings *settings_desktop = NULL; ++static GSettings *settings_keyboard = NULL; ++ ++static PostActivationCallback pa_callback = NULL; ++static void *pa_callback_user_data = NULL; ++ ++static GtkStatusIcon *icon = NULL; ++ ++static GHashTable *preview_dialogs = NULL; ++ ++static void ++activation_error (void) ++{ ++ char const *vendor; ++ GtkWidget *dialog; ++ ++ vendor = ++ ServerVendor (GDK_DISPLAY_XDISPLAY ++ (gdk_display_get_default ())); ++ ++ /* VNC viewers will not work, do not barrage them with warnings */ ++ if (NULL != vendor && NULL != strstr (vendor, "VNC")) ++ return; ++ ++ dialog = gtk_message_dialog_new_with_markup (NULL, ++ 0, ++ GTK_MESSAGE_ERROR, ++ GTK_BUTTONS_CLOSE, ++ _ ++ ("Error activating XKB configuration.\n" ++ "There can be various reasons for that.\n\n" ++ "If you report this situation as a bug, include the results of\n" ++ " • %s\n" ++ " • %s\n" ++ " • %s\n" ++ " • %s"), ++ "xprop -root | grep XKB", ++ "gsettings get org.gnome.libgnomekbd.keyboard model", ++ "gsettings get org.gnome.libgnomekbd.keyboard layouts", ++ "gsettings get org.gnome.libgnomekbd.keyboard options"); ++ g_signal_connect (dialog, "response", ++ G_CALLBACK (gtk_widget_destroy), NULL); ++ csd_delayed_show_dialog (dialog); ++} ++ ++static gboolean ++ensure_xkl_registry (void) ++{ ++ if (!xkl_registry) { ++ xkl_registry = ++ xkl_config_registry_get_instance (xkl_engine); ++ /* load all materials, unconditionally! */ ++ if (!xkl_config_registry_load (xkl_registry, TRUE)) { ++ g_object_unref (xkl_registry); ++ xkl_registry = NULL; ++ return FALSE; ++ } ++ } ++ ++ return TRUE; ++} ++ ++static void ++apply_desktop_settings (void) ++{ ++ if (!inited_ok) ++ return; ++ ++ csd_keyboard_manager_apply_settings (manager); ++ gkbd_desktop_config_load (¤t_config); ++ /* again, probably it would be nice to compare things ++ before activating them */ ++ gkbd_desktop_config_activate (¤t_config); ++} ++ ++static void ++popup_menu_launch_capplet () ++{ ++ GAppInfo *info; ++ GdkAppLaunchContext *ctx; ++ GError *error = NULL; ++ ++ info = ++ g_app_info_create_from_commandline ++ ("cinnamon-settings region", NULL, 0, &error); ++ ++ if (info != NULL) { ++ ctx = ++ gdk_display_get_app_launch_context ++ (gdk_display_get_default ()); ++ ++ if (g_app_info_launch (info, NULL, ++ G_APP_LAUNCH_CONTEXT (ctx), &error) == FALSE) { ++ g_warning ++ ("Could not execute keyboard properties capplet: [%s]\n", ++ error->message); ++ g_error_free (error); ++ } ++ ++ g_object_unref (info); ++ g_object_unref (ctx); ++ } ++ ++} ++ ++static void ++show_layout_destroy (GtkWidget * dialog, gint group) ++{ ++ g_hash_table_remove (preview_dialogs, GINT_TO_POINTER (group)); ++} ++ ++static void ++popup_menu_show_layout () ++{ ++ GtkWidget *dialog; ++ XklEngine *engine = ++ xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY ++ (gdk_display_get_default ())); ++ XklState *xkl_state = xkl_engine_get_current_state (engine); ++ ++ gchar **group_names = gkbd_status_get_group_names (); ++ ++ gpointer p = g_hash_table_lookup (preview_dialogs, ++ GINT_TO_POINTER ++ (xkl_state->group)); ++ ++ if (xkl_state->group < 0 ++ || xkl_state->group >= g_strv_length (group_names)) { ++ return; ++ } ++ ++ if (p != NULL) { ++ /* existing window */ ++ gtk_window_present (GTK_WINDOW (p)); ++ return; ++ } ++ ++ if (!ensure_xkl_registry ()) ++ return; ++ ++ dialog = gkbd_keyboard_drawing_dialog_new (); ++ gkbd_keyboard_drawing_dialog_set_group (dialog, xkl_registry, xkl_state->group); ++ ++ g_signal_connect (dialog, "destroy", ++ G_CALLBACK (show_layout_destroy), ++ GINT_TO_POINTER (xkl_state->group)); ++ g_hash_table_insert (preview_dialogs, ++ GINT_TO_POINTER (xkl_state->group), dialog); ++ gtk_widget_show_all (dialog); ++} ++ ++static void ++popup_menu_set_group (gint group_number, gboolean only_menu) ++{ ++ ++ XklEngine *engine = gkbd_status_get_xkl_engine (); ++ ++ XklState *st = xkl_engine_get_current_state(engine); ++ Window cur; ++ st->group = group_number; ++ xkl_engine_allow_one_switch_to_secondary_group (engine); ++ cur = xkl_engine_get_current_window (engine); ++ if (cur != (Window) NULL) { ++ xkl_debug (150, "Enforcing the state %d for window %lx\n", ++ st->group, cur); ++ ++ xkl_engine_save_state (engine, ++ xkl_engine_get_current_window ++ (engine), st); ++/* XSetInputFocus( GDK_DISPLAY(), cur, RevertToNone, CurrentTime );*/ ++ } else { ++ xkl_debug (150, ++ "??? Enforcing the state %d for unknown window\n", ++ st->group); ++ /* strange situation - bad things can happen */ ++ } ++ if (!only_menu) ++ xkl_engine_lock_group (engine, st->group); ++} ++ ++static void ++popup_menu_set_group_cb (GtkMenuItem * item, gpointer param) ++{ ++ gint group_number = GPOINTER_TO_INT (param); ++ ++ popup_menu_set_group(group_number, FALSE); ++} ++ ++ ++static GtkMenu * ++create_status_menu (void) ++{ ++ GtkMenu *popup_menu = GTK_MENU (gtk_menu_new ()); ++ int i = 0; ++ ++ GtkMenu *groups_menu = GTK_MENU (gtk_menu_new ()); ++ gchar **current_name = gkbd_status_get_group_names (); ++ ++ GtkWidget *item = gtk_menu_item_new_with_mnemonic (_("_Layouts")); ++ gtk_widget_show (item); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++ gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), ++ GTK_WIDGET (groups_menu)); ++ ++ item = gtk_menu_item_new_with_mnemonic (_("Show _Keyboard Layout...")); ++ gtk_widget_show (item); ++ g_signal_connect (item, "activate", popup_menu_show_layout, NULL); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++ ++ /* translators note: ++ * This is the name of the cinnamon-settings "region" panel */ ++ item = gtk_menu_item_new_with_mnemonic (_("Region and Language Settings")); ++ gtk_widget_show (item); ++ g_signal_connect (item, "activate", popup_menu_launch_capplet, NULL); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++ ++ for (i = 0; current_name && *current_name; i++, current_name++) { ++ ++ gchar *image_file = gkbd_status_get_image_filename (i); ++ ++ if (image_file == NULL) { ++ item = ++ gtk_menu_item_new_with_label (*current_name); ++ } else { ++ GdkPixbuf *pixbuf = ++ gdk_pixbuf_new_from_file_at_size (image_file, ++ 24, 24, ++ NULL); ++ GtkWidget *img = ++ gtk_image_new_from_pixbuf (pixbuf); ++ item = ++ gtk_image_menu_item_new_with_label ++ (*current_name); ++ gtk_widget_show (img); ++ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM ++ (item), img); ++ gtk_image_menu_item_set_always_show_image ++ (GTK_IMAGE_MENU_ITEM (item), TRUE); ++ g_free (image_file); ++ } ++ gtk_widget_show (item); ++ gtk_menu_shell_append (GTK_MENU_SHELL (groups_menu), item); ++ g_signal_connect (item, "activate", ++ G_CALLBACK (popup_menu_set_group_cb), ++ GINT_TO_POINTER (i)); ++ } ++ ++ return popup_menu; ++} ++ ++static void ++status_icon_popup_menu_cb (GtkStatusIcon * icon, guint button, guint time) ++{ ++ GtkMenu *popup_menu = create_status_menu (); ++ ++ gtk_menu_popup (popup_menu, NULL, NULL, ++ gtk_status_icon_position_menu, ++ (gpointer) icon, button, time); ++} ++ ++static void ++show_hide_icon () ++{ ++ if (g_strv_length (current_kbd_config.layouts_variants) > 1) { ++ if (icon == NULL) { ++ xkl_debug (150, "Creating keyboard status icon\n"); ++ icon = gkbd_status_new (); ++ g_signal_connect (icon, "popup-menu", ++ G_CALLBACK ++ (status_icon_popup_menu_cb), ++ NULL); ++ ++ } ++ } else { ++ if (icon != NULL) { ++ xkl_debug (150, "Destroying icon\n"); ++ g_object_unref (icon); ++ icon = NULL; ++ } ++ } ++} ++ ++static gboolean ++try_activating_xkb_config_if_new (GkbdKeyboardConfig * ++ current_sys_kbd_config) ++{ ++ /* Activate - only if different! */ ++ if (!gkbd_keyboard_config_equals ++ (¤t_kbd_config, current_sys_kbd_config)) { ++ if (gkbd_keyboard_config_activate (¤t_kbd_config)) { ++ if (pa_callback != NULL) { ++ (*pa_callback) (pa_callback_user_data); ++ return TRUE; ++ } ++ } else { ++ return FALSE; ++ } ++ } ++ return TRUE; ++} ++ ++static gboolean ++filter_xkb_config (void) ++{ ++ XklConfigItem *item; ++ gchar *lname; ++ gchar *vname; ++ gchar **lv; ++ gboolean any_change = FALSE; ++ ++ xkl_debug (100, "Filtering configuration against the registry\n"); ++ if (!ensure_xkl_registry ()) ++ return FALSE; ++ ++ lv = current_kbd_config.layouts_variants; ++ item = xkl_config_item_new (); ++ while (*lv) { ++ xkl_debug (100, "Checking [%s]\n", *lv); ++ if (gkbd_keyboard_config_split_items (*lv, &lname, &vname)) { ++ gboolean should_be_dropped = FALSE; ++ g_snprintf (item->name, sizeof (item->name), "%s", ++ lname); ++ if (!xkl_config_registry_find_layout ++ (xkl_registry, item)) { ++ xkl_debug (100, "Bad layout [%s]\n", ++ lname); ++ should_be_dropped = TRUE; ++ } else if (vname) { ++ g_snprintf (item->name, ++ sizeof (item->name), "%s", ++ vname); ++ if (!xkl_config_registry_find_variant ++ (xkl_registry, lname, item)) { ++ xkl_debug (100, ++ "Bad variant [%s(%s)]\n", ++ lname, vname); ++ should_be_dropped = TRUE; ++ } ++ } ++ if (should_be_dropped) { ++ gkbd_strv_behead (lv); ++ any_change = TRUE; ++ continue; ++ } ++ } ++ lv++; ++ } ++ g_object_unref (item); ++ return any_change; ++} ++ ++static void ++apply_xkb_settings (void) ++{ ++ GkbdKeyboardConfig current_sys_kbd_config; ++ ++ if (!inited_ok) ++ return; ++ ++ gkbd_keyboard_config_init (¤t_sys_kbd_config, xkl_engine); ++ ++ gkbd_keyboard_config_load (¤t_kbd_config, ++ &initial_sys_kbd_config); ++ ++ gkbd_keyboard_config_load_from_x_current (¤t_sys_kbd_config, ++ NULL); ++ ++ if (!try_activating_xkb_config_if_new (¤t_sys_kbd_config)) { ++ if (filter_xkb_config ()) { ++ if (!try_activating_xkb_config_if_new ++ (¤t_sys_kbd_config)) { ++ g_warning ++ ("Could not activate the filtered XKB configuration"); ++ activation_error (); ++ } ++ } else { ++ g_warning ++ ("Could not activate the XKB configuration"); ++ activation_error (); ++ } ++ } else ++ xkl_debug (100, ++ "Actual KBD configuration was not changed: redundant notification\n"); ++ ++ gkbd_keyboard_config_term (¤t_sys_kbd_config); ++ show_hide_icon (); ++} ++ ++static void ++csd_keyboard_xkb_analyze_sysconfig (void) ++{ ++ if (!inited_ok) ++ return; ++ ++ gkbd_keyboard_config_init (&initial_sys_kbd_config, xkl_engine); ++ gkbd_keyboard_config_load_from_x_initial (&initial_sys_kbd_config, ++ NULL); ++} ++ ++void ++csd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun, ++ void *user_data) ++{ ++ pa_callback = fun; ++ pa_callback_user_data = user_data; ++} ++ ++static GdkFilterReturn ++csd_keyboard_xkb_evt_filter (GdkXEvent * xev, GdkEvent * event) ++{ ++ XEvent *xevent = (XEvent *) xev; ++ xkl_engine_filter_events (xkl_engine, xevent); ++ return GDK_FILTER_CONTINUE; ++} ++ ++/* When new Keyboard is plugged in - reload the settings */ ++static void ++csd_keyboard_new_device (XklEngine * engine) ++{ ++ apply_desktop_settings (); ++ apply_xkb_settings (); ++} ++ ++void ++csd_keyboard_xkb_init (CsdKeyboardManager * kbd_manager) ++{ ++ Display *display = ++ GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); ++ cinnamon_settings_profile_start (NULL); ++ ++ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), ++ DATADIR G_DIR_SEPARATOR_S ++ "icons"); ++ ++ manager = kbd_manager; ++ cinnamon_settings_profile_start ("xkl_engine_get_instance"); ++ xkl_engine = xkl_engine_get_instance (display); ++ cinnamon_settings_profile_end ("xkl_engine_get_instance"); ++ if (xkl_engine) { ++ inited_ok = TRUE; ++ ++ gkbd_desktop_config_init (¤t_config, xkl_engine); ++ gkbd_keyboard_config_init (¤t_kbd_config, ++ xkl_engine); ++ xkl_engine_backup_names_prop (xkl_engine); ++ csd_keyboard_xkb_analyze_sysconfig (); ++ ++ settings_desktop = g_settings_new (GKBD_DESKTOP_SCHEMA); ++ settings_keyboard = g_settings_new (GKBD_KEYBOARD_SCHEMA); ++ g_signal_connect (settings_desktop, "changed", ++ (GCallback) apply_desktop_settings, ++ NULL); ++ g_signal_connect (settings_keyboard, "changed", ++ (GCallback) apply_xkb_settings, NULL); ++ ++ gdk_window_add_filter (NULL, (GdkFilterFunc) ++ csd_keyboard_xkb_evt_filter, NULL); ++ ++ if (xkl_engine_get_features (xkl_engine) & ++ XKLF_DEVICE_DISCOVERY) ++ g_signal_connect (xkl_engine, "X-new-device", ++ G_CALLBACK ++ (csd_keyboard_new_device), NULL); ++ ++ cinnamon_settings_profile_start ("xkl_engine_start_listen"); ++ xkl_engine_start_listen (xkl_engine, ++ XKLL_MANAGE_LAYOUTS | ++ XKLL_MANAGE_WINDOW_STATES); ++ cinnamon_settings_profile_end ("xkl_engine_start_listen"); ++ ++ cinnamon_settings_profile_start ("apply_desktop_settings"); ++ apply_desktop_settings (); ++ cinnamon_settings_profile_end ("apply_desktop_settings"); ++ cinnamon_settings_profile_start ("apply_xkb_settings"); ++ apply_xkb_settings (); ++ cinnamon_settings_profile_end ("apply_xkb_settings"); ++ } ++ preview_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal); ++ ++ cinnamon_settings_profile_end (NULL); ++} ++ ++void ++csd_keyboard_xkb_shutdown (void) ++{ ++ if (!inited_ok) ++ return; ++ ++ pa_callback = NULL; ++ pa_callback_user_data = NULL; ++ manager = NULL; ++ ++ if (preview_dialogs != NULL) ++ g_hash_table_destroy (preview_dialogs); ++ ++ if (!inited_ok) ++ return; ++ ++ xkl_engine_stop_listen (xkl_engine, ++ XKLL_MANAGE_LAYOUTS | ++ XKLL_MANAGE_WINDOW_STATES); ++ ++ gdk_window_remove_filter (NULL, (GdkFilterFunc) ++ csd_keyboard_xkb_evt_filter, NULL); ++ ++ g_object_unref (settings_desktop); ++ settings_desktop = NULL; ++ g_object_unref (settings_keyboard); ++ settings_keyboard = NULL; ++ ++ if (xkl_registry) { ++ g_object_unref (xkl_registry); ++ } ++ ++ g_object_unref (xkl_engine); ++ ++ xkl_engine = NULL; ++ ++ inited_ok = FALSE; ++} +diff -uNrp a/plugins/keyboard/xxx/csd-keyboard-xkb.h b/plugins/keyboard/xxx/csd-keyboard-xkb.h +--- a/plugins/keyboard/xxx/csd-keyboard-xkb.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/plugins/keyboard/xxx/csd-keyboard-xkb.h 2013-08-25 16:36:02.000000000 +0100 +@@ -0,0 +1,39 @@ ++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- ++ * cinnamon-settings-keyboard-xkb.h ++ * ++ * Copyright (C) 2001 Udaltsoft ++ * ++ * Written by Sergey V. Oudaltsov ++ * ++ * 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, 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 - Suite 500, Boston, MA ++ * 02110-1335, USA. ++ */ ++ ++#ifndef __CSD_KEYBOARD_XKB_H ++#define __CSD_KEYBOARD_XKB_H ++ ++#include ++#include "csd-keyboard-manager.h" ++ ++void csd_keyboard_xkb_init (CsdKeyboardManager *manager); ++void csd_keyboard_xkb_shutdown (void); ++ ++typedef void (*PostActivationCallback) (void *userData); ++ ++void ++csd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun, ++ void *userData); ++ ++#endif +diff -uNrp a/plugins/keyboard/xxx/delayed-dialog.c b/plugins/keyboard/xxx/delayed-dialog.c +--- a/plugins/keyboard/xxx/delayed-dialog.c 1970-01-01 01:00:00.000000000 +0100 ++++ b/plugins/keyboard/xxx/delayed-dialog.c 2013-08-25 16:36:02.000000000 +0100 +@@ -0,0 +1,128 @@ ++/* ++ * Copyright © 2006 Novell, 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, 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 - Suite 500, Boston, MA ++ * 02110-1335, USA. ++ */ ++ ++#include ++#include ++ ++#include ++#include ++ ++#include "delayed-dialog.h" ++ ++static gboolean delayed_show_timeout (gpointer data); ++static GdkFilterReturn message_filter (GdkXEvent *xevent, ++ GdkEvent *event, ++ gpointer data); ++ ++static GSList *dialogs = NULL; ++ ++/** ++ * csd_delayed_show_dialog: ++ * @dialog: the dialog ++ * ++ * Shows the dialog as with gtk_widget_show(), unless a window manager ++ * hasn't been started yet, in which case it will wait up to 5 seconds ++ * for that to happen before showing the dialog. ++ **/ ++void ++csd_delayed_show_dialog (GtkWidget *dialog) ++{ ++ GdkDisplay *display = gtk_widget_get_display (dialog); ++ Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); ++ GdkScreen *screen = gtk_widget_get_screen (dialog); ++ char selection_name[10]; ++ Atom selection_atom; ++ ++ /* We can't use gdk_selection_owner_get() for this, because ++ * it's an unknown out-of-process window. ++ */ ++ snprintf (selection_name, sizeof (selection_name), "WM_S%d", ++ gdk_screen_get_number (screen)); ++ selection_atom = XInternAtom (xdisplay, selection_name, True); ++ if (selection_atom && ++ XGetSelectionOwner (xdisplay, selection_atom) != None) { ++ gtk_widget_show (dialog); ++ return; ++ } ++ ++ dialogs = g_slist_prepend (dialogs, dialog); ++ ++ gdk_window_add_filter (NULL, message_filter, NULL); ++ ++ g_timeout_add (5000, delayed_show_timeout, NULL); ++} ++ ++static gboolean ++delayed_show_timeout (gpointer data) ++{ ++ GSList *l; ++ ++ for (l = dialogs; l; l = l->next) ++ gtk_widget_show (l->data); ++ g_slist_free (dialogs); ++ dialogs = NULL; ++ ++ /* FIXME: There's no gdk_display_remove_client_message_filter */ ++ ++ return FALSE; ++} ++ ++static GdkFilterReturn ++message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data) ++{ ++ XClientMessageEvent *evt; ++ char *selection_name; ++ int screen; ++ GSList *l, *next; ++ ++ if (((XEvent *)xevent)->type != ClientMessage) ++ return GDK_FILTER_CONTINUE; ++ ++ evt = (XClientMessageEvent *)xevent; ++ ++ if (evt->message_type != XInternAtom (evt->display, "MANAGER", FALSE)) ++ return GDK_FILTER_CONTINUE; ++ ++ selection_name = XGetAtomName (evt->display, evt->data.l[1]); ++ ++ if (strncmp (selection_name, "WM_S", 4) != 0) { ++ XFree (selection_name); ++ return GDK_FILTER_CONTINUE; ++ } ++ ++ screen = atoi (selection_name + 4); ++ ++ for (l = dialogs; l; l = next) { ++ GtkWidget *dialog = l->data; ++ next = l->next; ++ ++ if (gdk_screen_get_number (gtk_widget_get_screen (dialog)) == screen) { ++ gtk_widget_show (dialog); ++ dialogs = g_slist_remove (dialogs, dialog); ++ } ++ } ++ ++ if (!dialogs) { ++ gdk_window_remove_filter (NULL, message_filter, NULL); ++ } ++ ++ XFree (selection_name); ++ ++ return GDK_FILTER_CONTINUE; ++} +diff -uNrp a/plugins/keyboard/xxx/delayed-dialog.h b/plugins/keyboard/xxx/delayed-dialog.h +--- a/plugins/keyboard/xxx/delayed-dialog.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/plugins/keyboard/xxx/delayed-dialog.h 2013-08-25 16:36:02.000000000 +0100 +@@ -0,0 +1,32 @@ ++/* ++ * Copyright © 2006 Novell, 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, 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 - Suite 500, Boston, MA ++ * 02110-1335, USA. ++ */ ++ ++ ++#ifndef __DELAYED_DIALOG_H ++#define __DELAYED_DIALOG_H ++ ++#include ++ ++G_BEGIN_DECLS ++ ++void csd_delayed_show_dialog (GtkWidget *dialog); ++ ++G_END_DECLS ++ ++#endif +diff -uNrp a/plugins/keyboard/xxx/gkbd-configuration.c b/plugins/keyboard/xxx/gkbd-configuration.c +--- a/plugins/keyboard/xxx/gkbd-configuration.c 1970-01-01 01:00:00.000000000 +0100 ++++ b/plugins/keyboard/xxx/gkbd-configuration.c 2013-08-25 16:36:02.000000000 +0100 +@@ -0,0 +1,350 @@ ++/* ++ * Copyright (C) 2010 Canonical Ltd. ++ * ++ * Authors: Jan Arne Petersen ++ * ++ * Based on gkbd-status.c by Sergey V. Udaltsov ++ * ++ * This library 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 of the License, or (at your option) any later version. ++ * ++ * This library 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 library; if not, write to the ++ * Free Software Foundation, Inc., 51 Franklin Street - Suite 500, ++ * Boston, MA 02110-1335, USA. ++ */ ++ ++#include ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "gkbd-configuration.h" ++ ++struct _GkbdConfigurationPrivate { ++ XklEngine *engine; ++ XklConfigRegistry *registry; ++ ++ GkbdDesktopConfig cfg; ++ GkbdIndicatorConfig ind_cfg; ++ GkbdKeyboardConfig kbd_cfg; ++ ++ gchar **full_group_names; ++ gchar **short_group_names; ++ ++ gulong state_changed_handler; ++ gulong config_changed_handler; ++}; ++ ++enum { ++ SIGNAL_CHANGED, ++ SIGNAL_GROUP_CHANGED, ++ LAST_SIGNAL ++}; ++ ++static guint signals[LAST_SIGNAL] = { 0, }; ++ ++#define GKBD_CONFIGURATION_GET_PRIVATE(o) \ ++ (G_TYPE_INSTANCE_GET_PRIVATE ((o), GKBD_TYPE_CONFIGURATION, GkbdConfigurationPrivate)) ++ ++G_DEFINE_TYPE (GkbdConfiguration, gkbd_configuration, G_TYPE_OBJECT) ++ ++/* Should be called once for all widgets */ ++static void ++gkbd_configuration_cfg_changed (GSettings *settings, ++ const char *key, ++ GkbdConfiguration * configuration) ++{ ++ GkbdConfigurationPrivate *priv = configuration->priv; ++ ++ xkl_debug (100, ++ "General configuration changed in GSettings - reiniting...\n"); ++ gkbd_desktop_config_load (&priv->cfg); ++ gkbd_desktop_config_activate (&priv->cfg); ++ ++ g_signal_emit (configuration, ++ signals[SIGNAL_CHANGED], 0); ++} ++ ++/* Should be called once for all widgets */ ++static void ++gkbd_configuration_ind_cfg_changed (GSettings *settings, ++ const char *key, ++ GkbdConfiguration * configuration) ++{ ++ GkbdConfigurationPrivate *priv = configuration->priv; ++ xkl_debug (100, ++ "Applet configuration changed in GSettings - reiniting...\n"); ++ gkbd_indicator_config_load (&priv->ind_cfg); ++ ++ gkbd_indicator_config_free_image_filenames (&priv->ind_cfg); ++ gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, ++ &priv->kbd_cfg); ++ ++ gkbd_indicator_config_activate (&priv->ind_cfg); ++ ++ g_signal_emit (configuration, ++ signals[SIGNAL_CHANGED], 0); ++} ++ ++static void ++gkbd_configuration_load_group_names (GkbdConfiguration * configuration, ++ XklConfigRec * xklrec) ++{ ++ GkbdConfigurationPrivate *priv = configuration->priv; ++ ++ if (!gkbd_desktop_config_load_group_descriptions (&priv->cfg, ++ priv->registry, ++ (const char **) xklrec->layouts, ++ (const char **) xklrec->variants, ++ &priv->short_group_names, ++ &priv->full_group_names)) { ++ /* We just populate no short names (remain NULL) - ++ * full names are going to be used anyway */ ++ gint i, total_groups = ++ xkl_engine_get_num_groups (priv->engine); ++ xkl_debug (150, "group descriptions loaded: %d!\n", ++ total_groups); ++ priv->full_group_names = ++ g_new0 (char *, total_groups + 1); ++ ++ if (xkl_engine_get_features (priv->engine) & ++ XKLF_MULTIPLE_LAYOUTS_SUPPORTED) { ++ for (i = 0; priv->kbd_cfg.layouts_variants[i]; i++) { ++ priv->full_group_names[i] = ++ g_strdup ((char *) priv->kbd_cfg.layouts_variants[i]); ++ } ++ } else { ++ for (i = total_groups; --i >= 0;) { ++ priv->full_group_names[i] = ++ g_strdup_printf ("Group %d", i); ++ } ++ } ++ } ++} ++ ++/* Should be called once for all widgets */ ++static void ++gkbd_configuration_kbd_cfg_callback (XklEngine *engine, ++ GkbdConfiguration *configuration) ++{ ++ GkbdConfigurationPrivate *priv = configuration->priv; ++ XklConfigRec *xklrec = xkl_config_rec_new (); ++ xkl_debug (100, ++ "XKB configuration changed on X Server - reiniting...\n"); ++ ++ gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg, ++ xklrec); ++ ++ gkbd_indicator_config_free_image_filenames (&priv->ind_cfg); ++ gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, ++ &priv->kbd_cfg); ++ ++ g_strfreev (priv->full_group_names); ++ priv->full_group_names = NULL; ++ ++ g_strfreev (priv->short_group_names); ++ priv->short_group_names = NULL; ++ ++ gkbd_configuration_load_group_names (configuration, ++ xklrec); ++ ++ g_signal_emit (configuration, ++ signals[SIGNAL_CHANGED], ++ 0); ++ ++ g_object_unref (G_OBJECT (xklrec)); ++} ++ ++/* Should be called once for all applets */ ++static void ++gkbd_configuration_state_callback (XklEngine * engine, ++ XklEngineStateChange changeType, ++ gint group, gboolean restore, ++ GkbdConfiguration * configuration) ++{ ++ xkl_debug (150, "group is now %d, restore: %d\n", group, restore); ++ ++ if (changeType == GROUP_CHANGED) { ++ g_signal_emit (configuration, ++ signals[SIGNAL_GROUP_CHANGED], 0, ++ group); ++ } ++} ++ ++static void ++gkbd_configuration_init (GkbdConfiguration *configuration) ++{ ++ GkbdConfigurationPrivate *priv; ++ XklConfigRec *xklrec = xkl_config_rec_new (); ++ ++ priv = GKBD_CONFIGURATION_GET_PRIVATE (configuration); ++ configuration->priv = priv; ++ ++ priv->engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); ++ if (priv->engine == NULL) { ++ xkl_debug (0, "Libxklavier initialization error"); ++ return; ++ } ++ ++ priv->state_changed_handler = ++ g_signal_connect (priv->engine, "X-state-changed", ++ G_CALLBACK (gkbd_configuration_state_callback), ++ configuration); ++ priv->config_changed_handler = ++ g_signal_connect (priv->engine, "X-config-changed", ++ G_CALLBACK (gkbd_configuration_kbd_cfg_callback), ++ configuration); ++ ++ gkbd_desktop_config_init (&priv->cfg, priv->engine); ++ gkbd_keyboard_config_init (&priv->kbd_cfg, priv->engine); ++ gkbd_indicator_config_init (&priv->ind_cfg, priv->engine); ++ ++ gkbd_desktop_config_load (&priv->cfg); ++ gkbd_desktop_config_activate (&priv->cfg); ++ ++ priv->registry = xkl_config_registry_get_instance (priv->engine); ++ xkl_config_registry_load (priv->registry, ++ priv->cfg.load_extra_items); ++ ++ gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg, ++ xklrec); ++ ++ gkbd_indicator_config_load (&priv->ind_cfg); ++ ++ gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, ++ &priv->kbd_cfg); ++ ++ gkbd_indicator_config_activate (&priv->ind_cfg); ++ ++ gkbd_configuration_load_group_names (configuration, ++ xklrec); ++ g_object_unref (G_OBJECT (xklrec)); ++ ++ gkbd_desktop_config_start_listen (&priv->cfg, ++ G_CALLBACK (gkbd_configuration_cfg_changed), ++ configuration); ++ gkbd_indicator_config_start_listen (&priv->ind_cfg, ++ G_CALLBACK (gkbd_configuration_ind_cfg_changed), ++ configuration); ++ xkl_engine_start_listen (priv->engine, ++ XKLL_TRACK_KEYBOARD_STATE); ++ ++ xkl_debug (100, "Initiating the widget startup process for %p\n", ++ configuration); ++} ++ ++static void ++gkbd_configuration_finalize (GObject * obj) ++{ ++ GkbdConfiguration *configuration = GKBD_CONFIGURATION (obj); ++ GkbdConfigurationPrivate *priv = configuration->priv; ++ ++ xkl_debug (100, ++ "Starting the gnome-kbd-configuration widget shutdown process for %p\n", ++ configuration); ++ ++ xkl_engine_stop_listen (priv->engine, ++ XKLL_TRACK_KEYBOARD_STATE); ++ ++ gkbd_desktop_config_stop_listen (&priv->cfg); ++ gkbd_indicator_config_stop_listen (&priv->ind_cfg); ++ ++ gkbd_indicator_config_term (&priv->ind_cfg); ++ gkbd_keyboard_config_term (&priv->kbd_cfg); ++ gkbd_desktop_config_term (&priv->cfg); ++ ++ if (g_signal_handler_is_connected (priv->engine, ++ priv->state_changed_handler)) { ++ g_signal_handler_disconnect (priv->engine, ++ priv->state_changed_handler); ++ priv->state_changed_handler = 0; ++ } ++ if (g_signal_handler_is_connected (priv->engine, ++ priv->config_changed_handler)) { ++ g_signal_handler_disconnect (priv->engine, ++ priv->config_changed_handler); ++ priv->config_changed_handler = 0; ++ } ++ ++ g_object_unref (priv->registry); ++ priv->registry = NULL; ++ g_object_unref (priv->engine); ++ priv->engine = NULL; ++ ++ G_OBJECT_CLASS (gkbd_configuration_parent_class)->finalize (obj); ++} ++ ++static void ++gkbd_configuration_class_init (GkbdConfigurationClass * klass) ++{ ++ GObjectClass *object_class = G_OBJECT_CLASS (klass); ++ ++ /* Initing vtable */ ++ object_class->finalize = gkbd_configuration_finalize; ++ ++ /* Signals */ ++ signals[SIGNAL_CHANGED] = g_signal_new ("changed", ++ GKBD_TYPE_CONFIGURATION, ++ G_SIGNAL_RUN_LAST, ++ 0, ++ NULL, NULL, ++ g_cclosure_marshal_VOID__VOID, ++ G_TYPE_NONE, ++ 0); ++ signals[SIGNAL_GROUP_CHANGED] = g_signal_new ("group-changed", ++ GKBD_TYPE_CONFIGURATION, ++ G_SIGNAL_RUN_LAST, ++ 0, ++ NULL, NULL, ++ g_cclosure_marshal_VOID__INT, ++ G_TYPE_NONE, ++ 1, ++ G_TYPE_INT); ++ ++ g_type_class_add_private (klass, sizeof (GkbdConfigurationPrivate)); ++} ++ ++GkbdConfiguration * ++gkbd_configuration_get (void) ++{ ++ static gpointer instance = NULL; ++ ++ if (!instance) { ++ instance = g_object_new (GKBD_TYPE_CONFIGURATION, NULL); ++ g_object_add_weak_pointer (instance, &instance); ++ } else { ++ g_object_ref (instance); ++ } ++ ++ return instance; ++} ++ ++XklEngine * ++gkbd_configuration_get_xkl_engine (GkbdConfiguration *configuration) ++{ ++ return configuration->priv->engine; ++} ++ ++const char * const * ++gkbd_configuration_get_group_names (GkbdConfiguration *configuration) ++{ ++ return configuration->priv->full_group_names; ++} ++ ++const char * const * ++gkbd_configuration_get_short_group_names (GkbdConfiguration *configuration) ++{ ++ return configuration->priv->short_group_names; ++} +diff -uNrp a/plugins/keyboard/xxx/gkbd-configuration.h b/plugins/keyboard/xxx/gkbd-configuration.h +--- a/plugins/keyboard/xxx/gkbd-configuration.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/plugins/keyboard/xxx/gkbd-configuration.h 2013-08-25 16:36:02.000000000 +0100 +@@ -0,0 +1,65 @@ ++/* ++ * Copyright (C) 2010 Canonical Ltd. ++ * ++ * Authors: Jan Arne Petersen ++ * ++ * Based on gkbd-status.h by Sergey V. Udaltsov ++ * ++ * This library 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 of the License, or (at your option) any later version. ++ * ++ * This library 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 library; if not, write to the ++ * Free Software Foundation, Inc., 51 Franklin Street - Suite 500, ++ * Boston, MA 02110-1335, USA. ++ */ ++ ++#ifndef __GKBD_CONFIGURATION_H__ ++#define __GKBD_CONFIGURATION_H__ ++ ++#include ++ ++#include ++ ++G_BEGIN_DECLS ++ ++typedef struct _GkbdConfiguration GkbdConfiguration; ++typedef struct _GkbdConfigurationPrivate GkbdConfigurationPrivate; ++typedef struct _GkbdConfigurationClass GkbdConfigurationClass; ++ ++#define GKBD_TYPE_CONFIGURATION (gkbd_configuration_get_type ()) ++#define GKBD_CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfiguration)) ++#define GKBD_INDCATOR_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfigurationClass)) ++#define GKBD_IS_CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKBD_TYPE_CONFIGURATION)) ++#define GKBD_IS_CONFIGURATION_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), GKBD_TYPE_CONFIGURATION)) ++#define GKBD_CONFIGURATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfigurationClass)) ++ ++struct _GkbdConfiguration { ++ GObject parent; ++ ++ GkbdConfigurationPrivate *priv; ++}; ++ ++struct _GkbdConfigurationClass { ++ GObjectClass parent_class; ++}; ++ ++extern GType gkbd_configuration_get_type (void); ++ ++extern GkbdConfiguration *gkbd_configuration_get (void); ++ ++extern XklEngine *gkbd_configuration_get_xkl_engine (GkbdConfiguration *configuration); ++ ++extern const char * const *gkbd_configuration_get_group_names (GkbdConfiguration *configuration); ++extern const char * const *gkbd_configuration_get_short_group_names (GkbdConfiguration *configuration); ++ ++G_END_DECLS ++ ++#endif +diff -uNrp a/plugins/media-keys/csd-media-keys-manager.c b/plugins/media-keys/csd-media-keys-manager.c +--- a/plugins/media-keys/csd-media-keys-manager.c 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/media-keys/csd-media-keys-manager.c 2013-08-25 16:36:02.000000000 +0100 +@@ -120,6 +120,10 @@ static const gchar kb_introspection_xml[ + #define VOLUME_STEP 6 /* percents for one volume button press */ + #define MAX_VOLUME 65536.0 + ++#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.cinnamon.desktop.input-sources" ++#define KEY_CURRENT_INPUT_SOURCE "current" ++#define KEY_INPUT_SOURCES "sources" ++ + #define CSD_MEDIA_KEYS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CSD_TYPE_MEDIA_KEYS_MANAGER, CsdMediaKeysManagerPrivate)) + + typedef struct { +@@ -1750,6 +1754,40 @@ do_keyboard_brightness_action (CsdMediaK + manager); + } + ++static void ++do_switch_input_source_action (CsdMediaKeysManager *manager, ++ MediaKeyType type) ++{ ++ GSettings *settings; ++ GVariant *sources; ++ gint i, n; ++ ++ settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); ++ sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); ++ ++ n = g_variant_n_children (sources); ++ if (n < 2) ++ goto out; ++ ++ i = g_settings_get_uint (settings, KEY_CURRENT_INPUT_SOURCE); ++ ++ if (type == SWITCH_INPUT_SOURCE_KEY) ++ i += 1; ++ else ++ i -= 1; ++ ++ if (i < 0) ++ i = n - 1; ++ else if (i >= n) ++ i = 0; ++ ++ g_settings_set_uint (settings, KEY_CURRENT_INPUT_SOURCE, i); ++ ++ out: ++ g_variant_unref (sources); ++ g_object_unref (settings); ++} ++ + static gboolean + do_action (CsdMediaKeysManager *manager, + guint deviceid, +@@ -1908,6 +1946,10 @@ do_action (CsdMediaKeysManager *manager, + case BATTERY_KEY: + do_execute_desktop (manager, "gnome-power-statistics.desktop", timestamp); + break; ++ case SWITCH_INPUT_SOURCE_KEY: ++ case SWITCH_INPUT_SOURCE_BACKWARD_KEY: ++ do_switch_input_source_action (manager, type); ++ break; + /* Note, no default so compiler catches missing keys */ + case CUSTOM_KEY: + g_assert_not_reached (); +diff -uNrp a/plugins/media-keys/shortcuts-list.h b/plugins/media-keys/shortcuts-list.h +--- a/plugins/media-keys/shortcuts-list.h 2013-08-24 18:04:31.000000000 +0100 ++++ b/plugins/media-keys/shortcuts-list.h 2013-08-25 16:36:02.000000000 +0100 +@@ -81,6 +81,8 @@ typedef enum { + KEYBOARD_BRIGHTNESS_DOWN_KEY, + KEYBOARD_BRIGHTNESS_TOGGLE_KEY, + BATTERY_KEY, ++ SWITCH_INPUT_SOURCE_KEY, ++ SWITCH_INPUT_SOURCE_BACKWARD_KEY, + CUSTOM_KEY + } MediaKeyType; + +@@ -148,6 +150,9 @@ static struct { + { KEYBOARD_BRIGHTNESS_UP_KEY, NULL, "XF86KbdBrightnessUp" }, + { KEYBOARD_BRIGHTNESS_DOWN_KEY, NULL, "XF86KbdBrightnessDown" }, + { KEYBOARD_BRIGHTNESS_TOGGLE_KEY, NULL, "XF86KbdLightOnOff" }, ++ { SWITCH_INPUT_SOURCE_KEY, "switch-input-source", NULL }, ++ { SWITCH_INPUT_SOURCE_BACKWARD_KEY, "switch-input-source-backward", NULL }, ++ + { BATTERY_KEY, NULL, "XF86Battery" }, + }; + diff --git a/pkgs/desktops/cinnamon/systemd-support.patch b/pkgs/desktops/cinnamon/systemd-support.patch new file mode 100644 index 00000000000..feceaf05f7b --- /dev/null +++ b/pkgs/desktops/cinnamon/systemd-support.patch @@ -0,0 +1,536 @@ + +diff --git a/plugins/media-keys/csd-media-keys-manager.c b/plugins/media-keys/csd-media-keys-manager.c +index 02930a3..7c1c519 100644 +--- a/plugins/media-keys/csd-media-keys-manager.c ++++ b/plugins/media-keys/csd-media-keys-manager.c +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_GUDEV + #include +@@ -121,6 +122,10 @@ static const gchar kb_introspection_xml[] = + #define VOLUME_STEP 5 /* percents for one volume button press */ + #define MAX_VOLUME 65536.0 + ++#define SYSTEMD_DBUS_NAME "org.freedesktop.login1" ++#define SYSTEMD_DBUS_PATH "/org/freedesktop/login1" ++#define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager" ++ + #define CSD_MEDIA_KEYS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CSD_TYPE_MEDIA_KEYS_MANAGER, CsdMediaKeysManagerPrivate)) + + typedef struct { +@@ -167,6 +172,10 @@ struct CsdMediaKeysManagerPrivate + GDBusProxy *power_screen_proxy; + GDBusProxy *power_keyboard_proxy; + ++ /* systemd stuff */ ++ GDBusProxy *logind_proxy; ++ gint inhibit_keys_fd; ++ + /* Multihead stuff */ + GdkScreen *current_screen; + GSList *screens; +@@ -2213,6 +2222,11 @@ csd_media_keys_manager_stop (CsdMediaKeysManager *manager) + } + #endif /* HAVE_GUDEV */ + ++ if (priv->logind_proxy) { ++ g_object_unref (priv->logind_proxy); ++ priv->logind_proxy = NULL; ++ } ++ + if (priv->settings) { + g_object_unref (priv->settings); + priv->settings = NULL; +@@ -2356,9 +2370,85 @@ csd_media_keys_manager_class_init (CsdMediaKeysManagerClass *klass) + } + + static void ++inhibit_done (GObject *source, ++ GAsyncResult *result, ++ gpointer user_data) ++{ ++ GDBusProxy *proxy = G_DBUS_PROXY (source); ++ CsdMediaKeysManager *manager = CSD_MEDIA_KEYS_MANAGER (user_data); ++ GError *error = NULL; ++ GVariant *res; ++ GUnixFDList *fd_list = NULL; ++ gint idx; ++ ++ res = g_dbus_proxy_call_with_unix_fd_list_finish (proxy, &fd_list, result, &error); ++ if (res == NULL) { ++ g_warning ("Unable to inhibit keypresses: %s", error->message); ++ g_error_free (error); ++ } else { ++ g_variant_get (res, "(h)", &idx); ++ manager->priv->inhibit_keys_fd = g_unix_fd_list_get (fd_list, idx, &error); ++ if (manager->priv->inhibit_keys_fd == -1) { ++ g_warning ("Failed to receive system inhibitor fd: %s", error->message); ++ g_error_free (error); ++ } ++ g_debug ("System inhibitor fd is %d", manager->priv->inhibit_keys_fd); ++ g_object_unref (fd_list); ++ g_variant_unref (res); ++ } ++} ++ ++static void + csd_media_keys_manager_init (CsdMediaKeysManager *manager) + { ++ GError *error; ++ GDBusConnection *bus; ++ ++ error = NULL; + manager->priv = CSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager); ++ ++ bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); ++ if (bus == NULL) { ++ g_warning ("Failed to connect to system bus: %s", ++ error->message); ++ g_error_free (error); ++ return; ++ } ++ ++ manager->priv->logind_proxy = ++ g_dbus_proxy_new_sync (bus, ++ 0, ++ NULL, ++ SYSTEMD_DBUS_NAME, ++ SYSTEMD_DBUS_PATH, ++ SYSTEMD_DBUS_INTERFACE, ++ NULL, ++ &error); ++ ++ if (manager->priv->logind_proxy == NULL) { ++ g_warning ("Failed to connect to systemd: %s", ++ error->message); ++ g_error_free (error); ++ } ++ ++ g_object_unref (bus); ++ ++ g_debug ("Adding system inhibitors for power keys"); ++ manager->priv->inhibit_keys_fd = -1; ++ g_dbus_proxy_call_with_unix_fd_list (manager->priv->logind_proxy, ++ "Inhibit", ++ g_variant_new ("(ssss)", ++ "handle-power-key:handle-suspend-key:handle-hibernate-key", ++ g_get_user_name (), ++ "Cinnamon handling keypresses", ++ "block"), ++ 0, ++ G_MAXINT, ++ NULL, ++ NULL, ++ inhibit_done, ++ manager); ++ + } + + static void +@@ -2375,6 +2465,8 @@ csd_media_keys_manager_finalize (GObject *object) + + if (media_keys_manager->priv->start_idle_id != 0) + g_source_remove (media_keys_manager->priv->start_idle_id); ++ if (media_keys_manager->priv->inhibit_keys_fd != -1) ++ close (media_keys_manager->priv->inhibit_keys_fd); + + G_OBJECT_CLASS (csd_media_keys_manager_parent_class)->finalize (object); + } +diff --git a/plugins/power/csd-power-manager.c b/plugins/power/csd-power-manager.c +index b54cb5b..b9c5429 100644 +--- a/plugins/power/csd-power-manager.c ++++ b/plugins/power/csd-power-manager.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + #include + +@@ -79,6 +80,10 @@ + #define CSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT 5 /* seconds */ + #define CSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT 30 /* seconds */ + ++#define SYSTEMD_DBUS_NAME "org.freedesktop.login1" ++#define SYSTEMD_DBUS_PATH "/org/freedesktop/login1" ++#define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager" ++ + /* Keep this in sync with gnome-shell */ + #define SCREENSAVER_FADE_TIME 10 /* seconds */ + +@@ -203,6 +208,13 @@ struct CsdPowerManagerPrivate + GtkStatusIcon *status_icon; + guint xscreensaver_watchdog_timer_id; + gboolean is_virtual_machine; ++ ++ /* systemd stuff */ ++ GDBusProxy *logind_proxy; ++ gint inhibit_lid_switch_fd; ++ gboolean inhibit_lid_switch_taken; ++ gint inhibit_suspend_fd; ++ gboolean inhibit_suspend_taken; + }; + + enum { +@@ -3350,30 +3362,6 @@ lock_screensaver (CsdPowerManager *manager) + if (!do_lock) + return; + +- /* connect to the screensaver first */ +- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, +- G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, +- NULL, +- GS_DBUS_NAME, +- GS_DBUS_PATH, +- GS_DBUS_INTERFACE, +- NULL, +- sleep_cb_screensaver_proxy_ready_cb, +- manager); +-} +- +-static void +-upower_notify_sleep_cb (UpClient *client, +- UpSleepKind sleep_kind, +- CsdPowerManager *manager) +-{ +- gboolean do_lock; +- +- do_lock = g_settings_get_boolean (manager->priv->settings, +- "lock-on-suspend"); +- if (!do_lock) +- return; +- + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, +@@ -3384,46 +3372,6 @@ upower_notify_sleep_cb (UpClient *client, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); +- +-} +- +-static void +-upower_notify_resume_cb (UpClient *client, +- UpSleepKind sleep_kind, +- CsdPowerManager *manager) +-{ +- gboolean ret; +- GError *error = NULL; +- +- /* this displays the unlock dialogue so the user doesn't have +- * to move the mouse or press any key before the window comes up */ +- if (manager->priv->screensaver_proxy != NULL) { +- g_dbus_proxy_call (manager->priv->screensaver_proxy, +- "SimulateUserActivity", +- NULL, +- G_DBUS_CALL_FLAGS_NONE, +- -1, NULL, NULL, NULL); +- } +- +- if (manager->priv->screensaver_proxy != NULL) { +- g_object_unref (manager->priv->screensaver_proxy); +- manager->priv->screensaver_proxy = NULL; +- } +- +- /* close existing notifications on resume, the system power +- * state is probably different now */ +- notify_close_if_showing (manager->priv->notification_low); +- notify_close_if_showing (manager->priv->notification_discharging); +- +- /* ensure we turn the panel back on after resume */ +- ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, +- GNOME_RR_DPMS_ON, +- &error); +- if (!ret) { +- g_warning ("failed to turn the panel on after resume: %s", +- error->message); +- g_error_free (error); +- } + } + + static void +@@ -3582,6 +3530,219 @@ disable_builtin_screensaver (gpointer unused) + return TRUE; + } + ++static void ++inhibit_lid_switch_done (GObject *source, ++ GAsyncResult *result, ++ gpointer user_data) ++{ ++ GDBusProxy *proxy = G_DBUS_PROXY (source); ++ CsdPowerManager *manager = CSD_POWER_MANAGER (user_data); ++ GError *error = NULL; ++ GVariant *res; ++ GUnixFDList *fd_list = NULL; ++ gint idx; ++ ++ res = g_dbus_proxy_call_with_unix_fd_list_finish (proxy, &fd_list, result, &error); ++ if (res == NULL) { ++ g_warning ("Unable to inhibit lid switch: %s", error->message); ++ g_error_free (error); ++ } else { ++ g_variant_get (res, "(h)", &idx); ++ manager->priv->inhibit_lid_switch_fd = g_unix_fd_list_get (fd_list, idx, &error); ++ if (manager->priv->inhibit_lid_switch_fd == -1) { ++ g_warning ("Failed to receive system inhibitor fd: %s", error->message); ++ g_error_free (error); ++ } ++ g_debug ("System inhibitor fd is %d", manager->priv->inhibit_lid_switch_fd); ++ g_object_unref (fd_list); ++ g_variant_unref (res); ++ } ++} ++ ++static void ++inhibit_lid_switch (CsdPowerManager *manager) ++{ ++ GVariant *params; ++ ++ if (manager->priv->inhibit_lid_switch_taken) { ++ g_debug ("already inhibited lid-switch"); ++ return; ++ } ++ g_debug ("Adding lid switch system inhibitor"); ++ manager->priv->inhibit_lid_switch_taken = TRUE; ++ ++ params = g_variant_new ("(ssss)", ++ "handle-lid-switch", ++ g_get_user_name (), ++ "Multiple displays attached", ++ "block"); ++ g_dbus_proxy_call_with_unix_fd_list (manager->priv->logind_proxy, ++ "Inhibit", ++ params, ++ 0, ++ G_MAXINT, ++ NULL, ++ NULL, ++ inhibit_lid_switch_done, ++ manager); ++} ++ ++static void ++inhibit_suspend_done (GObject *source, ++ GAsyncResult *result, ++ gpointer user_data) ++{ ++ GDBusProxy *proxy = G_DBUS_PROXY (source); ++ CsdPowerManager *manager = CSD_POWER_MANAGER (user_data); ++ GError *error = NULL; ++ GVariant *res; ++ GUnixFDList *fd_list = NULL; ++ gint idx; ++ ++ res = g_dbus_proxy_call_with_unix_fd_list_finish (proxy, &fd_list, result, &error); ++ if (res == NULL) { ++ g_warning ("Unable to inhibit suspend: %s", error->message); ++ g_error_free (error); ++ } else { ++ g_variant_get (res, "(h)", &idx); ++ manager->priv->inhibit_suspend_fd = g_unix_fd_list_get (fd_list, idx, &error); ++ if (manager->priv->inhibit_suspend_fd == -1) { ++ g_warning ("Failed to receive system inhibitor fd: %s", error->message); ++ g_error_free (error); ++ } ++ g_debug ("System inhibitor fd is %d", manager->priv->inhibit_suspend_fd); ++ g_object_unref (fd_list); ++ g_variant_unref (res); ++ } ++} ++ ++/* We take a delay inhibitor here, which causes logind to send a ++ * PrepareToSleep signal, which gives us a chance to lock the screen ++ * and do some other preparations. ++ */ ++static void ++inhibit_suspend (CsdPowerManager *manager) ++{ ++ if (manager->priv->inhibit_suspend_taken) { ++ g_debug ("already inhibited lid-switch"); ++ return; ++ } ++ g_debug ("Adding suspend delay inhibitor"); ++ manager->priv->inhibit_suspend_taken = TRUE; ++ g_dbus_proxy_call_with_unix_fd_list (manager->priv->logind_proxy, ++ "Inhibit", ++ g_variant_new ("(ssss)", ++ "sleep", ++ g_get_user_name (), ++ "Cinnamon needs to lock the screen", ++ "delay"), ++ 0, ++ G_MAXINT, ++ NULL, ++ NULL, ++ inhibit_suspend_done, ++ manager); ++} ++ ++static void ++uninhibit_suspend (CsdPowerManager *manager) ++{ ++ if (manager->priv->inhibit_suspend_fd == -1) { ++ g_debug ("no suspend delay inhibitor"); ++ return; ++ } ++ g_debug ("Removing suspend delay inhibitor"); ++ close (manager->priv->inhibit_suspend_fd); ++ manager->priv->inhibit_suspend_fd = -1; ++ manager->priv->inhibit_suspend_taken = FALSE; ++} ++ ++static void ++handle_suspend_actions (CsdPowerManager *manager) ++{ ++ gboolean do_lock; ++ ++ do_lock = g_settings_get_boolean (manager->priv->settings, ++ "lock-on-suspend"); ++ if (do_lock) ++ lock_screensaver (manager); ++ ++ /* lift the delay inhibit, so logind can proceed */ ++ uninhibit_suspend (manager); ++} ++ ++static void ++handle_resume_actions (CsdPowerManager *manager) ++{ ++ gboolean ret; ++ GError *error = NULL; ++ ++ /* this displays the unlock dialogue so the user doesn't have ++ * to move the mouse or press any key before the window comes up */ ++ g_dbus_connection_call (manager->priv->connection, ++ GS_DBUS_NAME, ++ GS_DBUS_PATH, ++ GS_DBUS_INTERFACE, ++ "SimulateUserActivity", ++ NULL, NULL, ++ G_DBUS_CALL_FLAGS_NONE, -1, ++ NULL, NULL, NULL); ++ ++ /* close existing notifications on resume, the system power ++ * state is probably different now */ ++ notify_close_if_showing (manager->priv->notification_low); ++ notify_close_if_showing (manager->priv->notification_discharging); ++ ++ /* ensure we turn the panel back on after resume */ ++ ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, ++ GNOME_RR_DPMS_ON, ++ &error); ++ if (!ret) { ++ g_warning ("failed to turn the panel on after resume: %s", ++ error->message); ++ g_error_free (error); ++ } ++ ++ /* set up the delay again */ ++ inhibit_suspend (manager); ++} ++ ++static void ++upower_notify_sleep_cb (UpClient *client, ++ UpSleepKind sleep_kind, ++ CsdPowerManager *manager) ++{ ++ handle_suspend_actions (manager); ++} ++ ++static void ++upower_notify_resume_cb (UpClient *client, ++ UpSleepKind sleep_kind, ++ CsdPowerManager *manager) ++{ ++ handle_resume_actions (manager); ++} ++ ++static void ++logind_proxy_signal_cb (GDBusProxy *proxy, ++ const gchar *sender_name, ++ const gchar *signal_name, ++ GVariant *parameters, ++ gpointer user_data) ++{ ++ CsdPowerManager *manager = CSD_POWER_MANAGER (user_data); ++ gboolean is_about_to_suspend; ++ ++ if (g_strcmp0 (signal_name, "PrepareForSleep") != 0) ++ return; ++ g_variant_get (parameters, "(b)", &is_about_to_suspend); ++ if (is_about_to_suspend) { ++ handle_suspend_actions (manager); ++ } else { ++ handle_resume_actions (manager); ++ } ++} ++ + static gboolean + is_hardware_a_virtual_machine (void) + { +@@ -3647,6 +3808,26 @@ csd_power_manager_start (CsdPowerManager *manager, + if (manager->priv->x11_screen == NULL) + return FALSE; + ++ /* Set up the logind proxy */ ++ manager->priv->logind_proxy = ++ g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, ++ 0, ++ NULL, ++ SYSTEMD_DBUS_NAME, ++ SYSTEMD_DBUS_PATH, ++ SYSTEMD_DBUS_INTERFACE, ++ NULL, ++ error); ++ g_signal_connect (manager->priv->logind_proxy, "g-signal", ++ G_CALLBACK (logind_proxy_signal_cb), ++ manager); ++ ++ /* Set up a delay inhibitor to be informed about suspend attempts */ ++ inhibit_suspend (manager); ++ ++ /* Disable logind's lid handling while g-s-d is active */ ++ inhibit_lid_switch (manager); ++ + /* track the active session */ + manager->priv->session = cinnamon_settings_session_new (); + g_signal_connect (manager->priv->session, "notify::state", +@@ -3856,6 +4037,22 @@ csd_power_manager_stop (CsdPowerManager *manager) + manager->priv->up_client = NULL; + } + ++ if (manager->priv->inhibit_lid_switch_fd != -1) { ++ close (manager->priv->inhibit_lid_switch_fd); ++ manager->priv->inhibit_lid_switch_fd = -1; ++ manager->priv->inhibit_lid_switch_taken = FALSE; ++ } ++ if (manager->priv->inhibit_suspend_fd != -1) { ++ close (manager->priv->inhibit_suspend_fd); ++ manager->priv->inhibit_suspend_fd = -1; ++ manager->priv->inhibit_suspend_taken = FALSE; ++ } ++ ++ if (manager->priv->logind_proxy != NULL) { ++ g_object_unref (manager->priv->logind_proxy); ++ manager->priv->logind_proxy = NULL; ++ } ++ + if (manager->priv->x11_screen != NULL) { + g_object_unref (manager->priv->x11_screen); + manager->priv->x11_screen = NULL; +@@ -3928,6 +4125,8 @@ static void + csd_power_manager_init (CsdPowerManager *manager) + { + manager->priv = CSD_POWER_MANAGER_GET_PRIVATE (manager); ++ manager->priv->inhibit_lid_switch_fd = -1; ++ manager->priv->inhibit_suspend_fd = -1; + } + + static void diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 888f62d0f06..99dfa78af18 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9885,7 +9885,9 @@ let cinnamon = recurseIntoAttrs rec { callPackage = newScope pkgs.cinnamon; - inherit (gnome3) gnome_common; + inherit (gnome3) gnome_common libgnomekbd; + + cinnamon-settings-daemon = callPackage ../desktops/cinnamon/cinnamon-settings-daemon.nix{ }; cinnamon-session = callPackage ../desktops/cinnamon/cinnamon-session.nix{ } ; From 6fa1ad04da125d14e78634b01295dfd482f1f4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 12:26:29 +0200 Subject: [PATCH 0068/2033] nixos: extend documentation example for security.setuidOwners Show that it is possible to set custom permission bits. --- nixos/modules/security/setuid-wrappers.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/security/setuid-wrappers.nix b/nixos/modules/security/setuid-wrappers.nix index 62df85816e5..78be1cc6cde 100644 --- a/nixos/modules/security/setuid-wrappers.nix +++ b/nixos/modules/security/setuid-wrappers.nix @@ -46,6 +46,7 @@ in group = "postdrop"; setuid = false; setgid = true; + permissions = "u+rx,g+x,o+x"; } ]; description = '' From 086d6c802b26c11ff7b01b4733de0e3b1b2c1c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 13 Apr 2014 14:56:54 +0200 Subject: [PATCH 0069/2033] tk on darwin: another attempt to fix build They add the -lfontconfig explicitly in macports, so hopefully it fixes it. https://trac.macports.org/browser/trunk/dports/x11/tk/Portfile --- pkgs/development/libraries/tk/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/tk/default.nix b/pkgs/development/libraries/tk/default.nix index 2757a254385..fd3684d189c 100644 --- a/pkgs/development/libraries/tk/default.nix +++ b/pkgs/development/libraries/tk/default.nix @@ -21,6 +21,8 @@ stdenv.mkDerivation { buildInputs = [ pkgconfig tcl libXft ] ++ stdenv.lib.optional stdenv.isDarwin fontconfig; + NIX_CFLAGS_LINK = if stdenv.isDarwin then "-lfontconfig" else null; + inherit tcl; passthru = { From 83044b788c564cb4736c2a743480d575354c91d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cillian=20de=20R=C3=B3iste?= Date: Sun, 13 Apr 2014 17:21:21 +0200 Subject: [PATCH 0070/2033] pytest: fix for py2.6 by adding argparse as an input --- pkgs/top-level/python-packages.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 0e45f9825c3..028234a2aeb 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1312,6 +1312,7 @@ rec { ''; propagatedBuildInputs = [ py ] + ++ (optional isPy26 argparse) ++ stdenv.lib.optional pkgs.config.pythonPackages.pytest.selenium or false pythonPackages.selenium; From e9a8c8417f9e3bb8eb6ff1f09528b72bf27bcc59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Date: Wed, 9 Apr 2014 15:47:18 +0800 Subject: [PATCH 0071/2033] wildmidi: update to 0.3.6 --- .../libraries/wildmidi/default.nix | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pkgs/development/libraries/wildmidi/default.nix b/pkgs/development/libraries/wildmidi/default.nix index eb55d1d60f4..5b3f9e03ac7 100644 --- a/pkgs/development/libraries/wildmidi/default.nix +++ b/pkgs/development/libraries/wildmidi/default.nix @@ -1,22 +1,22 @@ -{ stdenv, fetchurl, alsaLib, freepats }: +{ stdenv, fetchurl, cmake, alsaLib, freepats }: stdenv.mkDerivation rec { - name = "wildmidi-0.2.3.5"; + name = "wildmidi-0.3.6"; src = fetchurl { - url = "mirror://sourceforge/project/wildmidi/wildmidi/${name}.tar.gz"; - sha256 = "0m75753mn0rbwja180c2qk53s149wp4k35dijr2i6pa7sc12fr00"; + url = "https://github.com/Mindwerks/wildmidi/archive/${name}.tar.gz"; + sha256 = "0y8r812f8h9jqlajwbzni7f23k8kfcp4wxz3jdq75z902bsmdzpf"; }; - # NOTE: $out in configureFlags, like this: - # configureFlags = "--disable-werror --with-wildmidi-cfg=$out/etc/wildmidi.cfg"; - # is not expanded, so use this workaround: - preConfigure = '' - configureFlags="--disable-werror --with-wildmidi-cfg=$out/etc/wildmidi.cfg" - ''; + nativeBuildInputs = [ cmake ]; buildInputs = [ alsaLib ]; + preConfigure = '' + substituteInPlace CMakeLists.txt \ + --replace /etc/wildmidi $out/etc + ''; + postInstall = '' mkdir "$out"/etc echo "dir ${freepats}" > "$out"/etc/wildmidi.cfg From 57a9eaab67801d4079aaa6cc9f6bcbc583d9d0d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benno=20F=C3=BCnfst=C3=BCck?= Date: Sun, 13 Apr 2014 18:40:59 +0200 Subject: [PATCH 0072/2033] haskell: jailbreak pipes-network --- pkgs/development/libraries/haskell/pipes-network/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/haskell/pipes-network/default.nix b/pkgs/development/libraries/haskell/pipes-network/default.nix index b70527ecdad..cd62850c96d 100644 --- a/pkgs/development/libraries/haskell/pipes-network/default.nix +++ b/pkgs/development/libraries/haskell/pipes-network/default.nix @@ -7,11 +7,11 @@ cabal.mkDerivation (self: { buildDepends = [ network networkSimple pipes pipesSafe transformers ]; + jailbreak = true; meta = { homepage = "https://github.com/k0001/pipes-network"; description = "Use network sockets together with the pipes library"; license = self.stdenv.lib.licenses.bsd3; platforms = self.ghc.meta.platforms; - maintainers = [ self.stdenv.lib.maintainers.ocharles ]; }; }) From e86e76e560a36bb65f4fcd4ad054c53a87824744 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Sun, 13 Apr 2014 20:49:26 +0400 Subject: [PATCH 0073/2033] Adding sysdig system call tracer for Linux --- pkgs/os-specific/linux/sysdig/default.nix | 41 +++++++++++++++++++ .../os-specific/linux/sysdig/default.upstream | 3 ++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 46 insertions(+) create mode 100644 pkgs/os-specific/linux/sysdig/default.nix create mode 100644 pkgs/os-specific/linux/sysdig/default.upstream diff --git a/pkgs/os-specific/linux/sysdig/default.nix b/pkgs/os-specific/linux/sysdig/default.nix new file mode 100644 index 00000000000..6f5bb3869bb --- /dev/null +++ b/pkgs/os-specific/linux/sysdig/default.nix @@ -0,0 +1,41 @@ +{stdenv, fetchurl, cmake, luajit, kernel}: +let + s = # Generated upstream information + rec { + baseName="sysdig"; + version="0.1.79"; + name="${baseName}-${version}"; + hash="04ng4q859xxlpsnavx6rcgmq7frzgbzxm0p5zmdsmhz8m6hfvz7l"; + url="https://github.com/draios/sysdig/archive/0.1.79.tar.gz"; + sha256="04ng4q859xxlpsnavx6rcgmq7frzgbzxm0p5zmdsmhz8m6hfvz7l"; + }; + buildInputs = [ + cmake luajit kernel + ]; +in +stdenv.mkDerivation { + inherit (s) name version; + inherit buildInputs; + src = fetchurl { + inherit (s) url sha256; + }; + + cmakeFlags = [ + "-DUSE_BUNDLED_LUAJIT=OFF" + ]; + makeFlags = [ + "KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + ]; + postInstall = '' + mkdir -p $out/lib/modules/${kernel.modDirVersion}/misc/sysdig + cp driver/*.ko $out/lib/modules/${kernel.modDirVersion}/misc/sysdig + ''; + + meta = { + inherit (s) version; + description = ''A tracepoint-based system tracing tool for Linux''; + license = stdenv.lib.licenses.gpl2 ; + maintainers = [stdenv.lib.maintainers.raskin]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/os-specific/linux/sysdig/default.upstream b/pkgs/os-specific/linux/sysdig/default.upstream new file mode 100644 index 00000000000..7071d982500 --- /dev/null +++ b/pkgs/os-specific/linux/sysdig/default.upstream @@ -0,0 +1,3 @@ +url https://github.com/draios/sysdig/releases +ensure_choice +version '.*/([0-9.]+)[.]tar[.].*' '\1' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 99dfa78af18..514a3f09bfb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7055,6 +7055,8 @@ let spl = callPackage ../os-specific/linux/spl/default.nix { }; + sysdig = callPackage ../os-specific/linux/sysdig {}; + tp_smapi = callPackage ../os-specific/linux/tp_smapi { }; v86d = callPackage ../os-specific/linux/v86d { }; From 2b9c96878caa765889588fa9aa6d9849494a8036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 19:04:28 +0200 Subject: [PATCH 0074/2033] qmmp: update 0.7.5 -> 0.7.6 Changes since 0.7.5: * added libav 10 and ffmpeg 2.2 support; * fixed url parsing; * fixed freezing on playback resume; * fixed random freezing in the mplayer plugin; * fixed reset selection of tracks when calling context menu; * fixed multimedia keys support under win32. --- pkgs/applications/audio/qmmp/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/audio/qmmp/default.nix b/pkgs/applications/audio/qmmp/default.nix index 122b7ed7867..a18ef97dd60 100644 --- a/pkgs/applications/audio/qmmp/default.nix +++ b/pkgs/applications/audio/qmmp/default.nix @@ -28,11 +28,11 @@ # handle that. stdenv.mkDerivation rec { - name = "qmmp-0.7.5"; + name = "qmmp-0.7.6"; src = fetchurl { url = "http://qmmp.ylsoftware.com/files/${name}.tar.bz2"; - sha256 = "0ryg4hns5zi9swn2q4vxjya3i4drdqfzycngwzd6fdl176lswrk0"; + sha256 = "1hq08ii06lyfg516jrvxdfcjj509gvglvdlsr96aqi1fh8v4k5p9"; }; buildInputs = From a555ee2412ab0369f653c40f004e9a624193ed06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 19:16:02 +0200 Subject: [PATCH 0075/2033] xmlrpc-c: bump 1.25.26 -> .27 Release 1.25.27 (released March 15, 2014): Fix bug: When serializing a very large floating point number, sender of an XML-RPC message adds some junk after the decimal point. With assertion checking enabled, it just crashes. Broken in 1.15 (June 2008). --- pkgs/development/libraries/xmlrpc-c/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/xmlrpc-c/default.nix b/pkgs/development/libraries/xmlrpc-c/default.nix index ef7a65599a9..9f578e4b9dd 100644 --- a/pkgs/development/libraries/xmlrpc-c/default.nix +++ b/pkgs/development/libraries/xmlrpc-c/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, curl }: stdenv.mkDerivation rec { - name = "xmlrpc-c-1.25.26"; + name = "xmlrpc-c-1.25.27"; src = fetchurl { url = "mirror://sourceforge/xmlrpc-c/${name}.tgz"; - sha256 = "1f82vsdkldhk1sfqyh6z0ylp5769x4fx3rnd2hw0c6fhx8swcmgj"; + sha256 = "0g9m9n258lpbs42a2lagd4h7qim1g34gkaqyx8h50qrsk49ipspn"; }; buildInputs = [ curl ]; From 99afbf9e91a187086645a99043631dc74e57ad67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 19:39:32 +0200 Subject: [PATCH 0076/2033] sdcc: bump 3.3.0 -> 3.4.0 This new sdcc doesn't need older boost, so switch to nixpkgs default version (currently 1.55). --- pkgs/development/compilers/sdcc/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/sdcc/default.nix b/pkgs/development/compilers/sdcc/default.nix index 1a51f087a28..fe293fbc4b8 100644 --- a/pkgs/development/compilers/sdcc/default.nix +++ b/pkgs/development/compilers/sdcc/default.nix @@ -1,12 +1,12 @@ { stdenv, fetchurl, bison, flex, boost, gputils ? null }: stdenv.mkDerivation rec { - version = "3.3.0"; + version = "3.4.0"; name = "sdcc-${version}"; src = fetchurl { url = "mirror://sourceforge/sdcc/sdcc-src-${version}.tar.bz2"; - sha256 = "1pj4hssvq34vbryvxc2jpp2b14cgxp695ygwiax6b7l2kvr62gw7"; + sha256 = "1yavxffqdfhdyabdza936xxh9wq4cfwa385g26gjapsdp5ighsng"; }; # TODO: remove this comment when gputils != null is tested diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 514a3f09bfb..d695253fbbf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3153,9 +3153,7 @@ let scala_2_10 = callPackage ../development/compilers/scala { }; scala = scala_2_10; - sdcc = callPackage ../development/compilers/sdcc { - boost = boost149; # sdcc 3.2.0 fails to build with boost 1.53 - }; + sdcc = callPackage ../development/compilers/sdcc { }; smlnj = callPackage_i686 ../development/compilers/smlnj { }; From 788d9a13fb313aad40e75a903feb6351b7e9b28a Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Sun, 13 Apr 2014 13:11:15 -0500 Subject: [PATCH 0077/2033] grsecurity: stable/vserver/testing updates - stable: 201404111812 -> 201404131252 - vserver: vs2.3.2.16-201404111814 -> vs2.3.2.16-201404131253 - testing: 201404111815 -> 201404131254 Signed-off-by: Austin Seipp --- pkgs/os-specific/linux/kernel/patches.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix index 267e5657e6c..c28a3ad3400 100644 --- a/pkgs/os-specific/linux/kernel/patches.nix +++ b/pkgs/os-specific/linux/kernel/patches.nix @@ -86,23 +86,23 @@ rec { grsecurity_stable = grsecPatch { kversion = "3.2.57"; - revision = "201404111812"; + revision = "201404131252"; branch = "stable"; - sha256 = "1kp2f5g5jdl6r833fm5l2sgf7qsjddl2br7mislc37iqgwzjmhlx"; + sha256 = "1yic257h2vy3175c34i54873lc93y0m57rw1d059wz1wxy9waiwl"; }; grsecurity_vserver = grsecPatch { kversion = "3.2.57"; - revision = "vs2.3.2.16-201404111814"; + revision = "vs2.3.2.16-201404131253"; branch = "vserver"; - sha256 = "025kxk4j8kx7v5gmpafls67747l39ssfmzh0drg0hyg2yc0hjk2c"; + sha256 = "0grhd9hbk952dwr91syi5pda1iccmcd8s0l3ki13689z8ns35f7k"; }; grsecurity_unstable = grsecPatch { kversion = "3.13.9"; - revision = "201404111815"; + revision = "201404131254"; branch = "test"; - sha256 = "1ikqvi0hv32m5rgxa8dpqr5v84hx7bnjfr6c1bvsfqikc818isvy"; + sha256 = "1qslkmqz25rlag0dvv481ka7yylfhmpx7mhzbv9qdaynx5s59l3v"; }; grsec_fix_path = From 694eb12f5f3ae862e671c9ae315ff68bc6b4386e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 20:18:38 +0200 Subject: [PATCH 0078/2033] apcupsd: bump 3.14.11 -> 3.14.12 (latest stable) Release notes: http://sourceforge.net/p/apcupsd/svn/HEAD/tree/tags/Release-3_14_12/ReleaseNotes --- pkgs/servers/apcupsd/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/apcupsd/default.nix b/pkgs/servers/apcupsd/default.nix index 6489d4dceff..8e25bdd87f0 100644 --- a/pkgs/servers/apcupsd/default.nix +++ b/pkgs/servers/apcupsd/default.nix @@ -4,11 +4,11 @@ stdenv.mkDerivation rec { pname = "apcupsd"; - name = "${pname}-3.14.11"; + name = "${pname}-3.14.12"; src = fetchurl { url = "mirror://sourceforge/${pname}/${name}.tar.gz"; - sha256 = "0wrb8vdc872f1x0gw21b5c81h0vxvsc7yks5qzbq2j3hkbl2vixd"; + sha256 = "0h54ahj65nqrgmdcg81h1gp0zlxg9hwwhg8pmx6z9zcwn4y70kqv"; }; buildInputs = [ pkgconfig utillinux man ] ++ stdenv.lib.optional enableCgiScripts gd; From 1d896c47c98516a727d25f90a11ea9910c2b293f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 20:28:43 +0200 Subject: [PATCH 0079/2033] apcupsd: add missing assert --- pkgs/servers/apcupsd/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/servers/apcupsd/default.nix b/pkgs/servers/apcupsd/default.nix index 8e25bdd87f0..ad8685d3d42 100644 --- a/pkgs/servers/apcupsd/default.nix +++ b/pkgs/servers/apcupsd/default.nix @@ -2,6 +2,8 @@ , enableCgiScripts ? true, gd }: +assert enableCgiScripts -> gd != null; + stdenv.mkDerivation rec { pname = "apcupsd"; name = "${pname}-3.14.12"; From 9878bb47a41db4e50d308a398ba6b743083269b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 21:11:49 +0200 Subject: [PATCH 0080/2033] buildbot{,slave}: bump 0.8.7p1 -> 0.8.8 Build and run tested. --- .../tools/build-managers/buildbot-slave/default.nix | 4 ++-- pkgs/development/tools/build-managers/buildbot/default.nix | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/build-managers/buildbot-slave/default.nix b/pkgs/development/tools/build-managers/buildbot-slave/default.nix index b28c4d9296f..f21be7cc48c 100644 --- a/pkgs/development/tools/build-managers/buildbot-slave/default.nix +++ b/pkgs/development/tools/build-managers/buildbot-slave/default.nix @@ -1,12 +1,12 @@ { stdenv, buildPythonPackage, fetchurl, coreutils, twisted }: buildPythonPackage (rec { - name = "buildbot-slave-0.8.7p1"; + name = "buildbot-slave-0.8.8"; namePrefix = ""; src = fetchurl { url = "http://buildbot.googlecode.com/files/${name}.tar.gz"; - sha256 = "1p7a0srab6ifljh9vi25awvxfrxljj9s0hi1jipiiykyhjihgnxv"; + sha256 = "1k1pk3y0rk6j01wc491jblryr4ajqg1ing9m3sjaw9s5sga34xcb"; }; patchPhase = '' diff --git a/pkgs/development/tools/build-managers/buildbot/default.nix b/pkgs/development/tools/build-managers/buildbot/default.nix index c872d67146b..2d7c63fdc7d 100644 --- a/pkgs/development/tools/build-managers/buildbot/default.nix +++ b/pkgs/development/tools/build-managers/buildbot/default.nix @@ -9,12 +9,12 @@ assert enableDebugClient -> pygobject != null && pyGtkGlade != null; buildPythonPackage (rec { - name = "buildbot-0.8.7p1"; + name = "buildbot-0.8.8"; namePrefix = ""; src = fetchurl { url = "http://buildbot.googlecode.com/files/${name}.tar.gz"; - sha256 = "0xjpk8510fhryl1g4mczz319h62il8hw9rh1rzvsfmffgf43zvld"; + sha256 = "1l1rsy82zv8582wypw00ac0k0wsr82ky74f3np4clbrxv3ry64sh"; }; patchPhase = From d5775a5ef934cce8bdabb0878eeae307e919a81b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 21:23:08 +0200 Subject: [PATCH 0081/2033] duply: upgrade 1.6.0 -> 1.7.3 Changes since 1.6.0: 1.7.3 (3.4.2014) - bugfix: test routines, gpg2 asked for passphrase although GPG_PW was set 1.7.2 (1.4.2014 "April,April") - bugfix: debian Bug#743190 "duply no longer allows restoration without gpg passphrase in conf file" GPG_AGENT_INFO env var is now needed to trigger --use-agent - bugfix: gpg keyenc test routines didn't work if GPG_PW was not set 1.7.1 (30.3.2014) - bugfix: purge-* commands renamed to purgeFull, purgeIncr due to incompatibility with new minus batch separator 1.7.0 (20.3.2014) - disabled gpg key id plausibility check, too many valid possibilities - featreq 7 "Halt if precondition fails": added and(+), or(-) batch command(separator) support - featreq 26 "pre/post script with shebang line": if a script is flagged executable it's executed in a subshell now as opposed to sourced to bash, which is the default - bugfix: do not check if dpbx, swift credentials are set anymore - bugfix: properly escape profile name, archdir if used as arguments - add DUPL_PRECMD conf setting for use with e.g. trickle --- pkgs/tools/backup/duply/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/backup/duply/default.nix b/pkgs/tools/backup/duply/default.nix index 91718fc02f7..73ef23059f4 100644 --- a/pkgs/tools/backup/duply/default.nix +++ b/pkgs/tools/backup/duply/default.nix @@ -3,11 +3,11 @@ }: stdenv.mkDerivation { - name = "duply-1.6.0"; + name = "duply-1.7.3"; src = fetchurl { - url = "mirror://sourceforge/project/ftplicity/duply%20%28simple%20duplicity%29/1.6.x/duply_1.6.0.tgz"; - sha256 = "1i1yy4z6fcf3lq2k72cqcyqspm7pa1m949f8l9yscjm47bwp5g8f"; + url = "mirror://sourceforge/project/ftplicity/duply%20%28simple%20duplicity%29/1.7.x/duply_1.7.3.tgz"; + sha256 = "1lq5gwz69l8g4ki4anvmjdngbs9nin124j1zb9kbcnqj0s5jkbp0"; }; buildInputs = [ txt2man makeWrapper ]; From 641ea31345eed2a0806ce984e4a6b79d0b7ee0f5 Mon Sep 17 00:00:00 2001 From: Roelof Wobben Date: Sun, 13 Apr 2014 21:46:48 +0200 Subject: [PATCH 0082/2033] new package: cinnamon-control-center --- .../cinnamon/cinnamon-control-center.nix | 40 + pkgs/desktops/cinnamon/region.patch | 5314 +++++++++++++++++ pkgs/top-level/all-packages.nix | 6 +- 3 files changed, 5358 insertions(+), 2 deletions(-) create mode 100644 pkgs/desktops/cinnamon/cinnamon-control-center.nix create mode 100644 pkgs/desktops/cinnamon/region.patch diff --git a/pkgs/desktops/cinnamon/cinnamon-control-center.nix b/pkgs/desktops/cinnamon/cinnamon-control-center.nix new file mode 100644 index 00000000000..ab2f389b4f5 --- /dev/null +++ b/pkgs/desktops/cinnamon/cinnamon-control-center.nix @@ -0,0 +1,40 @@ + +{ stdenv, fetchurl, pkgconfig, autoreconfHook, glib, gettext, gnome_common, cinnamon-desktop, intltool, libxslt, gtk3, libnotify, +gnome-menus, libxml2, systemd, upower, cinnamon-settings-daemon, colord, polkit, ibus, libcanberra_gtk3, pulseaudio, isocodes, krb5, +libxkbfile}: + +let + version = "2.0.9"; +in +stdenv.mkDerivation { + name = "cinnamon-control-center-${version}"; + + src = fetchurl { + url = "http://github.com/linuxmint/cinnamon-control-center/archive/${version}.tar.gz"; + sha256 = "0kivqdgsf8w257j2ja6fap0dpvljcnb9gphr3knp7y6ma2d1gfv3"; + }; + + configureFlags = "--enable-systemd --disable-update-mimedb" ; + + patches = [ ./region.patch]; + + buildInputs = [ + pkgconfig autoreconfHook + glib gettext gnome_common + intltool libxslt gtk3 cinnamon-desktop + libnotify gnome-menus libxml2 systemd + upower cinnamon-settings-daemon colord + polkit ibus libcanberra_gtk3 pulseaudio + isocodes krb5 libxkbfile ]; + + preBuild = "patchShebangs ./scripts"; + + meta = { + homepage = "http://cinnamon.linuxmint.com"; + description = "The cinnamon session files" ; + + platforms = stdenv.lib.platforms.linux; + maintainers = [ stdenv.lib.maintainers.roelof ]; + }; +} + diff --git a/pkgs/desktops/cinnamon/region.patch b/pkgs/desktops/cinnamon/region.patch new file mode 100644 index 00000000000..7b8133e820e --- /dev/null +++ b/pkgs/desktops/cinnamon/region.patch @@ -0,0 +1,5314 @@ + +diff -uNrp a/configure.ac b/configure.ac +--- a/configure.ac 2013-08-25 14:40:14.000000000 +0100 ++++ b/configure.ac 2013-08-25 16:50:30.000000000 +0100 +@@ -82,6 +82,22 @@ else + SYSTEMD= + fi + ++# IBus support ++IBUS_REQUIRED_VERSION=1.4.2 ++ ++#AC_ARG_ENABLE(ibus, ++# AS_HELP_STRING([--disable-ibus], ++# [Disable IBus support]), ++# enable_ibus=$enableval, ++# enable_ibus=yes) ++enable_ibus=yes ++#if test "x$enable_ibus" = "xyes" ; then ++IBUS_MODULE="ibus-1.0 >= $IBUS_REQUIRED_VERSION" ++AC_DEFINE(HAVE_IBUS, 1, [Defined if IBus support is enabled]) ++#else ++# IBUS_MODULE= ++#fi ++ + dnl ============================================== + dnl Check that we meet the dependencies + dnl ============================================== +@@ -119,9 +135,10 @@ PKG_CHECK_MODULES(NETWORK_PANEL, $COMMON + PKG_CHECK_MODULES(POWER_PANEL, $COMMON_MODULES upower-glib >= 0.9.1 + cinnamon-settings-daemon >= $CSD_REQUIRED_VERSION) + PKG_CHECK_MODULES(COLOR_PANEL, $COMMON_MODULES colord >= 0.1.8) +-PKG_CHECK_MODULES(REGION_PANEL, $COMMON_MODULES libgnomekbd >= 2.91.91 ++PKG_CHECK_MODULES(REGION_PANEL, $COMMON_MODULES + polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION +- libxklavier >= 5.1 libgnomekbdui >= 2.91.91) ++ cinnamon-desktop >= $CINNAMON_DESKTOP_REQUIRED_VERSION ++ $IBUS_MODULE) + PKG_CHECK_MODULES(SCREEN_PANEL, $COMMON_MODULES) + PKG_CHECK_MODULES(SOUND_PANEL, $COMMON_MODULES libxml-2.0 + libcanberra-gtk3 >= $CANBERRA_REQUIRED_VERSION +diff -uNrp a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c +--- a/panels/region/cc-region-panel.c 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cc-region-panel.c 2013-09-21 13:24:15.329949897 +0100 +@@ -18,17 +18,18 @@ + * Author: Sergey Udaltsov + * + */ +-#include "config.h" ++ + #include "cc-region-panel.h" ++#include + #include + #include + +-#include "cinnamon-region-panel-xkb.h" ++#include "cinnamon-region-panel-input.h" + #include "cinnamon-region-panel-lang.h" + #include "cinnamon-region-panel-formats.h" + #include "cinnamon-region-panel-system.h" + +-G_DEFINE_DYNAMIC_TYPE (CcRegionPanel, cc_region_panel, CC_TYPE_PANEL) ++CC_PANEL_REGISTER (CcRegionPanel, cc_region_panel) + + #define REGION_PANEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_REGION_PANEL, CcRegionPanelPrivate)) + +@@ -48,14 +49,6 @@ enum { + SYSTEM_PAGE + }; + +- +-static gboolean +-languages_link_cb (GtkButton *button, gpointer user_data) +-{ +- g_spawn_command_line_async ("gnome-language-selector", NULL); +- return TRUE; +-} +- + static void + cc_region_panel_set_page (CcRegionPanel *panel, + const char *page) +@@ -116,13 +109,22 @@ cc_region_panel_finalize (GObject * obje + G_OBJECT_CLASS (cc_region_panel_parent_class)->finalize (object); + } + ++static const char * ++cc_region_panel_get_help_uri (CcPanel *panel) ++{ ++ return "help:gnome-help/prefs-language"; ++} ++ + static void + cc_region_panel_class_init (CcRegionPanelClass * klass) + { + GObjectClass *object_class = G_OBJECT_CLASS (klass); ++ CcPanelClass * panel_class = CC_PANEL_CLASS (klass); + + g_type_class_add_private (klass, sizeof (CcRegionPanelPrivate)); + ++ panel_class->get_help_uri = cc_region_panel_get_help_uri; ++ + object_class->set_property = cc_region_panel_set_property; + object_class->finalize = cc_region_panel_finalize; + +@@ -130,22 +132,14 @@ cc_region_panel_class_init (CcRegionPane + } + + static void +-cc_region_panel_class_finalize (CcRegionPanelClass * klass) +-{ +-} +- +-static void + cc_region_panel_init (CcRegionPanel * self) + { + CcRegionPanelPrivate *priv; + GtkWidget *prefs_widget; +- const char *desktop; + GError *error = NULL; + + priv = self->priv = REGION_PANEL_PRIVATE (self); + +- desktop = g_getenv ("XDG_CURRENT_DESKTOP"); +- + priv->builder = gtk_builder_new (); + gtk_builder_set_translation_domain (priv->builder, GETTEXT_PACKAGE); + gtk_builder_add_from_file (priv->builder, +@@ -157,29 +151,16 @@ cc_region_panel_init (CcRegionPanel * se + return; + } + +- prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder, +- "region_notebook"); +- ++ prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder, ++ "region_notebook"); + gtk_widget_set_size_request (GTK_WIDGET (prefs_widget), -1, 400); + + gtk_widget_reparent (prefs_widget, GTK_WIDGET (self)); + +- setup_xkb_tabs (priv->builder); +- +- setup_language (priv->builder); +- setup_formats (priv->builder); +- setup_system (priv->builder); +- +- /* set screen link */ +- +- GtkWidget *widget = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, +- "get_languages_button")); +- +- gtk_button_set_label (GTK_BUTTON (widget), _("Get more languages...")); +- +- g_signal_connect (widget, "clicked", +- G_CALLBACK (languages_link_cb), +- self); ++ setup_input_tabs (priv->builder, self); ++ setup_language (priv->builder); ++ setup_formats (priv->builder); ++ setup_system (priv->builder); + } + + void +@@ -187,6 +168,7 @@ cc_region_panel_register (GIOModule * mo + { + bindtextdomain (GETTEXT_PACKAGE, "/usr/share/cinnamon/locale"); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); ++ + cc_region_panel_register_type (G_TYPE_MODULE (module)); + g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT, + CC_TYPE_REGION_PANEL, +diff -uNrp a/panels/region/cinnamon-region-panel-formats.h b/panels/region/cinnamon-region-panel-formats.h +--- a/panels/region/cinnamon-region-panel-formats.h 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-formats.h 2013-09-21 13:24:15.332949789 +0100 +@@ -19,8 +19,8 @@ + * 02110-1335, USA. + */ + +-#ifndef __GNOME_REGION_PANEL_FORMATS_H +-#define __GNOME_REGION_PANEL_FORMATS_H ++#ifndef __CINNAMON_REGION_PANEL_FORMATS_H ++#define __CINNAMON_REGION_PANEL_FORMATS_H + + #include + +diff -uNrp a/panels/region/cinnamon-region-panel-input.c b/panels/region/cinnamon-region-panel-input.c +--- a/panels/region/cinnamon-region-panel-input.c 1970-01-01 01:00:00.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-input.c 2013-09-21 13:24:15.338949572 +0100 +@@ -0,0 +1,1563 @@ ++/* ++ * Copyright (C) 2011 Red Hat, Inc. ++ * ++ * Written by: Matthias Clasen ++ * ++ * 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, 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 - Suite 500, Boston, MA ++ * 02110-1335, USA. ++ */ ++ ++#include ++ ++#include ++ ++#include ++#include ++#include ++ ++#define GNOME_DESKTOP_USE_UNSTABLE_API ++#include ++ ++#ifdef HAVE_IBUS ++#include ++#endif ++ ++#include "gdm-languages.h" ++#include "cinnamon-region-panel-input.h" ++ ++#define WID(s) GTK_WIDGET(gtk_builder_get_object (builder, s)) ++ ++#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.cinnamon.desktop.input-sources" ++ ++#define KEY_CURRENT_INPUT_SOURCE "current" ++#define KEY_INPUT_SOURCES "sources" ++ ++#define INPUT_SOURCE_TYPE_XKB "xkb" ++#define INPUT_SOURCE_TYPE_IBUS "ibus" ++ ++enum { ++ NAME_COLUMN, ++ TYPE_COLUMN, ++ ID_COLUMN, ++ SETUP_COLUMN, ++ N_COLUMNS ++}; ++ ++static GSettings *input_sources_settings = NULL; ++static GnomeXkbInfo *xkb_info = NULL; ++static GtkWidget *input_chooser = NULL; /* weak pointer */ ++ ++#ifdef HAVE_IBUS ++static IBusBus *ibus = NULL; ++static GHashTable *ibus_engines = NULL; ++static GCancellable *ibus_cancellable = NULL; ++static guint shell_name_watch_id = 0; ++ ++static const gchar *supported_ibus_engines[] = { ++ /* Simplified Chinese */ ++ "pinyin", ++ "bopomofo", ++ "wubi", ++ "erbi", ++ /* Default in Fedora, where ibus-libpinyin replaces ibus-pinyin */ ++ "libpinyin", ++ "libbopomofo", ++ ++ /* Traditional Chinese */ ++ /* https://bugzilla.gnome.org/show_bug.cgi?id=680840 */ ++ "chewing", ++ "cangjie5", ++ "cangjie3", ++ "quick5", ++ "quick3", ++ "stroke5", ++ ++ /* Japanese */ ++ "anthy", ++ "mozc-jp", ++ "skk", ++ ++ /* Korean */ ++ "hangul", ++ ++ /* Thai */ ++ "m17n:th:kesmanee", ++ "m17n:th:pattachote", ++ "m17n:th:tis820", ++ ++ /* Vietnamese */ ++ "m17n:vi:tcvn", ++ "m17n:vi:telex", ++ "m17n:vi:viqr", ++ "m17n:vi:vni", ++ "Unikey", ++ ++ /* Sinhala */ ++ "m17n:si:wijesekera", ++ "m17n:si:phonetic-dynamic", ++ "m17n:si:trans", ++ "sayura", ++ ++ /* Indic */ ++ /* https://fedoraproject.org/wiki/I18N/Indic#Keyboard_Layouts */ ++ ++ /* Assamese */ ++ "m17n:as:phonetic", ++ "m17n:as:inscript", ++ "m17n:as:itrans", ++ ++ /* Bengali */ ++ "m17n:bn:inscript", ++ "m17n:bn:itrans", ++ "m17n:bn:probhat", ++ ++ /* Gujarati */ ++ "m17n:gu:inscript", ++ "m17n:gu:itrans", ++ "m17n:gu:phonetic", ++ ++ /* Hindi */ ++ "m17n:hi:inscript", ++ "m17n:hi:itrans", ++ "m17n:hi:phonetic", ++ "m17n:hi:remington", ++ "m17n:hi:typewriter", ++ "m17n:hi:vedmata", ++ ++ /* Kannada */ ++ "m17n:kn:kgp", ++ "m17n:kn:inscript", ++ "m17n:kn:itrans", ++ ++ /* Kashmiri */ ++ "m17n:ks:inscript", ++ ++ /* Maithili */ ++ "m17n:mai:inscript", ++ ++ /* Malayalam */ ++ "m17n:ml:inscript", ++ "m17n:ml:itrans", ++ "m17n:ml:mozhi", ++ "m17n:ml:swanalekha", ++ ++ /* Marathi */ ++ "m17n:mr:inscript", ++ "m17n:mr:itrans", ++ "m17n:mr:phonetic", ++ ++ /* Nepali */ ++ "m17n:ne:rom", ++ "m17n:ne:trad", ++ ++ /* Oriya */ ++ "m17n:or:inscript", ++ "m17n:or:itrans", ++ "m17n:or:phonetic", ++ ++ /* Punjabi */ ++ "m17n:pa:inscript", ++ "m17n:pa:itrans", ++ "m17n:pa:phonetic", ++ "m17n:pa:jhelum", ++ ++ /* Sanskrit */ ++ "m17n:sa:harvard-kyoto", ++ ++ /* Sindhi */ ++ "m17n:sd:inscript", ++ ++ /* Tamil */ ++ "m17n:ta:tamil99", ++ "m17n:ta:inscript", ++ "m17n:ta:itrans", ++ "m17n:ta:phonetic", ++ "m17n:ta:lk-renganathan", ++ "m17n:ta:vutam", ++ "m17n:ta:typewriter", ++ ++ /* Telugu */ ++ "m17n:te:inscript", ++ "m17n:te:apple", ++ "m17n:te:pothana", ++ "m17n:te:rts", ++ ++ /* Urdu */ ++ "m17n:ur:phonetic", ++ ++ /* Inscript2 - https://bugzilla.gnome.org/show_bug.cgi?id=684854 */ ++ "m17n:as:inscript2", ++ "m17n:bn:inscript2", ++ "m17n:brx:inscript2-deva", ++ "m17n:doi:inscript2-deva", ++ "m17n:gu:inscript2", ++ "m17n:hi:inscript2", ++ "m17n:kn:inscript2", ++ "m17n:kok:inscript2-deva", ++ "m17n:mai:inscript2", ++ "m17n:ml:inscript2", ++ "m17n:mni:inscript2-beng", ++ "m17n:mni:inscript2-mtei", ++ "m17n:mr:inscript2", ++ "m17n:ne:inscript2-deva", ++ "m17n:or:inscript2", ++ "m17n:pa:inscript2-guru", ++ "m17n:sa:inscript2", ++ "m17n:sat:inscript2-deva", ++ "m17n:sat:inscript2-olck", ++ "m17n:sd:inscript2-deva", ++ "m17n:ta:inscript2", ++ "m17n:te:inscript2", ++ ++ /* No corresponding XKB map available for the languages */ ++ ++ /* Chinese Yi */ ++ "m17n:ii:phonetic", ++ ++ /* Tai-Viet */ ++ "m17n:tai:sonla", ++ ++ /* Kazakh in Arabic script */ ++ "m17n:kk:arabic", ++ ++ /* Yiddish */ ++ "m17n:yi:yivo", ++ ++ /* Canadian Aboriginal languages */ ++ "m17n:ath:phonetic", ++ "m17n:bla:phonetic", ++ "m17n:cr:western", ++ "m17n:iu:phonetic", ++ "m17n:nsk:phonetic", ++ "m17n:oj:phonetic", ++ ++ /* Non-trivial engines, like transliteration-based instead of ++ keymap-based. Confirmation needed that the engines below are ++ actually used by local language users. */ ++ ++ /* Tibetan */ ++ "m17n:bo:ewts", ++ "m17n:bo:tcrc", ++ "m17n:bo:wylie", ++ ++ /* Esperanto */ ++ "m17n:eo:h-f", ++ "m17n:eo:h", ++ "m17n:eo:plena", ++ "m17n:eo:q", ++ "m17n:eo:vi", ++ "m17n:eo:x", ++ ++ /* Amharic */ ++ "m17n:am:sera", ++ ++ /* Russian */ ++ "m17n:ru:translit", ++ ++ /* Classical Greek */ ++ "m17n:grc:mizuochi", ++ ++ /* Lao */ ++ "m17n:lo:lrt", ++ ++ /* Postfix modifier input methods */ ++ "m17n:da:post", ++ "m17n:sv:post", ++ NULL ++}; ++#endif /* HAVE_IBUS */ ++ ++static void populate_model (GtkListStore *store, ++ GtkListStore *active_sources_store); ++static GtkWidget *input_chooser_new (GtkWindow *main_window, ++ GtkListStore *active_sources); ++static gboolean input_chooser_get_selected (GtkWidget *chooser, ++ GtkTreeModel **model, ++ GtkTreeIter *iter); ++static GtkTreeModel *tree_view_get_actual_model (GtkTreeView *tv); ++ ++static gboolean ++strv_contains (const gchar * const *strv, ++ const gchar *str) ++{ ++ const gchar * const *p = strv; ++ for (p = strv; *p; p++) ++ if (g_strcmp0 (*p, str) == 0) ++ return TRUE; ++ ++ return FALSE; ++} ++ ++#ifdef HAVE_IBUS ++static void ++clear_ibus (void) ++{ ++ if (shell_name_watch_id > 0) ++ { ++ g_bus_unwatch_name (shell_name_watch_id); ++ shell_name_watch_id = 0; ++ } ++ g_cancellable_cancel (ibus_cancellable); ++ g_clear_object (&ibus_cancellable); ++ g_clear_pointer (&ibus_engines, g_hash_table_destroy); ++ g_clear_object (&ibus); ++} ++ ++static gchar * ++engine_get_display_name (IBusEngineDesc *engine_desc) ++{ ++ const gchar *name; ++ const gchar *language_code; ++ const gchar *language; ++ gchar *display_name; ++ ++ name = ibus_engine_desc_get_longname (engine_desc); ++ language_code = ibus_engine_desc_get_language (engine_desc); ++ language = ibus_get_language_name (language_code); ++ ++ display_name = g_strdup_printf ("%s (%s)", language, name); ++ ++ return display_name; ++} ++ ++static GDesktopAppInfo * ++setup_app_info_for_id (const gchar *id) ++{ ++ GDesktopAppInfo *app_info; ++ gchar *desktop_file_name; ++ gchar **strv; ++ ++ strv = g_strsplit (id, ":", 2); ++ desktop_file_name = g_strdup_printf ("ibus-setup-%s.desktop", strv[0]); ++ g_strfreev (strv); ++ ++ app_info = g_desktop_app_info_new (desktop_file_name); ++ g_free (desktop_file_name); ++ ++ return app_info; ++} ++ ++static void ++input_chooser_repopulate (GtkListStore *active_sources_store) ++{ ++ GtkBuilder *builder; ++ GtkListStore *model; ++ ++ if (!input_chooser) ++ return; ++ ++ builder = g_object_get_data (G_OBJECT (input_chooser), "builder"); ++ model = GTK_LIST_STORE (gtk_builder_get_object (builder, "input_source_model")); ++ ++ gtk_list_store_clear (model); ++ populate_model (model, active_sources_store); ++} ++ ++static void ++update_ibus_active_sources (GtkBuilder *builder) ++{ ++ GtkTreeView *tv; ++ GtkTreeModel *model; ++ GtkTreeIter iter; ++ gchar *type, *id; ++ gboolean ret; ++ ++ tv = GTK_TREE_VIEW (WID ("active_input_sources")); ++ model = tree_view_get_actual_model (tv); ++ ++ ret = gtk_tree_model_get_iter_first (model, &iter); ++ while (ret) ++ { ++ gtk_tree_model_get (model, &iter, ++ TYPE_COLUMN, &type, ++ ID_COLUMN, &id, ++ -1); ++ ++ if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) ++ { ++ IBusEngineDesc *engine_desc = NULL; ++ GDesktopAppInfo *app_info = NULL; ++ gchar *display_name = NULL; ++ ++ engine_desc = g_hash_table_lookup (ibus_engines, id); ++ if (engine_desc) ++ { ++ display_name = engine_get_display_name (engine_desc); ++ app_info = setup_app_info_for_id (id); ++ ++ gtk_list_store_set (GTK_LIST_STORE (model), &iter, ++ NAME_COLUMN, display_name, ++ SETUP_COLUMN, app_info, ++ -1); ++ g_free (display_name); ++ if (app_info) ++ g_object_unref (app_info); ++ } ++ } ++ ++ g_free (type); ++ g_free (id); ++ ++ ret = gtk_tree_model_iter_next (model, &iter); ++ } ++ ++ input_chooser_repopulate (GTK_LIST_STORE (model)); ++} ++ ++static void ++fetch_ibus_engines_result (GObject *object, ++ GAsyncResult *result, ++ GtkBuilder *builder) ++{ ++ gboolean show_all_sources; ++ GList *list, *l; ++ GError *error; ++ ++ error = NULL; ++ list = ibus_bus_list_engines_async_finish (ibus, result, &error); ++ ++ g_clear_object (&ibus_cancellable); ++ ++ if (!list && error) ++ { ++ g_warning ("Couldn't finish IBus request: %s", error->message); ++ g_error_free (error); ++ return; ++ } ++ ++ show_all_sources = g_settings_get_boolean (input_sources_settings, "show-all-sources"); ++ ++ /* Maps engine ids to engine description objects */ ++ ibus_engines = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); ++ ++ for (l = list; l; l = l->next) ++ { ++ IBusEngineDesc *engine = l->data; ++ const gchar *engine_id = ibus_engine_desc_get_name (engine); ++ ++ if (show_all_sources || strv_contains (supported_ibus_engines, engine_id)) ++ g_hash_table_replace (ibus_engines, (gpointer)engine_id, engine); ++ else ++ g_object_unref (engine); ++ } ++ g_list_free (list); ++ ++ update_ibus_active_sources (builder); ++} ++ ++static void ++fetch_ibus_engines (GtkBuilder *builder) ++{ ++ ibus_cancellable = g_cancellable_new (); ++ ++ ibus_bus_list_engines_async (ibus, ++ -1, ++ ibus_cancellable, ++ (GAsyncReadyCallback)fetch_ibus_engines_result, ++ builder); ++ ++ /* We've got everything we needed, don't want to be called again. */ ++ g_signal_handlers_disconnect_by_func (ibus, fetch_ibus_engines, builder); ++} ++ ++static void ++maybe_start_ibus (void) ++{ ++ /* IBus doesn't export API in the session bus. The only thing ++ * we have there is a well known name which we can use as a ++ * sure-fire way to activate it. */ ++ g_bus_unwatch_name (g_bus_watch_name (G_BUS_TYPE_SESSION, ++ IBUS_SERVICE_IBUS, ++ G_BUS_NAME_WATCHER_FLAGS_AUTO_START, ++ NULL, ++ NULL, ++ NULL, ++ NULL)); ++} ++ ++static void ++on_shell_appeared (GDBusConnection *connection, ++ const gchar *name, ++ const gchar *name_owner, ++ gpointer data) ++{ ++ GtkBuilder *builder = data; ++ ++ if (!ibus) ++ { ++ ibus = ibus_bus_new (); ++ if (ibus_bus_is_connected (ibus)) ++ fetch_ibus_engines (builder); ++ else ++ g_signal_connect_swapped (ibus, "connected", ++ G_CALLBACK (fetch_ibus_engines), builder); ++ } ++ maybe_start_ibus (); ++} ++#endif /* HAVE_IBUS */ ++ ++static gboolean ++add_source_to_table (GtkTreeModel *model, ++ GtkTreePath *path, ++ GtkTreeIter *iter, ++ gpointer data) ++{ ++ GHashTable *hash = data; ++ gchar *type; ++ gchar *id; ++ ++ gtk_tree_model_get (model, iter, ++ TYPE_COLUMN, &type, ++ ID_COLUMN, &id, ++ -1); ++ ++ g_hash_table_add (hash, g_strconcat (type, id, NULL)); ++ ++ g_free (type); ++ g_free (id); ++ ++ return FALSE; ++} ++ ++static void ++populate_model (GtkListStore *store, ++ GtkListStore *active_sources_store) ++{ ++ GHashTable *active_sources_table; ++ GtkTreeIter iter; ++ const gchar *name; ++ GList *sources, *tmp; ++ gchar *source_id = NULL; ++ ++ active_sources_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); ++ ++ gtk_tree_model_foreach (GTK_TREE_MODEL (active_sources_store), ++ add_source_to_table, ++ active_sources_table); ++ ++ sources = gnome_xkb_info_get_all_layouts (xkb_info); ++ ++ for (tmp = sources; tmp; tmp = tmp->next) ++ { ++ g_free (source_id); ++ source_id = g_strconcat (INPUT_SOURCE_TYPE_XKB, tmp->data, NULL); ++ ++ if (g_hash_table_contains (active_sources_table, source_id)) ++ continue; ++ ++ gnome_xkb_info_get_layout_info (xkb_info, (const gchar *)tmp->data, ++ &name, NULL, NULL, NULL); ++ ++ gtk_list_store_append (store, &iter); ++ gtk_list_store_set (store, &iter, ++ NAME_COLUMN, name, ++ TYPE_COLUMN, INPUT_SOURCE_TYPE_XKB, ++ ID_COLUMN, tmp->data, ++ -1); ++ } ++ g_free (source_id); ++ ++ g_list_free (sources); ++ ++#ifdef HAVE_IBUS ++ if (ibus_engines) ++ { ++ gchar *display_name; ++ ++ sources = g_hash_table_get_keys (ibus_engines); ++ ++ source_id = NULL; ++ for (tmp = sources; tmp; tmp = tmp->next) ++ { ++ g_free (source_id); ++ source_id = g_strconcat (INPUT_SOURCE_TYPE_IBUS, tmp->data, NULL); ++ ++ if (g_hash_table_contains (active_sources_table, source_id)) ++ continue; ++ ++ display_name = engine_get_display_name (g_hash_table_lookup (ibus_engines, tmp->data)); ++ ++ gtk_list_store_append (store, &iter); ++ gtk_list_store_set (store, &iter, ++ NAME_COLUMN, display_name, ++ TYPE_COLUMN, INPUT_SOURCE_TYPE_IBUS, ++ ID_COLUMN, tmp->data, ++ -1); ++ g_free (display_name); ++ } ++ g_free (source_id); ++ ++ g_list_free (sources); ++ } ++#endif ++ ++ g_hash_table_destroy (active_sources_table); ++} ++ ++static void ++populate_with_active_sources (GtkListStore *store) ++{ ++ GVariant *sources; ++ GVariantIter iter; ++ const gchar *name; ++ const gchar *type; ++ const gchar *id; ++ gchar *display_name; ++ GDesktopAppInfo *app_info; ++ GtkTreeIter tree_iter; ++ ++ sources = g_settings_get_value (input_sources_settings, KEY_INPUT_SOURCES); ++ ++ g_variant_iter_init (&iter, sources); ++ while (g_variant_iter_next (&iter, "(&s&s)", &type, &id)) ++ { ++ display_name = NULL; ++ app_info = NULL; ++ ++ if (g_str_equal (type, INPUT_SOURCE_TYPE_XKB)) ++ { ++ gnome_xkb_info_get_layout_info (xkb_info, id, &name, NULL, NULL, NULL); ++ if (!name) ++ { ++ g_warning ("Couldn't find XKB input source '%s'", id); ++ continue; ++ } ++ display_name = g_strdup (name); ++ } ++ else if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) ++ { ++#ifdef HAVE_IBUS ++ IBusEngineDesc *engine_desc = NULL; ++ ++ if (ibus_engines) ++ engine_desc = g_hash_table_lookup (ibus_engines, id); ++ ++ if (engine_desc) ++ { ++ display_name = engine_get_display_name (engine_desc); ++ app_info = setup_app_info_for_id (id); ++ } ++#else ++ g_warning ("IBus input source type specified but IBus support was not compiled"); ++ continue; ++#endif ++ } ++ else ++ { ++ g_warning ("Unknown input source type '%s'", type); ++ continue; ++ } ++ ++ gtk_list_store_append (store, &tree_iter); ++ gtk_list_store_set (store, &tree_iter, ++ NAME_COLUMN, display_name, ++ TYPE_COLUMN, type, ++ ID_COLUMN, id, ++ SETUP_COLUMN, app_info, ++ -1); ++ g_free (display_name); ++ if (app_info) ++ g_object_unref (app_info); ++ } ++ ++ g_variant_unref (sources); ++} ++ ++static void ++update_configuration (GtkTreeModel *model) ++{ ++ GtkTreeIter iter; ++ gchar *type; ++ gchar *id; ++ GVariantBuilder builder; ++ GVariant *old_sources; ++ const gchar *old_current_type; ++ const gchar *old_current_id; ++ guint old_current_index; ++ guint old_n_sources; ++ guint index; ++ ++ old_sources = g_settings_get_value (input_sources_settings, KEY_INPUT_SOURCES); ++ old_current_index = g_settings_get_uint (input_sources_settings, KEY_CURRENT_INPUT_SOURCE); ++ old_n_sources = g_variant_n_children (old_sources); ++ ++ if (old_n_sources > 0 && old_current_index < old_n_sources) ++ { ++ g_variant_get_child (old_sources, ++ old_current_index, ++ "(&s&s)", ++ &old_current_type, ++ &old_current_id); ++ } ++ else ++ { ++ old_current_type = ""; ++ old_current_id = ""; ++ } ++ ++ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)")); ++ index = 0; ++ gtk_tree_model_get_iter_first (model, &iter); ++ do ++ { ++ gtk_tree_model_get (model, &iter, ++ TYPE_COLUMN, &type, ++ ID_COLUMN, &id, ++ -1); ++ if (index != old_current_index && ++ g_str_equal (type, old_current_type) && ++ g_str_equal (id, old_current_id)) ++ { ++ g_settings_set_uint (input_sources_settings, KEY_CURRENT_INPUT_SOURCE, index); ++ } ++ g_variant_builder_add (&builder, "(ss)", type, id); ++ g_free (type); ++ g_free (id); ++ index += 1; ++ } ++ while (gtk_tree_model_iter_next (model, &iter)); ++ ++ g_settings_set_value (input_sources_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); ++ g_settings_apply (input_sources_settings); ++ ++ g_variant_unref (old_sources); ++} ++ ++static gboolean ++get_selected_iter (GtkBuilder *builder, ++ GtkTreeModel **model, ++ GtkTreeIter *iter) ++{ ++ GtkTreeSelection *selection; ++ ++ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (WID ("active_input_sources"))); ++ ++ return gtk_tree_selection_get_selected (selection, model, iter); ++} ++ ++static gint ++idx_from_model_iter (GtkTreeModel *model, ++ GtkTreeIter *iter) ++{ ++ GtkTreePath *path; ++ gint idx; ++ ++ path = gtk_tree_model_get_path (model, iter); ++ if (path == NULL) ++ return -1; ++ ++ idx = gtk_tree_path_get_indices (path)[0]; ++ gtk_tree_path_free (path); ++ ++ return idx; ++} ++ ++static void ++update_button_sensitivity (GtkBuilder *builder) ++{ ++ GtkWidget *remove_button; ++ GtkWidget *up_button; ++ GtkWidget *down_button; ++ GtkWidget *show_button; ++ GtkWidget *settings_button; ++ GtkTreeView *tv; ++ GtkTreeModel *model; ++ GtkTreeIter iter; ++ gint n_active; ++ gint index; ++ gboolean settings_sensitive; ++ GDesktopAppInfo *app_info; ++ ++ remove_button = WID("input_source_remove"); ++ show_button = WID("input_source_show"); ++ up_button = WID("input_source_move_up"); ++ down_button = WID("input_source_move_down"); ++ settings_button = WID("input_source_settings"); ++ ++ tv = GTK_TREE_VIEW (WID ("active_input_sources")); ++ n_active = gtk_tree_model_iter_n_children (gtk_tree_view_get_model (tv), NULL); ++ ++ if (get_selected_iter (builder, &model, &iter)) ++ { ++ index = idx_from_model_iter (model, &iter); ++ gtk_tree_model_get (model, &iter, SETUP_COLUMN, &app_info, -1); ++ } ++ else ++ { ++ index = -1; ++ app_info = NULL; ++ } ++ ++ settings_sensitive = (index >= 0 && app_info != NULL); ++ ++ if (app_info) ++ g_object_unref (app_info); ++ ++ gtk_widget_set_sensitive (remove_button, index >= 0 && n_active > 1); ++ gtk_widget_set_sensitive (show_button, index >= 0); ++ gtk_widget_set_sensitive (up_button, index > 0); ++ gtk_widget_set_sensitive (down_button, index >= 0 && index < n_active - 1); ++ gtk_widget_set_sensitive (settings_button, settings_sensitive); ++} ++ ++static void ++set_selected_path (GtkBuilder *builder, ++ GtkTreePath *path) ++{ ++ GtkTreeSelection *selection; ++ ++ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (WID ("active_input_sources"))); ++ ++ gtk_tree_selection_select_path (selection, path); ++} ++ ++static GtkTreeModel * ++tree_view_get_actual_model (GtkTreeView *tv) ++{ ++ GtkTreeModel *filtered_store; ++ ++ filtered_store = gtk_tree_view_get_model (tv); ++ ++ return gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (filtered_store)); ++} ++ ++static void ++chooser_response (GtkWidget *chooser, gint response_id, gpointer data) ++{ ++ GtkBuilder *builder = data; ++ ++ if (response_id == GTK_RESPONSE_OK) ++ { ++ GtkTreeModel *model; ++ GtkTreeIter iter; ++ ++ if (input_chooser_get_selected (chooser, &model, &iter)) ++ { ++ GtkTreeView *tv; ++ GtkListStore *child_model; ++ GtkTreeIter child_iter, filter_iter; ++ gchar *name; ++ gchar *type; ++ gchar *id; ++ GDesktopAppInfo *app_info = NULL; ++ ++ gtk_tree_model_get (model, &iter, ++ NAME_COLUMN, &name, ++ TYPE_COLUMN, &type, ++ ID_COLUMN, &id, ++ -1); ++ ++#ifdef HAVE_IBUS ++ if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) ++ app_info = setup_app_info_for_id (id); ++#endif ++ ++ tv = GTK_TREE_VIEW (WID ("active_input_sources")); ++ child_model = GTK_LIST_STORE (tree_view_get_actual_model (tv)); ++ ++ gtk_list_store_append (child_model, &child_iter); ++ ++ gtk_list_store_set (child_model, &child_iter, ++ NAME_COLUMN, name, ++ TYPE_COLUMN, type, ++ ID_COLUMN, id, ++ SETUP_COLUMN, app_info, ++ -1); ++ g_free (name); ++ g_free (type); ++ g_free (id); ++ if (app_info) ++ g_object_unref (app_info); ++ ++ gtk_tree_model_filter_convert_child_iter_to_iter (GTK_TREE_MODEL_FILTER (gtk_tree_view_get_model (tv)), ++ &filter_iter, ++ &child_iter); ++ gtk_tree_selection_select_iter (gtk_tree_view_get_selection (tv), &filter_iter); ++ ++ update_button_sensitivity (builder); ++ update_configuration (GTK_TREE_MODEL (child_model)); ++ } ++ else ++ { ++ g_debug ("nothing selected, nothing added"); ++ } ++ } ++ ++ gtk_widget_destroy (GTK_WIDGET (chooser)); ++} ++ ++static void ++add_input (GtkButton *button, gpointer data) ++{ ++ GtkBuilder *builder = data; ++ GtkWidget *chooser; ++ GtkWidget *toplevel; ++ GtkWidget *treeview; ++ GtkListStore *active_sources; ++ ++ g_debug ("add an input source"); ++ ++ toplevel = gtk_widget_get_toplevel (WID ("region_notebook")); ++ treeview = WID ("active_input_sources"); ++ active_sources = GTK_LIST_STORE (tree_view_get_actual_model (GTK_TREE_VIEW (treeview))); ++ ++ chooser = input_chooser_new (GTK_WINDOW (toplevel), active_sources); ++ g_signal_connect (chooser, "response", ++ G_CALLBACK (chooser_response), builder); ++} ++ ++static void ++remove_selected_input (GtkButton *button, gpointer data) ++{ ++ GtkBuilder *builder = data; ++ GtkTreeModel *model; ++ GtkTreeModel *child_model; ++ GtkTreeIter iter; ++ GtkTreeIter child_iter; ++ GtkTreePath *path; ++ ++ g_debug ("remove selected input source"); ++ ++ if (get_selected_iter (builder, &model, &iter) == FALSE) ++ return; ++ ++ path = gtk_tree_model_get_path (model, &iter); ++ ++ child_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model)); ++ gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model), ++ &child_iter, ++ &iter); ++ gtk_list_store_remove (GTK_LIST_STORE (child_model), &child_iter); ++ ++ if (!gtk_tree_model_get_iter (model, &iter, path)) ++ gtk_tree_path_prev (path); ++ ++ set_selected_path (builder, path); ++ ++ gtk_tree_path_free (path); ++ ++ update_button_sensitivity (builder); ++ update_configuration (child_model); ++} ++ ++static void ++move_selected_input_up (GtkButton *button, gpointer data) ++{ ++ GtkBuilder *builder = data; ++ GtkTreeModel *model; ++ GtkTreeModel *child_model; ++ GtkTreeIter iter, prev; ++ GtkTreeIter child_iter, child_prev; ++ GtkTreePath *path; ++ ++ g_debug ("move selected input source up"); ++ ++ if (!get_selected_iter (builder, &model, &iter)) ++ return; ++ ++ prev = iter; ++ if (!gtk_tree_model_iter_previous (model, &prev)) ++ return; ++ ++ path = gtk_tree_model_get_path (model, &prev); ++ ++ child_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model)); ++ gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model), ++ &child_iter, ++ &iter); ++ gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model), ++ &child_prev, ++ &prev); ++ gtk_list_store_swap (GTK_LIST_STORE (child_model), &child_iter, &child_prev); ++ ++ set_selected_path (builder, path); ++ gtk_tree_path_free (path); ++ ++ update_button_sensitivity (builder); ++ update_configuration (child_model); ++} ++ ++static void ++move_selected_input_down (GtkButton *button, gpointer data) ++{ ++ GtkBuilder *builder = data; ++ GtkTreeModel *model; ++ GtkTreeModel *child_model; ++ GtkTreeIter iter, next; ++ GtkTreeIter child_iter, child_next; ++ GtkTreePath *path; ++ ++ g_debug ("move selected input source down"); ++ ++ if (!get_selected_iter (builder, &model, &iter)) ++ return; ++ ++ next = iter; ++ if (!gtk_tree_model_iter_next (model, &next)) ++ return; ++ ++ path = gtk_tree_model_get_path (model, &next); ++ ++ child_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model)); ++ gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model), ++ &child_iter, ++ &iter); ++ gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model), ++ &child_next, ++ &next); ++ gtk_list_store_swap (GTK_LIST_STORE (child_model), &child_iter, &child_next); ++ ++ set_selected_path (builder, path); ++ gtk_tree_path_free (path); ++ ++ update_button_sensitivity (builder); ++ update_configuration (child_model); ++} ++ ++static void ++show_selected_layout (GtkButton *button, gpointer data) ++{ ++ GtkBuilder *builder = data; ++ GtkTreeModel *model; ++ GtkTreeIter iter; ++ gchar *type; ++ gchar *id; ++ gchar *kbd_viewer_args; ++ const gchar *xkb_layout; ++ const gchar *xkb_variant; ++ ++ g_debug ("show selected layout"); ++ ++ if (!get_selected_iter (builder, &model, &iter)) ++ return; ++ ++ gtk_tree_model_get (model, &iter, ++ TYPE_COLUMN, &type, ++ ID_COLUMN, &id, ++ -1); ++ ++ if (g_str_equal (type, INPUT_SOURCE_TYPE_XKB)) ++ { ++ gnome_xkb_info_get_layout_info (xkb_info, id, NULL, NULL, &xkb_layout, &xkb_variant); ++ ++ if (!xkb_layout || !xkb_layout[0]) ++ { ++ g_warning ("Couldn't find XKB input source '%s'", id); ++ goto exit; ++ } ++ } ++ else if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) ++ { ++#ifdef HAVE_IBUS ++ IBusEngineDesc *engine_desc = NULL; ++ ++ if (ibus_engines) ++ engine_desc = g_hash_table_lookup (ibus_engines, id); ++ ++ if (engine_desc) ++ { ++ xkb_layout = ibus_engine_desc_get_layout (engine_desc); ++ xkb_variant = ""; ++ } ++ else ++ { ++ g_warning ("Couldn't find IBus input source '%s'", id); ++ goto exit; ++ } ++#else ++ g_warning ("IBus input source type specified but IBus support was not compiled"); ++ goto exit; ++#endif ++ } ++ else ++ { ++ g_warning ("Unknown input source type '%s'", type); ++ goto exit; ++ } ++ ++ if (xkb_variant[0]) ++ kbd_viewer_args = g_strdup_printf ("gkbd-keyboard-display -l \"%s\t%s\"", ++ xkb_layout, xkb_variant); ++ else ++ kbd_viewer_args = g_strdup_printf ("gkbd-keyboard-display -l %s", ++ xkb_layout); ++ ++ g_spawn_command_line_async (kbd_viewer_args, NULL); ++ ++ g_free (kbd_viewer_args); ++ exit: ++ g_free (type); ++ g_free (id); ++} ++ ++static void ++show_selected_settings (GtkButton *button, gpointer data) ++{ ++ GtkBuilder *builder = data; ++ GtkTreeModel *model; ++ GtkTreeIter iter; ++ GdkAppLaunchContext *ctx; ++ GDesktopAppInfo *app_info; ++ gchar *id; ++ GError *error = NULL; ++ ++ g_debug ("show selected layout"); ++ ++ if (!get_selected_iter (builder, &model, &iter)) ++ return; ++ ++ gtk_tree_model_get (model, &iter, SETUP_COLUMN, &app_info, -1); ++ ++ if (!app_info) ++ return; ++ ++ ctx = gdk_display_get_app_launch_context (gdk_display_get_default ()); ++ gdk_app_launch_context_set_timestamp (ctx, gtk_get_current_event_time ()); ++ ++ gtk_tree_model_get (model, &iter, ID_COLUMN, &id, -1); ++ g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (ctx), ++ "IBUS_ENGINE_NAME", ++ id); ++ g_free (id); ++ ++ if (!g_app_info_launch (G_APP_INFO (app_info), NULL, G_APP_LAUNCH_CONTEXT (ctx), &error)) ++ { ++ g_warning ("Failed to launch input source setup: %s", error->message); ++ g_error_free (error); ++ } ++ ++ g_object_unref (ctx); ++ g_object_unref (app_info); ++} ++ ++static gboolean ++go_to_shortcuts (GtkLinkButton *button, ++ CcRegionPanel *panel) ++{ ++ gchar *argv[3]; ++ argv[0] = "cinnamon-settings"; ++ argv[1] = "keyboard"; ++ argv[3] = NULL; ++ g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); ++ return TRUE; ++} ++ ++static void ++input_sources_changed (GSettings *settings, ++ gchar *key, ++ GtkBuilder *builder) ++{ ++ GtkWidget *treeview; ++ GtkTreeModel *store; ++ GtkTreePath *path; ++ GtkTreeIter iter; ++ GtkTreeModel *model; ++ ++ treeview = WID("active_input_sources"); ++ store = tree_view_get_actual_model (GTK_TREE_VIEW (treeview)); ++ ++ if (get_selected_iter (builder, &model, &iter)) ++ path = gtk_tree_model_get_path (model, &iter); ++ else ++ path = NULL; ++ ++ gtk_list_store_clear (GTK_LIST_STORE (store)); ++ populate_with_active_sources (GTK_LIST_STORE (store)); ++ ++ if (path) ++ { ++ set_selected_path (builder, path); ++ gtk_tree_path_free (path); ++ } ++} ++ ++static void ++update_shortcut_label (GtkWidget *widget, ++ const char *value) ++{ ++ char *text; ++ guint accel_key, *keycode; ++ GdkModifierType mods; ++ ++ if (value == NULL || *value == '\0') ++ { ++ gtk_label_set_text (GTK_LABEL (widget), "\342\200\224"); ++ return; ++ } ++ gtk_accelerator_parse_with_keycode (value, &accel_key, &keycode, &mods); ++ if (accel_key == 0 && keycode == NULL && mods == 0) ++ { ++ gtk_label_set_text (GTK_LABEL (widget), "\342\200\224"); ++ g_warning ("Failed to parse keyboard shortcut: '%s'", value); ++ return; ++ } ++ ++ text = gtk_accelerator_get_label_with_keycode (gtk_widget_get_display (widget), accel_key, *keycode, mods); ++ g_free (keycode); ++ gtk_label_set_text (GTK_LABEL (widget), text); ++ g_free (text); ++} ++ ++static void ++update_shortcuts (GtkBuilder *builder) ++{ ++ char *previous, *next; ++ GSettings *settings; ++ ++ settings = g_settings_new ("org.cinnamon.settings-daemon.plugins.media-keys"); ++ ++ previous = g_settings_get_string (settings, "switch-input-source-backward"); ++ next = g_settings_get_string (settings, "switch-input-source"); ++ ++ update_shortcut_label (WID ("prev-source-shortcut-label"), previous); ++ update_shortcut_label (WID ("next-source-shortcut-label"), next); ++ ++ g_free (previous); ++ g_free (next); ++} ++ ++static gboolean ++active_sources_visible_func (GtkTreeModel *model, ++ GtkTreeIter *iter, ++ gpointer data) ++{ ++ gchar *display_name; ++ ++ gtk_tree_model_get (model, iter, NAME_COLUMN, &display_name, -1); ++ ++ if (!display_name) ++ return FALSE; ++ ++ g_free (display_name); ++ ++ return TRUE; ++} ++ ++void ++setup_input_tabs (GtkBuilder *builder, ++ CcRegionPanel *panel) ++{ ++ GtkWidget *treeview; ++ GtkTreeViewColumn *column; ++ GtkCellRenderer *cell; ++ GtkListStore *store; ++ GtkTreeModel *filtered_store; ++ GtkTreeSelection *selection; ++ ++ /* set up the list of active inputs */ ++ treeview = WID("active_input_sources"); ++ column = gtk_tree_view_column_new (); ++ cell = gtk_cell_renderer_text_new (); ++ gtk_tree_view_column_pack_start (column, cell, TRUE); ++ gtk_tree_view_column_add_attribute (column, cell, "text", NAME_COLUMN); ++ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); ++ ++ store = gtk_list_store_new (N_COLUMNS, ++ G_TYPE_STRING, ++ G_TYPE_STRING, ++ G_TYPE_STRING, ++ G_TYPE_DESKTOP_APP_INFO); ++ ++ gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store)); ++ ++ input_sources_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); ++ g_settings_delay (input_sources_settings); ++ g_object_weak_ref (G_OBJECT (builder), (GWeakNotify) g_object_unref, input_sources_settings); ++ ++ if (!xkb_info) ++ xkb_info = gnome_xkb_info_new (); ++ ++#ifdef HAVE_IBUS ++ ibus_init (); ++ shell_name_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, ++ "org.Cinnamon", ++ G_BUS_NAME_WATCHER_FLAGS_NONE, ++ on_shell_appeared, ++ NULL, ++ builder, ++ NULL); ++ g_object_weak_ref (G_OBJECT (builder), (GWeakNotify) clear_ibus, NULL); ++#endif ++ ++ populate_with_active_sources (store); ++ ++ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); ++ g_signal_connect_swapped (selection, "changed", ++ G_CALLBACK (update_button_sensitivity), builder); ++ ++ /* Some input source types might have their info loaded ++ * asynchronously. In that case we don't want to show them ++ * immediately so we use a filter model on top of the real model ++ * which mirrors the GSettings key. */ ++ filtered_store = gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL); ++ gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filtered_store), ++ active_sources_visible_func, ++ NULL, ++ NULL); ++ gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), filtered_store); ++ ++ /* set up the buttons */ ++ g_signal_connect (WID("input_source_add"), "clicked", ++ G_CALLBACK (add_input), builder); ++ g_signal_connect (WID("input_source_remove"), "clicked", ++ G_CALLBACK (remove_selected_input), builder); ++ g_signal_connect (WID("input_source_move_up"), "clicked", ++ G_CALLBACK (move_selected_input_up), builder); ++ g_signal_connect (WID("input_source_move_down"), "clicked", ++ G_CALLBACK (move_selected_input_down), builder); ++ g_signal_connect (WID("input_source_show"), "clicked", ++ G_CALLBACK (show_selected_layout), builder); ++ g_signal_connect (WID("input_source_settings"), "clicked", ++ G_CALLBACK (show_selected_settings), builder); ++ ++ /* use an em dash is no shortcut */ ++ update_shortcuts (builder); ++ ++ g_signal_connect (WID("jump-to-shortcuts"), "activate-link", ++ G_CALLBACK (go_to_shortcuts), panel); ++ ++ g_signal_connect (G_OBJECT (input_sources_settings), ++ "changed::" KEY_INPUT_SOURCES, ++ G_CALLBACK (input_sources_changed), ++ builder); ++} ++ ++static void ++filter_clear (GtkEntry *entry, ++ GtkEntryIconPosition icon_pos, ++ GdkEvent *event, ++ gpointer user_data) ++{ ++ gtk_entry_set_text (entry, ""); ++} ++ ++static gchar **search_pattern_list; ++ ++static void ++filter_changed (GtkBuilder *builder) ++{ ++ GtkTreeModelFilter *filtered_model; ++ GtkTreeView *tree_view; ++ GtkTreeSelection *selection; ++ GtkTreeIter selected_iter; ++ GtkWidget *filter_entry; ++ const gchar *pattern; ++ gchar *upattern; ++ ++ filter_entry = WID ("input_source_filter"); ++ pattern = gtk_entry_get_text (GTK_ENTRY (filter_entry)); ++ upattern = g_utf8_strup (pattern, -1); ++ if (!g_strcmp0 (pattern, "")) ++ g_object_set (G_OBJECT (filter_entry), ++ "secondary-icon-name", "edit-find-symbolic", ++ "secondary-icon-activatable", FALSE, ++ "secondary-icon-sensitive", FALSE, ++ NULL); ++ else ++ g_object_set (G_OBJECT (filter_entry), ++ "secondary-icon-name", "edit-clear-symbolic", ++ "secondary-icon-activatable", TRUE, ++ "secondary-icon-sensitive", TRUE, ++ NULL); ++ ++ if (search_pattern_list != NULL) ++ g_strfreev (search_pattern_list); ++ ++ search_pattern_list = g_strsplit (upattern, " ", -1); ++ g_free (upattern); ++ ++ filtered_model = GTK_TREE_MODEL_FILTER (gtk_builder_get_object (builder, "filtered_input_source_model")); ++ gtk_tree_model_filter_refilter (filtered_model); ++ ++ tree_view = GTK_TREE_VIEW (WID ("filtered_input_source_list")); ++ selection = gtk_tree_view_get_selection (tree_view); ++ if (gtk_tree_selection_get_selected (selection, NULL, &selected_iter)) ++ { ++ GtkTreePath *path = gtk_tree_model_get_path (GTK_TREE_MODEL (filtered_model), ++ &selected_iter); ++ gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 0.5, 0.5); ++ gtk_tree_path_free (path); ++ } ++ else ++ { ++ GtkTreeIter iter; ++ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (filtered_model), &iter)) ++ gtk_tree_selection_select_iter (selection, &iter); ++ } ++} ++ ++static void ++selection_changed (GtkTreeSelection *selection, ++ GtkBuilder *builder) ++{ ++ gtk_widget_set_sensitive (WID ("ok-button"), ++ gtk_tree_selection_get_selected (selection, NULL, NULL)); ++} ++ ++static void ++row_activated (GtkTreeView *tree_view, ++ GtkTreePath *path, ++ GtkTreeViewColumn *column, ++ GtkBuilder *builder) ++{ ++ GtkWidget *add_button; ++ GtkWidget *dialog; ++ ++ add_button = WID ("ok-button"); ++ dialog = WID ("input_source_chooser"); ++ if (gtk_widget_is_sensitive (add_button)) ++ gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); ++} ++ ++static void ++entry_activated (GtkBuilder *builder, ++ gpointer data) ++{ ++ row_activated (NULL, NULL, NULL, builder); ++} ++ ++static gboolean ++filter_func (GtkTreeModel *model, ++ GtkTreeIter *iter, ++ gpointer data) ++{ ++ gchar *name = NULL; ++ gchar **pattern; ++ gboolean rv = TRUE; ++ ++ if (search_pattern_list == NULL || search_pattern_list[0] == NULL) ++ return TRUE; ++ ++ gtk_tree_model_get (model, iter, ++ NAME_COLUMN, &name, ++ -1); ++ ++ pattern = search_pattern_list; ++ do { ++ gboolean is_pattern_found = FALSE; ++ gchar *udesc = g_utf8_strup (name, -1); ++ if (udesc != NULL && g_strstr_len (udesc, -1, *pattern)) ++ { ++ is_pattern_found = TRUE; ++ } ++ g_free (udesc); ++ ++ if (!is_pattern_found) ++ { ++ rv = FALSE; ++ break; ++ } ++ ++ } while (*++pattern != NULL); ++ ++ g_free (name); ++ ++ return rv; ++} ++ ++static GtkWidget * ++input_chooser_new (GtkWindow *main_window, ++ GtkListStore *active_sources) ++{ ++ GtkBuilder *builder; ++ GtkWidget *chooser; ++ GtkWidget *filtered_list; ++ GtkWidget *filter_entry; ++ GtkTreeViewColumn *visible_column; ++ GtkTreeSelection *selection; ++ GtkListStore *model; ++ GtkTreeModelFilter *filtered_model; ++ GtkTreeIter iter; ++ ++ builder = gtk_builder_new (); ++ gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE); ++ gtk_builder_add_from_file (builder, ++ CINNAMONCC_UI_DIR "/cinnamon-region-panel-input-chooser.ui", ++ NULL); ++ chooser = WID ("input_source_chooser"); ++ input_chooser = chooser; ++ g_object_add_weak_pointer (G_OBJECT (chooser), (gpointer *) &input_chooser); ++ g_object_set_data_full (G_OBJECT (chooser), "builder", builder, g_object_unref); ++ ++ filtered_list = WID ("filtered_input_source_list"); ++ filter_entry = WID ("input_source_filter"); ++ ++ g_object_set_data (G_OBJECT (chooser), ++ "filtered_input_source_list", filtered_list); ++ visible_column = ++ gtk_tree_view_column_new_with_attributes ("Input Sources", ++ gtk_cell_renderer_text_new (), ++ "text", NAME_COLUMN, ++ NULL); ++ ++ gtk_window_set_transient_for (GTK_WINDOW (chooser), main_window); ++ ++ gtk_tree_view_append_column (GTK_TREE_VIEW (filtered_list), ++ visible_column); ++ /* We handle searching ourselves, thank you. */ ++ gtk_tree_view_set_enable_search (GTK_TREE_VIEW (filtered_list), FALSE); ++ gtk_tree_view_set_search_column (GTK_TREE_VIEW (filtered_list), -1); ++ ++ g_signal_connect_swapped (G_OBJECT (filter_entry), "activate", ++ G_CALLBACK (entry_activated), builder); ++ g_signal_connect_swapped (G_OBJECT (filter_entry), "notify::text", ++ G_CALLBACK (filter_changed), builder); ++ ++ g_signal_connect (G_OBJECT (filter_entry), "icon-release", ++ G_CALLBACK (filter_clear), NULL); ++ ++ filtered_model = GTK_TREE_MODEL_FILTER (gtk_builder_get_object (builder, "filtered_input_source_model")); ++ model = GTK_LIST_STORE (gtk_builder_get_object (builder, "input_source_model")); ++ ++ populate_model (model, active_sources); ++ ++ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), ++ NAME_COLUMN, GTK_SORT_ASCENDING); ++ ++ gtk_tree_model_filter_set_visible_func (filtered_model, ++ filter_func, ++ NULL, NULL); ++ ++ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (filtered_list)); ++ ++ g_signal_connect (G_OBJECT (selection), "changed", ++ G_CALLBACK (selection_changed), builder); ++ ++ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (filtered_model), &iter)) ++ gtk_tree_selection_select_iter (selection, &iter); ++ ++ g_signal_connect (G_OBJECT (filtered_list), "row-activated", ++ G_CALLBACK (row_activated), builder); ++ ++ gtk_widget_grab_focus (filter_entry); ++ ++ gtk_widget_show (chooser); ++ ++ return chooser; ++} ++ ++static gboolean ++input_chooser_get_selected (GtkWidget *dialog, ++ GtkTreeModel **model, ++ GtkTreeIter *iter) ++{ ++ GtkWidget *tv; ++ GtkTreeSelection *selection; ++ ++ tv = g_object_get_data (G_OBJECT (dialog), "filtered_input_source_list"); ++ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tv)); ++ ++ return gtk_tree_selection_get_selected (selection, model, iter); ++} +diff -uNrp a/panels/region/cinnamon-region-panel-input-chooser.ui b/panels/region/cinnamon-region-panel-input-chooser.ui +--- a/panels/region/cinnamon-region-panel-input-chooser.ui 1970-01-01 01:00:00.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-input-chooser.ui 2013-09-21 13:24:15.339949536 +0100 +@@ -0,0 +1,157 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ input_source_model ++ ++ ++ False ++ False ++ 5 ++ Choose an input source ++ True ++ center-on-parent ++ dialog ++ ++ ++ True ++ False ++ vertical ++ 2 ++ ++ ++ True ++ False ++ end ++ ++ ++ gtk-cancel ++ True ++ True ++ True ++ False ++ False ++ True ++ ++ ++ False ++ False ++ end ++ 1 ++ ++ ++ ++ ++ gtk-add ++ True ++ True ++ True ++ False ++ False ++ True ++ ++ ++ False ++ False ++ end ++ 2 ++ ++ ++ ++ ++ ++ ++ True ++ False ++ 5 ++ 6 ++ ++ ++ True ++ False ++ 6 ++ ++ ++ True ++ False ++ 0 ++ Select an input source to add ++ ++ ++ False ++ False ++ 0 ++ ++ ++ ++ ++ True ++ True ++ never ++ etched-in ++ 450 ++ 250 ++ ++ ++ True ++ True ++ filtered_input_source_model ++ False ++ 0 ++ ++ ++ ++ ++ True ++ True ++ 1 ++ ++ ++ ++ ++ True ++ True ++ 0 ++ ++ ++ ++ ++ True ++ True ++ ++ edit-find-symbolic ++ False ++ False ++ ++ ++ False ++ False ++ end ++ 1 ++ ++ ++ ++ ++ True ++ True ++ 1 ++ ++ ++ ++ ++ ++ ok-button ++ cancel-button ++ ++ ++ +diff -uNrp a/panels/region/cinnamon-region-panel-input.h b/panels/region/cinnamon-region-panel-input.h +--- a/panels/region/cinnamon-region-panel-input.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-input.h 2013-09-21 13:24:15.339949536 +0100 +@@ -0,0 +1,36 @@ ++/* cinnamon-region-panel-input.h ++ * Copyright (C) 2011 Red Hat, Inc. ++ * ++ * Written by Matthias Clasen ++ * ++ * 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, 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 - Suite 500, Boston, MA ++ * 02110-1335, USA. ++ */ ++ ++#ifndef __CINNAMON_KEYBOARD_PROPERTY_INPUT_H ++#define __CINNAMON_KEYBOARD_PROPERTY_INPUT_H ++ ++#include ++ ++#include "cc-region-panel.h" ++ ++G_BEGIN_DECLS ++ ++void setup_input_tabs (GtkBuilder *builder, ++ CcRegionPanel *self); ++ ++G_END_DECLS ++ ++#endif /* __CINNAMON_KEYBOARD_PROPERTY_INPUT_H */ +diff -uNrp a/panels/region/cinnamon-region-panel-lang.c b/panels/region/cinnamon-region-panel-lang.c +--- a/panels/region/cinnamon-region-panel-lang.c 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-lang.c 2013-09-21 13:24:15.340949500 +0100 +@@ -24,7 +24,7 @@ + #endif + + #include +-#include ++#include + + #include "cinnamon-region-panel-lang.h" + #include "cinnamon-region-panel-formats.h" +diff -uNrp a/panels/region/cinnamon-region-panel-lang.h b/panels/region/cinnamon-region-panel-lang.h +--- a/panels/region/cinnamon-region-panel-lang.h 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-lang.h 2013-09-21 13:24:15.340949500 +0100 +@@ -19,8 +19,8 @@ + * 02110-1335, USA. + */ + +-#ifndef __GNOME_KEYBOARD_PROPERTY_LANG_H +-#define __GNOME_KEYBOARD_PROPERTY_LANG_H ++#ifndef __CINNAMON_KEYBOARD_PROPERTY_LANG_H ++#define __CINNAMON_KEYBOARD_PROPERTY_LANG_H + + #include + +@@ -29,4 +29,4 @@ G_BEGIN_DECLS + void setup_language (GtkBuilder *builder); + + G_END_DECLS +-#endif /* __GNOME_KEYBOARD_PROPERTY_LANG_H */ ++#endif /* __CINNAMON_KEYBOARD_PROPERTY_LANG_H */ +diff -uNrp a/panels/region/cinnamon-region-panel-layout-chooser.ui b/panels/region/cinnamon-region-panel-layout-chooser.ui +--- a/panels/region/cinnamon-region-panel-layout-chooser.ui 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-layout-chooser.ui 1970-01-01 01:00:00.000000000 +0100 +@@ -1,180 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- layout_list_model +- +- +- False +- False +- 5 +- Choose a Layout +- True +- center-on-parent +- dialog +- +- +- True +- False +- vertical +- 2 +- +- +- True +- False +- end +- +- +- Preview +- True +- True +- True +- False +- +- +- False +- False +- 0 +- True +- +- +- +- +- gtk-cancel +- True +- True +- True +- False +- False +- True +- +- +- False +- False +- end +- 1 +- +- +- +- +- gtk-add +- True +- True +- True +- False +- False +- True +- +- +- False +- False +- end +- 2 +- +- +- +- +- +- +- True +- False +- 5 +- 6 +- +- +- True +- False +- 6 +- +- +- True +- False +- 0 +- Select an input source to add +- +- +- False +- False +- 0 +- +- +- +- +- True +- True +- never +- etched-in +- 450 +- 250 +- +- +- True +- True +- filtered_layout_list_model +- False +- 0 +- +- +- +- +- +- +- +- True +- True +- 1 +- +- +- +- +- True +- True +- 0 +- +- +- +- +- True +- True +- +- edit-find-symbolic +- False +- False +- +- +- False +- False +- end +- 1 +- +- +- +- +- True +- True +- 1 +- +- +- +- +- +- btnPreview +- btnOk +- btnCancel +- +- +- +diff -uNrp a/panels/region/cinnamon-region-panel-options-dialog.ui b/panels/region/cinnamon-region-panel-options-dialog.ui +--- a/panels/region/cinnamon-region-panel-options-dialog.ui 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-options-dialog.ui 1970-01-01 01:00:00.000000000 +0100 +@@ -1,79 +0,0 @@ +- +- +- +- +- False +- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK +- 5 +- Keyboard Layout Options +- center-on-parent +- 550 +- 400 +- dialog +- +- +- True +- False +- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK +- vertical +- 2 +- +- +- True +- True +- 5 +- out +- +- +- True +- False +- none +- +- +- True +- False +- +- +- +- +- +- +- False +- True +- 1 +- +- +- +- +- True +- False +- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK +- end +- +- +- +- +- +- gtk-close +- True +- True +- True +- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK +- False +- True +- +- +- False +- False +- 1 +- +- +- +- +- +- +- +- button2 +- +- +- +diff -uNrp a/panels/region/cinnamon-region-panel-system.c b/panels/region/cinnamon-region-panel-system.c +--- a/panels/region/cinnamon-region-panel-system.c 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-system.c 2013-09-21 13:24:15.342949428 +0100 +@@ -27,15 +27,18 @@ + + #include + +-#include ++#include ++ ++#define GNOME_DESKTOP_USE_UNSTABLE_API ++#include + +-#include + #include "cc-common-language.h" + #include "gdm-languages.h" + #include "cinnamon-region-panel-system.h" +-#include "cinnamon-region-panel-xkb.h" + +-static GSettings *locale_settings, *xkb_settings; ++#define WID(s) GTK_WIDGET(gtk_builder_get_object (dialog, s)) ++ ++static GSettings *locale_settings, *input_sources_settings; + static GDBusProxy *localed_proxy; + static GPermission *localed_permission; + +@@ -72,13 +75,14 @@ update_copy_button (GtkBuilder *dialog) + + button = WID ("copy_settings_button"); + +- /* If the version of localed doesn't include layouts... */ +- if (system_input_source) { ++ if (user_input_source && user_input_source[0]) { + layouts_differ = (g_strcmp0 (user_input_source, system_input_source) != 0); + if (layouts_differ == FALSE) + layouts_differ = (g_strcmp0 (user_input_variants, system_input_variants) != 0); +- } else ++ } else { ++ /* Nothing to copy */ + layouts_differ = FALSE; ++ } + + if (g_strcmp0 (user_lang, system_lang) == 0 && + g_strcmp0 (user_region, system_region) == 0 && +@@ -131,61 +135,67 @@ system_update_language (GtkBuilder *dial + } + + static void +-xkb_settings_changed (GSettings *settings, +- const gchar *key, +- GtkBuilder *dialog) ++input_sources_changed (GSettings *settings, ++ const gchar *key, ++ GtkBuilder *dialog) + { +- guint i; +- GString *disp, *list, *variants; +- GtkWidget *label; +- gchar **layouts; +- +- layouts = g_settings_get_strv (settings, "layouts"); +- if (layouts == NULL) +- return; +- +- label = WID ("user_input_source"); +- disp = g_string_new (""); +- list = g_string_new (""); +- variants = g_string_new (""); +- +- for (i = 0; layouts[i]; i++) { +- gchar *utf_visible; +- char **split; +- gchar *layout, *variant; +- +- utf_visible = xkb_layout_description_utf8 (layouts[i]); +- if (disp->str[0] != '\0') +- g_string_append (disp, ", "); +- g_string_append (disp, utf_visible ? utf_visible : layouts[i]); +- g_free (utf_visible); +- +- split = g_strsplit_set (layouts[i], " \t", 2); +- +- if (split == NULL || split[0] == NULL) +- continue; +- +- layout = split[0]; +- variant = split[1]; +- +- if (list->str[0] != '\0') +- g_string_append (list, ","); +- g_string_append (list, layout); +- +- if (variants->str[0] != '\0') +- g_string_append (variants, ","); +- g_string_append (variants, variant ? variant : ""); +- +- g_strfreev (split); +- } +- g_strfreev (layouts); ++ GString *disp, *list, *variants; ++ GtkWidget *label; ++ GnomeXkbInfo *xkb_info; ++ GVariantIter iter; ++ GVariant *sources; ++ const gchar *type; ++ const gchar *id; ++ ++ sources = g_settings_get_value (input_sources_settings, "sources"); ++ xkb_info = gnome_xkb_info_new (); ++ ++ label = WID ("user_input_source"); ++ disp = g_string_new (""); ++ list = g_string_new (""); ++ variants = g_string_new (""); ++ ++ g_variant_iter_init (&iter, sources); ++ while (g_variant_iter_next (&iter, "(&s&s)", &type, &id)) { ++ /* We can't copy non-XKB layouts to the system yet */ ++ if (g_str_equal (type, "xkb")) { ++ char **split; ++ gchar *layout, *variant; ++ const char *name; ++ ++ gnome_xkb_info_get_layout_info (xkb_info, id, &name, NULL, NULL, NULL); ++ if (disp->str[0] != '\0') ++ g_string_append (disp, ", "); ++ g_string_append (disp, name); ++ ++ split = g_strsplit (id, "+", 2); ++ ++ if (split == NULL || split[0] == NULL) ++ continue; ++ ++ layout = split[0]; ++ variant = split[1]; ++ ++ if (list->str[0] != '\0') { ++ g_string_append (list, ","); ++ g_string_append (variants, ","); ++ } ++ g_string_append (list, layout); ++ g_string_append (variants, variant ? variant : ""); ++ ++ g_strfreev (split); ++ } ++ } ++ g_variant_unref (sources); ++ g_object_unref (xkb_info); + + g_object_set_data_full (G_OBJECT (label), "input_source", g_string_free (list, FALSE), g_free); + g_object_set_data_full (G_OBJECT (label), "input_variants", g_string_free (variants, FALSE), g_free); ++ + gtk_label_set_text (GTK_LABEL (label), disp->str); + g_string_free (disp, TRUE); + +- update_copy_button (dialog); ++ update_copy_button (dialog); + } + + static void +@@ -222,12 +232,13 @@ on_localed_properties_changed (GDBusProx + const gchar **invalidated_properties, + GtkBuilder *dialog) + { +- GVariant *v; ++ GVariant *v, *w; + GtkWidget *label; +- const char *layout; ++ GnomeXkbInfo *xkb_info; + char **layouts; ++ char **variants; + GString *disp; +- guint i; ++ guint i, n; + + if (invalidated_properties != NULL) { + guint i; +@@ -236,6 +247,8 @@ on_localed_properties_changed (GDBusProx + update_property (proxy, "Locale"); + else if (g_str_equal (invalidated_properties[i], "X11Layout")) + update_property (proxy, "X11Layout"); ++ else if (g_str_equal (invalidated_properties[i], "X11Variant")) ++ update_property (proxy, "X11Variant"); + } + } + +@@ -290,29 +303,56 @@ on_localed_properties_changed (GDBusProx + label = WID ("system_input_source"); + v = g_dbus_proxy_get_cached_property (proxy, "X11Layout"); + if (v) { +- layout = g_variant_get_string (v, NULL); +- g_object_set_data_full (G_OBJECT (label), "input_source", g_strdup (layout), g_free); +- } else { ++ layouts = g_strsplit (g_variant_get_string (v, NULL), ",", -1); ++ g_object_set_data_full (G_OBJECT (label), "input_source", ++ g_variant_dup_string (v, NULL), g_free); ++ g_variant_unref (v); ++ } else { + g_object_set_data_full (G_OBJECT (label), "input_source", NULL, g_free); + update_copy_button (dialog); + return; + } + +- disp = g_string_new (""); +- layouts = g_strsplit (layout, ",", -1); +- for (i = 0; layouts[i]; i++) { +- gchar *utf_visible; +- +- utf_visible = xkb_layout_description_utf8 (layouts[i]); +- if (disp->str[0] != '\0') +- disp = g_string_append (disp, ", "); +- disp = g_string_append (disp, utf_visible ? utf_visible : layouts[i]); +- g_free (utf_visible); +- } ++ w = g_dbus_proxy_get_cached_property (proxy, "X11Variant"); ++ if (w) { ++ variants = g_strsplit (g_variant_get_string (w, NULL), ",", -1); ++ g_object_set_data_full (G_OBJECT (label), "input_variants", ++ g_variant_dup_string (w, NULL), g_free); ++ g_variant_unref (w); ++ } else { ++ variants = NULL; ++ g_object_set_data_full (G_OBJECT (label), "input_variants", NULL, g_free); ++ } ++ ++ if (variants && variants[0]) ++ n = MIN (g_strv_length (layouts), g_strv_length (variants)); ++ else ++ n = g_strv_length (layouts); ++ ++ xkb_info = gnome_xkb_info_new (); ++ disp = g_string_new (""); ++ for (i = 0; i < n && layouts[i][0]; i++) { ++ const char *name; ++ char *id; ++ ++ if (variants && variants[i] && variants[i][0]) ++ id = g_strdup_printf ("%s+%s", layouts[i], variants[i]); ++ else ++ id = g_strdup (layouts[i]); ++ ++ gnome_xkb_info_get_layout_info (xkb_info, id, &name, NULL, NULL, NULL); ++ if (disp->str[0] != '\0') ++ disp = g_string_append (disp, ", "); ++ disp = g_string_append (disp, name ? name : id); ++ ++ g_free (id); ++ } + gtk_label_set_text (GTK_LABEL (label), disp->str); + g_string_free (disp, TRUE); + +- g_variant_unref (v); ++ g_strfreev (variants); ++ g_strfreev (layouts); ++ g_object_unref (xkb_info); + + update_copy_button (dialog); + } +@@ -386,6 +426,11 @@ copy_settings (GtkButton *button, GtkBui + layout = g_object_get_data (G_OBJECT (label), "input_source"); + variants = g_object_get_data (G_OBJECT (label), "input_variants"); + ++ if (layout == NULL || layout[0] == '\0') { ++ g_debug ("Not calling SetX11Keyboard, as there are no XKB input sources in the user's settings"); ++ return; ++ } ++ + g_dbus_proxy_call (localed_proxy, + "SetX11Keyboard", + g_variant_new ("(ssssbb)", layout, "", variants ? variants : "", "", TRUE, TRUE), +@@ -468,10 +513,10 @@ setup_system (GtkBuilder *dialog) + G_CALLBACK (locale_settings_changed), dialog); + g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, locale_settings); + +- xkb_settings = g_settings_new (GKBD_KEYBOARD_SCHEMA); +- g_signal_connect (xkb_settings, "changed::layouts", +- G_CALLBACK (xkb_settings_changed), dialog); +- g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, xkb_settings); ++ input_sources_settings = g_settings_new ("org.cinnamon.desktop.input-sources"); ++ g_signal_connect (input_sources_settings, "changed::sources", ++ G_CALLBACK (input_sources_changed), dialog); ++ g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, input_sources_settings); + + /* Display user settings */ + language = cc_common_language_get_current_language (); +@@ -480,7 +525,7 @@ setup_system (GtkBuilder *dialog) + + locale_settings_changed (locale_settings, "region", dialog); + +- xkb_settings_changed (xkb_settings, "layouts", dialog); ++ input_sources_changed (input_sources_settings, "sources", dialog); + + bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); + g_dbus_proxy_new (bus, +diff -uNrp a/panels/region/cinnamon-region-panel-system.h b/panels/region/cinnamon-region-panel-system.h +--- a/panels/region/cinnamon-region-panel-system.h 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-system.h 2013-09-21 13:24:15.342949428 +0100 +@@ -19,8 +19,8 @@ + * 02110-1335, USA. + */ + +-#ifndef __GNOME_REGION_PANEL_SYSTEM_H +-#define __GNOME_REGION_PANEL_SYSTEM_H ++#ifndef __CINNAMON_REGION_PANEL_SYSTEM_H ++#define __CINNAMON_REGION_PANEL_SYSTEM_H + + #include + +diff -uNrp a/panels/region/cinnamon-region-panel.ui b/panels/region/cinnamon-region-panel.ui +--- a/panels/region/cinnamon-region-panel.ui 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel.ui 2013-09-21 13:24:15.347949247 +0100 +@@ -162,27 +162,17 @@ + ++ + + ++ False + True +- False + Add Language +- True +- list-add-symbolic +- +- +- False +- True +- +- +- +- +- True +- False + False +- Remove Language + True +- list-remove-symbolic ++ list-add-symbolic + + + False +@@ -198,12 +188,13 @@ + + + +- True + False + + + True + False ++ True ++ Add Language + + + True +@@ -212,23 +203,24 @@ + + + +- +- button ++ ++ Install languages... + True + True + True ++ True + + +- True ++ False + True +- 13 ++ 1 + + + + + False + True +- 2 ++ 1 + + + +@@ -305,19 +297,19 @@ + + + +- True +- False + icons + False + 1 ++ True + + + ++ False ++ Add Region + True + False +- Add Region + True + list-add-symbolic + +@@ -328,10 +320,11 @@ + + + ++ False + True ++ Remove Region + False + False +- Remove Region + True + list-remove-symbolic + +@@ -373,18 +366,6 @@ + 9 + 2 + +- +- +- +- +- +- +- +- +- +- +- +- + + True + False +@@ -626,6 +607,12 @@ + 1 + + ++ ++ ++ ++ ++ ++ + + + 1 +@@ -643,36 +630,43 @@ + + + +- ++ + True + False +- 10 ++ 12 + 12 + +- ++ ++ True ++ False ++ 0 ++ Select keyboards or other input sources ++ ++ ++ False ++ False ++ 0 ++ + + +- ++ + True + False + 12 + +- ++ + True + False + +- ++ + True + True + in + +- ++ + True + True + False +- +- +- + + + +@@ -683,7 +677,7 @@ + + + +- ++ + True + False + icons +@@ -693,70 +687,166 @@ + + + +- ++ + True +- False +- Add Layout +- True +- list-add-symbolic ++ ++ ++ True ++ ++ ++ True ++ ++ ++ Add Input Source ++ ++ ++ ++ ++ ++ True ++ list-add-symbolic ++ 1 ++ ++ ++ ++ ++ ++ ++ True ++ ++ ++ Remove Input Source ++ ++ ++ ++ ++ True ++ list-remove-symbolic ++ 1 ++ ++ ++ ++ ++ ++ + +- +- False +- True +- + ++ + +- ++ + True +- False +- Remove Layout +- True +- list-remove-symbolic ++ False + + +- False +- True ++ True + + ++ + +- ++ + True +- False +- Move Up +- True +- go-up-symbolic ++ ++ ++ True ++ ++ ++ True ++ ++ ++ Move Input Source Up ++ ++ ++ ++ ++ ++ True ++ go-up-symbolic ++ 1 ++ ++ ++ ++ ++ ++ ++ True ++ ++ ++ Move Input Source Down ++ ++ ++ ++ ++ True ++ go-down-symbolic ++ 1 ++ ++ ++ ++ ++ ++ + +- +- False +- True +- + ++ + +- ++ + True +- False +- Move Down +- True +- go-down-symbolic ++ False ++ True + + +- False +- True ++ True + + ++ + +- ++ + True +- False +- Preview Layout +- True +- input-keyboard-symbolic ++ ++ ++ True ++ ++ ++ True ++ ++ ++ Input Source Settings ++ ++ ++ ++ ++ ++ True ++ preferences-system-symbolic ++ 1 ++ 16 ++ ++ ++ ++ ++ ++ ++ True ++ ++ ++ Show Keyboard Layout ++ ++ ++ ++ ++ ++ True ++ input-keyboard-symbolic ++ 1 ++ ++ ++ ++ ++ ++ + +- +- False +- True +- + ++ + + + False +@@ -772,168 +862,111 @@ + + + +- ++ + True + False +- 12 ++ 0 ++ none + +- ++ + True + False +- 6 ++ 12 + +- +- Use the same layout for all windows +- True +- True +- False +- 0 +- True +- True +- +- +- True +- True +- 0 +- +- +- +- +- Allow different layouts for individual windows +- True +- True +- False +- 0 +- True +- True +- chk_same_group +- +- +- True +- True +- 1 +- +- +- +- ++ + True + False +- 12 ++ 6 ++ 6 ++ 6 + +- ++ + True + False +- +- +- New windows use the default layout +- True +- True +- False +- 0 +- True +- True +- +- +- True +- True +- 0 +- +- +- +- +- New windows use the previous window's layout +- True +- True +- False +- 0 +- True +- True +- chk_new_windows_default_layout +- +- +- True +- True +- 1 +- +- ++ 0 ++ Switch to previous source + ++ ++ 0 ++ 0 ++ 1 ++ 1 ++ ++ ++ ++ ++ True ++ False ++ end ++ True ++ Ctrl+Alt+Space ++ ++ ++ ++ 1 ++ 0 ++ 1 ++ 1 ++ ++ ++ ++ ++ True ++ False ++ 0 ++ Switch to next source ++ ++ ++ 0 ++ 1 ++ 1 ++ 1 ++ ++ ++ ++ ++ True ++ False ++ end ++ True ++ Ctrl+Alt+Shift+Space ++ ++ ++ ++ 1 ++ 1 ++ 1 ++ 1 ++ ++ ++ ++ ++ True ++ True ++ Shortcut Settings ++ end ++ ++ ++ 1 ++ 2 ++ 1 ++ 1 ++ + + +- +- True +- True +- 2 +- + + +- +- False +- False +- 0 +- +- +- +- +- True +- False +- +- +- True +- False +- 1 +- + +- +- ++ ++ + True + False +- 6 +- end +- +- +- _Options... +- True +- True +- True +- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK +- True +- View and edit keyboard layout options +- View and edit keyboard layout options +- True +- +- +- False +- False +- 0 +- +- +- +- +- Reset to De_faults +- True +- True +- True +- True +- Replace the current keyboard layout settings with the +-default settings +- Replace the current keyboard layout settings with the +-default settings +- True +- +- +- False +- False +- end +- 1 +- True +- +- ++ Shortcuts ++ True ++ ++ ++ + +- +- False +- False +- 2 +- + + + +@@ -951,17 +984,17 @@ default settings + + + +- 2 ++ 3 + + + +- ++ + True + False +- Keyboard Layouts ++ Input Sources + + +- 2 ++ 3 + False + + +@@ -974,9 +1007,6 @@ default settings + 12 + 12 + +- +- +- + + True + False +@@ -1051,6 +1081,7 @@ default settings + 2 + 3 + 3 ++ GTK_FILL + + + +@@ -1060,6 +1091,7 @@ default settings + 0 + 0 + True ++ 18 + + + 1 +@@ -1068,6 +1100,7 @@ default settings + 2 + 3 + 3 ++ GTK_FILL + + + +@@ -1178,6 +1211,7 @@ default settings + 2 + 3 + 3 ++ GTK_FILL + + + +@@ -1187,6 +1221,7 @@ default settings + 0 + 0 + True ++ 18 + + + 1 +@@ -1195,6 +1230,7 @@ default settings + 2 + 3 + 3 ++ GTK_FILL + + + +@@ -1254,6 +1290,7 @@ default settings + + + Copy Settings... ++ False + True + True + True +@@ -1269,9 +1306,12 @@ default settings + 3 + + ++ ++ ++ + + +- 3 ++ 4 + + + +@@ -1281,7 +1321,7 @@ default settings + System + + +- 3 ++ 4 + False + + +@@ -1302,4 +1342,11 @@ default settings + + + ++ ++ vertical ++ ++ ++ ++ ++ + +diff -uNrp a/panels/region/cinnamon-region-panel-xkb.c b/panels/region/cinnamon-region-panel-xkb.c +--- a/panels/region/cinnamon-region-panel-xkb.c 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-xkb.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,190 +0,0 @@ +-/* cinnamon-region-panel-xkb.c +- * Copyright (C) 2003-2007 Sergey V. Udaltsov +- * +- * Written by: Sergey V. Udaltsov +- * +- * 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, 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 - Suite 500, Boston, MA +- * 02110-1335, USA. +- */ +- +-#ifdef HAVE_CONFIG_H +-# include +-#endif +- +-#include +-#include +-#include +- +-#include "cinnamon-region-panel-xkb.h" +- +-#include +- +-XklEngine *engine; +-XklConfigRegistry *config_registry; +- +-GkbdKeyboardConfig initial_config; +-GkbdDesktopConfig desktop_config; +- +-GSettings *xkb_keyboard_settings; +-GSettings *xkb_desktop_settings; +- +-char * +-xci_desc_to_utf8 (const XklConfigItem * ci) +-{ +- gchar *dd = g_strdup (ci->description); +- gchar *sd = g_strstrip (dd); +- gchar *rv = g_strdup (sd[0] == 0 ? ci->name : sd); +- g_free (dd); +- return rv; +-} +- +-static void +-cleanup_xkb_tabs (GtkBuilder * dialog, +- GObject *where_the_object_wa) +-{ +- gkbd_desktop_config_term (&desktop_config); +- gkbd_keyboard_config_term (&initial_config); +- g_object_unref (G_OBJECT (config_registry)); +- config_registry = NULL; +- /* Don't unref it here, or we'll crash if open the panel again */ +- engine = NULL; +- g_object_unref (G_OBJECT (xkb_keyboard_settings)); +- g_object_unref (G_OBJECT (xkb_desktop_settings)); +- xkb_keyboard_settings = NULL; +- xkb_desktop_settings = NULL; +-} +- +-static void +-reset_to_defaults (GtkWidget * button, GtkBuilder * dialog) +-{ +- GkbdKeyboardConfig empty_kbd_config; +- +- gkbd_keyboard_config_init (&empty_kbd_config, engine); +- gkbd_keyboard_config_save (&empty_kbd_config); +- gkbd_keyboard_config_term (&empty_kbd_config); +- +- g_settings_reset (xkb_desktop_settings, +- GKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP); +- +- /* all the rest is g-s-d's business */ +-} +- +-static void +-chk_new_windows_inherit_layout_toggled (GtkWidget * +- chk_new_windows_inherit_layout, +- GtkBuilder * dialog) +-{ +- xkb_save_default_group (gtk_toggle_button_get_active +- (GTK_TOGGLE_BUTTON +- (chk_new_windows_inherit_layout)) ? -1 : +- 0); +-} +- +-void +-setup_xkb_tabs (GtkBuilder * dialog) +-{ +- GtkWidget *widget; +- GtkStyleContext *context; +- GtkWidget *chk_new_windows_inherit_layout; +- +- chk_new_windows_inherit_layout = WID ("chk_new_windows_inherit_layout"); +- +- xkb_desktop_settings = g_settings_new (GKBD_DESKTOP_SCHEMA); +- xkb_keyboard_settings = g_settings_new (GKBD_KEYBOARD_SCHEMA); +- +- engine = +- xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY +- (gdk_display_get_default ())); +- config_registry = xkl_config_registry_get_instance (engine); +- +- gkbd_desktop_config_init (&desktop_config, engine); +- gkbd_desktop_config_load (&desktop_config); +- +- xkl_config_registry_load (config_registry, +- desktop_config.load_extra_items); +- +- gkbd_keyboard_config_init (&initial_config, engine); +- gkbd_keyboard_config_load_from_x_initial (&initial_config, NULL); +- +- /* Set initial state */ +- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("chk_separate_group_per_window")), +- g_settings_get_boolean (xkb_desktop_settings, +- GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW)); +- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_new_windows_inherit_layout), +- xkb_get_default_group () < 0); +- +- g_settings_bind (xkb_desktop_settings, +- GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW, +- WID ("chk_separate_group_per_window"), "active", +- G_SETTINGS_BIND_DEFAULT); +- g_settings_bind (xkb_desktop_settings, +- GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW, +- WID ("chk_new_windows_inherit_layout"), "sensitive", +- G_SETTINGS_BIND_DEFAULT); +- g_settings_bind (xkb_desktop_settings, +- GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW, +- WID ("chk_new_windows_default_layout"), "sensitive", +- G_SETTINGS_BIND_DEFAULT); +- +- xkb_layouts_prepare_selected_tree (dialog); +- xkb_layouts_fill_selected_tree (dialog); +- +- xkb_layouts_register_buttons_handlers (dialog); +- g_signal_connect (G_OBJECT (WID ("xkb_reset_to_defaults")), +- "clicked", G_CALLBACK (reset_to_defaults), +- dialog); +- +- g_signal_connect (G_OBJECT (chk_new_windows_inherit_layout), +- "toggled", +- G_CALLBACK +- (chk_new_windows_inherit_layout_toggled), +- dialog); +- +- g_signal_connect_swapped (G_OBJECT (WID ("xkb_layout_options")), +- "clicked", +- G_CALLBACK (xkb_options_popup_dialog), +- dialog); +- +- xkb_layouts_register_conf_listener (dialog); +- xkb_options_register_conf_listener (dialog); +- +- g_object_weak_ref (G_OBJECT (WID ("region_notebook")), +- (GWeakNotify) cleanup_xkb_tabs, dialog); +- +- enable_disable_restoring (dialog); +- +- /* Setup junction between toolbar and treeview */ +- widget = WID ("xkb_layouts_swindow"); +- context = gtk_widget_get_style_context (widget); +- gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM); +- widget = WID ("layouts-toolbar"); +- context = gtk_widget_get_style_context (widget); +- gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP); +-} +- +-void +-enable_disable_restoring (GtkBuilder * dialog) +-{ +- GkbdKeyboardConfig gswic; +- gboolean enable; +- +- gkbd_keyboard_config_init (&gswic, engine); +- gkbd_keyboard_config_load (&gswic, NULL); +- +- enable = !gkbd_keyboard_config_equals (&gswic, &initial_config); +- +- gkbd_keyboard_config_term (&gswic); +- gtk_widget_set_sensitive (WID ("xkb_reset_to_defaults"), enable); +-} +diff -uNrp a/panels/region/cinnamon-region-panel-xkb.h b/panels/region/cinnamon-region-panel-xkb.h +--- a/panels/region/cinnamon-region-panel-xkb.h 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-xkb.h 1970-01-01 01:00:00.000000000 +0100 +@@ -1,96 +0,0 @@ +-/* cinnamon-region-panel-xkb.h +- * Copyright (C) 2003-2007 Sergey V Udaltsov +- * +- * Written by Sergey V. Udaltsov +- * +- * 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, 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 - Suite 500, Boston, MA +- * 02110-1335, USA. +- */ +- +-#ifndef __GNOME_KEYBOARD_PROPERTY_XKB_H +-#define __GNOME_KEYBOARD_PROPERTY_XKB_H +- +-#include +- +-#include "libgnomekbd/gkbd-keyboard-config.h" +-#include "libgnomekbd/gkbd-util.h" +- +-G_BEGIN_DECLS +-#define CWID(s) GTK_WIDGET (gtk_builder_get_object (chooser_dialog, s)) +-#define WID(s) GTK_WIDGET (gtk_builder_get_object (dialog, s)) +-extern XklEngine *engine; +-extern XklConfigRegistry *config_registry; +-extern GSettings *xkb_keyboard_settings; +-extern GSettings *xkb_desktop_settings; +-extern GkbdKeyboardConfig initial_config; +- +-extern void setup_xkb_tabs (GtkBuilder * dialog); +- +-extern void xkb_layouts_fill_selected_tree (GtkBuilder * dialog); +- +-extern void xkb_layouts_register_buttons_handlers (GtkBuilder * dialog); +- +-extern void xkb_layouts_register_conf_listener (GtkBuilder * dialog); +- +-extern void xkb_options_register_conf_listener (GtkBuilder * dialog); +- +-extern void xkb_layouts_prepare_selected_tree (GtkBuilder * dialog); +- +-extern void xkb_options_load_options (GtkBuilder * dialog); +- +-extern void xkb_options_popup_dialog (GtkBuilder * dialog); +- +-extern char *xci_desc_to_utf8 (const XklConfigItem * ci); +- +-extern gchar *xkb_layout_description_utf8 (const gchar * visible); +- +-extern void enable_disable_restoring (GtkBuilder * dialog); +- +-extern void preview_toggled (GtkBuilder * dialog, GtkWidget * button); +- +-extern GtkWidget *xkb_layout_choose (GtkBuilder * dialog); +- +-extern void xkb_layout_chooser_response (GtkDialog *dialog, gint response_id); +- +-extern gchar **xkb_layouts_get_selected_list (void); +- +-extern gchar **xkb_options_get_selected_list (void); +- +-#define xkb_layouts_set_selected_list(list) \ +- g_settings_set_strv (xkb_keyboard_settings, \ +- GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS, \ +- (const gchar *const*)(list)) +- +-#define xkb_options_set_selected_list(list) \ +- g_settings_set_strv (xkb_keyboard_settings, \ +- GKBD_KEYBOARD_CONFIG_KEY_OPTIONS, \ +- (const gchar *const*)(list)) +- +-extern GtkWidget *xkb_layout_preview_create_widget (GtkBuilder * +- chooser_dialog); +- +-extern void xkb_layout_preview_update (GtkBuilder * chooser_dialog); +- +-extern void xkb_layout_preview_set_drawing_layout (GtkWidget * kbdraw, +- const gchar * id); +- +-extern gchar *xkb_layout_chooser_get_selected_id (GtkDialog *dialog); +- +-extern void xkb_save_default_group (gint group_no); +- +-extern gint xkb_get_default_group (void); +- +-G_END_DECLS +-#endif /* __GNOME_KEYBOARD_PROPERTY_XKB_H */ +diff -uNrp a/panels/region/cinnamon-region-panel-xkbltadd.c b/panels/region/cinnamon-region-panel-xkbltadd.c +--- a/panels/region/cinnamon-region-panel-xkbltadd.c 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-xkbltadd.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,495 +0,0 @@ +-/* cinnamon-region-panel-xkbltadd.c +- * Copyright (C) 2007 Sergey V. Udaltsov +- * +- * Written by: Sergey V. Udaltsov +- * +- * 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, 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 - Suite 500, Boston, MA +- * 02110-1335, USA. +- */ +- +-#ifdef HAVE_CONFIG_H +-# include +-#endif +- +-#include +- +-#include +-#include +- +-#include "cinnamon-region-panel-xkb.h" +- +-enum { +- COMBO_BOX_MODEL_COL_SORT, +- COMBO_BOX_MODEL_COL_VISIBLE, +- COMBO_BOX_MODEL_COL_XKB_ID, +- COMBO_BOX_MODEL_COL_COUNTRY_DESC, +- COMBO_BOX_MODEL_COL_LANGUAGE_DESC +-}; +- +-static gchar **search_pattern_list = NULL; +- +-static GtkWidget *preview_dialog = NULL; +- +-static GRegex *left_bracket_regex = NULL; +- +-#define RESPONSE_PREVIEW 1 +- +-static void +-xkb_preview_destroy_callback (GtkWidget * widget) +-{ +- preview_dialog = NULL; +-} +- +-static gboolean +-xkb_layout_chooser_selection_dupe (GtkDialog * dialog) +-{ +- gchar *selected_id = +- (gchar *) xkb_layout_chooser_get_selected_id (dialog); +- gchar **layouts_list, **pl; +- gboolean rv = FALSE; +- if (selected_id == NULL) +- return rv; +- layouts_list = pl = xkb_layouts_get_selected_list (); +- while (pl && *pl) { +- if (!g_ascii_strcasecmp (*pl++, selected_id)) { +- rv = TRUE; +- break; +- } +- } +- g_strfreev (layouts_list); +- return rv; +-} +- +-void +-xkb_layout_chooser_response (GtkDialog * dialog, gint response) +-{ +- switch (response) +- case GTK_RESPONSE_OK:{ +- /* Handled by the main code */ +- break; +- case RESPONSE_PREVIEW:{ +- gchar *selected_id = (gchar *) +- xkb_layout_chooser_get_selected_id +- (dialog); +- +- if (selected_id != NULL) { +- if (preview_dialog == NULL) { +- preview_dialog = +- gkbd_keyboard_drawing_dialog_new +- (); +- g_signal_connect (G_OBJECT +- (preview_dialog), +- "destroy", +- G_CALLBACK +- (xkb_preview_destroy_callback), +- NULL); +- /* Put into the separate group to avoid conflict +- with modal parent */ +- gtk_window_group_add_window +- (gtk_window_group_new +- (), +- GTK_WINDOW +- (preview_dialog)); +- }; +- gkbd_keyboard_drawing_dialog_set_layout +- (preview_dialog, +- config_registry, selected_id); +- +- gtk_widget_show_all +- (preview_dialog); +- } +- } +- +- return; +- } +- if (preview_dialog != NULL) { +- gtk_widget_destroy (preview_dialog); +- } +- if (search_pattern_list != NULL) { +- g_strfreev (search_pattern_list); +- search_pattern_list = NULL; +- } +- gtk_widget_destroy (GTK_WIDGET (dialog)); +-} +- +-static gchar * +-xkl_create_description_from_list (const XklConfigItem * item, +- const XklConfigItem * subitem, +- const gchar * prop_name, +- const gchar * +- (*desc_getter) (const gchar * code)) +-{ +- gchar *rv = NULL, *code = NULL; +- gchar **list = NULL; +- const gchar *desc; +- +- if (subitem != NULL) +- list = +- (gchar +- **) (g_object_get_data (G_OBJECT (subitem), +- prop_name)); +- if (list == NULL || *list == 0) +- list = +- (gchar +- **) (g_object_get_data (G_OBJECT (item), prop_name)); +- +- /* First try the parent id as such */ +- desc = desc_getter (item->name); +- if (desc != NULL) { +- rv = g_utf8_strup (desc, -1); +- } else { +- code = g_utf8_strup (item->name, -1); +- desc = desc_getter (code); +- if (desc != NULL) { +- rv = g_utf8_strup (desc, -1); +- } +- g_free (code); +- } +- +- if (list == NULL || *list == 0) +- return rv; +- +- while (*list != 0) { +- code = *list++; +- desc = desc_getter (code); +- if (desc != NULL) { +- gchar *udesc = g_utf8_strup (desc, -1); +- if (rv == NULL) { +- rv = udesc; +- } else { +- gchar *orv = rv; +- rv = g_strdup_printf ("%s %s", rv, udesc); +- g_free (orv); +- g_free (udesc); +- } +- } +- } +- return rv; +-} +- +-static void +-xkl_layout_add_to_list (XklConfigRegistry * config, +- const XklConfigItem * item, +- const XklConfigItem * subitem, +- GtkBuilder * chooser_dialog) +-{ +- GtkListStore *list_store = +- GTK_LIST_STORE (gtk_builder_get_object (chooser_dialog, +- "layout_list_model")); +- GtkTreeIter iter; +- +- gchar *utf_variant_name = +- subitem ? +- xkb_layout_description_utf8 (gkbd_keyboard_config_merge_items +- (item->name, +- subitem->name)) : +- xci_desc_to_utf8 (item); +- +- const gchar *xkb_id = +- subitem ? gkbd_keyboard_config_merge_items (item->name, +- subitem->name) : +- item->name; +- +- gchar *country_desc = +- xkl_create_description_from_list (item, subitem, +- XCI_PROP_COUNTRY_LIST, +- xkl_get_country_name); +- gchar *language_desc = +- xkl_create_description_from_list (item, subitem, +- XCI_PROP_LANGUAGE_LIST, +- xkl_get_language_name); +- +- gchar *tmp = utf_variant_name; +- utf_variant_name = +- g_regex_replace_literal (left_bracket_regex, tmp, -1, 0, +- "<", 0, NULL); +- g_free (tmp); +- +- if (subitem +- && g_object_get_data (G_OBJECT (subitem), +- XCI_PROP_EXTRA_ITEM)) { +- gchar *buf = +- g_strdup_printf ("%s", utf_variant_name); +- gtk_list_store_insert_with_values (list_store, &iter, -1, +- COMBO_BOX_MODEL_COL_SORT, +- utf_variant_name, +- COMBO_BOX_MODEL_COL_VISIBLE, +- buf, +- COMBO_BOX_MODEL_COL_XKB_ID, +- xkb_id, +- COMBO_BOX_MODEL_COL_COUNTRY_DESC, +- country_desc, +- COMBO_BOX_MODEL_COL_LANGUAGE_DESC, +- language_desc, -1); +- g_free (buf); +- } else +- gtk_list_store_insert_with_values (list_store, &iter, +- -1, +- COMBO_BOX_MODEL_COL_SORT, +- utf_variant_name, +- COMBO_BOX_MODEL_COL_VISIBLE, +- utf_variant_name, +- COMBO_BOX_MODEL_COL_XKB_ID, +- xkb_id, +- COMBO_BOX_MODEL_COL_COUNTRY_DESC, +- country_desc, +- COMBO_BOX_MODEL_COL_LANGUAGE_DESC, +- language_desc, -1); +- g_free (utf_variant_name); +- g_free (country_desc); +- g_free (language_desc); +-} +- +-static void +-xkb_layout_filter_clear (GtkEntry * entry, +- GtkEntryIconPosition icon_pos, +- GdkEvent * event, gpointer user_data) +-{ +- gtk_entry_set_text (entry, ""); +-} +- +-static void +-xkb_layout_filter_changed (GtkBuilder * chooser_dialog) +-{ +- GtkTreeModelFilter *filtered_model = +- GTK_TREE_MODEL_FILTER (gtk_builder_get_object (chooser_dialog, +- "filtered_layout_list_model")); +- GtkWidget *xkb_layout_filter = CWID ("xkb_layout_filter"); +- const gchar *pattern = +- gtk_entry_get_text (GTK_ENTRY (xkb_layout_filter)); +- gchar *upattern = g_utf8_strup (pattern, -1); +- +- if (!g_strcmp0 (pattern, "")) { +- g_object_set (G_OBJECT (xkb_layout_filter), +- "secondary-icon-name", "edit-find-symbolic", +- "secondary-icon-activatable", FALSE, +- "secondary-icon-sensitive", FALSE, NULL); +- } else { +- g_object_set (G_OBJECT (xkb_layout_filter), +- "secondary-icon-name", "edit-clear-symbolic", +- "secondary-icon-activatable", TRUE, +- "secondary-icon-sensitive", TRUE, NULL); +- } +- +- if (search_pattern_list != NULL) +- g_strfreev (search_pattern_list); +- +- search_pattern_list = g_strsplit (upattern, " ", -1); +- g_free (upattern); +- +- gtk_tree_model_filter_refilter (filtered_model); +-} +- +-static void +-xkb_layout_chooser_selection_changed (GtkTreeSelection * selection, +- GtkBuilder * chooser_dialog) +-{ +- GList *selected_layouts = +- gtk_tree_selection_get_selected_rows (selection, NULL); +- GtkWidget *add_button = CWID ("btnOk"); +- GtkWidget *preview_button = CWID ("btnPreview"); +- gboolean anything_selected = g_list_length (selected_layouts) == 1; +- gboolean dupe = +- xkb_layout_chooser_selection_dupe (GTK_DIALOG +- (CWID +- ("xkb_layout_chooser"))); +- +- gtk_widget_set_sensitive (add_button, anything_selected && !dupe); +- gtk_widget_set_sensitive (preview_button, anything_selected); +-} +- +-static void +-xkb_layout_chooser_row_activated (GtkTreeView * tree_view, +- GtkTreePath * path, +- GtkTreeViewColumn * column, +- GtkBuilder * chooser_dialog) +-{ +- GtkWidget *add_button = CWID ("btnOk"); +- GtkWidget *dialog = CWID ("xkb_layout_chooser"); +- +- if (gtk_widget_is_sensitive (add_button)) +- gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); +-} +- +-static gboolean +-xkb_filter_layouts (GtkTreeModel * model, +- GtkTreeIter * iter, gpointer data) +-{ +- gchar *desc = NULL, *country_desc = NULL, *language_desc = +- NULL, **pattern; +- gboolean rv = TRUE; +- +- if (search_pattern_list == NULL || search_pattern_list[0] == NULL) +- return TRUE; +- +- gtk_tree_model_get (model, iter, +- COMBO_BOX_MODEL_COL_SORT, &desc, +- COMBO_BOX_MODEL_COL_COUNTRY_DESC, +- &country_desc, +- COMBO_BOX_MODEL_COL_LANGUAGE_DESC, +- &language_desc, -1); +- +- pattern = search_pattern_list; +- do { +- gboolean is_pattern_found = FALSE; +- gchar *udesc = g_utf8_strup (desc, -1); +- if (udesc != NULL && g_strstr_len (udesc, -1, *pattern)) { +- is_pattern_found = TRUE; +- } else if (country_desc != NULL +- && g_strstr_len (country_desc, -1, *pattern)) { +- is_pattern_found = TRUE; +- } else if (language_desc != NULL +- && g_strstr_len (language_desc, -1, *pattern)) { +- is_pattern_found = TRUE; +- } +- g_free (udesc); +- +- if (!is_pattern_found) { +- rv = FALSE; +- break; +- } +- +- } while (*++pattern != NULL); +- +- g_free (desc); +- g_free (country_desc); +- g_free (language_desc); +- return rv; +-} +- +-GtkWidget * +-xkb_layout_choose (GtkBuilder * dialog) +-{ +- GtkBuilder *chooser_dialog = gtk_builder_new (); +- GtkWidget *chooser, *xkb_filtered_layouts_list, *xkb_layout_filter; +- GtkTreeViewColumn *visible_column; +- GtkTreeSelection *selection; +- GtkListStore *model; +- GtkTreeModelFilter *filtered_model; +- gtk_builder_set_translation_domain (chooser_dialog, GETTEXT_PACKAGE); +- gtk_builder_add_from_file (chooser_dialog, CINNAMONCC_UI_DIR +- "/cinnamon-region-panel-layout-chooser.ui", +- NULL); +- chooser = CWID ("xkb_layout_chooser"); +- xkb_filtered_layouts_list = CWID ("xkb_filtered_layouts_list"); +- xkb_layout_filter = CWID ("xkb_layout_filter"); +- +- g_object_set_data (G_OBJECT (chooser), "xkb_filtered_layouts_list", +- xkb_filtered_layouts_list); +- visible_column = +- gtk_tree_view_column_new_with_attributes ("Layout", +- gtk_cell_renderer_text_new +- (), "markup", +- COMBO_BOX_MODEL_COL_VISIBLE, +- NULL); +- +- gtk_window_set_transient_for (GTK_WINDOW (chooser), +- GTK_WINDOW +- (gtk_widget_get_toplevel +- (WID ("region_notebook")))); +- +- gtk_tree_view_append_column (GTK_TREE_VIEW +- (xkb_filtered_layouts_list), +- visible_column); +- g_signal_connect_swapped (G_OBJECT (xkb_layout_filter), +- "notify::text", +- G_CALLBACK +- (xkb_layout_filter_changed), +- chooser_dialog); +- +- g_signal_connect (G_OBJECT (xkb_layout_filter), "icon-release", +- G_CALLBACK (xkb_layout_filter_clear), NULL); +- +- selection = +- gtk_tree_view_get_selection (GTK_TREE_VIEW +- (xkb_filtered_layouts_list)); +- +- g_signal_connect (G_OBJECT (selection), +- "changed", +- G_CALLBACK +- (xkb_layout_chooser_selection_changed), +- chooser_dialog); +- +- xkb_layout_chooser_selection_changed (selection, chooser_dialog); +- +- g_signal_connect (G_OBJECT (xkb_filtered_layouts_list), +- "row-activated", +- G_CALLBACK (xkb_layout_chooser_row_activated), +- chooser_dialog); +- +- filtered_model = +- GTK_TREE_MODEL_FILTER (gtk_builder_get_object +- (chooser_dialog, +- "filtered_layout_list_model")); +- model = +- GTK_LIST_STORE (gtk_builder_get_object +- (chooser_dialog, "layout_list_model")); +- +- left_bracket_regex = g_regex_new ("<", 0, 0, NULL); +- +- xkl_config_registry_search_by_pattern (config_registry, +- NULL, +- (TwoConfigItemsProcessFunc) +- (xkl_layout_add_to_list), +- chooser_dialog); +- +- g_regex_unref (left_bracket_regex); +- +- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), +- COMBO_BOX_MODEL_COL_SORT, +- GTK_SORT_ASCENDING); +- +- gtk_tree_model_filter_set_visible_func (filtered_model, +- xkb_filter_layouts, +- NULL, NULL); +- +- gtk_widget_grab_focus (xkb_layout_filter); +- +- gtk_widget_show (chooser); +- +- return chooser; +-} +- +-gchar * +-xkb_layout_chooser_get_selected_id (GtkDialog * dialog) +-{ +- GtkTreeModel *filtered_list_model; +- GtkWidget *xkb_filtered_layouts_list = +- g_object_get_data (G_OBJECT (dialog), +- "xkb_filtered_layouts_list"); +- GtkTreeIter viter; +- gchar *v_id; +- GtkTreeSelection *selection = +- gtk_tree_view_get_selection (GTK_TREE_VIEW +- (xkb_filtered_layouts_list)); +- GList *selected_layouts = +- gtk_tree_selection_get_selected_rows (selection, +- &filtered_list_model); +- +- if (g_list_length (selected_layouts) != 1) +- return NULL; +- +- gtk_tree_model_get_iter (filtered_list_model, +- &viter, +- (GtkTreePath *) (selected_layouts->data)); +- g_list_foreach (selected_layouts, +- (GFunc) gtk_tree_path_free, NULL); +- g_list_free (selected_layouts); +- +- gtk_tree_model_get (filtered_list_model, &viter, +- COMBO_BOX_MODEL_COL_XKB_ID, &v_id, -1); +- +- return v_id; +-} +diff -uNrp a/panels/region/cinnamon-region-panel-xkblt.c b/panels/region/cinnamon-region-panel-xkblt.c +--- a/panels/region/cinnamon-region-panel-xkblt.c 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-xkblt.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,470 +0,0 @@ +-/* cinnamon-region-panel-xkblt.c +- * Copyright (C) 2003-2007 Sergey V. Udaltsov +- * +- * Written by: Sergey V. Udaltsov +- * +- * 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, 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 - Suite 500, Boston, MA +- * 02110-1335, USA. +- */ +- +-#ifdef HAVE_CONFIG_H +-# include +-#endif +- +-#include +-#include +- +-#include +-#include +- +-#include "cinnamon-region-panel-xkb.h" +- +-enum { +- SEL_LAYOUT_TREE_COL_DESCRIPTION, +- SEL_LAYOUT_TREE_COL_ID, +- SEL_LAYOUT_TREE_COL_ENABLED, +- SEL_LAYOUT_N_COLS +-}; +- +-static int idx2select = -1; +-static int max_selected_layouts = -1; +- +-static GtkCellRenderer *text_renderer; +- +-static gboolean disable_buttons_sensibility_update = FALSE; +- +-static gboolean +-get_selected_iter (GtkBuilder *dialog, +- GtkTreeModel **model, +- GtkTreeIter *iter) +-{ +- GtkTreeSelection *selection; +- +- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (WID ("xkb_layouts_selected"))); +- +- return gtk_tree_selection_get_selected (selection, model, iter); +-} +- +-static void +-set_selected_path (GtkBuilder *dialog, +- GtkTreePath *path) +-{ +- GtkTreeSelection *selection; +- +- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (WID ("xkb_layouts_selected"))); +- +- gtk_tree_selection_select_path (selection, path); +-} +- +-static gint +-find_selected_layout_idx (GtkBuilder *dialog) +-{ +- GtkTreeIter selected_iter; +- GtkTreeModel *model; +- GtkTreePath *path; +- gint *indices; +- gint rv; +- +- if (!get_selected_iter (dialog, &model, &selected_iter)) +- return -1; +- +- path = gtk_tree_model_get_path (model, &selected_iter); +- if (path == NULL) +- return -1; +- +- indices = gtk_tree_path_get_indices (path); +- rv = indices[0]; +- gtk_tree_path_free (path); +- return rv; +-} +- +-gchar ** +-xkb_layouts_get_selected_list (void) +-{ +- gchar **retval; +- +- retval = g_settings_get_strv (xkb_keyboard_settings, +- GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS); +- if (retval == NULL || retval[0] == NULL) { +- g_strfreev (retval); +- retval = g_strdupv (initial_config.layouts_variants); +- } +- +- return retval; +-} +- +-gint +-xkb_get_default_group () +-{ +- return g_settings_get_int (xkb_desktop_settings, +- GKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP); +-} +- +-void +-xkb_save_default_group (gint default_group) +-{ +- g_settings_set_int (xkb_desktop_settings, +- GKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP, +- default_group); +-} +- +-static void +-xkb_layouts_enable_disable_buttons (GtkBuilder * dialog) +-{ +- GtkWidget *add_layout_btn = WID ("xkb_layouts_add"); +- GtkWidget *show_layout_btn = WID ("xkb_layouts_show"); +- GtkWidget *del_layout_btn = WID ("xkb_layouts_remove"); +- GtkWidget *selected_layouts_tree = WID ("xkb_layouts_selected"); +- GtkWidget *move_up_layout_btn = WID ("xkb_layouts_move_up"); +- GtkWidget *move_down_layout_btn = WID ("xkb_layouts_move_down"); +- +- GtkTreeSelection *s_selection = +- gtk_tree_view_get_selection (GTK_TREE_VIEW +- (selected_layouts_tree)); +- const int n_selected_selected_layouts = +- gtk_tree_selection_count_selected_rows (s_selection); +- GtkTreeModel *selected_layouts_model = gtk_tree_view_get_model +- (GTK_TREE_VIEW (selected_layouts_tree)); +- const int n_selected_layouts = +- gtk_tree_model_iter_n_children (selected_layouts_model, +- NULL); +- gint sidx = find_selected_layout_idx (dialog); +- +- if (disable_buttons_sensibility_update) +- return; +- +- gtk_widget_set_sensitive (add_layout_btn, +- (n_selected_layouts < +- max_selected_layouts +- || max_selected_layouts == 0)); +- gtk_widget_set_sensitive (del_layout_btn, (n_selected_layouts > 1) +- && (n_selected_selected_layouts > 0)); +- gtk_widget_set_sensitive (show_layout_btn, +- (n_selected_selected_layouts > 0)); +- gtk_widget_set_sensitive (move_up_layout_btn, sidx > 0); +- gtk_widget_set_sensitive (move_down_layout_btn, sidx >= 0 +- && sidx < (n_selected_layouts - 1)); +-} +- +-static void +-update_layouts_list (GtkTreeModel *model, +- GtkBuilder *dialog) +-{ +- gboolean cont; +- GtkTreeIter iter; +- GPtrArray *array; +- +- array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_free); +- cont = gtk_tree_model_get_iter_first (model, &iter); +- while (cont) { +- char *id; +- +- gtk_tree_model_get (model, &iter, +- SEL_LAYOUT_TREE_COL_ID, &id, +- -1); +- g_ptr_array_add (array, id); +- cont = gtk_tree_model_iter_next (model, &iter); +- } +- g_ptr_array_add (array, NULL); +- xkb_layouts_set_selected_list (array->pdata); +- g_ptr_array_free (array, TRUE); +- +- xkb_layouts_enable_disable_buttons (dialog); +-} +- +-static void +-xkb_layouts_drag_end (GtkWidget *widget, +- GdkDragContext *drag_context, +- gpointer user_data) +-{ +- update_layouts_list (gtk_tree_view_get_model (GTK_TREE_VIEW (widget)), +- GTK_BUILDER (user_data)); +-} +- +-void +-xkb_layouts_prepare_selected_tree (GtkBuilder * dialog) +-{ +- GtkListStore *list_store; +- GtkWidget *tree_view = WID ("xkb_layouts_selected"); +- GtkTreeSelection *selection; +- GtkTreeViewColumn *desc_column; +- +- list_store = gtk_list_store_new (SEL_LAYOUT_N_COLS, +- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN); +- +- text_renderer = GTK_CELL_RENDERER (gtk_cell_renderer_text_new ()); +- +- desc_column = +- gtk_tree_view_column_new_with_attributes (_("Layout"), +- text_renderer, +- "text", +- SEL_LAYOUT_TREE_COL_DESCRIPTION, +- "sensitive", +- SEL_LAYOUT_TREE_COL_ENABLED, +- NULL); +- selection = +- gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); +- +- gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), +- GTK_TREE_MODEL (list_store)); +- +- gtk_tree_view_column_set_sizing (desc_column, +- GTK_TREE_VIEW_COLUMN_AUTOSIZE); +- gtk_tree_view_column_set_resizable (desc_column, TRUE); +- gtk_tree_view_column_set_expand (desc_column, TRUE); +- +- gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), +- desc_column); +- +- g_signal_connect_swapped (G_OBJECT (selection), "changed", +- G_CALLBACK +- (xkb_layouts_enable_disable_buttons), +- dialog); +- max_selected_layouts = xkl_engine_get_max_num_groups (engine); +- +- /* Setting up DnD */ +- gtk_tree_view_set_reorderable (GTK_TREE_VIEW (tree_view), TRUE); +- g_signal_connect (G_OBJECT (tree_view), "drag-end", +- G_CALLBACK (xkb_layouts_drag_end), dialog); +-} +- +-gchar * +-xkb_layout_description_utf8 (const gchar * visible) +-{ +- char *l, *sl, *v, *sv; +- if (gkbd_keyboard_config_get_descriptions +- (config_registry, visible, &sl, &l, &sv, &v)) +- visible = +- gkbd_keyboard_config_format_full_description (l, v); +- return g_strstrip (g_strdup (visible)); +-} +- +-void +-xkb_layouts_fill_selected_tree (GtkBuilder * dialog) +-{ +- gchar **layouts = xkb_layouts_get_selected_list (); +- guint i; +- GtkListStore *list_store = +- GTK_LIST_STORE (gtk_tree_view_get_model +- (GTK_TREE_VIEW +- (WID ("xkb_layouts_selected")))); +- +- /* temporarily disable the buttons' status update */ +- disable_buttons_sensibility_update = TRUE; +- +- gtk_list_store_clear (list_store); +- +- for (i = 0; layouts != NULL && layouts[i] != NULL; i++) { +- char *cur_layout = layouts[i]; +- gchar *utf_visible = +- xkb_layout_description_utf8 (cur_layout); +- +- gtk_list_store_insert_with_values (list_store, NULL, G_MAXINT, +- SEL_LAYOUT_TREE_COL_DESCRIPTION, +- utf_visible, +- SEL_LAYOUT_TREE_COL_ID, +- cur_layout, +- SEL_LAYOUT_TREE_COL_ENABLED, +- i < max_selected_layouts, -1); +- g_free (utf_visible); +- } +- +- g_strfreev (layouts); +- +- /* enable the buttons' status update */ +- disable_buttons_sensibility_update = FALSE; +- +- if (idx2select != -1) { +- GtkTreeSelection *selection = +- gtk_tree_view_get_selection ((GTK_TREE_VIEW +- (WID +- ("xkb_layouts_selected")))); +- GtkTreePath *path = +- gtk_tree_path_new_from_indices (idx2select, -1); +- gtk_tree_selection_select_path (selection, path); +- gtk_tree_path_free (path); +- idx2select = -1; +- } else { +- /* if there is nothing to select - just enable/disable the buttons, +- otherwise it would be done by the selection change */ +- xkb_layouts_enable_disable_buttons (dialog); +- } +-} +- +-static void +-add_default_switcher_if_necessary () +-{ +- gchar **layouts_list = xkb_layouts_get_selected_list(); +- gchar **options_list = xkb_options_get_selected_list (); +- gboolean was_appended; +- +- options_list = +- gkbd_keyboard_config_add_default_switch_option_if_necessary +- (layouts_list, options_list, &was_appended); +- if (was_appended) +- xkb_options_set_selected_list (options_list); +- g_strfreev (options_list); +-} +- +-static void +-chooser_response (GtkDialog *chooser, +- int response_id, +- GtkBuilder *dialog) +-{ +- if (response_id == GTK_RESPONSE_OK) { +- char *id, *name; +- GtkListStore *list_store; +- +- list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (WID ("xkb_layouts_selected")))); +- id = xkb_layout_chooser_get_selected_id (chooser); +- name = xkb_layout_description_utf8 (id); +- gtk_list_store_insert_with_values (list_store, NULL, G_MAXINT, +- SEL_LAYOUT_TREE_COL_DESCRIPTION, name, +- SEL_LAYOUT_TREE_COL_ID, id, +- SEL_LAYOUT_TREE_COL_ENABLED, TRUE, +- -1); +- g_free (name); +- add_default_switcher_if_necessary (); +- update_layouts_list (GTK_TREE_MODEL (list_store), dialog); +- } +- +- xkb_layout_chooser_response (chooser, response_id); +-} +- +-static void +-add_selected_layout (GtkWidget * button, GtkBuilder * dialog) +-{ +- GtkWidget *chooser; +- +- chooser = xkb_layout_choose (dialog); +- g_signal_connect (G_OBJECT (chooser), "response", +- G_CALLBACK (chooser_response), dialog); +-} +- +-static void +-show_selected_layout (GtkWidget * button, GtkBuilder * dialog) +-{ +- gint idx = find_selected_layout_idx (dialog); +- +- if (idx != -1) { +- GtkWidget *parent = WID ("region_notebook"); +- GtkWidget *popup = gkbd_keyboard_drawing_dialog_new (); +- gkbd_keyboard_drawing_dialog_set_group (popup, +- config_registry, +- idx); +- gtk_window_set_transient_for (GTK_WINDOW (popup), +- GTK_WINDOW +- (gtk_widget_get_toplevel +- (parent))); +- gtk_widget_show_all (popup); +- } +-} +- +-static void +-remove_selected_layout (GtkWidget * button, GtkBuilder * dialog) +-{ +- GtkTreeModel *model; +- GtkTreeIter iter; +- +- if (get_selected_iter (dialog, &model, &iter) == FALSE) +- return; +- +- gtk_list_store_remove (GTK_LIST_STORE (model), &iter); +- update_layouts_list (model, dialog); +-} +- +-static void +-move_up_selected_layout (GtkWidget * button, GtkBuilder * dialog) +-{ +- GtkTreeModel *model; +- GtkTreeIter iter, prev; +- GtkTreePath *path; +- +- if (get_selected_iter (dialog, &model, &iter) == FALSE) +- return; +- +- prev = iter; +- if (!gtk_tree_model_iter_previous (model, &prev)) +- return; +- +- path = gtk_tree_model_get_path (model, &prev); +- +- gtk_list_store_swap (GTK_LIST_STORE (model), &iter, &prev); +- +- update_layouts_list (model, dialog); +- +- set_selected_path (dialog, path); +- +- gtk_tree_path_free (path); +-} +- +-static void +-move_down_selected_layout (GtkWidget * button, GtkBuilder * dialog) +-{ +- GtkTreeModel *model; +- GtkTreeIter iter, next; +- GtkTreePath *path; +- +- if (get_selected_iter (dialog, &model, &iter) == FALSE) +- return; +- +- next = iter; +- if (!gtk_tree_model_iter_next (model, &next)) +- return; +- +- path = gtk_tree_model_get_path (model, &next); +- +- gtk_list_store_swap (GTK_LIST_STORE (model), &iter, &next); +- +- update_layouts_list (model, dialog); +- +- set_selected_path (dialog, path); +- +- gtk_tree_path_free (path); +-} +- +-void +-xkb_layouts_register_buttons_handlers (GtkBuilder * dialog) +-{ +- g_signal_connect (G_OBJECT (WID ("xkb_layouts_add")), "clicked", +- G_CALLBACK (add_selected_layout), dialog); +- g_signal_connect (G_OBJECT (WID ("xkb_layouts_show")), "clicked", +- G_CALLBACK (show_selected_layout), dialog); +- g_signal_connect (G_OBJECT (WID ("xkb_layouts_remove")), "clicked", +- G_CALLBACK (remove_selected_layout), dialog); +- g_signal_connect (G_OBJECT (WID ("xkb_layouts_move_up")), +- "clicked", G_CALLBACK (move_up_selected_layout), +- dialog); +- g_signal_connect (G_OBJECT (WID ("xkb_layouts_move_down")), +- "clicked", +- G_CALLBACK (move_down_selected_layout), dialog); +-} +- +-static void +-xkb_layouts_update_list (GSettings * settings, +- gchar * key, GtkBuilder * dialog) +-{ +- if (strcmp (key, GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS) == 0) { +- xkb_layouts_fill_selected_tree (dialog); +- enable_disable_restoring (dialog); +- } +-} +- +-void +-xkb_layouts_register_conf_listener (GtkBuilder * dialog) +-{ +- g_signal_connect (xkb_keyboard_settings, "changed", +- G_CALLBACK (xkb_layouts_update_list), dialog); +-} +diff -uNrp a/panels/region/cinnamon-region-panel-xkbot.c b/panels/region/cinnamon-region-panel-xkbot.c +--- a/panels/region/cinnamon-region-panel-xkbot.c 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-xkbot.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,516 +0,0 @@ +-/* cinnamon-region-panel-xkbot.c +- * Copyright (C) 2003-2007 Sergey V. Udaltsov +- * +- * Written by: Sergey V. Udaltsov +- * John Spray +- * +- * 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, 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 - Suite 500, Boston, MA +- * 02110-1335, USA. +- */ +- +-#ifdef HAVE_CONFIG_H +-# include +-#endif +- +-#include +-#include +- +-#include "cinnamon-region-panel-xkb.h" +- +-static GtkBuilder *chooser_dialog = NULL; +-static const char *current1st_level_id = NULL; +-static GSList *option_checks_list = NULL; +-static GtkWidget *current_none_radio = NULL; +-static GtkWidget *current_expander = NULL; +-static gboolean current_multi_select = FALSE; +-static GSList *current_radio_group = NULL; +- +-#define OPTION_ID_PROP "optionID" +-#define SELCOUNTER_PROP "selectionCounter" +-#define GCONFSTATE_PROP "gconfState" +-#define EXPANDERS_PROP "expandersList" +- +-gchar ** +-xkb_options_get_selected_list (void) +-{ +- gchar **retval; +- +- retval = +- g_settings_get_strv (xkb_keyboard_settings, +- GKBD_KEYBOARD_CONFIG_KEY_OPTIONS); +- if (retval == NULL) { +- retval = g_strdupv (initial_config.options); +- } +- +- return retval; +-} +- +-/* Returns the selection counter of the expander (static current_expander) */ +-static int +-xkb_options_expander_selcounter_get (void) +-{ +- return +- GPOINTER_TO_INT (g_object_get_data +- (G_OBJECT (current_expander), +- SELCOUNTER_PROP)); +-} +- +-/* Increments the selection counter in the expander (static current_expander) +- using the value (can be 0)*/ +-static void +-xkb_options_expander_selcounter_add (int value) +-{ +- g_object_set_data (G_OBJECT (current_expander), SELCOUNTER_PROP, +- GINT_TO_POINTER +- (xkb_options_expander_selcounter_get () +- + value)); +-} +- +-/* Resets the seletion counter in the expander (static current_expander) */ +-static void +-xkb_options_expander_selcounter_reset (void) +-{ +- g_object_set_data (G_OBJECT (current_expander), SELCOUNTER_PROP, +- GINT_TO_POINTER (0)); +-} +- +-/* Formats the expander (static current_expander), based on the selection counter */ +-static void +-xkb_options_expander_highlight (void) +-{ +- char *utf_group_name = +- g_object_get_data (G_OBJECT (current_expander), +- "utfGroupName"); +- int counter = xkb_options_expander_selcounter_get (); +- if (utf_group_name != NULL) { +- gchar *titlemarkup = +- g_strconcat (counter > +- 0 ? "" : "", +- utf_group_name, "", NULL); +- gtk_expander_set_label (GTK_EXPANDER (current_expander), +- titlemarkup); +- g_free (titlemarkup); +- } +-} +- +-/* Add optionname from the backend's selection list if it's not +- already in there. */ +-static void +-xkb_options_select (gchar * optionname) +-{ +- gboolean already_selected = FALSE; +- gchar **options_list; +- guint i; +- +- options_list = xkb_options_get_selected_list (); +- for (i = 0; options_list != NULL && options_list[i] != NULL; i++) { +- gchar *option = options_list[i]; +- if (!strcmp (option, optionname)) { +- already_selected = TRUE; +- break; +- } +- } +- +- if (!already_selected) { +- options_list = +- gkbd_strv_append (options_list, g_strdup (optionname)); +- xkb_options_set_selected_list (options_list); +- } +- +- g_strfreev (options_list); +-} +- +-/* Remove all occurences of optionname from the backend's selection list */ +-static void +-xkb_options_deselect (gchar * optionname) +-{ +- gchar **options_list = xkb_options_get_selected_list (); +- if (options_list != NULL) { +- gchar **option = options_list; +- while (*option != NULL) { +- gchar *id = *option; +- if (!strcmp (id, optionname)) { +- gkbd_strv_behead (option); +- } else +- option++; +- } +- xkb_options_set_selected_list (options_list); +- } +- g_strfreev (options_list); +-} +- +-/* Return true if optionname describes a string already in the backend's +- list of selected options */ +-static gboolean +-xkb_options_is_selected (gchar * optionname) +-{ +- gboolean retval = FALSE; +- gchar **options_list = xkb_options_get_selected_list (); +- if (options_list != NULL) { +- gchar **option = options_list; +- while (*option != NULL) { +- if (!strcmp (*option, optionname)) { +- retval = TRUE; +- break; +- } +- option++; +- } +- } +- g_strfreev (options_list); +- return retval; +-} +- +-/* Make sure selected options stay visible when navigating with the keyboard */ +-static gboolean +-option_focused_cb (GtkWidget * widget, GdkEventFocus * event, +- gpointer data) +-{ +- GtkScrolledWindow *win = GTK_SCROLLED_WINDOW (data); +- GtkAllocation alloc; +- GtkAdjustment *adj; +- +- gtk_widget_get_allocation (widget, &alloc); +- adj = gtk_scrolled_window_get_vadjustment (win); +- gtk_adjustment_clamp_page (adj, alloc.y, alloc.y + alloc.height); +- +- return FALSE; +-} +- +-/* Update xkb backend to reflect the new UI state */ +-static void +-option_toggled_cb (GtkWidget * checkbutton, gpointer data) +-{ +- gpointer optionID = +- g_object_get_data (G_OBJECT (checkbutton), OPTION_ID_PROP); +- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton))) +- xkb_options_select (optionID); +- else +- xkb_options_deselect (optionID); +-} +- +-/* Add a check_button or radio_button to control a particular option +- This function makes particular use of the current... variables at +- the top of this file. */ +-static void +-xkb_options_add_option (XklConfigRegistry * config_registry, +- XklConfigItem * config_item, GtkBuilder * dialog) +-{ +- GtkWidget *option_check; +- gchar *utf_option_name = xci_desc_to_utf8 (config_item); +- /* Copy this out because we'll load it into the widget with set_data */ +- gchar *full_option_name = +- g_strdup (gkbd_keyboard_config_merge_items +- (current1st_level_id, config_item->name)); +- gboolean initial_state; +- +- if (current_multi_select) +- option_check = +- gtk_check_button_new_with_label (utf_option_name); +- else { +- if (current_radio_group == NULL) { +- /* The first radio in a group is to be "Default", meaning none of +- the below options are to be included in the selected list. +- This is a HIG-compliant alternative to allowing no +- selection in the group. */ +- option_check = +- gtk_radio_button_new_with_label +- (current_radio_group, _("Default")); +- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON +- (option_check), +- TRUE); +- /* Make option name underscore - +- to enforce its first position in the list */ +- g_object_set_data_full (G_OBJECT (option_check), +- "utfOptionName", +- g_strdup (" "), g_free); +- option_checks_list = +- g_slist_append (option_checks_list, +- option_check); +- current_radio_group = +- gtk_radio_button_get_group (GTK_RADIO_BUTTON +- (option_check)); +- current_none_radio = option_check; +- +- g_signal_connect (option_check, "focus-in-event", +- G_CALLBACK (option_focused_cb), +- WID ("options_scroll")); +- } +- option_check = +- gtk_radio_button_new_with_label (current_radio_group, +- utf_option_name); +- current_radio_group = +- gtk_radio_button_get_group (GTK_RADIO_BUTTON +- (option_check)); +- g_object_set_data (G_OBJECT (option_check), "NoneRadio", +- current_none_radio); +- } +- +- initial_state = xkb_options_is_selected (full_option_name); +- +- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (option_check), +- initial_state); +- +- g_object_set_data_full (G_OBJECT (option_check), OPTION_ID_PROP, +- full_option_name, g_free); +- g_object_set_data_full (G_OBJECT (option_check), "utfOptionName", +- utf_option_name, g_free); +- +- g_signal_connect (option_check, "toggled", +- G_CALLBACK (option_toggled_cb), NULL); +- +- option_checks_list = +- g_slist_append (option_checks_list, option_check); +- +- g_signal_connect (option_check, "focus-in-event", +- G_CALLBACK (option_focused_cb), +- WID ("options_scroll")); +- +- xkb_options_expander_selcounter_add (initial_state); +- g_object_set_data (G_OBJECT (option_check), GCONFSTATE_PROP, +- GINT_TO_POINTER (initial_state)); +-} +- +-static gint +-xkb_option_checks_compare (GtkWidget * chk1, GtkWidget * chk2) +-{ +- const gchar *t1 = +- g_object_get_data (G_OBJECT (chk1), "utfOptionName"); +- const gchar *t2 = +- g_object_get_data (G_OBJECT (chk2), "utfOptionName"); +- return g_utf8_collate (t1, t2); +-} +- +-/* Add a group of options: create title and layout widgets and then +- add widgets for all the options in the group. */ +-static void +-xkb_options_add_group (XklConfigRegistry * config_registry, +- XklConfigItem * config_item, GtkBuilder * dialog) +-{ +- GtkWidget *align, *vbox, *option_check; +- gboolean allow_multiple_selection = +- GPOINTER_TO_INT (g_object_get_data (G_OBJECT (config_item), +- XCI_PROP_ALLOW_MULTIPLE_SELECTION)); +- +- GSList *expanders_list = +- g_object_get_data (G_OBJECT (dialog), EXPANDERS_PROP); +- +- gchar *utf_group_name = xci_desc_to_utf8 (config_item); +- gchar *titlemarkup = +- g_strconcat ("", utf_group_name, "", NULL); +- +- current_expander = gtk_expander_new (titlemarkup); +- gtk_expander_set_use_markup (GTK_EXPANDER (current_expander), +- TRUE); +- g_object_set_data_full (G_OBJECT (current_expander), +- "utfGroupName", utf_group_name, g_free); +- g_object_set_data_full (G_OBJECT (current_expander), "groupId", +- g_strdup (config_item->name), g_free); +- +- g_free (titlemarkup); +- align = gtk_alignment_new (0, 0, 1, 1); +- gtk_alignment_set_padding (GTK_ALIGNMENT (align), 6, 12, 12, 0); +- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); +- gtk_box_set_homogeneous (GTK_BOX (vbox), TRUE); +- gtk_container_add (GTK_CONTAINER (align), vbox); +- gtk_container_add (GTK_CONTAINER (current_expander), align); +- +- current_multi_select = (gboolean) allow_multiple_selection; +- current_radio_group = NULL; +- current1st_level_id = config_item->name; +- +- option_checks_list = NULL; +- +- xkl_config_registry_foreach_option (config_registry, +- config_item->name, +- (ConfigItemProcessFunc) +- xkb_options_add_option, +- dialog); +- /* sort it */ +- option_checks_list = +- g_slist_sort (option_checks_list, +- (GCompareFunc) xkb_option_checks_compare); +- while (option_checks_list) { +- option_check = GTK_WIDGET (option_checks_list->data); +- gtk_box_pack_start (GTK_BOX (vbox), option_check, TRUE, +- TRUE, 0); +- option_checks_list = option_checks_list->next; +- } +- /* free it */ +- g_slist_free (option_checks_list); +- option_checks_list = NULL; +- +- xkb_options_expander_highlight (); +- +- expanders_list = g_slist_append (expanders_list, current_expander); +- g_object_set_data (G_OBJECT (dialog), EXPANDERS_PROP, +- expanders_list); +- +- g_signal_connect (current_expander, "focus-in-event", +- G_CALLBACK (option_focused_cb), +- WID ("options_scroll")); +-} +- +-static gint +-xkb_options_expanders_compare (GtkWidget * expander1, +- GtkWidget * expander2) +-{ +- const gchar *t1 = +- g_object_get_data (G_OBJECT (expander1), "utfGroupName"); +- const gchar *t2 = +- g_object_get_data (G_OBJECT (expander2), "utfGroupName"); +- return g_utf8_collate (t1, t2); +-} +- +-/* Create widgets to represent the options made available by the backend */ +-void +-xkb_options_load_options (GtkBuilder * dialog) +-{ +- GtkWidget *opts_vbox = WID ("options_vbox"); +- GtkWidget *dialog_vbox = WID ("dialog_vbox"); +- GtkWidget *options_scroll = WID ("options_scroll"); +- GtkWidget *expander; +- GSList *expanders_list; +- +- current1st_level_id = NULL; +- current_none_radio = NULL; +- current_multi_select = FALSE; +- current_radio_group = NULL; +- +- /* fill the list */ +- xkl_config_registry_foreach_option_group (config_registry, +- (ConfigItemProcessFunc) +- xkb_options_add_group, +- dialog); +- /* sort it */ +- expanders_list = +- g_object_get_data (G_OBJECT (dialog), EXPANDERS_PROP); +- expanders_list = +- g_slist_sort (expanders_list, +- (GCompareFunc) xkb_options_expanders_compare); +- g_object_set_data (G_OBJECT (dialog), EXPANDERS_PROP, +- expanders_list); +- while (expanders_list) { +- expander = GTK_WIDGET (expanders_list->data); +- gtk_box_pack_start (GTK_BOX (opts_vbox), expander, FALSE, +- FALSE, 0); +- expanders_list = expanders_list->next; +- } +- +- /* Somewhere in gtk3 the top vbox in dialog is made non-expandable */ +- gtk_box_set_child_packing (GTK_BOX (dialog_vbox), options_scroll, +- TRUE, TRUE, 0, GTK_PACK_START); +- gtk_widget_show_all (dialog_vbox); +-} +- +-static void +-chooser_response_cb (GtkDialog * dialog, gint response, gpointer data) +-{ +- switch (response) { +- case GTK_RESPONSE_DELETE_EVENT: +- case GTK_RESPONSE_CLOSE: { +- /* just cleanup */ +- GSList *expanders_list = +- g_object_get_data (G_OBJECT (dialog), +- EXPANDERS_PROP); +- g_object_set_data (G_OBJECT (dialog), +- EXPANDERS_PROP, NULL); +- g_slist_free (expanders_list); +- +- gtk_widget_destroy (GTK_WIDGET (dialog)); +- chooser_dialog = NULL; +- } +- break; +- } +-} +- +-/* Create popup dialog */ +-void +-xkb_options_popup_dialog (GtkBuilder * dialog) +-{ +- GtkWidget *chooser; +- +- chooser_dialog = gtk_builder_new (); +- gtk_builder_set_translation_domain (chooser_dialog, GETTEXT_PACKAGE); +- gtk_builder_add_from_file (chooser_dialog, CINNAMONCC_UI_DIR +- "/cinnamon-region-panel-options-dialog.ui", +- NULL); +- +- chooser = CWID ("xkb_options_dialog"); +- gtk_window_set_transient_for (GTK_WINDOW (chooser), +- GTK_WINDOW (gtk_widget_get_toplevel (WID ("region_notebook")))); +- gtk_window_set_modal (GTK_WINDOW (chooser), TRUE); +- xkb_options_load_options (chooser_dialog); +- +- g_signal_connect (chooser, "response", +- G_CALLBACK (chooser_response_cb), dialog); +- gtk_widget_show (chooser); +-} +- +-/* Update selected option counters for a group-bound expander */ +-static void +-xkb_options_update_option_counters (XklConfigRegistry * config_registry, +- XklConfigItem * config_item) +-{ +- gchar *full_option_name = +- g_strdup (gkbd_keyboard_config_merge_items +- (current1st_level_id, config_item->name)); +- gboolean current_state = +- xkb_options_is_selected (full_option_name); +- g_free (full_option_name); +- +- xkb_options_expander_selcounter_add (current_state); +-} +- +-/* Respond to a change in the xkb gconf settings */ +-static void +-xkb_options_update (GSettings * settings, gchar * key, GtkBuilder * dialog) +-{ +- if (!strcmp (key, GKBD_KEYBOARD_CONFIG_KEY_OPTIONS)) { +- /* Updating options is handled by gconf notifies for each widget +- This is here to avoid calling it N_OPTIONS times for each gconf +- change. */ +- enable_disable_restoring (dialog); +- +- if (chooser_dialog != NULL) { +- GSList *expanders_list = +- g_object_get_data (G_OBJECT (chooser_dialog), +- EXPANDERS_PROP); +- while (expanders_list) { +- current_expander = +- GTK_WIDGET (expanders_list->data); +- gchar *group_id = +- g_object_get_data (G_OBJECT +- (current_expander), +- "groupId"); +- current1st_level_id = group_id; +- xkb_options_expander_selcounter_reset (); +- xkl_config_registry_foreach_option +- (config_registry, group_id, +- (ConfigItemProcessFunc) +- xkb_options_update_option_counters, +- current_expander); +- xkb_options_expander_highlight (); +- expanders_list = expanders_list->next; +- } +- } +- } +-} +- +-void +-xkb_options_register_conf_listener (GtkBuilder * dialog) +-{ +- g_signal_connect (xkb_keyboard_settings, "changed", +- G_CALLBACK (xkb_options_update), dialog); +-} +diff -uNrp a/panels/region/cinnamon-region-panel-xkbpv.c b/panels/region/cinnamon-region-panel-xkbpv.c +--- a/panels/region/cinnamon-region-panel-xkbpv.c 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/cinnamon-region-panel-xkbpv.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,120 +0,0 @@ +-/* cinnamon-region-panel-xkbpv.c +- * Copyright (C) 2003-2007 Sergey V. Udaltsov +- * +- * Written by: Sergey V. Udaltsov +- * +- * 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, 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 - Suite 500, Boston, MA +- * 02110-1335, USA. +- */ +- +-#ifdef HAVE_CONFIG_H +-# include +-#endif +- +-#include +- +-#include "cinnamon-region-panel-xkb.h" +- +-#ifdef HAVE_X11_EXTENSIONS_XKB_H +-#include "X11/XKBlib.h" +-/** +- * BAD STYLE: Taken from xklavier_private_xkb.h +- * Any ideas on architectural improvements are WELCOME +- */ +-extern gboolean xkl_xkb_config_native_prepare (XklEngine * engine, +- const XklConfigRec * data, +- XkbComponentNamesPtr +- component_names); +- +-extern void xkl_xkb_config_native_cleanup (XklEngine * engine, +- XkbComponentNamesPtr +- component_names); +- +-/* */ +-#endif +- +-static GkbdKeyboardDrawingGroupLevel groupsLevels[] = +- { {0, 1}, {0, 3}, {0, 0}, {0, 2} }; +-static GkbdKeyboardDrawingGroupLevel *pGroupsLevels[] = { +- groupsLevels, groupsLevels + 1, groupsLevels + 2, groupsLevels + 3 +-}; +- +-GtkWidget * +-xkb_layout_preview_create_widget (GtkBuilder * chooserDialog) +-{ +- GtkWidget *kbdraw = gkbd_keyboard_drawing_new (); +- +- gkbd_keyboard_drawing_set_groups_levels (GKBD_KEYBOARD_DRAWING +- (kbdraw), pGroupsLevels); +- return kbdraw; +-} +- +-void +-xkb_layout_preview_set_drawing_layout (GtkWidget * kbdraw, +- const gchar * id) +-{ +-#ifdef HAVE_X11_EXTENSIONS_XKB_H +- if (kbdraw != NULL) { +- if (id != NULL) { +- XklConfigRec *data; +- char **p, *layout, *variant; +- XkbComponentNamesRec component_names; +- +- data = xkl_config_rec_new (); +- if (xkl_config_rec_get_from_server (data, engine)) { +- if ((p = data->layouts) != NULL) +- g_strfreev (data->layouts); +- +- if ((p = data->variants) != NULL) +- g_strfreev (data->variants); +- +- data->layouts = g_new0 (char *, 2); +- data->variants = g_new0 (char *, 2); +- if (gkbd_keyboard_config_split_items +- (id, &layout, &variant) +- && variant != NULL) { +- data->layouts[0] = +- (layout == +- NULL) ? NULL : +- g_strdup (layout); +- data->variants[0] = +- (variant == +- NULL) ? NULL : +- g_strdup (variant); +- } else { +- data->layouts[0] = +- (id == +- NULL) ? NULL : g_strdup (id); +- data->variants[0] = NULL; +- } +- +- if (xkl_xkb_config_native_prepare +- (engine, data, &component_names)) { +- gkbd_keyboard_drawing_set_keyboard +- (GKBD_KEYBOARD_DRAWING +- (kbdraw), &component_names); +- +- xkl_xkb_config_native_cleanup +- (engine, &component_names); +- } +- } +- g_object_unref (G_OBJECT (data)); +- } else +- gkbd_keyboard_drawing_set_keyboard +- (GKBD_KEYBOARD_DRAWING (kbdraw), NULL); +- +- } +-#endif +-} +diff -uNrp a/panels/region/.indent.pro b/panels/region/.indent.pro +--- a/panels/region/.indent.pro 1970-01-01 01:00:00.000000000 +0100 ++++ b/panels/region/.indent.pro 2013-08-25 16:50:30.000000000 +0100 +@@ -0,0 +1,2 @@ ++-kr -i8 -pcs -lps -psl ++ +diff -uNrp a/panels/region/Makefile.am b/panels/region/Makefile.am +--- a/panels/region/Makefile.am 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/Makefile.am 2013-09-21 13:24:15.347949247 +0100 +@@ -23,12 +23,9 @@ libregion_la_SOURCES = \ + cinnamon-region-panel-lang.h \ + cinnamon-region-panel-system.c \ + cinnamon-region-panel-system.h \ +- cinnamon-region-panel-xkb.c \ +- cinnamon-region-panel-xkblt.c \ +- cinnamon-region-panel-xkbltadd.c \ +- cinnamon-region-panel-xkbot.c \ +- cinnamon-region-panel-xkbpv.c \ +- cinnamon-region-panel-xkb.h ++ cinnamon-region-panel-input.c \ ++ cinnamon-region-panel-input.h \ ++ $(NULL) + + libregion_la_LIBADD = $(PANEL_LIBS) $(REGION_PANEL_LIBS) $(builddir)/../common/liblanguage.la + +@@ -39,8 +36,8 @@ libregion_la_LDFLAGS = $(PANEL_LDFLAGS) + uidir = $(pkgdatadir)/ui + ui_DATA = \ + cinnamon-region-panel.ui \ +- cinnamon-region-panel-layout-chooser.ui \ +- cinnamon-region-panel-options-dialog.ui ++ cinnamon-region-panel-input-chooser.ui \ ++ $(NULL) + + desktopdir = $(datadir)/applications + Desktop_in_files = cinnamon-region-panel.desktop.in +diff -uNrp a/panels/region/region-module.c b/panels/region/region-module.c +--- a/panels/region/region-module.c 2013-08-25 14:40:14.000000000 +0100 ++++ b/panels/region/region-module.c 2013-09-21 13:24:15.347949247 +0100 +@@ -28,6 +28,7 @@ + void + g_io_module_load (GIOModule * module) + { ++ + /* register the panel */ + cc_region_panel_register (module); + } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 514a3f09bfb..cf1c0875e2b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9887,8 +9887,10 @@ let cinnamon = recurseIntoAttrs rec { callPackage = newScope pkgs.cinnamon; - inherit (gnome3) gnome_common libgnomekbd; - + inherit (gnome3) gnome_common libgnomekbd gnome-menus; + + cinnamon-control-center = callPackage ../desktops/cinnamon/cinnamon-control-center.nix{ }; + cinnamon-settings-daemon = callPackage ../desktops/cinnamon/cinnamon-settings-daemon.nix{ }; cinnamon-session = callPackage ../desktops/cinnamon/cinnamon-session.nix{ } ; From f4cc9c29c756681177cb694916b61158ec59642c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 21:49:04 +0200 Subject: [PATCH 0083/2033] ipython: update 1.1.0 -> 2.0.0 Release notes: http://ipython.org/ipython-doc/2/whatsnew/version2.0.html Build and run tested terminal mode (default), notebook, qtconsole; all works. (And the release notes list few backwards incompatible changes.) --- pkgs/shells/ipython/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/shells/ipython/default.nix b/pkgs/shells/ipython/default.nix index b9b9129cb48..cb0cc95c4ce 100644 --- a/pkgs/shells/ipython/default.nix +++ b/pkgs/shells/ipython/default.nix @@ -13,12 +13,12 @@ assert qtconsoleSupport == true -> pyqt4 != null; assert pylabQtSupport == true -> pyqt4 != null && sip != null; buildPythonPackage rec { - name = "ipython-1.1.0"; + name = "ipython-2.0.0"; namePrefix = ""; src = fetchurl { url = "http://pypi.python.org/packages/source/i/ipython/${name}.tar.gz"; - sha256 = "1glivwy7k2dciy0y5i39syngip84nrqhpggn4glmpd2s49jllkkc"; + sha256 = "0fl9sznx83y2ck8wh5zr8avzjm5hz6r0xz38ij2fil3gin7w10sf"; }; propagatedBuildInputs = [ From f249de831207885d3838fb517ea07848d80f297c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 22:18:33 +0200 Subject: [PATCH 0084/2033] lftp: update 4.4.5 -> 4.4.15 Bug fixes and minor improvements. I had to switch download mirror because the current one didn't have the newest release(s). --- pkgs/tools/networking/lftp/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/networking/lftp/default.nix b/pkgs/tools/networking/lftp/default.nix index 2bc575bbd02..a9bbf84a425 100644 --- a/pkgs/tools/networking/lftp/default.nix +++ b/pkgs/tools/networking/lftp/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, gnutls, pkgconfig, readline, zlib, xz }: stdenv.mkDerivation rec { - name = "lftp-4.4.5"; + name = "lftp-4.4.15"; src = fetchurl { - url = "ftp://ftp.tuwien.ac.at/infosys/browsers/ftp/lftp/${name}.tar.xz"; - sha256 = "1p3nxsd2an9pdwc3vgwxy8p5nnjrc7mhilikjaddy62cyvxdbpxq"; + url = "http://lftp.yar.ru/ftp/${name}.tar.gz"; + sha256 = "1iw0xvvi9wr7grm6dwbxgm8ms98pg5skj44q477gxzrrff9dvvvp"; }; patches = [ ./no-gets.patch ]; From b8cadc493e5bc7e1875f7fefe6ac6651a2e87c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 22:23:23 +0200 Subject: [PATCH 0085/2033] lftp: add/update meta attributes --- pkgs/tools/networking/lftp/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/networking/lftp/default.nix b/pkgs/tools/networking/lftp/default.nix index a9bbf84a425..434ddbce3e7 100644 --- a/pkgs/tools/networking/lftp/default.nix +++ b/pkgs/tools/networking/lftp/default.nix @@ -12,9 +12,11 @@ stdenv.mkDerivation rec { buildInputs = [ gnutls pkgconfig readline zlib ]; - meta = { - homepage = http://lftp.yar.ru/; + meta = with stdenv.lib; { description = "A file transfer program supporting a number of network protocols"; - license = "GPL"; + homepage = http://lftp.yar.ru/; + license = licenses.gpl3; + platforms = platforms.linux; + maintainers = [ maintainers.bjornfor ]; }; } From 5e50b35a26911479a62d4c80a76d83014a43be8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 22:36:31 +0200 Subject: [PATCH 0086/2033] bluez5: remove unneeded libusb dependency bluez >= 5.9 does not depend on libusb[1]. [1] http://www.bluez.org/release-of-bluez-5-9/ --- pkgs/os-specific/linux/bluez/bluez5.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/bluez/bluez5.nix b/pkgs/os-specific/linux/bluez/bluez5.nix index ffa91e951a8..f9f5c185bbd 100644 --- a/pkgs/os-specific/linux/bluez/bluez5.nix +++ b/pkgs/os-specific/linux/bluez/bluez5.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, pkgconfig, dbus, glib, libusb, alsaLib, python, +{ stdenv, fetchurl, pkgconfig, dbus, glib, alsaLib, python, pythonPackages, pythonDBus, readline, libsndfile, udev, libical, systemd }: @@ -16,7 +16,7 @@ stdenv.mkDerivation rec { [ pythonDBus pygobject pygobject3 recursivePthLoader ]; buildInputs = - [ pkgconfig dbus.libs glib libusb alsaLib python pythonPackages.wrapPython + [ pkgconfig dbus.libs glib alsaLib python pythonPackages.wrapPython readline libsndfile udev libical # Disables GStreamer; not clear what it gains us other than a # zillion extra dependencies. From 129637268166dd7e63674658c8fb866d9abfe91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 13 Apr 2014 22:56:21 +0200 Subject: [PATCH 0087/2033] cifs-utils: update 6.2 -> 6.3 January 9, 2014: Release 6.3: * fixes for various bugs turned up by Coverity * clean unused cruft out of upcall binary * add new pam_cifscreds PAM module for establishing NTLM creds on login * https://lists.samba.org/archive/samba-technical/2014-January/097124.html --- pkgs/os-specific/linux/cifs-utils/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/cifs-utils/default.nix b/pkgs/os-specific/linux/cifs-utils/default.nix index bef8de495ad..ce609c5be47 100644 --- a/pkgs/os-specific/linux/cifs-utils/default.nix +++ b/pkgs/os-specific/linux/cifs-utils/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl }: stdenv.mkDerivation rec { - name = "cifs-utils-6.2"; + name = "cifs-utils-6.3"; src = fetchurl { url = "ftp://ftp.samba.org/pub/linux-cifs/cifs-utils/${name}.tar.bz2"; - sha256 = "0cydya7l7xwxk2j1g1659kbvb4jzql11ivb6cldwwfg19qvnwrrl"; + sha256 = "0nrpd3ibzfhdxgq1pw0jhzx163z5jvq4qcjxl35qlqj74lm3pxzz"; }; makeFlags = "root_sbindir=$(out)/sbin"; From 091ce87a00fd20d7a4a2ece8e563fd0a013661f1 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sun, 13 Apr 2014 23:30:15 +0200 Subject: [PATCH 0088/2033] audacious: find gsettings schemas --- pkgs/applications/audio/audacious/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/audio/audacious/default.nix b/pkgs/applications/audio/audacious/default.nix index d838d29e8be..409a831727b 100644 --- a/pkgs/applications/audio/audacious/default.nix +++ b/pkgs/applications/audio/audacious/default.nix @@ -49,7 +49,7 @@ stdenv.mkDerivation { source $stdenv/setup # gsettings schemas for file dialogues for file in "$out/bin/"*; do - wrapProgram "$file" --prefix XDG_DATA_DIRS : "$XDG_ADD" + wrapProgram "$file" --prefix XDG_DATA_DIRS : "$XDG_ADD:$GSETTINGS_SCHEMAS_PATH" done ) ''; From 57b6ecb7999ce57fc131837ba26929f148a56034 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sun, 13 Apr 2014 23:50:21 +0200 Subject: [PATCH 0089/2033] sflphone: find gsettings schemas --- .../networking/instant-messengers/sflphone/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/sflphone/default.nix b/pkgs/applications/networking/instant-messengers/sflphone/default.nix index 2401d796bfd..a31a682abf8 100644 --- a/pkgs/applications/networking/instant-messengers/sflphone/default.nix +++ b/pkgs/applications/networking/instant-messengers/sflphone/default.nix @@ -75,8 +75,10 @@ rec { ''; # gtk3 programs have the runtime dependency on XDG_DATA_DIRS - postInstall = '' - wrapProgram $out/bin/sflphone* --prefix XDG_DATA_DIRS ":" ${gtk}/share + preFixup = '' + for f in "$out/bin/sflphone" "$out/bin/sflphone-client-gnome"; do + wrapProgram $f --prefix XDG_DATA_DIRS ":" "${gtk}/share:$GSETTINGS_SCHEMAS_PATH" + done ''; buildInputs = [ daemon pkgconfig gtk glib dbus_glib libnotify intltool makeWrapper ]; From 93e91548050cb97f31fdeeb029498d616a6243b3 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 11 Apr 2014 07:35:06 -0400 Subject: [PATCH 0090/2033] rsync updated 3.0.9 to 3.1.0, rsyncd service module --- nixos/modules/module-list.nix | 1 + .../services/network-filesystems/rsyncd.nix | 139 ++++++++++++++++++ .../networking/sync/rsync/default.nix | 13 +- 3 files changed, 147 insertions(+), 6 deletions(-) create mode 100644 nixos/modules/services/network-filesystems/rsyncd.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b2f530474b5..f59e04425fc 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -159,6 +159,7 @@ ./services/network-filesystems/drbd.nix ./services/network-filesystems/nfsd.nix ./services/network-filesystems/openafs-client/default.nix + ./services/network-filesystems/rsyncd.nix ./services/network-filesystems/samba.nix ./services/networking/amuled.nix ./services/networking/avahi-daemon.nix diff --git a/nixos/modules/services/network-filesystems/rsyncd.nix b/nixos/modules/services/network-filesystems/rsyncd.nix new file mode 100644 index 00000000000..bc17add809b --- /dev/null +++ b/nixos/modules/services/network-filesystems/rsyncd.nix @@ -0,0 +1,139 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +let + + cfg = config.services.rsyncd; + + motdFile = pkgs.writeText "rsyncd-motd" cfg.motd; + + rsyncdCfg = "" + + optionalString (cfg.motd != "") "motd file = ${motdFile}\n" + + optionalString (cfg.address != "") "address = ${cfg.address}\n" + + optionalString (cfg.port != 873) "port = ${toString cfg.port}\n" + + cfg.extraConfig + + "\n" + + flip concatMapStrings cfg.modules (m: "[${m.name}]\n\tpath = ${m.path}\n" + + optionalString (m.comment != "") "\tcomment = ${m.comment}\n" + + m.extraConfig + + "\n" + ); + + rsyncdCfgFile = pkgs.writeText "rsyncd.conf" rsyncdCfg; + +in + +{ + options = { + + services.rsyncd = { + + enable = mkOption { + default = false; + description = "Whether to enable the rsync daemon."; + }; + + motd = mkOption { + type = types.string; + default = ""; + description = '' + Message of the day to display to clients on each connect. + This usually contains site information and any legal notices. + ''; + }; + + port = mkOption { + default = 873; + type = types.int; + description = "TCP port the daemon will listen on."; + }; + + address = mkOption { + default = ""; + example = "192.168.1.2"; + description = '' + IP address the daemon will listen on; rsyncd will listen on + all addresses if this is not specified. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Lines of configuration to add to rsyncd globally. + See man rsyncd.conf for more options. + ''; + }; + + modules = mkOption { + default = [ ]; + example = [ + { name = "ftp"; + path = "/home/ftp"; + comment = "ftp export area"; + extraConfig = '' + secrets file = /etc/rsyncd.secrets + ''; + } + ]; + description = "The list of file paths to export."; + type = types.listOf types.optionSet; + + options = { + + name = mkOption { + example = "ftp"; + type = types.string; + description = "Name of export module."; + }; + + comment = mkOption { + default = ""; + description = '' + Description string that is displayed next to the module name + when clients obtain a list of available modules. + ''; + }; + + path = mkOption { + example = "/home/ftp"; + type = types.string; + description = "Directory to make available in this module."; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Lines of configuration to add to this module. + See man rsyncd.conf for more options. + ''; + }; + }; + }; + }; + }; + + ###### implementation + + config = mkIf cfg.enable { + + environment.etc = singleton + { source = rsyncdCfgFile; + target = "rsyncd.conf"; + }; + + systemd.services.rsyncd = { + description = "Rsync daemon"; + wantedBy = [ "multi-user.target" ]; + + path = [ pkgs.rsync ]; + + serviceConfig.ExecStart = "${pkgs.rsync}/bin/rsync --daemon --no-detach"; + }; + + networking.firewall.allowedTCPPorts = [ cfg.port ]; + }; +} \ No newline at end of file diff --git a/pkgs/applications/networking/sync/rsync/default.nix b/pkgs/applications/networking/sync/rsync/default.nix index 5447b21009f..5265faf87b6 100644 --- a/pkgs/applications/networking/sync/rsync/default.nix +++ b/pkgs/applications/networking/sync/rsync/default.nix @@ -6,16 +6,17 @@ assert enableACLs -> acl != null; stdenv.mkDerivation rec { - name = "rsync-3.0.9"; + name = "rsync-${version}"; + version = "3.1.0"; mainSrc = fetchurl { - url = http://rsync.samba.org/ftp/rsync/src/rsync-3.0.9.tar.gz; - sha256 = "01bw4klqsrlhh3i9lazd485sd9qx5djvnwa21lj2h3a9sn6hzw9h"; + url = "http://rsync.samba.org/ftp/rsync/src/rsync-${version}.tar.gz"; + sha256 = "0kirw8wglqvwi1v8bwxp373g03xg857h59j5k3mmgff9gzvj7jl1"; }; patchesSrc = fetchurl { - url = http://rsync.samba.org/ftp/rsync/rsync-patches-3.0.9.tar.gz; - sha256 = "0c1e9b56e99667dfc47641124460bac61a04c5d2ee89f575c6bc78c7a69005a9"; + url = "http://rsync.samba.org/ftp/rsync/rsync-patches-${version}.tar.gz"; + sha256 = "0sl8aadpjblvbb05vgais40z90yzhr09rwz0cykjdiv452gli75p"; }; srcs = [mainSrc] ++ stdenv.lib.optional enableCopyDevicesPatch patchesSrc; @@ -30,6 +31,6 @@ stdenv.mkDerivation rec { license = stdenv.lib.licenses.gpl3Plus; platforms = stdenv.lib.platforms.unix; - maintainers = [ stdenv.lib.maintainers.simons ]; + maintainers = [ stdenv.lib.maintainers.simons stdenv.lib.maintainers.emery ]; }; } From da5b52f1b4aaba59e3651caa70d1e3f4fdbea3c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Mon, 14 Apr 2014 07:06:49 +0200 Subject: [PATCH 0091/2033] minicom: update 2.6.2 -> 2.7 Changelog: - Configurable status line via -F option, see manpage for a listing of format specifier. - Improve display of device name in status line. - Script: Binary transmission feature via "!<" - Bugfixes --- pkgs/tools/misc/minicom/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/misc/minicom/default.nix b/pkgs/tools/misc/minicom/default.nix index 2ab1195020c..8ede3aa918b 100644 --- a/pkgs/tools/misc/minicom/default.nix +++ b/pkgs/tools/misc/minicom/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, ncurses }: stdenv.mkDerivation rec { - name = "minicom-2.6.2"; + name = "minicom-2.7"; src = fetchurl { - url = "http://alioth.debian.org/frs/download.php/file/3869/${name}.tar.gz"; - sha256 = "0s4ibk8scspm8a0raf5s4zgp9b82c4bn529rir9abzqlg5gj3kzk"; + url = "http://alioth.debian.org/frs/download.php/file/3977/${name}.tar.gz"; + sha256 = "1x04m4k7c71j5cnhzpjrbz43dd96k4mpkd0l87v5skrgp1isdhws"; }; buildInputs = [ncurses]; From 13137dbb460c14e4ecfd77e2d6ac5149a6bd90ba Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Mon, 14 Apr 2014 11:29:36 +0530 Subject: [PATCH 0092/2033] doc: meta.xml -- fix a typo --- doc/meta.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/meta.xml b/doc/meta.xml index 00e9b8ac67a..6c8e458509a 100644 --- a/doc/meta.xml +++ b/doc/meta.xml @@ -164,7 +164,7 @@ meta.hydraPlatforms = []; If set to true, the package is marked as “broken”, meaning that it won’t show up in nix-env -qa, and cannot be built or installed. - Sush packages should be removed from Nixpkgs eventually unless + Such packages should be removed from Nixpkgs eventually unless they are fixed. From 58b58903ba2f4f10aae4b29a1fb8625ca6fb5563 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Mon, 14 Apr 2014 11:42:01 +0530 Subject: [PATCH 0093/2033] doc: quick-start.xml -- fix a typo in the link. Chapter 2, gmp 5.1.1.nix url and filename has changed in the repo to 5.1.x.nix. --- doc/quick-start.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/quick-start.xml b/doc/quick-start.xml index 35983f0b114..49c674052b9 100644 --- a/doc/quick-start.xml +++ b/doc/quick-start.xml @@ -71,7 +71,7 @@ $ git add pkgs/development/libraries/libfoo/default.nix GNU Multiple Precision arithmetic library (GMP): pkgs/development/libraries/gmp/5.1.1.nix. + xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/gmp/5.1.x.nix">pkgs/development/libraries/gmp/5.1.x.nix. Also done by the generic builder, but has a dependency on m4. From ebe8fab999e6333953849cf300b89ed7e9b968be Mon Sep 17 00:00:00 2001 From: Alexander Kjeldaas Date: Mon, 14 Apr 2014 09:22:31 +0200 Subject: [PATCH 0094/2033] Make the user aware of the allowUnfree option. --- pkgs/stdenv/generic/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 3a475933d24..035e1516932 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -58,7 +58,16 @@ let pos' = if pos != null then "‘" + pos.file + ":" + toString pos.line + "’" else "«unknown-file»"; in if !allowUnfree && (let l = lib.lists.toList attrs.meta.license or []; in lib.lists.elem "unfree" l || lib.lists.elem "unfree-redistributable" l) then - throw "package ‘${attrs.name}’ in ${pos'} has an unfree license, refusing to evaluate" + throw ''package ‘${attrs.name}’ in ${pos'} has an unfree license, refusing to evaluate. + You can set + { nixpkgs.config.allowUnfree = true; } + in configuration.nix to override this. + If you use nix standalnd, you can add + { config.allowUnfree = true; } + to ~/.nixpkgs/config.nix or pass + --arg config '{ allowUnfree = true; }' + on the command line. + '' else if !allowBroken && attrs.meta.broken or false then throw "you can't use package ‘${attrs.name}’ in ${pos'} because it has been marked as broken" else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem result.system attrs.meta.platforms then From 722143a5d365ab084bc69db4aa4258d0b4a8c549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Mon, 14 Apr 2014 09:29:41 +0200 Subject: [PATCH 0095/2033] fix typo --- pkgs/stdenv/generic/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 035e1516932..a341e36b631 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -62,7 +62,7 @@ let You can set { nixpkgs.config.allowUnfree = true; } in configuration.nix to override this. - If you use nix standalnd, you can add + If you use nix standalne, you can add { config.allowUnfree = true; } to ~/.nixpkgs/config.nix or pass --arg config '{ allowUnfree = true; }' From d5b4c3c63e97415396ff0ad74299aa770512c71b Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Wed, 9 Apr 2014 15:57:02 +0200 Subject: [PATCH 0096/2033] tracker: new package Desktop-neutral user information store, search tool and indexer https://wiki.gnome.org/Projects/Tracker --- nixos/modules/module-list.nix | 1 + .../services/desktops/gnome3/tracker.nix | 39 +++++++++++++++ .../services/x11/desktop-managers/gnome3.nix | 1 + .../desktops/gnome-3/core/tracker/default.nix | 49 +++++++++++++++++++ pkgs/desktops/gnome-3/default.nix | 2 + 5 files changed, 92 insertions(+) create mode 100644 nixos/modules/services/desktops/gnome3/tracker.nix create mode 100644 pkgs/desktops/gnome-3/core/tracker/default.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b2f530474b5..a4915a2fa5c 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -101,6 +101,7 @@ ./services/desktops/gnome3/at-spi2-core.nix ./services/desktops/gnome3/evolution-data-server.nix ./services/desktops/gnome3/sushi.nix + ./services/desktops/gnome3/tracker.nix ./services/desktops/telepathy.nix ./services/games/ghost-one.nix ./services/games/minecraft-server.nix diff --git a/nixos/modules/services/desktops/gnome3/tracker.nix b/nixos/modules/services/desktops/gnome3/tracker.nix new file mode 100644 index 00000000000..94a22d0c881 --- /dev/null +++ b/nixos/modules/services/desktops/gnome3/tracker.nix @@ -0,0 +1,39 @@ +# Tracker daemon. + +{ config, pkgs, ... }: + +with pkgs.lib; + +{ + + ###### interface + + options = { + + services.gnome3.tracker = { + + enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable Tracker services, a search engine, + search tool and metadata storage system. + ''; + }; + + }; + + }; + + + ###### implementation + + config = mkIf config.services.gnome3.tracker.enable { + + environment.systemPackages = [ pkgs.gnome3.tracker ]; + + services.dbus.packages = [ pkgs.gnome3.tracker ]; + + }; + +} diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index bebda772352..aa231f2bad7 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -33,6 +33,7 @@ in { services.gnome3.at-spi2-core.enable = true; services.gnome3.evolution-data-server.enable = true; services.gnome3.sushi.enable = true; + services.gnome3.tracker.enable = mkDefault true; services.telepathy.enable = true; networking.networkmanager.enable = true; services.upower.enable = config.powerManagement.enable; diff --git a/pkgs/desktops/gnome-3/core/tracker/default.nix b/pkgs/desktops/gnome-3/core/tracker/default.nix new file mode 100644 index 00000000000..6ac3592f6bf --- /dev/null +++ b/pkgs/desktops/gnome-3/core/tracker/default.nix @@ -0,0 +1,49 @@ +{ stdenv, intltool, fetchurl, libxml2, upower +, pkgconfig, gtk3, glib, hicolor_icon_theme +, bash, makeWrapper, itstool, vala, sqlite +, gnome3, librsvg, gdk_pixbuf, file, libnotify +, evolution_data_server, gst_all_1, poppler +, icu, taglib, libjpeg, libtiff, giflib, libcue +, libvorbis, flac, exempi, networkmanager +, libpng, libexif, libgsf, libuuid, bzip2 }: + +stdenv.mkDerivation rec { + name = "tracker-1.0.0"; + + src = fetchurl { + url = "mirror://gnome/sources/tracker/1.0/${name}.tar.xz"; + sha256 = "a1d033faf2c78f0e239f3c2c961b96623c9a7dabd938c08e3f5660bd70f54ba2"; + }; + + propagatedUserEnvPkgs = [ gnome3.gnome_themes_standard ]; + + NIX_CFLAGS_COMPILE = "-I${gnome3.glib}/include/gio-unix-2.0"; + + enableParallelBuilding = true; + + buildInputs = [ vala pkgconfig gtk3 glib intltool itstool libxml2 + bzip2 gnome3.totem-pl-parser + gnome3.gsettings_desktop_schemas makeWrapper file + gdk_pixbuf gnome3.gnome_icon_theme librsvg sqlite + upower libnotify evolution_data_server gnome3.libgee + gst_all_1.gstreamer gst_all_1.gst-plugins-base flac + poppler icu taglib libjpeg libtiff giflib libvorbis + exempi networkmanager libpng libexif libgsf libuuid + hicolor_icon_theme gnome3.gnome_icon_theme_symbolic ]; + + preFixup = '' + for f in $out/bin/* $out/libexec/*; do + wrapProgram $f \ + --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ + --prefix XDG_DATA_DIRS : "${gtk3}/share:${gnome3.gnome_themes_standard}/share:$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" + done + ''; + + meta = with stdenv.lib; { + homepage = https://wiki.gnome.org/Projects/Tracker; + description = "Desktop-neutral user information store, search tool and indexer"; + maintainers = with maintainers; [ lethalman ]; + license = licenses.gpl2; + platforms = platforms.linux; + }; +} diff --git a/pkgs/desktops/gnome-3/default.nix b/pkgs/desktops/gnome-3/default.nix index d9a673fb4c7..d8d510b0bb9 100644 --- a/pkgs/desktops/gnome-3/default.nix +++ b/pkgs/desktops/gnome-3/default.nix @@ -122,6 +122,8 @@ rec { totem-pl-parser = callPackage ./core/totem-pl-parser { }; + tracker = callPackage ./core/tracker { }; + vte = callPackage ./core/vte { }; vino = callPackage ./core/vino { }; From b4096479faf7147e885e5a7abc03c35c23db88ea Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Thu, 10 Apr 2014 22:29:36 +0200 Subject: [PATCH 0097/2033] gnome-user-docs: new package licensed under the new licenses.cc-by-30 User and system administration help for the Gnome https://help.gnome.org/users/gnome-help/3.10 --- lib/licenses.nix | 6 ++++++ .../services/x11/desktop-managers/gnome3.nix | 1 + .../gnome-3/core/gnome-user-docs/default.nix | 20 +++++++++++++++++++ pkgs/desktops/gnome-3/default.nix | 2 ++ 4 files changed, 29 insertions(+) create mode 100644 pkgs/desktops/gnome-3/core/gnome-user-docs/default.nix diff --git a/lib/licenses.nix b/lib/licenses.nix index 603fddcb857..20c1b220031 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -64,6 +64,12 @@ url = https://fedoraproject.org/wiki/Licensing/BSD; }; + cc-by-30 = { + shortName = "CC BY 3.0"; + fullName = "Creative Commons Attribution 3.0"; + url = http://creativecommons.org/licenses/by/3.0; + }; + cddl = { shortName = "CDDL"; fullName = "Common Development Distribution License "; diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index aa231f2bad7..9f0d53bb653 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -85,6 +85,7 @@ in { gnome3.gnome-system-log gnome3.gnome-system-monitor gnome3.gnome_terminal + gnome3.gnome-user-docs gnome3.file-roller ] config.environment.gnome3.excludePackages); diff --git a/pkgs/desktops/gnome-3/core/gnome-user-docs/default.nix b/pkgs/desktops/gnome-3/core/gnome-user-docs/default.nix new file mode 100644 index 00000000000..d66863a2218 --- /dev/null +++ b/pkgs/desktops/gnome-3/core/gnome-user-docs/default.nix @@ -0,0 +1,20 @@ +{ stdenv, fetchurl, pkgconfig, file, gnome3, itstool, libxml2, intltool }: + +stdenv.mkDerivation rec { + name = "gnome-user-docs-3.10.3"; + + src = fetchurl { + url = "mirror://gnome/sources/gnome-user-docs/3.10/${name}.tar.xz"; + sha256 = "960b6373ea52e41e3deb3501930e024005b29d2cc958bfadc87450a291d2a905"; + }; + + buildInputs = [ pkgconfig gnome3.yelp itstool libxml2 intltool ]; + + meta = with stdenv.lib; { + homepage = https://help.gnome.org/users/gnome-help/3.10; + description = "User and system administration help for the Gnome desktop"; + maintainers = with maintainers; [ lethalman ]; + license = licenses.cc-by-30; + platforms = platforms.linux; + }; +} diff --git a/pkgs/desktops/gnome-3/default.nix b/pkgs/desktops/gnome-3/default.nix index d8d510b0bb9..5ac3fb75f16 100644 --- a/pkgs/desktops/gnome-3/default.nix +++ b/pkgs/desktops/gnome-3/default.nix @@ -86,6 +86,8 @@ rec { gnome_themes_standard = callPackage ./core/gnome-themes-standard { }; + gnome-user-docs = callPackage ./core/gnome-user-docs { }; + grilo = callPackage ./core/grilo { }; gsettings_desktop_schemas = callPackage ./core/gsettings-desktop-schemas { }; From 87284dd9e9196caa0c5aa78f997de4d4e8c58d48 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Thu, 10 Apr 2014 23:31:37 +0200 Subject: [PATCH 0098/2033] sushi, telepathy: make enabling the service overridable --- nixos/modules/services/x11/desktop-managers/gnome3.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 9f0d53bb653..be41d917792 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -32,9 +32,9 @@ in { services.accounts-daemon.enable = true; services.gnome3.at-spi2-core.enable = true; services.gnome3.evolution-data-server.enable = true; - services.gnome3.sushi.enable = true; + services.gnome3.sushi.enable = mkDefault true; services.gnome3.tracker.enable = mkDefault true; - services.telepathy.enable = true; + services.telepathy.enable = mkDefault true; networking.networkmanager.enable = true; services.upower.enable = config.powerManagement.enable; From 4c8b9fc957e4dcd15cd0e6ff7d55937f367c4a37 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Fri, 11 Apr 2014 00:24:40 +0200 Subject: [PATCH 0099/2033] sushi: upgrade to 3.10.0 --- pkgs/desktops/gnome-3/core/sushi/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/desktops/gnome-3/core/sushi/default.nix b/pkgs/desktops/gnome-3/core/sushi/default.nix index 55729a54669..089b5cd03c1 100644 --- a/pkgs/desktops/gnome-3/core/sushi/default.nix +++ b/pkgs/desktops/gnome-3/core/sushi/default.nix @@ -4,11 +4,11 @@ , gdk_pixbuf, librsvg, hicolor_icon_theme }: stdenv.mkDerivation rec { - name = "sushi-3.8.1"; + name = "sushi-3.10.0"; src = fetchurl { - url = "mirror://gnome/sources/sushi/3.8/${name}.tar.xz"; - sha256 = "c4f24d0961ce8fc5ef3a4fe9af178e368c7117459df2c0be12c8f953646c82dd"; + url = "mirror://gnome/sources/sushi/3.10/${name}.tar.xz"; + sha256 = "cffcf28b170f5825e84983a979972d4d901a453b61cbe3e560d362e8dd4b4bc8"; }; propagatedUserEnvPkgs = [ gst_all_1.gstreamer gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good ]; From 9d5a06cfe7160db895962815fb60d989e3705d4b Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Fri, 11 Apr 2014 00:28:15 +0200 Subject: [PATCH 0100/2033] gnome3: use package names for environment.gnome3.excludePackages --- lib/lists.nix | 2 -- .../modules/services/x11/desktop-managers/gnome3.nix | 12 +++++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/lists.nix b/lib/lists.nix index 6c7773304de..4b5f04a6758 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -227,6 +227,4 @@ in rec { crossLists = f: foldl (fs: args: concatMap (f: map f args) fs) [f]; - # List difference, xs - ys. Removes elements of ys from xs. - difference = xs: ys: filter (y: !(builtins.elem y ys)) xs; } diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index be41d917792..60a74d6c7fe 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -5,6 +5,16 @@ with pkgs.lib; let cfg = config.services.xserver.desktopManager.gnome3; gnome3 = pkgs.gnome3; + + # Remove packages of ys from xs, based on their names + removePackagesByName = xs: ys: + let + pkgName = drv: (builtins.parseDrvName drv.name).name; + ysNames = map pkgName ys; + res = (filter (x: !(builtins.elem (pkgName x) ysNames)) xs); + in + filter (x: !(builtins.elem (pkgName x) ysNames)) xs; + in { options = { @@ -68,7 +78,7 @@ in { gnome3.gnome_settings_daemon gnome3.gnome_shell gnome3.gnome_themes_standard - ] ++ (lists.difference [ + ] ++ (removePackagesByName [ gnome3.baobab gnome3.eog gnome3.epiphany From b0154961ed7765ae11dd857a4699e18a0a36015b Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Fri, 11 Apr 2014 00:41:51 +0200 Subject: [PATCH 0101/2033] gnome-keyring: add dbus service --- nixos/modules/module-list.nix | 1 + .../desktops/gnome3/gnome-keyring.nix | 40 +++++++++++++++++++ .../services/x11/desktop-managers/gnome3.nix | 1 + 3 files changed, 42 insertions(+) create mode 100644 nixos/modules/services/desktops/gnome3/gnome-keyring.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index a4915a2fa5c..2541bc6a98a 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -100,6 +100,7 @@ ./services/desktops/accountservice.nix ./services/desktops/gnome3/at-spi2-core.nix ./services/desktops/gnome3/evolution-data-server.nix + ./services/desktops/gnome3/gnome-keyring.nix ./services/desktops/gnome3/sushi.nix ./services/desktops/gnome3/tracker.nix ./services/desktops/telepathy.nix diff --git a/nixos/modules/services/desktops/gnome3/gnome-keyring.nix b/nixos/modules/services/desktops/gnome3/gnome-keyring.nix new file mode 100644 index 00000000000..447fd783f14 --- /dev/null +++ b/nixos/modules/services/desktops/gnome3/gnome-keyring.nix @@ -0,0 +1,40 @@ +# GNOME Keyring daemon. + +{ config, pkgs, ... }: + +with pkgs.lib; + +{ + + ###### interface + + options = { + + services.gnome3.gnome-keyring = { + + enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable GNOME Keyring daemon, a service designed to + take care of the user's security credentials, + such as user names and passwordsa search engine. + ''; + }; + + }; + + }; + + + ###### implementation + + config = mkIf config.services.gnome3.gnome-keyring.enable { + + environment.systemPackages = [ pkgs.gnome3.gnome_keyring ]; + + services.dbus.packages = [ pkgs.gnome3.gnome_keyring ]; + + }; + +} diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 60a74d6c7fe..a6f63304d7d 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -42,6 +42,7 @@ in { services.accounts-daemon.enable = true; services.gnome3.at-spi2-core.enable = true; services.gnome3.evolution-data-server.enable = true; + services.gnome3.gnome-keyring.enable = true; services.gnome3.sushi.enable = mkDefault true; services.gnome3.tracker.enable = mkDefault true; services.telepathy.enable = mkDefault true; From 191c4b6145aa3c3c2f2b62e4cd26b5ef019dc39e Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Fri, 11 Apr 2014 15:03:32 +0200 Subject: [PATCH 0102/2033] gnome3: make extensions.gnome.org recognize the gnome desktop --- nixos/modules/services/x11/desktop-managers/gnome3.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index a6f63304d7d..ea12ce2ef18 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -62,6 +62,9 @@ in { export XDG_MENU_PREFIX=gnome + # Don't let epiphany depend upon gnome-shell + export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${pkgs.gnome3.gnome_shell}/share/gsettings-schemas/${pkgs.gnome3.gnome_shell.name} + ${gnome3.gnome_session}/bin/gnome-session& waitPID=$! ''; From bff4580852853f064231397cd4125da8775216e5 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Fri, 11 Apr 2014 17:12:14 +0200 Subject: [PATCH 0103/2033] gnome-shell: add unzip to PATH for installing extensions --- pkgs/desktops/gnome-3/core/gnome-shell/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/desktops/gnome-3/core/gnome-shell/default.nix b/pkgs/desktops/gnome-3/core/gnome-shell/default.nix index 087b5778163..be25c615d97 100644 --- a/pkgs/desktops/gnome-3/core/gnome-shell/default.nix +++ b/pkgs/desktops/gnome-3/core/gnome-shell/default.nix @@ -1,6 +1,6 @@ { fetchurl, stdenv, pkgconfig, gnome3, json_glib, libcroco, intltool, libsecret , python, libsoup, polkit, clutter, networkmanager, docbook_xsl, docbook_xsl_ns -, libstartup_notification, telepathy_glib, telepathy_logger, libXtst, p11_kit +, libstartup_notification, telepathy_glib, telepathy_logger, libXtst, p11_kit, unzip , pulseaudio, libical, libtool, nss, gobjectIntrospection, gstreamer, makeWrapper , accountservice, gdk_pixbuf, gdm, upower, ibus, networkmanagerapplet, librsvg }: @@ -29,6 +29,7 @@ stdenv.mkDerivation rec { preFixup = with gnome3; '' wrapProgram "$out/bin/gnome-shell" \ + --prefix PATH : "${unzip}/bin" \ --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ --prefix LD_LIBRARY_PATH : "${accountservice}/lib:${ibus}/lib:${gdm}/lib" \ --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ From d3a34c18622ac7e65c1031e33047e7a278fa8829 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Fri, 11 Apr 2014 22:55:15 +0200 Subject: [PATCH 0104/2033] dconf: rm HighContrast icon cache --- pkgs/desktops/gnome-3/core/dconf/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/desktops/gnome-3/core/dconf/default.nix b/pkgs/desktops/gnome-3/core/dconf/default.nix index a485b18c5e5..a6236f16744 100644 --- a/pkgs/desktops/gnome-3/core/dconf/default.nix +++ b/pkgs/desktops/gnome-3/core/dconf/default.nix @@ -19,6 +19,7 @@ stdenv.mkDerivation rec { rm $out/lib/gio/modules/giomodule.cache rm $out/share/icons/hicolor/icon-theme.cache + rm $out/share/icons/HighContrast/icon-theme.cache ''; meta = with stdenv.lib; { From e08861a4cd7e5e6f84652230bb32d78d4b8dbb3f Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sat, 12 Apr 2014 12:48:16 +0200 Subject: [PATCH 0105/2033] mod_dnssd: new apache httpd 2.2 module Provide Zeroconf support via DNS-SD using Avahi http://0pointer.de/lennart/projects/mod_dnssd --- .../http/apache-modules/mod_dnssd/default.nix | 28 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/servers/http/apache-modules/mod_dnssd/default.nix diff --git a/pkgs/servers/http/apache-modules/mod_dnssd/default.nix b/pkgs/servers/http/apache-modules/mod_dnssd/default.nix new file mode 100644 index 00000000000..06f12820a10 --- /dev/null +++ b/pkgs/servers/http/apache-modules/mod_dnssd/default.nix @@ -0,0 +1,28 @@ +{ stdenv, fetchurl, pkgconfig, apacheHttpd_2_2, apr, avahi }: + +stdenv.mkDerivation rec { + name = "mod_dnssd-0.6"; + + src = fetchurl { + url = "http://0pointer.de/lennart/projects/mod_dnssd/${name}.tar.gz"; + sha256 = "2cd171d76eba398f03c1d5bcc468a1756f4801cd8ed5bd065086e4374997c5aa"; + }; + + configureFlags = [ "--disable-lynx" ]; + + buildInputs = [ pkgconfig apacheHttpd_2_2 avahi apr ]; + + installPhase = '' + mkdir -p $out/modules + cp src/.libs/mod_dnssd.so $out/modules + ''; + + meta = with stdenv.lib; { + homepage = http://0pointer.de/lennart/projects/mod_dnssd; + description = "Provide Zeroconf support via DNS-SD using Avahi"; + license = licenses.asl20; + platforms = platforms.linux; + maintainers = with maintainers; [ lethalman ]; + }; +} + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d695253fbbf..3ca1041fa09 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6451,6 +6451,8 @@ let memcached = callPackage ../servers/memcached {}; + mod_dnssd = callPackage ../servers/http/apache-modules/mod_dnssd/default.nix { }; + mod_evasive = callPackage ../servers/http/apache-modules/mod_evasive { }; mod_python = callPackage ../servers/http/apache-modules/mod_python { }; From a5b4c74a163660c1adca8ba273b4902ae65098ea Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Fri, 11 Apr 2014 23:13:31 +0200 Subject: [PATCH 0106/2033] gnome-user-share: new package Service that exports the contents of the Public folder in your home directory on the local network https://help.gnome.org/users/gnome-user-share/3.8 --- nixos/modules/module-list.nix | 1 + .../desktops/gnome3/gnome-user-share.nix | 42 +++++++++++++++ .../services/x11/desktop-managers/gnome3.nix | 1 + .../gnome-3/core/gnome-user-share/default.nix | 52 +++++++++++++++++++ pkgs/desktops/gnome-3/default.nix | 2 + 5 files changed, 98 insertions(+) create mode 100644 nixos/modules/services/desktops/gnome3/gnome-user-share.nix create mode 100644 pkgs/desktops/gnome-3/core/gnome-user-share/default.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 2541bc6a98a..bdb678248eb 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -101,6 +101,7 @@ ./services/desktops/gnome3/at-spi2-core.nix ./services/desktops/gnome3/evolution-data-server.nix ./services/desktops/gnome3/gnome-keyring.nix + ./services/desktops/gnome3/gnome-user-share.nix ./services/desktops/gnome3/sushi.nix ./services/desktops/gnome3/tracker.nix ./services/desktops/telepathy.nix diff --git a/nixos/modules/services/desktops/gnome3/gnome-user-share.nix b/nixos/modules/services/desktops/gnome3/gnome-user-share.nix new file mode 100644 index 00000000000..df796ed77ff --- /dev/null +++ b/nixos/modules/services/desktops/gnome3/gnome-user-share.nix @@ -0,0 +1,42 @@ +# GNOME User Share daemon. + +{ config, pkgs, ... }: + +with pkgs.lib; + +{ + + ###### interface + + options = { + + services.gnome3.gnome-user-share = { + + enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable GNOME User Share, a service that exports the + contents of the Public folder in your home directory on the local network. + ''; + }; + + }; + + }; + + + ###### implementation + + config = mkIf config.services.gnome3.gnome-user-share.enable { + + environment.systemPackages = [ pkgs.gnome3.gnome-user-share ]; + + services.xserver.displayManager.sessionCommands = with pkgs.gnome3; '' + # Don't let gnome-control-center depend upon gnome-user-share + export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${gnome-user-share}/share/gsettings-schemas/${gnome-user-share.name} + ''; + + }; + +} diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index ea12ce2ef18..f7f11ff5f92 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -43,6 +43,7 @@ in { services.gnome3.at-spi2-core.enable = true; services.gnome3.evolution-data-server.enable = true; services.gnome3.gnome-keyring.enable = true; + services.gnome3.gnome-user-share.enable = mkDefault true; services.gnome3.sushi.enable = mkDefault true; services.gnome3.tracker.enable = mkDefault true; services.telepathy.enable = mkDefault true; diff --git a/pkgs/desktops/gnome-3/core/gnome-user-share/default.nix b/pkgs/desktops/gnome-3/core/gnome-user-share/default.nix new file mode 100644 index 00000000000..976b0eaca45 --- /dev/null +++ b/pkgs/desktops/gnome-3/core/gnome-user-share/default.nix @@ -0,0 +1,52 @@ +{ stdenv, intltool, fetchurl, apacheHttpd_2_2, nautilus +, pkgconfig, gtk3, glib, hicolor_icon_theme, libxml2, gnused +, bash, makeWrapper, itstool, libnotify, libtool, mod_dnssd +, gnome3, librsvg, gdk_pixbuf, file, libcanberra_gtk3 }: + +stdenv.mkDerivation rec { + name = "gnome-user-share-3.10.2"; + + src = fetchurl { + url = "mirror://gnome/sources/gnome-user-share/3.10/${name}.tar.xz"; + sha256 = "1d1ea57a49224c36e7cba04f80265e835639377f474a7582c9e8ac946eda0f8f"; + }; + + doCheck = true; + + NIX_CFLAGS_COMPILE = "-I${gnome3.glib}/include/gio-unix-2.0"; + + preConfigure = '' + sed -e 's,^LoadModule dnssd_module.\+,LoadModule dnssd_module ${mod_dnssd}/modules/mod_dnssd.so,' -i data/dav_user_2.2.conf + ''; + + configureFlags = [ "--with-httpd=${apacheHttpd_2_2}/bin/httpd" + "--with-modules-path=${apacheHttpd_2_2}/modules" + "--disable-bluetooth" + "--with-nautilusdir=$(out)/lib/nautilus/extensions-3.0" ]; + + buildInputs = [ pkgconfig gtk3 glib intltool itstool libxml2 libtool + makeWrapper file gdk_pixbuf gnome3.gnome_icon_theme librsvg + hicolor_icon_theme gnome3.gnome_icon_theme_symbolic + nautilus libnotify libcanberra_gtk3 ]; + + postInstall = '' + mkdir -p $out/share/gsettings-schemas/$name + mv $out/share/glib-2.0 $out/share/gsettings-schemas/$name + ${glib}/bin/glib-compile-schemas $out/share/gsettings-schemas/$name/glib-2.0/schemas + ''; + + preFixup = '' + wrapProgram "$out/libexec/gnome-user-share" \ + --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ + --prefix XDG_DATA_DIRS : "$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" + rm $out/share/icons/hicolor/icon-theme.cache + ''; + + meta = with stdenv.lib; { + homepage = https://help.gnome.org/users/gnome-user-share/3.8; + description = "Service that exports the contents of the Public folder in your home directory on the local network"; + maintainers = with maintainers; [ lethalman ]; + license = licenses.gpl2; + platforms = platforms.linux; + }; +} diff --git a/pkgs/desktops/gnome-3/default.nix b/pkgs/desktops/gnome-3/default.nix index 5ac3fb75f16..a6d4f6197d8 100644 --- a/pkgs/desktops/gnome-3/default.nix +++ b/pkgs/desktops/gnome-3/default.nix @@ -88,6 +88,8 @@ rec { gnome-user-docs = callPackage ./core/gnome-user-docs { }; + gnome-user-share = callPackage ./core/gnome-user-share { }; + grilo = callPackage ./core/grilo { }; gsettings_desktop_schemas = callPackage ./core/gsettings-desktop-schemas { }; From add4977a91f90db9ae3389e204f9277f4d43ca17 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sat, 12 Apr 2014 16:30:29 +0200 Subject: [PATCH 0107/2033] system-path, gnome3: run update-desktop-database to create the mime cache This allows programs such as yelp to handle help:// protocol schemas --- nixos/modules/config/system-path.nix | 4 ++++ nixos/modules/services/x11/desktop-managers/gnome3.nix | 1 + 2 files changed, 5 insertions(+) diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix index 1913e17f929..37d452cf942 100644 --- a/nixos/modules/config/system-path.nix +++ b/nixos/modules/config/system-path.nix @@ -135,6 +135,10 @@ in if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas fi + + if [ -x $out/bin/update-desktop-database -a -w $out/share/applications ]; then + $out/bin/update-desktop-database $out/share/applications + fi ''; }; diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index f7f11ff5f92..7930a6457fd 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -75,6 +75,7 @@ in { "${pkgs.glib_networking}/lib/gio/modules" ]; environment.systemPackages = [ gnome3.dconf + pkgs.desktop_file_utils pkgs.glib_networking pkgs.ibus gnome3.gnome-backgrounds From 64ce2101a48643ccc407cc5288b9f593ec7b6f15 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sat, 12 Apr 2014 19:43:42 +0200 Subject: [PATCH 0108/2033] telepathy-glib: update to 0.24.0 Adding a gnome online account was not possible due to https://bugs.freedesktop.org/show_bug.cgi?id=68892 --- pkgs/development/libraries/telepathy/glib/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/telepathy/glib/default.nix b/pkgs/development/libraries/telepathy/glib/default.nix index 78d2d520050..6c0806ec4cd 100644 --- a/pkgs/development/libraries/telepathy/glib/default.nix +++ b/pkgs/development/libraries/telepathy/glib/default.nix @@ -2,11 +2,11 @@ , gobjectIntrospection, valaSupport ? true, vala }: stdenv.mkDerivation rec { - name = "telepathy-glib-0.22.1"; + name = "telepathy-glib-0.24.0"; src = fetchurl { url = "${meta.homepage}/releases/telepathy-glib/${name}.tar.gz"; - sha256 = "0vf2drh7g55nxyd0mxyn9sf99m981dagnvv9yc3q9f4k8x092a78"; + sha256 = "ae0002134991217f42e503c43dea7817853afc18863b913744d51ffa029818cf"; }; configureFlags = stdenv.lib.optional valaSupport "--enable-vala-bindings"; From c6383af311edacfb837be33ae00413b017bf52a9 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sat, 12 Apr 2014 19:45:12 +0200 Subject: [PATCH 0109/2033] gnome-online-accounts: add dbus service --- nixos/modules/module-list.nix | 1 + .../desktops/gnome3/gnome-online-accounts.nix | 39 +++++++++++++++++++ .../services/x11/desktop-managers/gnome3.nix | 1 + .../core/gnome-control-center/default.nix | 4 ++ .../core/gnome-online-accounts/default.nix | 2 + 5 files changed, 47 insertions(+) create mode 100644 nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index bdb678248eb..bf7e2eb3fa2 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -101,6 +101,7 @@ ./services/desktops/gnome3/at-spi2-core.nix ./services/desktops/gnome3/evolution-data-server.nix ./services/desktops/gnome3/gnome-keyring.nix + ./services/desktops/gnome3/gnome-online-accounts.nix ./services/desktops/gnome3/gnome-user-share.nix ./services/desktops/gnome3/sushi.nix ./services/desktops/gnome3/tracker.nix diff --git a/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix b/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix new file mode 100644 index 00000000000..365e19c15bb --- /dev/null +++ b/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix @@ -0,0 +1,39 @@ +# GNOME Online Accounts daemon. + +{ config, pkgs, ... }: + +with pkgs.lib; + +{ + + ###### interface + + options = { + + services.gnome3.gnome-online-accounts = { + + enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable GNOME Online Accounts daemon, a service that provides + a single sign-on framework for the GNOME desktop. + ''; + }; + + }; + + }; + + + ###### implementation + + config = mkIf config.services.gnome3.gnome-online-accounts.enable { + + environment.systemPackages = [ pkgs.gnome3.gnome_online_accounts ]; + + services.dbus.packages = [ pkgs.gnome3.gnome_online_accounts ]; + + }; + +} diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 7930a6457fd..72729f1c1f6 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -43,6 +43,7 @@ in { services.gnome3.at-spi2-core.enable = true; services.gnome3.evolution-data-server.enable = true; services.gnome3.gnome-keyring.enable = true; + services.gnome3.gnome-online-accounts.enable = mkDefault true; services.gnome3.gnome-user-share.enable = mkDefault true; services.gnome3.sushi.enable = mkDefault true; services.gnome3.tracker.enable = mkDefault true; diff --git a/pkgs/desktops/gnome-3/core/gnome-control-center/default.nix b/pkgs/desktops/gnome-3/core/gnome-control-center/default.nix index 92a6b6c2c40..76b06f59bcb 100644 --- a/pkgs/desktops/gnome-3/core/gnome-control-center/default.nix +++ b/pkgs/desktops/gnome-3/core/gnome-control-center/default.nix @@ -20,6 +20,8 @@ stdenv.mkDerivation rec { propagatedBuildInputs = [ gdk_pixbuf gnome3.gnome_icon_theme librsvg hicolor_icon_theme gnome3.gnome_icon_theme_symbolic ]; + enableParallelBuilding = true; + buildInputs = with gnome3; [ pkgconfig intltool ibus gtk glib upower libcanberra gsettings_desktop_schemas libxml2 gnome_desktop gnome_settings_daemon polkit libxslt libgtop gnome-menus @@ -48,6 +50,8 @@ stdenv.mkDerivation rec { ''; meta = with stdenv.lib; { + description = "Single sign-on framework for GNOME"; + maintainers = with maintainers; [ lethalman ]; platforms = platforms.linux; }; diff --git a/pkgs/desktops/gnome-3/core/gnome-online-accounts/default.nix b/pkgs/desktops/gnome-3/core/gnome-online-accounts/default.nix index c17b3ba3eb6..8c459435733 100644 --- a/pkgs/desktops/gnome-3/core/gnome-online-accounts/default.nix +++ b/pkgs/desktops/gnome-3/core/gnome-online-accounts/default.nix @@ -12,6 +12,8 @@ stdenv.mkDerivation rec { NIX_CFLAGS_COMPILE = "-I${dbus_glib}/include/dbus-1.0 -I${dbus_libs}/include/dbus-1.0"; + enableParallelBuilding = true; + buildInputs = [ pkgconfig glib libxslt gtk webkitgtk json_glib rest libsecret dbus_glib telepathy_glib intltool icu libsoup docbook_xsl_ns docbook_xsl]; meta = with stdenv.lib; { From dd23d9a5a7d4bad9bdcccc5eeccd03bba4d2cdcb Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sun, 13 Apr 2014 17:19:56 +0200 Subject: [PATCH 0110/2033] libnotify: enable gobject introspection --- .../development/libraries/libnotify/default.nix | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/pkgs/development/libraries/libnotify/default.nix b/pkgs/development/libraries/libnotify/default.nix index 00308bf9471..2b82fe2a4bc 100644 --- a/pkgs/development/libraries/libnotify/default.nix +++ b/pkgs/development/libraries/libnotify/default.nix @@ -1,4 +1,5 @@ -{ stdenv, fetchurl, pkgconfig, automake, autoconf, libtool, glib, gdk_pixbuf }: +{ stdenv, fetchurl, pkgconfig, automake, autoconf, libtool +, glib, gdk_pixbuf, gobjectIntrospection, autoreconfHook }: stdenv.mkDerivation rec { ver_maj = "0.7"; @@ -9,23 +10,15 @@ stdenv.mkDerivation rec { url = "mirror://gnome/sources/libnotify/${ver_maj}/${name}.tar.xz"; sha256 = "0dyq8zgjnnzcah31axnx6afb21kl7bks1gvrg4hjh3nk02j1rxhf"; }; - src_m4 = fetchurl { - url = "mirror://gentoo/distfiles/introspection-20110205.m4.tar.bz2"; - sha256 = "1cnqh7aaji648nfd5537v7xaak8hgww3bpifhwam7bl0sc3ad523"; - }; # see Gentoo ebuild - we don't need to depend on gtk+(2/3) - preConfigure = '' - cd m4 - tar xvf ${src_m4} - cd .. - + preAutoreconf = '' sed -i -e 's:noinst_PROG:check_PROG:' tests/Makefile.am || die sed -i -e '/PKG_CHECK_MODULES(TESTS/d' configure.ac || die - AT_M4DIR=. autoreconf ''; - buildInputs = [ pkgconfig automake autoconf glib gdk_pixbuf ]; + buildInputs = [ pkgconfig automake autoconf autoreconfHook + libtool glib gdk_pixbuf gobjectIntrospection ]; meta = { homepage = http://galago-project.org/; # very obsolete but found no better From 3cc07a44bc45886cb194f79c87a4ebb093c11ddf Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sun, 13 Apr 2014 17:20:40 +0200 Subject: [PATCH 0111/2033] gnome-tweak-tool: new package A tool to customize advanced GNOME 3 options https://wiki.gnome.org/action/show/Apps/GnomeTweakTool --- .../services/x11/desktop-managers/gnome3.nix | 1 + pkgs/desktops/gnome-3/default.nix | 2 + .../gnome-3/misc/gnome-tweak-tool/default.nix | 46 +++++++++++++++++++ .../gnome-tweak-tool/find_gsettings.patch | 22 +++++++++ 4 files changed, 71 insertions(+) create mode 100644 pkgs/desktops/gnome-3/misc/gnome-tweak-tool/default.nix create mode 100644 pkgs/desktops/gnome-3/misc/gnome-tweak-tool/find_gsettings.patch diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 72729f1c1f6..c8a996dca08 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -105,6 +105,7 @@ in { gnome3.gnome-user-docs gnome3.file-roller + gnome3.gnome-tweak-tool ] config.environment.gnome3.excludePackages); }; diff --git a/pkgs/desktops/gnome-3/default.nix b/pkgs/desktops/gnome-3/default.nix index a6d4f6197d8..4518293f68e 100644 --- a/pkgs/desktops/gnome-3/default.nix +++ b/pkgs/desktops/gnome-3/default.nix @@ -162,4 +162,6 @@ rec { libgit2-glib = callPackage ./misc/libgit2-glib { }; gexiv2 = callPackage ./misc/gexiv2 { }; + + gnome-tweak-tool = callPackage ./misc/gnome-tweak-tool { }; } diff --git a/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/default.nix b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/default.nix new file mode 100644 index 00000000000..2eccb9a32cf --- /dev/null +++ b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/default.nix @@ -0,0 +1,46 @@ +{ stdenv, intltool, fetchurl, python, pygobject3, atk +, pkgconfig, gtk3, glib, hicolor_icon_theme, libsoup +, bash, makeWrapper, itstool, libxml2, python3Packages +, gnome3, librsvg, gdk_pixbuf, file, libnotify }: + +stdenv.mkDerivation rec { + name = "gnome-tweak-tool-3.10.1"; + + src = fetchurl { + url = "mirror://gnome/sources/gnome-tweak-tool/3.10/${name}.tar.xz"; + sha256 = "fb5af9022c0521a925ef9f295e4080212b1b45427cd5f5f3a901667590afa7ec"; + }; + + doCheck = true; + + propagatedUserEnvPkgs = [ gnome3.gnome_themes_standard ]; + + makeFlags = [ "DESTDIR=/" ]; + + buildInputs = [ pkgconfig gtk3 glib intltool itstool libxml2 + gnome3.gsettings_desktop_schemas makeWrapper file + gdk_pixbuf gnome3.gnome_icon_theme librsvg + hicolor_icon_theme gnome3.gnome_icon_theme_symbolic + python pygobject3 libnotify gnome3.gnome_shell + libsoup gnome3.gnome_settings_daemon gnome3.nautilus + gnome3.gnome_desktop ]; + + preFixup = '' + wrapProgram "$out/bin/gnome-tweak-tool" \ + --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ + --prefix XDG_DATA_DIRS : "${gtk3}/share:${gnome3.gnome_themes_standard}/share:$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \ + --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ + --prefix LD_LIBRARY_PATH ":" "${libsoup}/lib:${gnome3.gnome_desktop}/lib:${libnotify}/lib:${gtk3}/lib:${atk}/lib" \ + --prefix PYTHONPATH : "$PYTHONPATH:$(toPythonPath $out)" + ''; + + patches = [ ./find_gsettings.patch ]; + + meta = with stdenv.lib; { + homepage = https://wiki.gnome.org/action/show/Apps/GnomeTweakTool; + description = "A tool to customize advanced GNOME 3 options"; + maintainers = with maintainers; [ lethalman ]; + license = licenses.gpl3; + platforms = platforms.linux; + }; +} diff --git a/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/find_gsettings.patch b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/find_gsettings.patch new file mode 100644 index 00000000000..3e68c04cb3a --- /dev/null +++ b/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/find_gsettings.patch @@ -0,0 +1,22 @@ +diff --git a/gtweak/gsettings.py b/gtweak/gsettings.py +index a00fe19..dce74b2 100644 +--- a/gtweak/gsettings.py ++++ b/gtweak/gsettings.py +@@ -33,10 +33,15 @@ class GSettingsMissingError(Exception): + + class _GSettingsSchema: + def __init__(self, schema_name, schema_dir=None, schema_filename=None, **options): +- if not schema_dir: +- schema_dir = gtweak.GSETTINGS_SCHEMA_DIR + if not schema_filename: + schema_filename = schema_name + ".gschema.xml" ++ if not schema_dir: ++ schema_dir = gtweak.GSETTINGS_SCHEMA_DIR ++ for xdg_dir in GLib.get_system_data_dirs(): ++ dir = os.path.join(xdg_dir, "glib-2.0", "schemas") ++ if os.path.exists(os.path.join(dir, schema_filename)): ++ schema_dir = dir ++ break + + schema_path = os.path.join(schema_dir, schema_filename) + if not os.path.exists(schema_path): From 997b4898b51ca06b952f926c8c026122889dc277 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sun, 13 Apr 2014 17:22:07 +0200 Subject: [PATCH 0112/2033] gnome-shell-extensions: new package Modify and extend GNOME Shell functionality and behavior https://wiki.gnome.org/Projects/GnomeShell/Extensions --- .../services/x11/desktop-managers/gnome3.nix | 1 + .../core/gnome-shell-extensions/default.nix | 26 +++++++++++++++++++ pkgs/desktops/gnome-3/default.nix | 2 ++ 3 files changed, 29 insertions(+) create mode 100644 pkgs/desktops/gnome-3/core/gnome-shell-extensions/default.nix diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index c8a996dca08..54bc8524607 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -99,6 +99,7 @@ in { gnome3.gnome-contacts gnome3.gnome-font-viewer gnome3.gnome-screenshot + gnome3.gnome-shell-extensions gnome3.gnome-system-log gnome3.gnome-system-monitor gnome3.gnome_terminal diff --git a/pkgs/desktops/gnome-3/core/gnome-shell-extensions/default.nix b/pkgs/desktops/gnome-3/core/gnome-shell-extensions/default.nix new file mode 100644 index 00000000000..00974edb1db --- /dev/null +++ b/pkgs/desktops/gnome-3/core/gnome-shell-extensions/default.nix @@ -0,0 +1,26 @@ +{ stdenv, intltool, fetchurl, libgtop +, pkgconfig, gtk3, glib, hicolor_icon_theme +, bash, makeWrapper, itstool +, gnome3, file }: + +stdenv.mkDerivation rec { + name = "gnome-shell-extensions-3.10.1"; + + src = fetchurl { + url = "mirror://gnome/sources/gnome-shell-extensions/3.10/${name}.tar.xz"; + sha256 = "9baa9ddaf4e14cab6d4d7944d8dc009378b25f995acfd0fd72843f599cb5ae43"; + }; + + doCheck = true; + + buildInputs = [ pkgconfig gtk3 glib libgtop intltool itstool + makeWrapper file ]; + + meta = with stdenv.lib; { + homepage = https://wiki.gnome.org/Projects/GnomeShell/Extensions; + description = "Modify and extend GNOME Shell functionality and behavior"; + maintainers = with maintainers; [ lethalman ]; + license = licenses.gpl2; + platforms = platforms.linux; + }; +} diff --git a/pkgs/desktops/gnome-3/default.nix b/pkgs/desktops/gnome-3/default.nix index 4518293f68e..d29ea3d1c69 100644 --- a/pkgs/desktops/gnome-3/default.nix +++ b/pkgs/desktops/gnome-3/default.nix @@ -74,6 +74,8 @@ rec { gnome_shell = callPackage ./core/gnome-shell { }; + gnome-shell-extensions = callPackage ./core/gnome-shell-extensions { }; + gnome-screenshot = callPackage ./core/gnome-screenshot { }; gnome_settings_daemon = callPackage ./core/gnome-settings-daemon { }; From ba29614578dd7181a05ed0972c80ba59548b6f52 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 14 Apr 2014 10:19:30 +0200 Subject: [PATCH 0113/2033] Manual: Generate stable ids for options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit E.g. ‘#opt-boot.initrd.kernelModules’. Also, shut up a stupid XSLT warning (‘attribute value is not an NCName’). --- nixos/doc/manual/options-to-docbook.xsl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl index 9647aae0f2f..6170332880f 100644 --- a/nixos/doc/manual/options-to-docbook.xsl +++ b/nixos/doc/manual/options-to-docbook.xsl @@ -18,8 +18,10 @@ + - + +