├── .bzr ├── branch │ ├── tags │ ├── format │ ├── last-revision │ └── branch.conf ├── checkout │ ├── views │ ├── conflicts │ ├── format │ └── dirstate ├── branch-format ├── repository │ ├── format │ ├── pack-names │ ├── indices │ │ ├── 001681c55364e62751da6a4dd63e8382.six │ │ ├── 158473cb560447dc77a38a29309bd6f9.six │ │ ├── 001681c55364e62751da6a4dd63e8382.cix │ │ ├── 001681c55364e62751da6a4dd63e8382.iix │ │ ├── 001681c55364e62751da6a4dd63e8382.rix │ │ ├── 001681c55364e62751da6a4dd63e8382.tix │ │ ├── 158473cb560447dc77a38a29309bd6f9.cix │ │ ├── 158473cb560447dc77a38a29309bd6f9.iix │ │ ├── 158473cb560447dc77a38a29309bd6f9.rix │ │ └── 158473cb560447dc77a38a29309bd6f9.tix │ ├── obsolete_packs │ │ ├── 4d4d5e14fdbcd47effdabc872f3d1ebb.six │ │ ├── 648f619d5da21fceb43b875ecdd49d5a.six │ │ ├── 715ecfdc154a80b539e99bb14909903a.six │ │ ├── f333639bbd14bb0ae2cb29be34cfdf11.six │ │ ├── f5f342366fb479f0f70ea9327bb595b8.six │ │ ├── 4d4d5e14fdbcd47effdabc872f3d1ebb.cix │ │ ├── 4d4d5e14fdbcd47effdabc872f3d1ebb.iix │ │ ├── 4d4d5e14fdbcd47effdabc872f3d1ebb.pack │ │ ├── 4d4d5e14fdbcd47effdabc872f3d1ebb.rix │ │ ├── 4d4d5e14fdbcd47effdabc872f3d1ebb.tix │ │ ├── 648f619d5da21fceb43b875ecdd49d5a.cix │ │ ├── 648f619d5da21fceb43b875ecdd49d5a.iix │ │ ├── 648f619d5da21fceb43b875ecdd49d5a.pack │ │ ├── 648f619d5da21fceb43b875ecdd49d5a.rix │ │ ├── 648f619d5da21fceb43b875ecdd49d5a.tix │ │ ├── 715ecfdc154a80b539e99bb14909903a.cix │ │ ├── 715ecfdc154a80b539e99bb14909903a.iix │ │ ├── 715ecfdc154a80b539e99bb14909903a.pack │ │ ├── 715ecfdc154a80b539e99bb14909903a.rix │ │ ├── 715ecfdc154a80b539e99bb14909903a.tix │ │ ├── f333639bbd14bb0ae2cb29be34cfdf11.cix │ │ ├── f333639bbd14bb0ae2cb29be34cfdf11.iix │ │ ├── f333639bbd14bb0ae2cb29be34cfdf11.pack │ │ ├── f333639bbd14bb0ae2cb29be34cfdf11.rix │ │ ├── f333639bbd14bb0ae2cb29be34cfdf11.tix │ │ ├── f5f342366fb479f0f70ea9327bb595b8.cix │ │ ├── f5f342366fb479f0f70ea9327bb595b8.iix │ │ ├── f5f342366fb479f0f70ea9327bb595b8.pack │ │ ├── f5f342366fb479f0f70ea9327bb595b8.rix │ │ └── f5f342366fb479f0f70ea9327bb595b8.tix │ └── packs │ │ ├── 001681c55364e62751da6a4dd63e8382.pack │ │ └── 158473cb560447dc77a38a29309bd6f9.pack └── README ├── src ├── lxlauncher ├── Widgets │ ├── FavouritesBar.vala │ ├── SearchEntry.vala │ ├── Preferences.vala │ ├── LauncherView.vala │ ├── TabButton.vala │ ├── SearchView.vala │ ├── FavouriteLauncher.vala │ ├── Launcher.vala │ └── PreferencesSetting ├── lxlauncher.css ├── Misc.vala ├── Backend │ ├── Category.vala │ ├── App.vala │ └── AppDatabase.vala ├── Config.vala └── Frontend.vala ├── lxlauncher-vala.deb ├── desktopsetting ├── lxlauncher ├── DesktopSetting ├── PreferencesSetting.vala └── DesktopSetting.vala ├── lxlauncher-vala ├── usr │ ├── bin │ │ └── lxlauncher │ └── share │ │ └── doc │ │ └── lxlauncher │ │ ├── changelog.Debian.gz │ │ ├── README │ │ ├── README.Debian │ │ └── copyright ├── etc │ └── xdg │ │ ├── autostart │ │ └── lxlauncher.desktop │ │ └── lxlauncher │ │ └── background.png └── DEBIAN │ └── control ├── README ├── compile-project.sh └── vapi └── libmenu-cache.vapi /.bzr/branch/tags: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.bzr/checkout/views: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.bzr/branch-format: -------------------------------------------------------------------------------- 1 | Bazaar-NG meta directory, format 1 2 | -------------------------------------------------------------------------------- /.bzr/checkout/conflicts: -------------------------------------------------------------------------------- 1 | BZR conflict list format 1 2 | -------------------------------------------------------------------------------- /.bzr/branch/format: -------------------------------------------------------------------------------- 1 | Bazaar Branch Format 7 (needs bzr 1.6) 2 | -------------------------------------------------------------------------------- /.bzr/checkout/format: -------------------------------------------------------------------------------- 1 | Bazaar Working Tree Format 6 (bzr 1.14) 2 | -------------------------------------------------------------------------------- /.bzr/branch/last-revision: -------------------------------------------------------------------------------- 1 | 20 vanhonit@gmail.com-20120626021253-njf2o4083bv3et8a 2 | -------------------------------------------------------------------------------- /.bzr/repository/format: -------------------------------------------------------------------------------- 1 | Bazaar repository format 2a (needs bzr 1.16 or later) 2 | -------------------------------------------------------------------------------- /src/lxlauncher: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/src/lxlauncher -------------------------------------------------------------------------------- /lxlauncher-vala.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/lxlauncher-vala.deb -------------------------------------------------------------------------------- /.bzr/repository/pack-names: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/pack-names -------------------------------------------------------------------------------- /desktopsetting/lxlauncher: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/desktopsetting/lxlauncher -------------------------------------------------------------------------------- /desktopsetting/DesktopSetting: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/desktopsetting/DesktopSetting -------------------------------------------------------------------------------- /lxlauncher-vala/usr/bin/lxlauncher: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/lxlauncher-vala/usr/bin/lxlauncher -------------------------------------------------------------------------------- /.bzr/repository/indices/001681c55364e62751da6a4dd63e8382.six: -------------------------------------------------------------------------------- 1 | B+Tree Graph Index 2 2 | node_ref_lists=0 3 | key_elements=1 4 | len=0 5 | row_lengths= 6 | -------------------------------------------------------------------------------- /.bzr/repository/indices/158473cb560447dc77a38a29309bd6f9.six: -------------------------------------------------------------------------------- 1 | B+Tree Graph Index 2 2 | node_ref_lists=0 3 | key_elements=1 4 | len=0 5 | row_lengths= 6 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | To try lxlauncher, type: 2 | ./compile-project.sh 3 | lxlauncher will be compiled and launched. 4 | at the moment there is no build system. 5 | -------------------------------------------------------------------------------- /lxlauncher-vala/etc/xdg/autostart/lxlauncher.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=LxLauncher 4 | Exec=lxlauncher 5 | NoDisplay=true 6 | 7 | -------------------------------------------------------------------------------- /lxlauncher-vala/etc/xdg/lxlauncher/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/lxlauncher-vala/etc/xdg/lxlauncher/background.png -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/4d4d5e14fdbcd47effdabc872f3d1ebb.six: -------------------------------------------------------------------------------- 1 | B+Tree Graph Index 2 2 | node_ref_lists=0 3 | key_elements=1 4 | len=0 5 | row_lengths= 6 | -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/648f619d5da21fceb43b875ecdd49d5a.six: -------------------------------------------------------------------------------- 1 | B+Tree Graph Index 2 2 | node_ref_lists=0 3 | key_elements=1 4 | len=0 5 | row_lengths= 6 | -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/715ecfdc154a80b539e99bb14909903a.six: -------------------------------------------------------------------------------- 1 | B+Tree Graph Index 2 2 | node_ref_lists=0 3 | key_elements=1 4 | len=0 5 | row_lengths= 6 | -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f333639bbd14bb0ae2cb29be34cfdf11.six: -------------------------------------------------------------------------------- 1 | B+Tree Graph Index 2 2 | node_ref_lists=0 3 | key_elements=1 4 | len=0 5 | row_lengths= 6 | -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f5f342366fb479f0f70ea9327bb595b8.six: -------------------------------------------------------------------------------- 1 | B+Tree Graph Index 2 2 | node_ref_lists=0 3 | key_elements=1 4 | len=0 5 | row_lengths= 6 | -------------------------------------------------------------------------------- /.bzr/README: -------------------------------------------------------------------------------- 1 | This is a Bazaar control directory. 2 | Do not change any files in this directory. 3 | See http://bazaar.canonical.com/ for more information about Bazaar. 4 | -------------------------------------------------------------------------------- /.bzr/repository/packs/001681c55364e62751da6a4dd63e8382.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/packs/001681c55364e62751da6a4dd63e8382.pack -------------------------------------------------------------------------------- /.bzr/repository/packs/158473cb560447dc77a38a29309bd6f9.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/packs/158473cb560447dc77a38a29309bd6f9.pack -------------------------------------------------------------------------------- /.bzr/repository/indices/001681c55364e62751da6a4dd63e8382.cix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/indices/001681c55364e62751da6a4dd63e8382.cix -------------------------------------------------------------------------------- /.bzr/repository/indices/001681c55364e62751da6a4dd63e8382.iix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/indices/001681c55364e62751da6a4dd63e8382.iix -------------------------------------------------------------------------------- /.bzr/repository/indices/001681c55364e62751da6a4dd63e8382.rix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/indices/001681c55364e62751da6a4dd63e8382.rix -------------------------------------------------------------------------------- /.bzr/repository/indices/001681c55364e62751da6a4dd63e8382.tix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/indices/001681c55364e62751da6a4dd63e8382.tix -------------------------------------------------------------------------------- /.bzr/repository/indices/158473cb560447dc77a38a29309bd6f9.cix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/indices/158473cb560447dc77a38a29309bd6f9.cix -------------------------------------------------------------------------------- /.bzr/repository/indices/158473cb560447dc77a38a29309bd6f9.iix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/indices/158473cb560447dc77a38a29309bd6f9.iix -------------------------------------------------------------------------------- /.bzr/repository/indices/158473cb560447dc77a38a29309bd6f9.rix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/indices/158473cb560447dc77a38a29309bd6f9.rix -------------------------------------------------------------------------------- /.bzr/repository/indices/158473cb560447dc77a38a29309bd6f9.tix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/indices/158473cb560447dc77a38a29309bd6f9.tix -------------------------------------------------------------------------------- /lxlauncher-vala/usr/share/doc/lxlauncher/changelog.Debian.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/lxlauncher-vala/usr/share/doc/lxlauncher/changelog.Debian.gz -------------------------------------------------------------------------------- /.bzr/branch/branch.conf: -------------------------------------------------------------------------------- 1 | parent_location = http://bazaar.launchpad.net/~stephen-smally/lxlauncher/trunk/ 2 | push_location = bzr+ssh://bazaar.launchpad.net/~vanhonit/lxlauncher/lxlauncher/ 3 | -------------------------------------------------------------------------------- /lxlauncher-vala/usr/share/doc/lxlauncher/README: -------------------------------------------------------------------------------- 1 | To try lxlauncher, type: 2 | ./compile-project.sh 3 | lxlauncher will be compiled and launched. 4 | at the moment there is no build system. 5 | -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/4d4d5e14fdbcd47effdabc872f3d1ebb.cix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/4d4d5e14fdbcd47effdabc872f3d1ebb.cix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/4d4d5e14fdbcd47effdabc872f3d1ebb.iix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/4d4d5e14fdbcd47effdabc872f3d1ebb.iix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/4d4d5e14fdbcd47effdabc872f3d1ebb.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/4d4d5e14fdbcd47effdabc872f3d1ebb.pack -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/4d4d5e14fdbcd47effdabc872f3d1ebb.rix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/4d4d5e14fdbcd47effdabc872f3d1ebb.rix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/4d4d5e14fdbcd47effdabc872f3d1ebb.tix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/4d4d5e14fdbcd47effdabc872f3d1ebb.tix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/648f619d5da21fceb43b875ecdd49d5a.cix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/648f619d5da21fceb43b875ecdd49d5a.cix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/648f619d5da21fceb43b875ecdd49d5a.iix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/648f619d5da21fceb43b875ecdd49d5a.iix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/648f619d5da21fceb43b875ecdd49d5a.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/648f619d5da21fceb43b875ecdd49d5a.pack -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/648f619d5da21fceb43b875ecdd49d5a.rix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/648f619d5da21fceb43b875ecdd49d5a.rix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/648f619d5da21fceb43b875ecdd49d5a.tix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/648f619d5da21fceb43b875ecdd49d5a.tix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/715ecfdc154a80b539e99bb14909903a.cix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/715ecfdc154a80b539e99bb14909903a.cix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/715ecfdc154a80b539e99bb14909903a.iix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/715ecfdc154a80b539e99bb14909903a.iix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/715ecfdc154a80b539e99bb14909903a.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/715ecfdc154a80b539e99bb14909903a.pack -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/715ecfdc154a80b539e99bb14909903a.rix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/715ecfdc154a80b539e99bb14909903a.rix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/715ecfdc154a80b539e99bb14909903a.tix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/715ecfdc154a80b539e99bb14909903a.tix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f333639bbd14bb0ae2cb29be34cfdf11.cix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/f333639bbd14bb0ae2cb29be34cfdf11.cix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f333639bbd14bb0ae2cb29be34cfdf11.iix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/f333639bbd14bb0ae2cb29be34cfdf11.iix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f333639bbd14bb0ae2cb29be34cfdf11.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/f333639bbd14bb0ae2cb29be34cfdf11.pack -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f333639bbd14bb0ae2cb29be34cfdf11.rix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/f333639bbd14bb0ae2cb29be34cfdf11.rix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f333639bbd14bb0ae2cb29be34cfdf11.tix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/f333639bbd14bb0ae2cb29be34cfdf11.tix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f5f342366fb479f0f70ea9327bb595b8.cix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/f5f342366fb479f0f70ea9327bb595b8.cix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f5f342366fb479f0f70ea9327bb595b8.iix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/f5f342366fb479f0f70ea9327bb595b8.iix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f5f342366fb479f0f70ea9327bb595b8.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/f5f342366fb479f0f70ea9327bb595b8.pack -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f5f342366fb479f0f70ea9327bb595b8.rix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/f5f342366fb479f0f70ea9327bb595b8.rix -------------------------------------------------------------------------------- /.bzr/repository/obsolete_packs/f5f342366fb479f0f70ea9327bb595b8.tix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/lxlauncher-vala/HEAD/.bzr/repository/obsolete_packs/f5f342366fb479f0f70ea9327bb595b8.tix -------------------------------------------------------------------------------- /lxlauncher-vala/usr/share/doc/lxlauncher/README.Debian: -------------------------------------------------------------------------------- 1 | lxlauncher for Debian 2 | --------------------- 3 | 4 | 5 | 6 | -- x-mario Mon, 18 Jun 2012 15:42:02 +0700 7 | -------------------------------------------------------------------------------- /src/Widgets/FavouritesBar.vala: -------------------------------------------------------------------------------- 1 | using Gtk; 2 | using Gdk; 3 | using LxLauncher.Backend; 4 | 5 | namespace LxLauncher.Widgets { 6 | public class FavouriteBar : Box { 7 | public FavouriteLauncher launcher; 8 | 9 | public void add_favourite (App app) { 10 | launcher = new FavouriteLauncher(app); 11 | pack_start(launcher, false, false, 0); 12 | launcher.show_all(); 13 | } 14 | 15 | public FavouriteBar () { 16 | orientation = Orientation.VERTICAL; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lxlauncher-vala/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package:lxlauncher-vala 2 | Version: 1.0-1 3 | Architecture: i386 4 | Maintainer: x-mario 5 | Installed-Size: 40 6 | Section: x11 7 | Priority: extra 8 | Depends: libgee2(>=0.5),libmenu-cache1(>=0.3),libgtk-3-0(>=3.4) 9 | Homepage: http://packages.x-mario.com/binary 10 | Description:Easy-Mode launcher for subnotebook like EeePC 11 | LXLauncher-vala create by Stephen Smally and this version edit by Hon Nguyen . 12 | . 13 | It is standard-compliant and desktop-independent. It follows 14 | freedesktop.org specs, so newly added applications will automatically 15 | show up in the launcher, and vice versa for the removed ones. 16 | -------------------------------------------------------------------------------- /compile-project.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #echo "Installing compilation softwares" 4 | #if (! sudo yum install libgtk-3-dev valac-0.14 libmenu-cache1-dev ); then 5 | # echo "Can't install necessary packages" 6 | # exit 1 7 | #fi 8 | 9 | cd src 10 | VALAFLAGS="--pkg gtk+-3.0 --pkg libmenu-cache --pkg gee-1.0 --pkg posix" 11 | files=$(find ./ | grep .vala) 12 | if (! valac $VALAFLAGS --vapidir=../vapi -g $files -o lxlauncher); then 13 | echo "Some errors during the compilation, please report this at eco.stefi@fastwebnet.it" 14 | exit 1 15 | fi 16 | 17 | echo "Successfully compiled" 18 | echo "Hit Ctrl+C to exit, or Enter to execute lxlauncher" 19 | read 20 | 21 | echo "Start of the lxlauncher output" 22 | echo "------------------------------" 23 | 24 | ./lxlauncher 25 | -------------------------------------------------------------------------------- /src/Widgets/SearchEntry.vala: -------------------------------------------------------------------------------- 1 | 2 | using Gtk; 3 | using Gdk; 4 | 5 | namespace LxLauncher.Widgets { 6 | public class SearchEntry : Entry { 7 | public void check_if_icon (Editable ed) { 8 | if (get_text().length > 0) { 9 | set_icon_from_stock(EntryIconPosition.SECONDARY, Stock.CLEAR); 10 | } else { 11 | set_icon_from_stock(EntryIconPosition.SECONDARY, null); 12 | } 13 | } 14 | 15 | public void on_icon_press (Entry widg, EntryIconPosition pos, Event ev) { 16 | if (pos == EntryIconPosition.SECONDARY) { 17 | set_text(""); 18 | } 19 | } 20 | 21 | public SearchEntry (string hint_text) { 22 | set_placeholder_text(hint_text); 23 | changed.connect(check_if_icon); 24 | icon_press.connect(on_icon_press); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/lxlauncher.css: -------------------------------------------------------------------------------- 1 | #lxlauncher-label { 2 | color: #dbdbdb; 3 | } 4 | 5 | #lxlauncher-viewport { 6 | background-color: #000000; 7 | } 8 | 9 | #lxlauncher-button { 10 | border-color: transparent; 11 | border-style: none; 12 | } 13 | 14 | #lxlauncher-button:hover { 15 | border-radius: 10; 16 | background-image: -gtk-gradient (linear, 17 | left top, 18 | left bottom, 19 | from (#000000), 20 | to (#ffffff)); 21 | } 22 | 23 | #lxlauncher-button:hover:active { 24 | border-radius: 10; 25 | border-color: transparent; 26 | color: #ffffff; 27 | background-image: -gtk-gradient (linear, 28 | left top, 29 | left bottom, 30 | from (#606060), 31 | to (#707070)); 32 | } 33 | -------------------------------------------------------------------------------- /src/Misc.vala: -------------------------------------------------------------------------------- 1 | // Copyright Stephen Smally 2012 2 | // 3 | // This program is free software; you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation; either version 2 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program; if not, write to the Free Software 15 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | // MA 02110-1301, USA. 17 | // 18 | 19 | namespace LxLauncher.Misc { 20 | public void print_debug (string message) { 21 | if (verbose) { 22 | stdout.printf("[DEBUG] %s\n", message); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Backend/Category.vala: -------------------------------------------------------------------------------- 1 | // Copyright Stephen Smally 2012 2 | // 3 | // This program is free software; you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation; either version 2 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program; if not, write to the Free Software 15 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | // MA 02110-1301, USA. 17 | // 18 | 19 | using MenuCache; 20 | 21 | namespace LxLauncher.Backend { 22 | public class Category : Object { 23 | public string name { get; private set; } 24 | public string comment { get; private set; } 25 | public string icon { get; private set; } 26 | public string id { get; private set; } 27 | 28 | public Category (CacheItem item) { 29 | name = item.get_name(); 30 | comment = item.get_comment() ?? ""; 31 | icon = item.get_icon() ?? "application-default-icon"; 32 | id = item.get_file_basename(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lxlauncher-vala/usr/share/doc/lxlauncher/copyright: -------------------------------------------------------------------------------- 1 | Format: http://dep.debian.net/deps/dep5 2 | Upstream-Name: lxlauncher 3 | Source: 4 | 5 | Files: * 6 | Copyright: 7 | 8 | License: 9 | 10 | 11 | . 12 | 13 | 14 | # If you want to use GPL v2 or later for the /debian/* files use 15 | # the following clauses, or change it to suit. Delete these two lines 16 | Files: debian/* 17 | Copyright: 2012 x-mario 18 | License: GPL-2+ 19 | This package is free software; you can redistribute it and/or modify 20 | it under the terms of the GNU General Public License as published by 21 | the Free Software Foundation; either version 2 of the License, or 22 | (at your option) any later version. 23 | . 24 | This package is distributed in the hope that it will be useful, 25 | but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | GNU General Public License for more details. 28 | . 29 | You should have received a copy of the GNU General Public License 30 | along with this program. If not, see 31 | . 32 | On Debian systems, the complete text of the GNU General 33 | Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". 34 | 35 | # Please also look if there are files or directories which have a 36 | # different copyright/license attached and list them here. 37 | -------------------------------------------------------------------------------- /src/Widgets/Preferences.vala: -------------------------------------------------------------------------------- 1 | 2 | using Gtk; 3 | using LxLauncher.Config; 4 | 5 | namespace LxLauncher.Widgets { 6 | public class PreferencesBox : Box { 7 | public ListStore pos_model; 8 | 9 | public void add_positions () { 10 | string[] positions = {"Top", "Right", "Bottom", "Left"}; 11 | foreach (string name in positions) { 12 | TreeIter iter; 13 | pos_model.append(out iter); 14 | pos_model.set(iter, 0, name); 15 | } 16 | } 17 | 18 | public void changed_launchers (ComboBox widget) { 19 | settings_manager.set_integer("Interface", "favourites-bar-position", widget.get_active()); 20 | settings_manager.save_changes(); 21 | //Frontend.move_favourites(); see FavouriteLauncher 22 | } 23 | 24 | public PreferencesBox () { 25 | set_border_width(5); 26 | set_orientation(Orientation.VERTICAL); 27 | CellRendererText pos_cell = new CellRendererText(); 28 | pos_model = new ListStore(1, typeof(string)); 29 | add_positions(); 30 | ComboBox bar_pos = new ComboBox.with_model(pos_model); 31 | bar_pos.pack_start(pos_cell, false); 32 | bar_pos.add_attribute(pos_cell, "text", 0); 33 | bar_pos.set_active(settings_manager.favourites_pos); 34 | bar_pos.changed.connect(changed_launchers); 35 | Box bar_pos_box = new Box(Orientation.HORIZONTAL, 5); 36 | bar_pos_box.pack_start(new Label("Favourites bar position"), false, false, 0); 37 | bar_pos_box.pack_end(bar_pos, false, false, 0); 38 | pack_start(bar_pos_box, false, false, 0); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/Widgets/LauncherView.vala: -------------------------------------------------------------------------------- 1 | 2 | using Gtk; 3 | using LxLauncher.Backend; 4 | 5 | namespace LxLauncher.Widgets { 6 | public class LauncherGrid : Box { 7 | public Launcher launcher_child; 8 | private Box chil; 9 | private int n_rows; 10 | private int n_columns; 11 | public int children { get; private set; } 12 | 13 | public void append_launcher (App item) { 14 | if (children == n_columns) { 15 | children = 0; 16 | chil = new Box(Orientation.HORIZONTAL, 5); 17 | chil.homogeneous = true; 18 | pack_end(chil, true, false, 0); 19 | //scroll.add(chil); 20 | //pack_start(scroll, false, false, 0); 21 | n_rows++; 22 | } 23 | 24 | launcher_child = new Launcher(item, false, false); 25 | 26 | chil.pack_start(launcher_child, true, true, 0); 27 | launcher_child.show_all(); 28 | children++; 29 | } 30 | 31 | public void complete_grid () { 32 | while (children != n_columns) { 33 | Image placeholder = new Image(); 34 | chil.pack_start(placeholder, true, true, 0); 35 | placeholder.show(); 36 | children++; 37 | } 38 | } 39 | 40 | public LauncherGrid (int columns) { 41 | orientation = Orientation.VERTICAL; 42 | spacing = 5; 43 | homogeneous = true; 44 | n_columns = columns; 45 | n_rows = 1; 46 | children = 0; 47 | chil = new Box(Orientation.HORIZONTAL, 5); 48 | //scroll = new ScrolledWindow(null,null); 49 | chil.homogeneous = true; 50 | valign = Gtk.Align.START; 51 | pack_start(chil, false, false, 0); 52 | //scroll.add(chil); 53 | //pack_start(scroll, false, false, 0); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Backend/App.vala: -------------------------------------------------------------------------------- 1 | // Copyright Stephen Smally 2012 2 | // 3 | // This program is free software; you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation; either version 2 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program; if not, write to the Free Software 15 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | // MA 02110-1301, USA. 17 | // 18 | 19 | using MenuCache; 20 | using LxLauncher.Misc; 21 | 22 | namespace LxLauncher.Backend { 23 | public class App : Object { 24 | public string name { get; private set; } 25 | public string comment { get; private set; } 26 | public string icon { get; private set; } 27 | public string exec { get; private set; } 28 | public string desktop_id { get; private set; } 29 | 30 | public void launch () { 31 | string command; 32 | if ("%" in exec) { 33 | command = exec.split("%")[0].strip(); 34 | } else { 35 | command = exec; 36 | } 37 | stdout.printf("Launching '%s'\n", command); 38 | try { 39 | Process.spawn_async(null, command.split(" "), null, SpawnFlags.SEARCH_PATH, null, null); 40 | } catch (Error e) { 41 | print_debug(e.message); 42 | } 43 | } 44 | 45 | public App (CacheItem item) { 46 | name = item.get_name(); 47 | comment = item.get_comment() ?? name; 48 | icon = item.get_icon() ?? "system-execute"; 49 | exec = ((CacheApp) item).get_exec(); 50 | desktop_id = item.get_file_basename(); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /src/Widgets/TabButton.vala: -------------------------------------------------------------------------------- 1 | using Gtk; 2 | using Pango; 3 | using LxLauncher.Backend; 4 | using LxLauncher.Config; 5 | 6 | namespace LxLauncher.Widgets { 7 | public class TabButton : RadioButton { 8 | public new string label; 9 | public string icon; 10 | public string comment; 11 | public string id; 12 | public int number; 13 | public Image icon_widget; 14 | public Label label_widget; 15 | 16 | private void complete (bool tool) { 17 | can_focus = false; 18 | name = "tabbutton"; 19 | Box child_box = new Box(Orientation.HORIZONTAL, 0); 20 | Image icon_widget = new Image.from_icon_name(icon, IconSize.LARGE_TOOLBAR); 21 | Label label_widget = new Label(label); 22 | label_widget.set_ellipsize(EllipsizeMode.END); 23 | set_tooltip_text(comment); 24 | set_mode(false); 25 | // Support icon + label Hon Nguyen 26 | if (settings_manager.option_view_tabs == 0) child_box.pack_start(label_widget, false, false, 0); 27 | else if (settings_manager.option_view_tabs == 1) child_box.pack_start(icon_widget, false, false, 0); 28 | else { 29 | child_box.pack_start(icon_widget, false, false, 0); 30 | child_box.pack_start(label_widget, false, false, 0); 31 | } 32 | 33 | if (tool) { 34 | relief = ReliefStyle.NONE; 35 | } 36 | add(child_box); 37 | } 38 | public TabButton.custom(TabButton? parent = null, string icon, string name, string comment, int number, bool tool = true){ 39 | label = name; 40 | this.icon = icon; 41 | this.comment = comment;; 42 | id = icon; 43 | this.number = number; 44 | join_group(parent); 45 | complete(tool); 46 | } 47 | public TabButton.with_icon (TabButton? parent = null, string icon, int number, bool tool = true) { 48 | label = ""; 49 | this.icon = icon; 50 | comment = ""; 51 | id = icon; 52 | this.number = number; 53 | join_group(parent); 54 | complete(tool); 55 | } 56 | 57 | public TabButton (TabButton? parent = null, Category item, int number, bool tool = true) { 58 | label = item.name; 59 | icon = item.icon; 60 | comment = item.comment; 61 | id = item.id; 62 | this.number = number; 63 | join_group(parent); 64 | complete(tool); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /vapi/libmenu-cache.vapi: -------------------------------------------------------------------------------- 1 | /* libmenu-cache.vapi generated by vapigen, do not modify. */ 2 | 3 | namespace MenuCache { 4 | [CCode (cname = "MenuCache", cprefix="menu_cache_", cheader_filename = "menu-cache.h", ref_function = "menu_cache_ref", unref_function = "menu_cache_unref")] 5 | [Compact] 6 | public class Cache { 7 | public void* add_reload_notify (GLib.Func func); 8 | public uint32 get_desktop_env_flag (string desktop_env); 9 | public unowned CacheDir get_dir_from_path (string path); 10 | public unowned CacheDir get_root_dir (); 11 | public static void init (int flags); 12 | public unowned GLib.SList list_all_apps (); 13 | public static unowned Cache lookup (string menu_name); 14 | public static unowned Cache lookup_sync (string menu_name); 15 | public bool reload (); 16 | public void remove_reload_notify (void* notify_id); 17 | } 18 | [CCode (cname = "MenuCacheApp", cprefix="menu_cache_app_", cheader_filename = "menu-cache.h")] 19 | [Compact] 20 | public class CacheApp { 21 | public unowned string get_exec (); 22 | public bool get_is_visible (uint32 de_flags); 23 | public uint32 get_show_flags (); 24 | public bool get_use_sn (); 25 | public bool get_use_terminal (); 26 | public unowned string get_working_dir (); 27 | } 28 | [CCode (cname = "MenuCacheDir", cprefix="menu_cache_dir_", cheader_filename = "menu-cache.h")] 29 | [Compact] 30 | public class CacheDir { 31 | public unowned GLib.SList get_children (); 32 | public unowned string make_path (); 33 | } 34 | [CCode (cname = "MenuCacheItem", cprefix="menu_cache_item_", cheader_filename = "menu-cache.h", ref_function = "menu_cache_item_ref", unref_function = "menu_cache_item_unref")] 35 | [Compact] 36 | public class CacheItem { 37 | public unowned Type get_type (); 38 | public unowned string get_comment (); 39 | public unowned string get_file_basename (); 40 | public unowned string get_file_dirname (); 41 | public unowned string get_file_path (); 42 | public unowned string get_icon (); 43 | public unowned string get_id (); 44 | public unowned string get_name (); 45 | public unowned CacheDir get_parent (); 46 | } 47 | [CCode (cname="MenuCacheItemFlag", cheader_filename = "menu-cache.h", cprefix = "FLAG_", has_type_id = false)] 48 | public enum Item { 49 | USE_TERMINAL, 50 | USE_SN 51 | } 52 | [CCode (cname="MenuCacheShowFlag", cheader_filename = "menu-cache.h", cprefix = "SHOW_", has_type_id = false)] 53 | public enum Show { 54 | IN_LXDE, 55 | IN_GNOME, 56 | IN_KDE, 57 | IN_XFCE, 58 | IN_ROX, 59 | N_KNOWN_DESKTOPS 60 | } 61 | [CCode (cname="MenuCacheType", cheader_filename = "menu-cache.h", cprefix = "MENU_CACHE_TYPE_", has_type_id = false)] 62 | public enum Type { 63 | NONE, 64 | DIR, 65 | APP, 66 | SEP 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Widgets/SearchView.vala: -------------------------------------------------------------------------------- 1 | // Copyright Stephen Smally 2012 2 | // 3 | // This program is free software; you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation; either version 2 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program; if not, write to the Free Software 15 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | // MA 02110-1301, USA. 17 | // 18 | 19 | using Gtk; 20 | using LxLauncher.Backend; 21 | using LxLauncher.Config; 22 | using LxLauncher.Misc; 23 | 24 | namespace LxLauncher.Widgets { 25 | public class SearchView : ScrolledWindow { 26 | private ListStore model; 27 | private TreeIter iter; 28 | public Gee.ArrayList added_items { get; private set; } 29 | 30 | public void clear () { 31 | added_items.clear(); 32 | model.clear(); 33 | } 34 | 35 | public void launch (string exec) { 36 | string command; 37 | if ("%" in exec) { 38 | command = exec.split("%")[0].strip(); 39 | } else { 40 | command = exec; 41 | } 42 | stdout.printf("Launching '%s'\n", command); 43 | try { 44 | Process.spawn_async(null, command.split(" "), null, SpawnFlags.SEARCH_PATH, null, null); 45 | } catch (Error e) { 46 | print_debug(e.message); 47 | } 48 | } 49 | 50 | public void on_row_activated (TreeView view, TreePath path, TreeViewColumn col) { 51 | model.get_iter(out iter, path); 52 | Value exec; 53 | model.get_value(iter, 3, out exec); 54 | launch(exec.get_string()); 55 | } 56 | 57 | public void append_app (App app) { 58 | model.append(out iter); 59 | model.set(iter, 0, string.joinv("\n", {app.name, app.comment}), 1, app.icon, 2, settings_manager.icon_size, 3, app.exec); 60 | added_items.add(app.desktop_id); 61 | } 62 | 63 | public SearchView () { 64 | added_items = new Gee.ArrayList(); 65 | model = new ListStore(4, typeof(string), typeof(string), typeof(int), typeof(string)); 66 | TreeView view = new TreeView.with_model(model); 67 | view.headers_visible = false; 68 | view.insert_column_with_attributes(-1, "Icon", new CellRendererPixbuf(), "icon-name", 1, "stock-size", 2); 69 | view.insert_column_with_attributes(-1, "Name", new CellRendererText(), "text", 0); 70 | view.row_activated.connect(on_row_activated); 71 | add(view); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/Widgets/FavouriteLauncher.vala: -------------------------------------------------------------------------------- 1 | 2 | using Gtk; 3 | using Gdk; 4 | using Pango; 5 | using LxLauncher.Config; 6 | using LxLauncher.Backend; 7 | 8 | namespace LxLauncher.Widgets { 9 | public class FavouriteLauncher : Box { 10 | public Button button; 11 | public Gtk.Menu menu; 12 | public string label; 13 | public string icon; 14 | public string comment; 15 | public string exec; 16 | public string desktop_id; 17 | 18 | public void popup_error (string error, string error_body) { 19 | MessageDialog error_dialog = new MessageDialog(null, DialogFlags.DESTROY_WITH_PARENT, MessageType.ERROR, ButtonsType.CLOSE, error, error_body); 20 | error_dialog.format_secondary_text(error_body); 21 | error_dialog.run(); 22 | error_dialog.destroy(); 23 | } 24 | 25 | public bool pop_menu (Widget but, EventButton event) { 26 | if (event.button != 1) { 27 | menu.popup(null, null, null, event.button, event.time); 28 | return true; 29 | } 30 | return false; 31 | } 32 | 33 | public void remove_to_favourites (Gtk.MenuItem widg) { 34 | settings_manager.remove_key("Favourites", desktop_id.split(".")[0]); 35 | settings_manager.save_changes(); 36 | //Frontend.append_favourites(); should be replace by a notify signal 37 | } 38 | 39 | public FavouriteLauncher (App app, bool hide_label = true) { 40 | set_orientation(Orientation.VERTICAL); 41 | set_spacing(5); 42 | set_border_width(5); 43 | label = app.name; 44 | icon = app.icon; 45 | comment = app.comment; 46 | exec = app.exec; 47 | desktop_id = app.desktop_id; 48 | name = "launcher"; 49 | Label label_widget = new Label(label); 50 | label_widget.halign = Align.CENTER; 51 | label_widget.ellipsize = EllipsizeMode.END; 52 | Image icon_widget; 53 | int width, height; 54 | IconTheme theme = IconTheme.get_default(); 55 | icon_size_lookup((IconSize) settings_manager.icon_size, out width, out height); 56 | if (FileUtils.test(icon, FileTest.EXISTS)) { 57 | theme.append_search_path(Path.get_dirname(icon)); 58 | icon = Path.get_basename(icon); 59 | } 60 | if ("." in icon) { 61 | icon = icon.split(".")[0]; 62 | } 63 | icon_widget = new Image.from_icon_name(icon, (IconSize) settings_manager.icon_size); 64 | icon_widget.set_pixel_size(height); 65 | button = new Button(); 66 | ((Widget)button).button_press_event.connect(pop_menu); 67 | button.clicked.connect(() => { app.launch(); }); 68 | button.set_relief(ReliefStyle.NONE); 69 | button.set_can_focus(false); 70 | button.set_tooltip_text(comment); 71 | button.set_image(icon_widget); 72 | button.halign = Align.CENTER; 73 | menu = new Gtk.Menu(); 74 | ImageMenuItem remove_item = new ImageMenuItem.with_label("Remove to favourites"); 75 | remove_item.set_image(new Image.from_stock(Stock.ADD, IconSize.MENU)); 76 | remove_item.activate.connect(remove_to_favourites); 77 | remove_item.show(); 78 | menu.append(remove_item); 79 | pack_start(button, false, false, 0); 80 | if (! hide_label) { 81 | pack_start(label_widget, false, false, 0); 82 | } 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/Backend/AppDatabase.vala: -------------------------------------------------------------------------------- 1 | // Copyright Stephen Smally 2012 2 | // 3 | // This program is free software; you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation; either version 2 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program; if not, write to the Free Software 15 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | // MA 02110-1301, USA. 17 | // 18 | 19 | using MenuCache; 20 | using Gee; 21 | 22 | namespace LxLauncher.Backend { 23 | public class AppDatabase : Object { 24 | private string path; 25 | public Cache cache; 26 | private unowned CacheDir cache_dir; 27 | private SList cache_apps; 28 | private Category category_temp; 29 | private App app_temp; 30 | private ArrayList apps_owned_by_category; 31 | public ArrayList categories; // Needed to get the proper categories sorting 32 | public HashMap> apps_by_category; 33 | 34 | void add_app_2 (CacheItem cache_item) { 35 | MenuCache.Type item_type = cache_item.get_type (); 36 | 37 | if (item_type != MenuCache.Type.SEP ) { 38 | if (item_type == MenuCache.Type.DIR) { 39 | category_temp = new Category(cache_item); 40 | categories.add(category_temp); 41 | apps_owned_by_category = new ArrayList(); 42 | apps_by_category[category_temp] = apps_owned_by_category; 43 | } else { 44 | app_temp = new App(cache_item); 45 | apps_owned_by_category.add(app_temp); 46 | } 47 | } 48 | } 49 | 50 | public void add_app (CacheDir cache_dir) { 51 | unowned SList item_list = cache_dir.get_children (); 52 | 53 | while (item_list != null) { 54 | 55 | CacheItem cache_item = item_list.data; 56 | MenuCache.Type item_type = cache_item.get_type(); 57 | 58 | if ((item_type == MenuCache.Type.APP) && ((CacheApp) cache_item).get_is_visible (MenuCache.Show.IN_LXDE) == false) { 59 | item_list = item_list.next; 60 | continue; 61 | } 62 | 63 | add_app_2(cache_item); 64 | 65 | if (item_type == MenuCache.Type.DIR) { 66 | add_app ((CacheDir) cache_item); 67 | } 68 | 69 | item_list = item_list.next; 70 | } 71 | } 72 | 73 | public void get_applications () { 74 | categories.clear(); 75 | apps_by_category.clear(); 76 | cache_apps = new SList(); 77 | cache = Cache.lookup_sync (path); 78 | cache_dir = cache.get_root_dir (); 79 | 80 | add_app(cache_dir); 81 | } 82 | 83 | public AppDatabase (string pathname) { 84 | path = pathname; 85 | categories = new ArrayList(); 86 | apps_by_category = new HashMap>(); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/Widgets/Launcher.vala: -------------------------------------------------------------------------------- 1 | 2 | using Gtk; 3 | using Gdk; 4 | using Pango; 5 | using LxLauncher.Backend; 6 | using LxLauncher.Config; 7 | 8 | namespace LxLauncher.Widgets { 9 | public class Launcher : Button { 10 | public Button button; 11 | public Gtk.Menu menu; 12 | public ImageMenuItem add_item; 13 | public new string label; 14 | public string icon; 15 | public string comment; 16 | public string exec; 17 | public string desktop_id; 18 | 19 | public void popup_error (string error, string error_body) { 20 | MessageDialog error_dialog = new MessageDialog(null, DialogFlags.DESTROY_WITH_PARENT, MessageType.ERROR, ButtonsType.CLOSE, error, error_body); 21 | error_dialog.format_secondary_text(error_body); 22 | error_dialog.run(); 23 | error_dialog.destroy(); 24 | } 25 | 26 | public bool pop_menu (Widget but, EventButton event) { 27 | if (desktop_id in settings_manager.favourites) { 28 | add_item.set_sensitive(false); 29 | add_item.label = "Already in favourites"; 30 | } else { 31 | add_item.set_sensitive(true); 32 | add_item.label = "Add to favourites"; 33 | } 34 | if (event.button != 1) { 35 | menu.popup(null, null, null, event.button, event.time); 36 | return true; 37 | } 38 | return false; 39 | } 40 | 41 | public void add_to_favourites (Gtk.MenuItem widg) { 42 | settings_manager.set_string("Favourites", desktop_id.split(".")[0], desktop_id); 43 | settings_manager.save_changes(); 44 | // main_page.append_favourites(); //see FavouriteLauncher 45 | } 46 | 47 | public Launcher (App app, bool hide_label = false, bool preferred = false) { 48 | Box child_box = new Box(Orientation.VERTICAL, 5); 49 | child_box.set_border_width(5); 50 | label = app.name; 51 | icon = app.icon; 52 | comment = app.comment; 53 | exec = app.exec; 54 | desktop_id = app.desktop_id; 55 | name = "launcher"; 56 | Label label_widget = new Label(label); 57 | label_widget.halign = Align.CENTER; 58 | label_widget.ellipsize = EllipsizeMode.END; 59 | Image icon_widget; 60 | int width, height; 61 | IconTheme theme = IconTheme.get_default(); 62 | icon_size_lookup((IconSize) settings_manager.icon_size, out width, out height); 63 | if (FileUtils.test(icon, FileTest.EXISTS)) { 64 | theme.append_search_path(Path.get_dirname(icon)); 65 | icon = Path.get_basename(icon); 66 | } 67 | if ("." in icon) { 68 | icon = icon.split(".")[0]; 69 | } 70 | icon_widget = new Image.from_icon_name(icon, (IconSize) settings_manager.icon_size); 71 | icon_widget.pixel_size = height; 72 | button_press_event.connect(pop_menu); 73 | clicked.connect(() => { app.launch(); }); 74 | relief = ReliefStyle.NONE; 75 | can_focus = false; 76 | tooltip_text = comment; 77 | menu = new Gtk.Menu(); 78 | add_item = new ImageMenuItem.with_label("Add to favourites"); 79 | add_item.image = new Image.from_stock(Stock.ADD, IconSize.MENU); 80 | add_item.activate.connect(add_to_favourites); 81 | add_item.show(); 82 | menu.append(add_item); 83 | child_box.pack_start(icon_widget, false, false, 0); 84 | if (! hide_label) { 85 | child_box.pack_start(label_widget, false, false, 0); 86 | } 87 | add(child_box); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /.bzr/checkout/dirstate: -------------------------------------------------------------------------------- 1 | #bazaar dirstate flat format 3 2 | crc32: -1785050487 3 | num_entries: 26 4 | 1vanhonit@gmail.com-20120626021253-njf2o4083bv3et8a 5 | 0 6 | tree_root-20120130090008-q86h1ax59yga3pik-1d0nAAAQAE/pGitP6RorAAAIAQAOQCYAAEHAd0neco.stefi@fastwebnet.it-20120130090042-2lnjgt30zcbtn76p 7 | READMEreadme-20120210144828-r29m1g0m8fwgzek8-1f3632d545ccd75e15ff5761fd5a503e9d83e219d2128nAAAAgE/ZovtP5gB6AAAIAQAOQC8AAIGAf3632d545ccd75e15ff5761fd5a503e9d83e219d2128neco.stefi@fastwebnet.it-20120213152810-vqggrw8qgde3th1z 8 | compile-project.shcompileproject.sh-20120130091022-2y02p7hmlwf026bv-1f10d1de7f4c14159328f3115603075cd159f0112d652nAAACjE/nAABP5wAAAAAIAQAOQEQAAIGAf10d1de7f4c14159328f3115603075cd159f0112d652nvanhonit@gmail.com-20120626021223-avm3dedfumx9vdpo 9 | srcsrc-20120130090011-1y1ngdi3blfygqvm-1d0nAAAQAE/pFJpP6RSaAAAIAQAWFOUAAEHAd0neco.stefi@fastwebnet.it-20120130090042-2lnjgt30zcbtn76p 10 | vapivapi-20120130190826-0eqpfu642qtmv08t-1d0nAAAQAE/ZovtP5gB6AAAIAQAWFPoAAEHAd0neco.stefi@fastwebnet.it-20120130190829-to0o4tktyaqbvm6u 11 | srcBackendbackend-20120215195804-2veqn2hcoma8y0ox-1d0nAAAQAE/pFJpP6RSaAAAIAQAWFOkAAEHAd0neco.stefi@fastwebnet.it-20120215195810-0ckibj7we35ble26 12 | srcConfig.valaconfig.vala-20120215195804-2veqn2hcoma8y0ox-2f833a4102cc35dae9daba4609451e67c252098b7411871nAAAuX0/pE+tP6RPsAAAIAQAWFU4AAIGAf833a4102cc35dae9daba4609451e67c252098b7411871nvanhonit@gmail.com-20120626021223-avm3dedfumx9vdpo 13 | srcFrontend.valafrontend.vala-20120215195804-2veqn2hcoma8y0ox-3fe9940362b47f34e84781409bb0952561fcc291b313666nAAA1Yk/oledP6JXnAAAIAQAWFPYAAIGAfe9940362b47f34e84781409bb0952561fcc291b313666nvanhonit@gmail.com-20120626021223-avm3dedfumx9vdpo 14 | srcMisc.valamisc.vala-20120216141207-up591yzrfc46lv1y-1f5c01a7252c1baa5e4532a72fc33a48f5aa86fa731008nAAAD8E/ZovtP5gB6AAAIAQAWFPkAAIGAf5c01a7252c1baa5e4532a72fc33a48f5aa86fa731008neco.stefi@fastwebnet.it-20120216151722-e3m79o8l7t9ptf54 15 | srcWidgetswidgets-20120215195804-2veqn2hcoma8y0ox-4d0nAAAQAE/pFJpP6RSaAAAIAQAWFO0AAEHAd0neco.stefi@fastwebnet.it-20120215195810-0ckibj7we35ble26 16 | srclxlauncherlxlauncher-20120618071208-aufp8ubh1k3rn4tf-1f38766bfc01e500994eb4430b54b440b7f0b19f56446340yAAbPhE/pFJpP6RSaAAAIAQAWFOcAAIH9f38766bfc01e500994eb4430b54b440b7f0b19f56446340yvanhonit@gmail.com-20120626021223-avm3dedfumx9vdpo 17 | srclxlauncher.csslxlauncher.css-20120130090011-1y1ngdi3blfygqvm-5ff25b81b2ad6816a18d26b78b1d8ce9a160b4520f838nAAADRk/aB8xP5gB6AAAIAQAWFPgAAIGAff25b81b2ad6816a18d26b78b1d8ce9a160b4520f838nvanhonit@gmail.com-20120618071345-ci6n1j407gmo24q6 18 | src/BackendApp.valaapp.vala-20120215195804-2veqn2hcoma8y0ox-5fa9917f1869cb266535eff4bc08fd17de715976e51995nAAAHy0/ZovtP5gB6AAAIAQAWFOsAAIGAfa9917f1869cb266535eff4bc08fd17de715976e51995neco.stefi@fastwebnet.it-20120216151722-e3m79o8l7t9ptf54 19 | src/BackendAppDatabase.valaappdatabase.vala-20120215195804-2veqn2hcoma8y0ox-6ff7654d92bf20cd90325a5b68cdce3692b94b7f7b3437nAAANbU/ZovtP5gB6AAAIAQAWFOwAAIGAff7654d92bf20cd90325a5b68cdce3692b94b7f7b3437neco.stefi@fastwebnet.it-20120216135029-l6585upqglaqsuo6 20 | src/BackendCategory.valacategory.vala-20120215195804-2veqn2hcoma8y0ox-7f8f9d4c74c10b34abfb7392487cb4e7808f11b8471381nAAAFZU/gkNhP5gB6AAAIAQAWFOoAAIGAf8f9d4c74c10b34abfb7392487cb4e7808f11b8471381nvanhonit@gmail.com-20120619152409-jiq4mhw3tu60k4b8 21 | src/WidgetsFavouriteLauncher.valafavouritelauncher.va-20120215195804-2veqn2hcoma8y0ox-8f4cd3e5887866db02d03764a07eabb15c01a863953361nAAANIU/ZxGBP5gB6AAAIAQAWFPMAAIGAf4cd3e5887866db02d03764a07eabb15c01a863953361nvanhonit@gmail.com-20120618071345-ci6n1j407gmo24q6 22 | src/WidgetsFavouritesBar.valafavouritesbar.vala-20120215195804-2veqn2hcoma8y0ox-9f343eb754a44c513c145ae215658570e720414946469nAAAB1U/ZovtP5gB6AAAIAQAWFPIAAIGAf343eb754a44c513c145ae215658570e720414946469neco.stefi@fastwebnet.it-20120215200654-rz2tvqetgm6yb50j 23 | src/WidgetsLauncher.valalauncher.vala-20120215195804-2veqn2hcoma8y0ox-10f9862fc37b17bb59ddb973b9ceff52b1ae058b9523540nAAAN1E/ZxE1P5gB6AAAIAQAWFPQAAIGAf9862fc37b17bb59ddb973b9ceff52b1ae058b9523540nvanhonit@gmail.com-20120618071345-ci6n1j407gmo24q6 24 | src/WidgetsLauncherView.valalauncherview.vala-20120215195804-2veqn2hcoma8y0ox-11f2c390c7b3f2a2daa2ba5d8a82c01c25c92b619d21525nAAAF9U/bSC9P5gB6AAAIAQAWFO8AAIGAf2c390c7b3f2a2daa2ba5d8a82c01c25c92b619d21525nvanhonit@gmail.com-20120618071345-ci6n1j407gmo24q6 25 | src/WidgetsPreferences.valapreferences.vala-20120215195804-2veqn2hcoma8y0ox-12f5c77d496c556e36dd358671607051f849d225b481605nAAAGRU/ZovtP5gB6AAAIAQAWFPUAAIGAf5c77d496c556e36dd358671607051f849d225b481605neco.stefi@fastwebnet.it-20120215200654-rz2tvqetgm6yb50j 26 | src/WidgetsPreferencesButton.valapreferencesbutton.va-20120215195804-2veqn2hcoma8y0ox-13ff1e0365ed1a35c639c4e2b9b6fa4f3c3e504b953942nAAADrk/oldJP6JXSAAAIAQAWFOYAAIGAff1e0365ed1a35c639c4e2b9b6fa4f3c3e504b953942nvanhonit@gmail.com-20120626021223-avm3dedfumx9vdpo 27 | src/WidgetsPreferencesSetting.valapreferencessetting.v-20120626021245-743wlqfc8o9q4kjc-1f192f2cb3bd286aac161345909f256860c2bad3e611391nAAAsf0/pFI5P6RSOAAAIAQAWFRYAAIGAf192f2cb3bd286aac161345909f256860c2bad3e611391nvanhonit@gmail.com-20120626021253-njf2o4083bv3et8a 28 | src/WidgetsSearchEntry.valasearchentry.vala-20120215195804-2veqn2hcoma8y0ox-14f1b95748ad7a96a4d75e871b2bbe9b9344d880aab790nAAADFk/ZovtP5gB6AAAIAQAWFPcAAIGAf1b95748ad7a96a4d75e871b2bbe9b9344d880aab790neco.stefi@fastwebnet.it-20120216151722-e3m79o8l7t9ptf54 29 | src/WidgetsSearchView.valasearchview.vala-20120216151719-kemst7z43v221dbk-1fc560a72732e103077610532545ee95e143465c052919nAAALZ0/cCspP5gB6AAAIAQAWFPAAAIGAfc560a72732e103077610532545ee95e143465c052919nvanhonit@gmail.com-20120618071345-ci6n1j407gmo24q6 30 | src/WidgetsTabButton.valatabbutton.vala-20120215195804-2veqn2hcoma8y0ox-15fff627c90645f72280f241cb72dcbd63cf8d277cf2314nAAAJCk/olQRP6JUEAAAIAQAWFUgAAIGAfff627c90645f72280f241cb72dcbd63cf8d277cf2314nvanhonit@gmail.com-20120626021223-avm3dedfumx9vdpo 31 | vapilibmenu-cache.vapilibmenucache.vapi-20120130190826-0eqpfu642qtmv08t-2f3b25f3bafb475c3cd90d29921b8d1a82e2ff2a462472nAAAJqE/ZovtP5gB6AAAIAQAWFPsAAIGAf3b25f3bafb475c3cd90d29921b8d1a82e2ff2a462472neco.stefi@fastwebnet.it-20120215195810-0ckibj7we35ble26 32 | -------------------------------------------------------------------------------- /src/Config.vala: -------------------------------------------------------------------------------- 1 | // Copyright Stephen Smally 2012 2 | // 3 | // This program is free software; you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation; either version 2 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program; if not, write to the Free Software 15 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | // MA 02110-1301, USA. 17 | // 18 | 19 | using Gdk; 20 | using LxLauncher.Misc; 21 | 22 | namespace LxLauncher.Config { 23 | public SettingsManager settings_manager; 24 | 25 | public class SettingsManager : Object { 26 | private KeyFile config; 27 | private File file; 28 | //private File css; 29 | public string menu_path = ""; 30 | public int icon_size { get; private set; } 31 | public int columns { get; private set; } 32 | public int favourites_pos { get; private set; } 33 | public int screen_width { get; private set; } 34 | public int screen_height { get; private set; } 35 | /// public string css_path; 36 | public int option_view_tabs; 37 | public string[] favourites { get; private set; } 38 | public string css_style { get; private set; } 39 | public string background ; 40 | public int bg_option; 41 | public string font_family; 42 | 43 | public string font_color; 44 | public string tab_bgcolor; 45 | private string load_background(){ 46 | try{ 47 | return config.get_string("CSS","background"); 48 | }catch(Error e){ 49 | stderr.printf("Error "+e.message); 50 | } 51 | return ""; 52 | } 53 | private string load_bgtab(){ 54 | try{ 55 | return config.get_string("CSS","bg-color"); 56 | }catch(Error e){ 57 | stderr.printf("Error "+e.message); 58 | } 59 | return ""; 60 | } 61 | 62 | private string load_font_family(){ 63 | try{ 64 | return config.get_string("CSS","font"); 65 | }catch(Error e){return "";} 66 | return ""; 67 | } 68 | 69 | private string load_font_color(){ 70 | try{ 71 | return config.get_string("CSS","font-color"); 72 | }catch(Error e){return "";} 73 | return ""; 74 | } 75 | private string init_css_style(){ 76 | string tmp; 77 | tmp =""; 78 | background = load_background(); 79 | font_family = load_font_family(); 80 | //font_size = load_font_size(); 81 | font_color = load_font_color(); 82 | tab_bgcolor = load_bgtab(); 83 | if (background != "") 84 | { 85 | //if (bg_option == 0) { 86 | tmp += "GtkViewport {background:url('"+background+"'); }\n"; 87 | //} 88 | //else if (bg_option == 1) tmp+="GtkWindow#lxlauncher {background:url('"+background+"') no-repeat;\nbackground-position:center;}\n"; 89 | //else tmp+="GtkWindow#lxlauncher {background:url('"+background+"') no-repeat ;background-size:100% 100%;}\n"; 90 | } 91 | else tmp+="GtkViewport {background-image:none;}\n"; 92 | if (font_family != "") tmp+="GtkWindow#lxlauncher {font:"+font_family+";}\n"; 93 | if (font_color != "") tmp+="GtkWidget {color:"+font_color+";}\n"; 94 | if (tab_bgcolor != "") tmp+="GtkViewport {background-color:"+tab_bgcolor+";}\n"; 95 | tmp+="\nGtkTreeView{background-color:rgba(0,0,0,0.5);}"; 96 | return tmp; 97 | } 98 | private string[] load_favourites_launchers () { 99 | try { 100 | return config.get_keys("Favourites"); 101 | } catch (Error err) { 102 | stdout.printf("%s\n", err.message); 103 | } 104 | return {}; 105 | } 106 | 107 | private string load_menu_path () { 108 | try { 109 | return config.get_string("General", "menu"); 110 | } catch (Error err) { 111 | stdout.printf("%s\n", err.message); 112 | } 113 | return ""; 114 | } 115 | /* private string load_css_path(){ 116 | try{ 117 | return Environment.get_home_dir()+"/.config/lxlauncher/"+config.get_string("CSS","css"); 118 | }catch(Error e){stderr.printf("Error "+e.message); 119 | } 120 | return ""; 121 | } 122 | /* Remove support resize icon */ 123 | /*private int load_icon_size () { 124 | try { 125 | return config.get_integer("Interface", "icon-size"); 126 | } catch (Error err) { 127 | stdout.printf("%s\n", err.message); 128 | } 129 | return 6; 130 | }*/ 131 | 132 | private int load_n_column () { 133 | try { 134 | return config.get_integer("Interface", "columns"); 135 | } catch (Error err) { 136 | stdout.printf("%s\n", err.message); 137 | } 138 | return 6; 139 | } 140 | private int load_option_view () { 141 | try { 142 | return config.get_integer("Interface", "view"); 143 | } catch (Error err) { 144 | stdout.printf("%s\n", err.message); 145 | } 146 | return 2; 147 | } 148 | private int load_bg_option(){ 149 | try { 150 | return config.get_integer("CSS", "bg_option"); 151 | } catch (Error err) { 152 | stdout.printf("%s\n", err.message); 153 | } 154 | return 2; 155 | } 156 | 157 | /*private int load_favourites_pos () { 158 | try { 159 | return config.get_integer("Interface", "favourites-bar-position"); 160 | } catch (Error err) { 161 | stdout.printf("%s\n", err.message); 162 | } 163 | return 2; 164 | }*/ 165 | 166 | private bool compare_arrays (string[] first, string[] second) { 167 | int x; 168 | for (x = 0; x <= first.length; x++) { 169 | if (first[x] != second[x]) { 170 | return false; 171 | } 172 | } 173 | return true; 174 | } 175 | private string init_file () { 176 | if (menu_path == "") config.set_string("General", "menu", "/etc/xdg/lubuntu/menus/lxgames-applications.menu"); else 177 | config.set_string("General", "menu", menu_path); 178 | config.set_integer("Interface", "columns", 9); 179 | if (option_view_tabs == -1) config.set_integer("Interface","view",2);else config.set_integer("Interface","view",option_view_tabs); 180 | //config.set_string("Favourites", "pcmanfm", "pcmanfm.desktop"); 181 | if (background != "") config.set_string("CSS","background",background); 182 | if (font_family != "") config.set_string("CSS","font",font_family); 183 | //if (font_size != "") config.set_string("CSS","font-size",font_size); 184 | if (font_color != "") config.set_string("CSS","font-color",font_color); 185 | if (tab_bgcolor != "") config.set_string("CSS","bg-color",tab_bgcolor); 186 | if (bg_option == -1 ) config.set_integer("CSS","bg_option",2);else config.set_integer("CSS","bg_option",bg_option); 187 | return config.to_data(); 188 | } 189 | 190 | private void fill_file (File file) { 191 | try{ 192 | file.create(0, null); 193 | print_debug("Created new profile in ~/.config/lxlauncher/"+profile+".ini"); 194 | string default_content = "[General]\n[Interface]\n[Favourites]\n[CSS]\n"; 195 | FileUtils.set_contents(file.get_path(), default_content, default_content.length); 196 | config.load_from_file(file.get_path(), 0); 197 | default_content = init_file(); 198 | FileUtils.set_contents(file.get_path(), default_content, default_content.length); 199 | }catch(Error e){stderr.printf("Error "+e.message);} 200 | } 201 | /*private string init_css(){ 202 | string bg = Environment.get_home_dir()+"/.config/lxlauncher/background.png"; 203 | return "GtkWindow#lxlauncher {"+ 204 | "background-image:url('"+bg+"');"+ 205 | "}\n"; 206 | } 207 | private void fill_css(File file){ 208 | try{ 209 | file.create(0,null); 210 | //config.load_from_file(file.get_path(), 0); 211 | string content = init_css(); 212 | FileUtils.set_contents(file.get_path(),content,content.length); 213 | } 214 | catch(Error e){stderr.printf("Error "+e.message); 215 | } 216 | }*/ 217 | 218 | private void load_keys () { 219 | menu_path = load_menu_path(); 220 | icon_size = 6;//load_icon_size(); 221 | columns = load_n_column(); 222 | option_view_tabs = load_option_view(); 223 | //bg_option = load_bg_option(); 224 | //favourites_pos = load_favourites_pos(); 225 | css_style = init_css_style(); 226 | string[] raw_launchers = load_favourites_launchers(); 227 | if (raw_launchers.length > 0 && raw_launchers.length != favourites.length) { 228 | try{string favourites_tmp = config.get_string("Favourites", raw_launchers[0]); 229 | for (int x = 1; x <= raw_launchers.length; x++) { 230 | if (raw_launchers[x] != null) { 231 | favourites_tmp = string.joinv("|", {favourites_tmp, config.get_string("Favourites", raw_launchers[x])}); 232 | } 233 | } 234 | favourites = favourites_tmp.split("|"); 235 | 236 | } 237 | catch(Error e){stderr.printf("Error "+e.message);} 238 | } 239 | } 240 | 241 | public void remove_key (string group, string key) { 242 | try{config.remove_key(group, key);}catch(Error e){stderr.printf("Error "+e.message);} 243 | } 244 | 245 | public void set_string (string group, string key, string val) { 246 | config.set_string(group, key, val); 247 | } 248 | 249 | public void set_integer (string group, string key, int val) { 250 | config.set_integer(group, key, val); 251 | } 252 | 253 | public void save_changes () { 254 | try{ 255 | string content = config.to_data(); 256 | FileUtils.set_contents(file.get_path(), content, content.length); 257 | config.load_from_file(file.get_path(), 0); 258 | load_keys(); 259 | }catch(Error e){stderr.printf("Error "+e.message);} 260 | } 261 | public void update(){ 262 | try{ 263 | file.delete(); 264 | fill_file(file); 265 | config.load_from_file(file.get_path(), 0); 266 | load_keys(); 267 | }catch(Error e){} 268 | } 269 | public SettingsManager (string profile) { 270 | try{ 271 | string[] groups = {"General", "Interface", "Favourites","CSS"}; 272 | Screen screen = Screen.get_default(); 273 | screen_height = screen.get_height(); 274 | screen_width = screen.get_width(); 275 | 276 | option_view_tabs = load_option_view(); 277 | //bg_option = load_bg_option(); 278 | font_family = ""; 279 | font_color = ""; 280 | config = new KeyFile(); 281 | //favourites_pos = load_favourites_pos(); 282 | File dir = File.new_for_path(Environment.get_home_dir()+"/.config/"+"lxlauncher"); 283 | if (dir.query_exists() == false) { dir.make_directory_with_parents(); } 284 | file = File.new_for_path(dir.get_path()+"/"+profile+".conf"); 285 | //css = File.new_for_path(dir.get_path()+"/lxlauncher.css"); 286 | if (file.query_exists() == false) { 287 | background = "/etc/xdg/lxlauncher/background.png"; 288 | fill_file(file); 289 | config.load_from_file(file.get_path(), 0); 290 | } else { 291 | print_debug("Using "+profile+" profile"); 292 | config.load_from_file(file.get_path(), 0); 293 | } 294 | 295 | if (! compare_arrays(config.get_groups(), groups)) { 296 | file.delete(); 297 | fill_file(file); 298 | config.load_from_file(file.get_path(), 0); 299 | } 300 | load_keys(); 301 | }catch(Error e){ 302 | stderr.printf("Error "+e.message); 303 | }; 304 | } 305 | } 306 | 307 | public void init () { 308 | settings_manager = new SettingsManager(profile); 309 | } 310 | } 311 | -------------------------------------------------------------------------------- /src/Frontend.vala: -------------------------------------------------------------------------------- 1 | // Copyright Stephen Smally 2012 2 | // 3 | // This program is free software; you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation; either version 2 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program; if not, write to the Free Software 15 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | // MA 02110-1301, USA. 17 | // 18 | 19 | using Gtk; 20 | using Gdk; 21 | using Posix; 22 | using LxLauncher.Backend; 23 | using LxLauncher.Widgets; 24 | using LxLauncher.Config; 25 | using LxLauncher.Misc; 26 | 27 | namespace LxLauncher.Main { 28 | public Frontend main_page; 29 | public class Frontend : Gtk.Window { 30 | public AppDatabase apps_db; 31 | public Box main; 32 | public Box main_2; 33 | public Notebook button_table; 34 | public SearchView searchview; 35 | public PreferencesBox preferences_box; 36 | public TabButton category_button; 37 | public Box tab_box; 38 | public Box home_box; 39 | public ScrolledWindow fav_scroll; 40 | public LauncherGrid table; 41 | public FavouriteBar favourite_box; 42 | public SearchEntry searchentry; 43 | public string filter; 44 | public int tabs; 45 | public int x; // multi purpose iterator 46 | public int page_nth; 47 | public Pixbuf pixbuf; 48 | public Widget widget; 49 | public StyleContext stylecontext; 50 | public CssProvider css_style; 51 | public Screen scr; 52 | 53 | public void setup_ui () { 54 | main = new Box(Orientation.VERTICAL, 5); 55 | //main.set_border_width(40); 56 | 57 | //main.set_margin_bottom(40); 58 | //main.set_margin_left(50); 59 | //main.set_margin_right(50); 60 | 61 | main_2 = new Box(Orientation.VERTICAL, 5); 62 | //Box favourite_box_center = new Box(Orientation.VERTICAL, 0); 63 | 64 | searchentry = new SearchEntry("Search Applications..."); 65 | searchentry.changed.connect(on_search); 66 | 67 | Box tab_box_vertical = new Box(Orientation.VERTICAL, 0); 68 | 69 | Box tab_box_2 = new Box(Orientation.HORIZONTAL, 5); 70 | 71 | tab_box = new Box(Orientation.HORIZONTAL, 5); 72 | 73 | button_table = new Notebook(); 74 | button_table.show_tabs = false; 75 | button_table.show_border = false; 76 | //searchview = new SearchView(); 77 | 78 | ; 79 | //tab_box_2.pack_start(searchentry, false, false, 0); 80 | tab_box_vertical.pack_start(tab_box, true, true, 0); 81 | tab_box_2.pack_start(tab_box_vertical, true, true, 0); 82 | 83 | 84 | //favourite_box_center.pack_start(favourite_box, true, false, 0); 85 | 86 | //main_2.pack_start(favourite_box, false, false, 0); 87 | 88 | main_2.pack_start(button_table, true, true, 0); 89 | //main_2.pack_start(searchview, true, true, 0); 90 | 91 | 92 | 93 | //main.pack_start(se,false,false,0); 94 | main.set_homogeneous(false); 95 | main.pack_start(tab_box_2, false, false, 0); 96 | main.pack_start(main_2, true, true, 0); 97 | add(main); 98 | category_button = null; 99 | tabs = 0; 100 | } 101 | public void on_search (Editable ed) { 102 | filter = searchentry.get_text(); 103 | searchview.clear(); 104 | if (filter == "") { 105 | tab_box.set_sensitive(true); 106 | searchview.set_visible(false); 107 | //button_table.set_visible(true); 108 | favourite_box.set_visible(true); 109 | } else { 110 | tab_box.set_sensitive(false); 111 | searchview.set_visible(true); 112 | favourite_box.set_visible(false); 113 | // button_table.set_visible(false); 114 | foreach (Category categ in apps_db.categories) { 115 | foreach (App app in apps_db.apps_by_category[categ]) { 116 | if ((filter in app.name || filter in app.comment || filter in app.exec) && ! (app.desktop_id in searchview.added_items)) { 117 | searchview.append_app(app); 118 | } 119 | } 120 | } 121 | } 122 | } 123 | 124 | public void append_favourite (App favourite) { 125 | favourite_box.add_favourite(favourite); 126 | } 127 | 128 | public void append_favourites () { 129 | foreach (Gee.ArrayList array in apps_db.apps_by_category.values) { 130 | foreach (App app in array) { 131 | if (app.desktop_id in settings_manager.favourites) { 132 | append_favourite(app); 133 | } 134 | } 135 | } 136 | } 137 | 138 | public void change_page (Button widget) { 139 | int ind = ((TabButton)widget).number; 140 | //stderr.printf("%d",ind); 141 | button_table.set_current_page(ind); 142 | } 143 | 144 | public void foreach_category (Category item) { 145 | print_debug("Parsing category "+item.id); 146 | 147 | table = new LauncherGrid(settings_manager.columns); 148 | 149 | foreach (App app in apps_db.apps_by_category[item]) { 150 | if (app.desktop_id in settings_manager.favourites) { 151 | append_favourite(app); 152 | } 153 | table.append_launcher(app); 154 | print_debug("Appending "+app.name); 155 | } 156 | table.complete_grid(); 157 | Box table_box = new Box(Orientation.VERTICAL, 0); 158 | var scroll = new ScrolledWindow(null,null); 159 | scroll.set_placement(Gtk.CornerType.TOP_LEFT); 160 | scroll.add_with_viewport(table); 161 | table_box.pack_start(scroll, true, true, 0); 162 | 163 | //table_box.pack_start(table, false, false, 0); 164 | 165 | button_table.append_page(table_box, null); 166 | table_box.show_all(); 167 | 168 | category_button = new TabButton(category_button, item, tabs); 169 | 170 | (Button) category_button.clicked.connect(change_page); 171 | Separator se = new Separator(Orientation.VERTICAL); 172 | tab_box.pack_start(se,false,false,0); 173 | tab_box.pack_start(category_button, false, false, 0); 174 | category_button.show_all(); 175 | tabs++; 176 | } 177 | 178 | public void clear_all () { 179 | x = 0; 180 | page_nth = button_table.get_n_pages(); 181 | while (x != page_nth) { 182 | button_table.remove_page(0); 183 | x++; 184 | } 185 | tabs = 0; 186 | tab_box.foreach((widget) => { 187 | widget.destroy(); 188 | }); 189 | category_button = null; 190 | favourite_box.foreach((widget) => { 191 | widget.destroy(); 192 | }); 193 | } 194 | public void setup_launchers () { 195 | clear_all(); 196 | apps_db.get_applications(); 197 | //home_table = new LauncherGrid(settings_manager.columns); 198 | Box home_table_box = new Box(Orientation.VERTICAL, 0); 199 | home_box = new Box (Orientation.VERTICAL,0); 200 | home_table_box.expand = true; 201 | var scroll = new ScrolledWindow(null,null); 202 | searchentry.set_margin_left(20); 203 | searchentry.set_margin_right(20); 204 | searchentry.set_margin_top(10); 205 | home_table_box.pack_start(searchentry,false,false,0); 206 | home_table_box.pack_start(home_box,true,true,0); 207 | favourite_box = new FavouriteBar(); 208 | favourite_box.set_orientation(Orientation.HORIZONTAL); 209 | home_box.pack_start(favourite_box, false, false, 0); 210 | //if (settings_manager.favourites_pos == 0) favourite_box.set_visible(false); else favourite_box.set_visible(true); 211 | searchview = new SearchView(); 212 | searchview.set_margin_top(10); 213 | searchview.set_margin_bottom(10); 214 | searchview.set_margin_right(20); 215 | searchview.set_margin_left(20); 216 | searchview.set_size_request(searchview.width_request,button_table.height_request); 217 | home_box.pack_start(searchview,true,true,0); 218 | scroll.add_with_viewport(home_table_box); 219 | button_table.append_page(scroll, null); 220 | home_table_box.show_all(); 221 | category_button = new TabButton.custom(category_button,"folder-home","Home","Home Tab",0); 222 | Separator se = new Separator(Orientation.VERTICAL); 223 | tab_box.pack_start(se,false,false,0); 224 | tab_box.pack_start(category_button,false,false,0); 225 | (Button) category_button.clicked.connect(change_page); 226 | category_button.show_all(); 227 | tabs++; 228 | foreach (Category categ in apps_db.categories) { 229 | foreach_category(categ); 230 | } 231 | Viewport utils_port = new Viewport(null,null); 232 | Box utils_box = new Box(Orientation.HORIZONTAL,0); 233 | utils_port.name = "utils"; 234 | Button wifi = new Button(); 235 | wifi.set_image(new Image.from_icon_name("gtk-network",IconSize.LARGE_TOOLBAR)); 236 | wifi.clicked.connect(()=>{ 237 | system("wicd-client -n"); 238 | }); 239 | Button shutdown = new Button(); 240 | shutdown.set_image(new Image.from_icon_name("system-shutdown",IconSize.LARGE_TOOLBAR)); 241 | shutdown.clicked.connect(() => { 242 | system("lxsession-logout --banner '/etc/xdg/lxlauncher/logout-banner.png' --side=top"); 243 | }); 244 | VolumeButton volume = new VolumeButton(); 245 | volume.set_value(0.5); 246 | volume.value_changed.connect(()=>{ 247 | string command = "amixer set Master "+ (volume.get_value()*100).to_string(); 248 | system(command +"% "); 249 | }); 250 | utils_box.pack_start(wifi,false,false,0); 251 | utils_box.pack_start(volume,false,false,0); 252 | utils_box.pack_start(shutdown,false,false,0); 253 | utils_port.add(utils_box); 254 | tab_box.pack_start(utils_port,true,false,0); 255 | } 256 | 257 | public void settings_changed_manager (ParamSpec param) { 258 | favourite_box.foreach((widget) => { 259 | widget.destroy(); 260 | }); 261 | append_favourites(); 262 | } 263 | public void load_style(){ 264 | stylecontext.reset_widgets(scr); 265 | stylecontext.add_provider_for_screen(scr,css_style, 800); 266 | try{css_style.load_from_data(settings_manager.css_style,-1); }catch(Error e){} 267 | } 268 | public Frontend () { 269 | apps_db = new AppDatabase(settings_manager.menu_path); 270 | set_title("LxLauncher"); 271 | set_position(WindowPosition.CENTER); 272 | name = "lxlauncher"; 273 | css_style = new CssProvider(); 274 | stylecontext = new StyleContext(); 275 | scr = Screen.get_default(); 276 | set_default_size(settings_manager.screen_width, settings_manager.screen_height); 277 | set_keep_below(true); 278 | decorated = false; 279 | skip_taskbar_hint = true; 280 | skip_pager_hint = true; 281 | setup_ui(); 282 | maximize(); 283 | stick(); 284 | //show_all(); 285 | setup_launchers(); 286 | load_style(); 287 | searchview.set_visible(false); 288 | settings_manager.notify.connect(settings_changed_manager); 289 | apps_db.cache.add_reload_notify((Func) setup_launchers); 290 | 291 | } 292 | } 293 | public void init(){ 294 | main_page = new Frontend(); 295 | } 296 | } 297 | 298 | static string profile; 299 | static bool verbose = false; 300 | 301 | const OptionEntry entries[] = { 302 | {"profile", 'p', 0, OptionArg.FILENAME, out profile, "Use a custom profile"}, 303 | {"verbose", 'v', 0, OptionArg.NONE, out verbose, "Verbose output"}, 304 | {null} 305 | }; 306 | 307 | int main (string[] args) { 308 | Gtk.init(ref args); 309 | var argparse = new OptionContext(""); 310 | argparse.add_main_entries(entries, null); 311 | argparse.add_group(Gtk.get_option_group(true)); 312 | if (profile == null) { profile = "default"; } 313 | try { 314 | argparse.parse(ref args); 315 | } catch (Error e) { 316 | //stderr.printf("%s\n", e.message); 317 | return 1; 318 | } 319 | LxLauncher.Config.init(); 320 | //system("killall lxpanel"); 321 | //system("lxpanel &"); 322 | LxLauncher.Main.init(); 323 | LxLauncher.Main.main_page.show_all(); 324 | LxLauncher.Main.main_page.searchview.set_visible(false); 325 | Gtk.main(); 326 | return 0; 327 | } 328 | -------------------------------------------------------------------------------- /src/Widgets/PreferencesSetting: -------------------------------------------------------------------------------- 1 | 2 | using Gtk; 3 | using Gdk; 4 | using Posix; 5 | 6 | using LxLauncher.Config; 7 | 8 | 9 | public class PreferencesSetting : Gtk.Window { 10 | private Notebook main11; 11 | private Box background; 12 | private Box tabs; 13 | private Box favourite; 14 | 15 | private Entry file_link; 16 | private Entry color; 17 | private Entry f_color; 18 | private Entry font; 19 | private RadioButton tabs_text; 20 | private RadioButton tabs_icon; 21 | private RadioButton tabs_all; 22 | private CheckButton show_favourite; 23 | 24 | private void open_file(){ 25 | var file_chooser = new FileChooserDialog ("Open File", this, 26 | FileChooserAction.OPEN,Stock.CANCEL, 27 | ResponseType.CANCEL,Stock.OPEN, ResponseType.ACCEPT); 28 | var filter = new Gtk.FileFilter(); 29 | filter.set_name("Images"); 30 | filter.add_mime_type("image/png"); 31 | filter.add_mime_type("image/jpeg"); 32 | filter.add_mime_type("image/gif"); 33 | filter.add_pattern("*.png"); 34 | filter.add_pattern("*.jpg"); 35 | filter.add_pattern("*.gif"); 36 | file_chooser.add_filter(filter); 37 | if (file_chooser.run () == ResponseType.ACCEPT) { 38 | file_link.set_text(file_chooser.get_filename ()); 39 | settings_manager.background = file_chooser.get_filename (); 40 | color.set_text(""); 41 | } 42 | file_chooser.destroy (); 43 | } 44 | private void choose_color(){ 45 | var color_choose = new ColorSelectionDialog("Choose color"); 46 | if (color_choose.run() == ResponseType.OK){ 47 | ColorSelection colorsl = (ColorSelection)color_choose.get_color_selection(); 48 | Color co; 49 | colorsl.get_current_color(out co); 50 | float r; 51 | float g; 52 | float b; 53 | r = co.red; 54 | g = co.green; 55 | b = co.blue; 56 | settings_manager.tab_bgcolor = "#%02x%02x%02x".printf((int) r >> 8,(int) g >> 8,(int) b >> 8); 57 | color.set_text(settings_manager.tab_bgcolor); 58 | file_link.set_text(""); 59 | settings_manager.background = ""; 60 | } 61 | color_choose.destroy(); 62 | } 63 | private void font_choose(){ 64 | var font_choose = new FontSelectionDialog("Choose color"); 65 | if (font_choose.run() == ResponseType.OK){ 66 | FontSelection fontsl = (FontSelection)font_choose.get_font_selection(); 67 | settings_manager.font_family = fontsl.get_font_name(); 68 | font.set_text(fontsl.get_font_name()); 69 | } 70 | font_choose.destroy(); 71 | } 72 | private void choose_color_font(){ 73 | var color_choose = new ColorSelectionDialog("Choose color"); 74 | if (color_choose.run() == ResponseType.OK){ 75 | ColorSelection colorsl = (ColorSelection)color_choose.get_color_selection(); 76 | Color co; 77 | colorsl.get_current_color(out co); 78 | float r; 79 | float g; 80 | float b; 81 | r = co.red; 82 | g = co.green; 83 | b = co.blue; 84 | settings_manager.font_color = "#%02x%02x%02x".printf((int) r >> 8,(int) g >> 8,(int) b >> 8); 85 | f_color.set_text(settings_manager.font_color); 86 | 87 | } 88 | color_choose.destroy(); 89 | } 90 | public void save_config(){ 91 | settings_manager.update(); 92 | if (file_link.get_text() != "") {system("pcmanfm --set-wallpaper="+file_link.get_text()+" --wallpaper-mode=stretch"); 93 | var file = File.new_for_path(Environment.get_home_dir()+"/.config/lxpanel/default/panels/panel"); 94 | if (file.query_exists() == true){ 95 | try{file.delete(); 96 | file.create(0,null);}catch(Error e){} 97 | string content = "# lxpanel config file. Manually editing is not recommended."+ 98 | "# Use preference dialog in lxpanel to adjust config when you can."+ 99 | "\nGlobal {\n"+ 100 | "edge=top\n"+ 101 | "allign=center\n"+ 102 | "margin=0\n"+ 103 | "widthtype=percent\n"+ 104 | "width=8\n"+ 105 | "height=26\n"+ 106 | "transparent=1\n"+ 107 | "tintcolor=#000000"+ 108 | "\nalpha=0\n"+ 109 | "autohide=0\n"+ 110 | "heightwhenhidden=2\n"+ 111 | "setdocktype=1\n"+ 112 | "setpartialstrut=0\n"+ 113 | "usefontcolor=1\n"+ 114 | "fontsize=10\n"+ 115 | "fontcolor=#000000\n"+ 116 | "usefontsize=0\n"+ 117 | "background=0\n"+ 118 | "backgroundfile=/usr/share/lxpanel/images/background.png\n"+ 119 | "iconsize=24\n"+ 120 | "}\n\nPlugin {\n \ntype = tray\n }\nPlugin {\ntype = volumealsa\n}\nPlugin {\ntype = launchbar \nConfig {\nButton {\nid=lubuntu-logout.desktop\n}\n}\n}"; 121 | try{FileUtils.set_contents(file.get_path(), content, content.length);}catch(Error e){} 122 | system("killall lxpanel"); 123 | system("lxpanel &");} 124 | } 125 | if (color.get_text() != ""){ 126 | var file = File.new_for_path(Environment.get_home_dir()+"/.config/lxpanel/default/panels/panel"); 127 | if (file.query_exists() == true){ 128 | try{file.delete(); 129 | file.create(0,null);}catch(Error e){} 130 | string content = "# lxpanel config file. Manually editing is not recommended."+ 131 | "# Use preference dialog in lxpanel to adjust config when you can."+ 132 | "\nGlobal {\n"+ 133 | "edge=top\n"+ 134 | "allign=center\n"+ 135 | "margin=0\n"+ 136 | "widthtype=percent\n"+ 137 | "width=8\n"+ 138 | "height=26\n"+ 139 | "transparent=1\n"+ 140 | "tintcolor="+color.get_text()+ 141 | "\nalpha=255\n"+ 142 | "autohide=0\n"+ 143 | "heightwhenhidden=2\n"+ 144 | "setdocktype=1\n"+ 145 | "setpartialstrut=0\n"+ 146 | "usefontcolor=1\n"+ 147 | "fontsize=10\n"+ 148 | "fontcolor=#000000\n"+ 149 | "usefontsize=0\n"+ 150 | "background=0\n"+ 151 | "backgroundfile=/usr/share/lxpanel/images/background.png\n"+ 152 | "iconsize=24\n"+ 153 | "}\n\nPlugin {\n \ntype = tray\n }\nPlugin {\ntype = volumealsa\n}\nPlugin {\ntype = launchbar \nConfig {\nButton {\nid=lubuntu-logout.desktop\n}\n}\n}"; 154 | try{FileUtils.set_contents(file.get_path(), content, content.length); 155 | }catch(Error e){} 156 | system("killall lxpanel"); 157 | system("lxpanel &"); } 158 | } 159 | //main1_page.load_style(); 160 | 161 | } 162 | public void reset_config(){ 163 | file_link.set_text("/etc/xdg/lxlauncher/background.png"); 164 | settings_manager.background = "/etc/xdg/lxlauncher/background.png"; 165 | save_config(); 166 | } 167 | public void cancel_config(){ 168 | hide_on_delete(); 169 | } 170 | public void background_setup(){ 171 | Box bg = new Box(Orientation.HORIZONTAL,5); 172 | bg.set_homogeneous(true); 173 | Box bg1 = new Box(Orientation.HORIZONTAL,5); 174 | bg1.set_homogeneous(true); 175 | file_link = new Entry(); 176 | file_link.set_text(settings_manager.background); 177 | ToolButton open = new ToolButton.from_stock(Stock.OPEN); 178 | open.clicked.connect(open_file); 179 | //file_link.set_size_request(200,-1); 180 | bg.pack_start(new Label("Desktop Image: "),true,false); 181 | bg.pack_start(file_link,true,false); 182 | //CheckButton t1 = new CheckButton.with_label(""); 183 | /*Box bgo = new Box(Orientation.HORIZONTAL,5); 184 | RadioButton tiles = new RadioButton.with_label_from_widget(null,"Tiles"); 185 | if (settings_manager.bg_option == 0) tiles.set_active(true); 186 | bgo.pack_start(tiles,true,false); 187 | tiles.toggled.connect(radio_select2); 188 | RadioButton stretch = new RadioButton.from_widget(tiles); 189 | stretch.set_label("Stretch"); 190 | stretch.toggled.connect(radio_select2); 191 | bgo.pack_start(stretch,true,false); 192 | if (settings_manager.bg_option == 2) stretch.set_active(true); 193 | RadioButton center = new RadioButton.from_widget(tiles); 194 | center.set_label("Center"); 195 | center.toggled.connect(radio_select2); 196 | if (settings_manager.bg_option == 1) center.set_active(true); 197 | bgo.pack_start(center,true,false); 198 | bgo.show_all();*/ 199 | bg1.pack_start(new Label("Background Color: "),true,false); 200 | bg.pack_start(open,true,false); 201 | color = new Entry(); 202 | //color.set_size_request(200,-1); 203 | ToolButton color_picker = new ToolButton.from_stock(Stock.COLOR_PICKER); 204 | bg1.pack_start(color,true,false); 205 | bg1.pack_start(color_picker,true,false); 206 | color_picker.clicked.connect(choose_color); 207 | //bg.set_spacing(25); 208 | bg.set_margin_left(15); 209 | //bg1.set_spacing(10); 210 | bg1.set_margin_left(20); 211 | Box button = new Box(Orientation.HORIZONTAL,5); 212 | Button reset = new Button.with_label("Reset"); 213 | reset.clicked.connect(reset_config); 214 | Button cancel = new Button.from_stock(Stock.CANCEL); 215 | cancel.clicked.connect(cancel_config); 216 | Button save = new Button.from_stock(Stock.SAVE); 217 | save.clicked.connect(save_config); 218 | button.pack_end(reset,true,false); 219 | button.pack_end(cancel,true,false); 220 | button.pack_end(save,true,false); 221 | button.show_all(); 222 | bg1.show_all(); 223 | background.set_margin_top(15); 224 | background.set_margin_bottom(15); 225 | background.pack_start(bg,true,false); 226 | //background.pack_start(bgo,true,false); 227 | background.pack_start(bg1,true,false); 228 | background.pack_start(button,true,false); 229 | bg.show_all(); 230 | background.show_all(); 231 | } 232 | public static void radio_select(ToggleButton button){ 233 | var name = button.get_label(); 234 | if(button.get_active()) 235 | { 236 | if(name == "Text") settings_manager.option_view_tabs = 0; 237 | if(name == "Icons") settings_manager.option_view_tabs = 1; 238 | if(name == "Text + Icons") settings_manager.option_view_tabs = 2; 239 | } 240 | } 241 | /*public static void radio_select2(ToggleButton button){ 242 | var name = button.get_label(); 243 | if(button.get_active()) 244 | { 245 | if(name == "Tiles") settings_manager.bg_option = 0; 246 | if(name == "Center") settings_manager.bg_option = 1; 247 | if(name == "Stretch") settings_manager.bg_option = 2; 248 | } 249 | }*/ 250 | public void save_view(){ 251 | //save_config(); 252 | settings_manager.update(); 253 | main1_page.destroy(); 254 | LxLauncher.main1.init(); 255 | main1_page.show_all(); 256 | LxLauncher.main1.main1_page.searchview.set_visible(false); 257 | //main1_page.tab_box.set_visible(false); 258 | //main1_page.clear_all(); 259 | } 260 | public void tabs_setup(){ 261 | Box bg = new Box(Orientation.HORIZONTAL,5); 262 | bg.set_homogeneous(true); 263 | bg.pack_start(new Label("Font Color: "),true,false); 264 | f_color = new Entry(); 265 | ToolButton color_picker = new ToolButton.from_stock(Stock.COLOR_PICKER); 266 | bg.pack_start(f_color,true,false); 267 | bg.pack_start(color_picker,true,false); 268 | color_picker.clicked.connect(choose_color_font); 269 | Box font_box = new Box(Orientation.HORIZONTAL,5); 270 | //font_box.set_spacing(20); 271 | font_box.set_homogeneous(true); 272 | font_box.pack_start(new Label("Font "),true, false); 273 | font = new Entry(); 274 | font_box.pack_start(font,true,false); 275 | ToolButton font_dialog = new ToolButton.from_stock(Stock.SELECT_FONT); 276 | font_dialog.clicked.connect(font_choose); 277 | font_box.pack_start(font_dialog,true,false); 278 | font_box.show_all(); 279 | Box option_tab = new Box(Orientation.HORIZONTAL,5); 280 | Label ss = new Label("Show on tabs"); 281 | option_tab.pack_start(ss,true,false); 282 | option_tab.set_homogeneous(true); 283 | Box option_tab1 = new Box(Orientation.VERTICAL,5); 284 | tabs_text = new RadioButton.with_label(null,"Text"); 285 | tabs_text.toggled.connect(radio_select); 286 | if (settings_manager.option_view_tabs == 0) tabs_text.set_active(true); 287 | tabs_icon = new RadioButton.from_widget(tabs_text); 288 | tabs_icon.set_label("Icons"); 289 | tabs_icon.toggled.connect(radio_select); 290 | if (settings_manager.option_view_tabs == 1) tabs_icon.set_active(true); 291 | tabs_all = new RadioButton.from_widget(tabs_text); 292 | tabs_all.set_label("Text + Icons"); 293 | tabs_all.toggled.connect(radio_select); 294 | if (settings_manager.option_view_tabs == 2) tabs_all.set_active(true); 295 | option_tab1.pack_start(tabs_text,true,false); 296 | option_tab1.pack_start(tabs_icon,true,false); 297 | option_tab1.pack_start(tabs_all,true,false); 298 | option_tab1.show_all(); 299 | option_tab1.set_margin_right(30); 300 | option_tab.pack_start(option_tab1,true,false); 301 | option_tab.show_all(); 302 | Box button = new Box(Orientation.HORIZONTAL,5); 303 | Button cancel = new Button.from_stock(Stock.CANCEL); 304 | cancel.clicked.connect(cancel_config); 305 | Button save = new Button.from_stock(Stock.SAVE); 306 | save.clicked.connect(save_view); 307 | button.pack_end(cancel,true,false); 308 | button.pack_end(save,true,false); 309 | button.show_all(); 310 | tabs.set_margin_top(20); 311 | tabs.set_margin_bottom(20); 312 | tabs.pack_start(bg,true,false); 313 | tabs.pack_start(font_box,true,false); 314 | tabs.pack_start(option_tab,true,false); 315 | tabs.pack_start(button,true,false); 316 | bg.show_all(); 317 | tabs.show_all(); 318 | } 319 | public void save_favourite(){ 320 | if (show_favourite.get_active()){ 321 | main1_page.favourite_box.set_visible(true); 322 | }else main1_page.favourite_box.set_visible(false); 323 | } 324 | public void favourite_setup(){ 325 | Box bg = new Box (Orientation.HORIZONTAL,5); 326 | show_favourite = new CheckButton.with_label("Show Favourite bar in Home tab"); 327 | if (main1_page.favourite_box.get_visible()) show_favourite.set_active(true); else show_favourite.set_active(false); 328 | bg.pack_start(show_favourite,true,false); 329 | bg.show_all(); 330 | Box button = new Box(Orientation.HORIZONTAL,5); 331 | Button save = new Button.from_stock(Stock.SAVE); 332 | save.clicked.connect(save_favourite); 333 | button.pack_start(save,true,false); 334 | Button cancel = new Button.from_stock(Stock.CANCEL); 335 | cancel.clicked.connect(cancel_config); 336 | button.pack_start(cancel,true,false); 337 | button.show_all(); 338 | favourite.pack_start(bg,true,false); 339 | favourite.pack_start(button,true,false); 340 | favourite.show_all(); 341 | } 342 | public void setui(){ 343 | background = new Box(Orientation.VERTICAL, 5); 344 | tabs = new Box(Orientation.VERTICAL, 5); 345 | favourite = new Box(Orientation.VERTICAL, 5); 346 | main1 = new Notebook(); 347 | main1.show_tabs = true; 348 | main1.append_page(background,new Label("Background")); 349 | main1.append_page(tabs,new Label("Tabs")); 350 | main1.append_page(favourite,new Label("Favourites")); 351 | background_setup(); 352 | tabs_setup(); 353 | favourite_setup(); 354 | main1.show_all(); 355 | this.add(main1); 356 | } 357 | int main(string [] args){ 358 | //app = new Gtk.Application("lxlauncher_setting",GLib.ApplicationFlags.IS_LAUNCHER); 359 | set_title("Preferences Settings"); 360 | hide_on_delete(); 361 | //set_default_size(300,300); 362 | set_resizable(false); 363 | setui(); 364 | set_modal(true); 365 | //set_application(app); 366 | set_position(WindowPosition.CENTER); 367 | decorated = true; 368 | return 0; 369 | } 370 | } 371 | -------------------------------------------------------------------------------- /desktopsetting/PreferencesSetting.vala: -------------------------------------------------------------------------------- 1 | 2 | using Gtk; 3 | using Gdk; 4 | using Posix; 5 | 6 | using LxLauncher.Config; 7 | using LxLauncher.Main; 8 | namespace LxLauncher.Widgets { 9 | public PreferencesSetting preferences; 10 | public class PreferencesSetting : Gtk.Window { 11 | private Notebook main; 12 | private Box background; 13 | private Box tabs; 14 | private Box favourite; 15 | 16 | private Entry file_link; 17 | private Entry color; 18 | private Entry f_color; 19 | private Entry font; 20 | private RadioButton tabs_text; 21 | private RadioButton tabs_icon; 22 | private RadioButton tabs_all; 23 | private CheckButton show_favourite; 24 | 25 | private void open_file(){ 26 | var file_chooser = new FileChooserDialog ("Open File", this, 27 | FileChooserAction.OPEN,Stock.CANCEL, 28 | ResponseType.CANCEL,Stock.OPEN, ResponseType.ACCEPT); 29 | var filter = new Gtk.FileFilter(); 30 | filter.set_name("Images"); 31 | filter.add_mime_type("image/png"); 32 | filter.add_mime_type("image/jpeg"); 33 | filter.add_mime_type("image/gif"); 34 | filter.add_pattern("*.png"); 35 | filter.add_pattern("*.jpg"); 36 | filter.add_pattern("*.gif"); 37 | file_chooser.add_filter(filter); 38 | if (file_chooser.run () == ResponseType.ACCEPT) { 39 | file_link.set_text(file_chooser.get_filename ()); 40 | settings_manager.background = file_chooser.get_filename (); 41 | color.set_text(""); 42 | } 43 | file_chooser.destroy (); 44 | } 45 | private void choose_color(){ 46 | var color_choose = new ColorSelectionDialog("Choose color"); 47 | if (color_choose.run() == ResponseType.OK){ 48 | ColorSelection colorsl = (ColorSelection)color_choose.get_color_selection(); 49 | Color co; 50 | colorsl.get_current_color(out co); 51 | float r; 52 | float g; 53 | float b; 54 | r = co.red; 55 | g = co.green; 56 | b = co.blue; 57 | settings_manager.tab_bgcolor = "#%02x%02x%02x".printf((int) r >> 8,(int) g >> 8,(int) b >> 8); 58 | color.set_text(settings_manager.tab_bgcolor); 59 | file_link.set_text(""); 60 | settings_manager.background = ""; 61 | } 62 | color_choose.destroy(); 63 | } 64 | private void font_choose(){ 65 | var font_choose = new FontSelectionDialog("Choose color"); 66 | if (font_choose.run() == ResponseType.OK){ 67 | FontSelection fontsl = (FontSelection)font_choose.get_font_selection(); 68 | settings_manager.font_family = fontsl.get_font_name(); 69 | font.set_text(fontsl.get_font_name()); 70 | } 71 | font_choose.destroy(); 72 | } 73 | private void choose_color_font(){ 74 | var color_choose = new ColorSelectionDialog("Choose color"); 75 | if (color_choose.run() == ResponseType.OK){ 76 | ColorSelection colorsl = (ColorSelection)color_choose.get_color_selection(); 77 | Color co; 78 | colorsl.get_current_color(out co); 79 | float r; 80 | float g; 81 | float b; 82 | r = co.red; 83 | g = co.green; 84 | b = co.blue; 85 | settings_manager.font_color = "#%02x%02x%02x".printf((int) r >> 8,(int) g >> 8,(int) b >> 8); 86 | f_color.set_text(settings_manager.font_color); 87 | 88 | } 89 | color_choose.destroy(); 90 | } 91 | public void save_config(){ 92 | settings_manager.update(); 93 | if (file_link.get_text() != "") {system("pcmanfm --set-wallpaper="+file_link.get_text()+" --wallpaper-mode=stretch"); 94 | var file = File.new_for_path(Environment.get_home_dir()+"/.config/lxpanel/default/panels/panel"); 95 | if (file.query_exists() == true){ 96 | try{file.delete(); 97 | file.create(0,null);}catch(Error e){} 98 | string content = "# lxpanel config file. Manually editing is not recommended."+ 99 | "# Use preference dialog in lxpanel to adjust config when you can."+ 100 | "\nGlobal {\n"+ 101 | "edge=top\n"+ 102 | "allign=center\n"+ 103 | "margin=0\n"+ 104 | "widthtype=percent\n"+ 105 | "width=8\n"+ 106 | "height=26\n"+ 107 | "transparent=1\n"+ 108 | "tintcolor=#000000"+ 109 | "\nalpha=0\n"+ 110 | "autohide=0\n"+ 111 | "heightwhenhidden=2\n"+ 112 | "setdocktype=1\n"+ 113 | "setpartialstrut=0\n"+ 114 | "usefontcolor=1\n"+ 115 | "fontsize=10\n"+ 116 | "fontcolor=#000000\n"+ 117 | "usefontsize=0\n"+ 118 | "background=0\n"+ 119 | "backgroundfile=/usr/share/lxpanel/images/background.png\n"+ 120 | "iconsize=24\n"+ 121 | "}\n\nPlugin {\n \ntype = tray\n }\nPlugin {\ntype = volumealsa\n}\nPlugin {\ntype = launchbar \nConfig {\nButton {\nid=lubuntu-logout.desktop\n}\n}\n}"; 122 | try{FileUtils.set_contents(file.get_path(), content, content.length);}catch(Error e){} 123 | system("killall lxpanel"); 124 | system("lxpanel &");} 125 | } 126 | if (color.get_text() != ""){ 127 | var file = File.new_for_path(Environment.get_home_dir()+"/.config/lxpanel/default/panels/panel"); 128 | if (file.query_exists() == true){ 129 | try{file.delete(); 130 | file.create(0,null);}catch(Error e){} 131 | string content = "# lxpanel config file. Manually editing is not recommended."+ 132 | "# Use preference dialog in lxpanel to adjust config when you can."+ 133 | "\nGlobal {\n"+ 134 | "edge=top\n"+ 135 | "allign=center\n"+ 136 | "margin=0\n"+ 137 | "widthtype=percent\n"+ 138 | "width=8\n"+ 139 | "height=26\n"+ 140 | "transparent=1\n"+ 141 | "tintcolor="+color.get_text()+ 142 | "\nalpha=255\n"+ 143 | "autohide=0\n"+ 144 | "heightwhenhidden=2\n"+ 145 | "setdocktype=1\n"+ 146 | "setpartialstrut=0\n"+ 147 | "usefontcolor=1\n"+ 148 | "fontsize=10\n"+ 149 | "fontcolor=#000000\n"+ 150 | "usefontsize=0\n"+ 151 | "background=0\n"+ 152 | "backgroundfile=/usr/share/lxpanel/images/background.png\n"+ 153 | "iconsize=24\n"+ 154 | "}\n\nPlugin {\n \ntype = tray\n }\nPlugin {\ntype = volumealsa\n}\nPlugin {\ntype = launchbar \nConfig {\nButton {\nid=lubuntu-logout.desktop\n}\n}\n}"; 155 | try{FileUtils.set_contents(file.get_path(), content, content.length); 156 | }catch(Error e){} 157 | system("killall lxpanel"); 158 | system("lxpanel &"); } 159 | } 160 | main_page.load_style(); 161 | //main_page.load_style(); 162 | } 163 | public void reset_config(){ 164 | file_link.set_text("/etc/xdg/lxlauncher/background.png"); 165 | settings_manager.background = "/etc/xdg/lxlauncher/background.png"; 166 | save_config(); 167 | } 168 | public void cancel_config(){ 169 | hide_on_delete(); 170 | } 171 | public void background_setup(){ 172 | Box bg = new Box(Orientation.HORIZONTAL,5); 173 | bg.set_homogeneous(true); 174 | Box bg1 = new Box(Orientation.HORIZONTAL,5); 175 | bg1.set_homogeneous(true); 176 | file_link = new Entry(); 177 | file_link.set_text(settings_manager.background); 178 | ToolButton open = new ToolButton.from_stock(Stock.OPEN); 179 | open.clicked.connect(open_file); 180 | //file_link.set_size_request(200,-1); 181 | bg.pack_start(new Label("Desktop Image: "),true,false); 182 | bg.pack_start(file_link,true,false); 183 | //CheckButton t1 = new CheckButton.with_label(""); 184 | /*Box bgo = new Box(Orientation.HORIZONTAL,5); 185 | RadioButton tiles = new RadioButton.with_label_from_widget(null,"Tiles"); 186 | if (settings_manager.bg_option == 0) tiles.set_active(true); 187 | bgo.pack_start(tiles,true,false); 188 | tiles.toggled.connect(radio_select2); 189 | RadioButton stretch = new RadioButton.from_widget(tiles); 190 | stretch.set_label("Stretch"); 191 | stretch.toggled.connect(radio_select2); 192 | bgo.pack_start(stretch,true,false); 193 | if (settings_manager.bg_option == 2) stretch.set_active(true); 194 | RadioButton center = new RadioButton.from_widget(tiles); 195 | center.set_label("Center"); 196 | center.toggled.connect(radio_select2); 197 | if (settings_manager.bg_option == 1) center.set_active(true); 198 | bgo.pack_start(center,true,false); 199 | bgo.show_all();*/ 200 | bg1.pack_start(new Label("Background Color: "),true,false); 201 | bg.pack_start(open,true,false); 202 | color = new Entry(); 203 | //color.set_size_request(200,-1); 204 | ToolButton color_picker = new ToolButton.from_stock(Stock.COLOR_PICKER); 205 | bg1.pack_start(color,true,false); 206 | bg1.pack_start(color_picker,true,false); 207 | color_picker.clicked.connect(choose_color); 208 | //bg.set_spacing(25); 209 | bg.set_margin_left(15); 210 | //bg1.set_spacing(10); 211 | bg1.set_margin_left(20); 212 | Box button = new Box(Orientation.HORIZONTAL,5); 213 | Button reset = new Button.with_label("Reset"); 214 | reset.clicked.connect(reset_config); 215 | Button cancel = new Button.from_stock(Stock.CANCEL); 216 | cancel.clicked.connect(cancel_config); 217 | Button save = new Button.from_stock(Stock.SAVE); 218 | save.clicked.connect(save_config); 219 | button.pack_end(reset,true,false); 220 | button.pack_end(cancel,true,false); 221 | button.pack_end(save,true,false); 222 | button.show_all(); 223 | bg1.show_all(); 224 | background.set_margin_top(15); 225 | background.set_margin_bottom(15); 226 | background.pack_start(bg,true,false); 227 | //background.pack_start(bgo,true,false); 228 | background.pack_start(bg1,true,false); 229 | background.pack_start(button,true,false); 230 | bg.show_all(); 231 | background.show_all(); 232 | } 233 | public static void radio_select(ToggleButton button){ 234 | var name = button.get_label(); 235 | if(button.get_active()) 236 | { 237 | if(name == "Text") settings_manager.option_view_tabs = 0; 238 | if(name == "Icons") settings_manager.option_view_tabs = 1; 239 | if(name == "Text + Icons") settings_manager.option_view_tabs = 2; 240 | } 241 | } 242 | /*public static void radio_select2(ToggleButton button){ 243 | var name = button.get_label(); 244 | if(button.get_active()) 245 | { 246 | if(name == "Tiles") settings_manager.bg_option = 0; 247 | if(name == "Center") settings_manager.bg_option = 1; 248 | if(name == "Stretch") settings_manager.bg_option = 2; 249 | } 250 | }*/ 251 | public void save_view(){ 252 | //save_config(); 253 | settings_manager.update(); 254 | main_page.destroy(); 255 | LxLauncher.Main.init(); 256 | main_page.show_all(); 257 | LxLauncher.Main.main_page.searchview.set_visible(false); 258 | //main_page.tab_box.set_visible(false); 259 | //main_page.clear_all(); 260 | } 261 | public void tabs_setup(){ 262 | Box bg = new Box(Orientation.HORIZONTAL,5); 263 | bg.set_homogeneous(true); 264 | bg.pack_start(new Label("Font Color: "),true,false); 265 | f_color = new Entry(); 266 | ToolButton color_picker = new ToolButton.from_stock(Stock.COLOR_PICKER); 267 | bg.pack_start(f_color,true,false); 268 | bg.pack_start(color_picker,true,false); 269 | color_picker.clicked.connect(choose_color_font); 270 | Box font_box = new Box(Orientation.HORIZONTAL,5); 271 | //font_box.set_spacing(20); 272 | font_box.set_homogeneous(true); 273 | font_box.pack_start(new Label("Font "),true, false); 274 | font = new Entry(); 275 | font_box.pack_start(font,true,false); 276 | ToolButton font_dialog = new ToolButton.from_stock(Stock.SELECT_FONT); 277 | font_dialog.clicked.connect(font_choose); 278 | font_box.pack_start(font_dialog,true,false); 279 | font_box.show_all(); 280 | Box option_tab = new Box(Orientation.HORIZONTAL,5); 281 | Label ss = new Label("Show on tabs"); 282 | option_tab.pack_start(ss,true,false); 283 | option_tab.set_homogeneous(true); 284 | Box option_tab1 = new Box(Orientation.VERTICAL,5); 285 | tabs_text = new RadioButton.with_label(null,"Text"); 286 | tabs_text.toggled.connect(radio_select); 287 | if (settings_manager.option_view_tabs == 0) tabs_text.set_active(true); 288 | tabs_icon = new RadioButton.from_widget(tabs_text); 289 | tabs_icon.set_label("Icons"); 290 | tabs_icon.toggled.connect(radio_select); 291 | if (settings_manager.option_view_tabs == 1) tabs_icon.set_active(true); 292 | tabs_all = new RadioButton.from_widget(tabs_text); 293 | tabs_all.set_label("Text + Icons"); 294 | tabs_all.toggled.connect(radio_select); 295 | if (settings_manager.option_view_tabs == 2) tabs_all.set_active(true); 296 | option_tab1.pack_start(tabs_text,true,false); 297 | option_tab1.pack_start(tabs_icon,true,false); 298 | option_tab1.pack_start(tabs_all,true,false); 299 | option_tab1.show_all(); 300 | option_tab1.set_margin_right(30); 301 | option_tab.pack_start(option_tab1,true,false); 302 | option_tab.show_all(); 303 | Box button = new Box(Orientation.HORIZONTAL,5); 304 | Button cancel = new Button.from_stock(Stock.CANCEL); 305 | cancel.clicked.connect(cancel_config); 306 | Button save = new Button.from_stock(Stock.SAVE); 307 | save.clicked.connect(save_view); 308 | button.pack_end(cancel,true,false); 309 | button.pack_end(save,true,false); 310 | button.show_all(); 311 | tabs.set_margin_top(20); 312 | tabs.set_margin_bottom(20); 313 | tabs.pack_start(bg,true,false); 314 | tabs.pack_start(font_box,true,false); 315 | tabs.pack_start(option_tab,true,false); 316 | tabs.pack_start(button,true,false); 317 | bg.show_all(); 318 | tabs.show_all(); 319 | } 320 | public void save_favourite(){ 321 | if (show_favourite.get_active()){ 322 | main_page.favourite_box.set_visible(true); 323 | }else main_page.favourite_box.set_visible(false); 324 | } 325 | public void favourite_setup(){ 326 | Box bg = new Box (Orientation.HORIZONTAL,5); 327 | show_favourite = new CheckButton.with_label("Show Favourite bar in Home tab"); 328 | if (main_page.favourite_box.get_visible()) show_favourite.set_active(true); else show_favourite.set_active(false); 329 | bg.pack_start(show_favourite,true,false); 330 | bg.show_all(); 331 | Box button = new Box(Orientation.HORIZONTAL,5); 332 | Button save = new Button.from_stock(Stock.SAVE); 333 | save.clicked.connect(save_favourite); 334 | button.pack_start(save,true,false); 335 | Button cancel = new Button.from_stock(Stock.CANCEL); 336 | cancel.clicked.connect(cancel_config); 337 | button.pack_start(cancel,true,false); 338 | button.show_all(); 339 | favourite.pack_start(bg,true,false); 340 | favourite.pack_start(button,true,false); 341 | favourite.show_all(); 342 | } 343 | public void setui(){ 344 | background = new Box(Orientation.VERTICAL, 5); 345 | tabs = new Box(Orientation.VERTICAL, 5); 346 | favourite = new Box(Orientation.VERTICAL, 5); 347 | main = new Notebook(); 348 | main.show_tabs = true; 349 | main.append_page(background,new Label("Background")); 350 | main.append_page(tabs,new Label("Tabs")); 351 | main.append_page(favourite,new Label("Favourites")); 352 | background_setup(); 353 | tabs_setup(); 354 | favourite_setup(); 355 | main.show_all(); 356 | this.add(main); 357 | } 358 | 359 | public PreferencesSetting(){ 360 | //app = new Gtk.Application("lxlauncher_setting",GLib.ApplicationFlags.IS_LAUNCHER); 361 | set_title("Preferences Settings"); 362 | hide_on_delete(); 363 | //set_default_size(300,300); 364 | set_resizable(false); 365 | setui(); 366 | set_modal(true); 367 | //set_application(app); 368 | set_position(WindowPosition.CENTER); 369 | decorated = true; 370 | 371 | //stick(); 372 | } 373 | } 374 | } 375 | -------------------------------------------------------------------------------- /desktopsetting/DesktopSetting.vala: -------------------------------------------------------------------------------- 1 | using Posix; 2 | using Gtk; 3 | using Gdk; 4 | public SettingsManager settings_manager; 5 | public class DesktopSetting: Gtk.Window 6 | { 7 | private Notebook main; 8 | private Box background; 9 | private Box tabs; 10 | private Box favourite; 11 | private Entry file_link; 12 | private Entry color; 13 | private Entry f_color; 14 | private Entry font; 15 | private RadioButton tabs_text; 16 | private RadioButton tabs_icon; 17 | private RadioButton tabs_all; 18 | private CheckButton show_favourite; 19 | 20 | private void open_file(){ 21 | var file_chooser = new FileChooserDialog ("Open File", this, 22 | FileChooserAction.OPEN,Stock.CANCEL, 23 | ResponseType.CANCEL,Stock.OPEN, ResponseType.ACCEPT); 24 | var filter = new Gtk.FileFilter(); 25 | filter.set_name("Images"); 26 | filter.add_mime_type("image/png"); 27 | filter.add_mime_type("image/jpeg"); 28 | filter.add_mime_type("image/gif"); 29 | filter.add_pattern("*.png"); 30 | filter.add_pattern("*.jpg"); 31 | filter.add_pattern("*.gif"); 32 | file_chooser.add_filter(filter); 33 | if (file_chooser.run () == ResponseType.ACCEPT) { 34 | file_link.set_text(file_chooser.get_filename ()); 35 | settings_manager.background = file_chooser.get_filename (); 36 | color.set_text(""); 37 | } 38 | file_chooser.destroy (); 39 | } 40 | private void choose_color(){ 41 | var color_choose = new ColorSelectionDialog("Choose color"); 42 | if (color_choose.run() == ResponseType.OK){ 43 | ColorSelection colorsl = (ColorSelection)color_choose.get_color_selection(); 44 | Color co; 45 | colorsl.get_current_color(out co); 46 | float r; 47 | float g; 48 | float b; 49 | r = co.red; 50 | g = co.green; 51 | b = co.blue; 52 | settings_manager.tab_bgcolor = "#%02x%02x%02x".printf((int) r >> 8,(int) g >> 8,(int) b >> 8); 53 | color.set_text(settings_manager.tab_bgcolor); 54 | file_link.set_text(""); 55 | settings_manager.background = ""; 56 | } 57 | color_choose.destroy(); 58 | } 59 | private void font_choose(){ 60 | var font_choose = new FontSelectionDialog("Choose color"); 61 | if (font_choose.run() == ResponseType.OK){ 62 | FontSelection fontsl = (FontSelection)font_choose.get_font_selection(); 63 | settings_manager.font_family = fontsl.get_font_name(); 64 | font.set_text(fontsl.get_font_name()); 65 | } 66 | font_choose.destroy(); 67 | } 68 | private void choose_color_font(){ 69 | var color_choose = new ColorSelectionDialog("Choose color"); 70 | if (color_choose.run() == ResponseType.OK){ 71 | ColorSelection colorsl = (ColorSelection)color_choose.get_color_selection(); 72 | Color co; 73 | colorsl.get_current_color(out co); 74 | float r; 75 | float g; 76 | float b; 77 | r = co.red; 78 | g = co.green; 79 | b = co.blue; 80 | settings_manager.font_color = "#%02x%02x%02x".printf((int) r >> 8,(int) g >> 8,(int) b >> 8); 81 | f_color.set_text(settings_manager.font_color); 82 | 83 | } 84 | color_choose.destroy(); 85 | } 86 | public void reset_config(){ 87 | file_link.set_text("/etc/xdg/lxlauncher/background.png"); 88 | settings_manager.background = "/etc/xdg/lxlauncher/background.png"; 89 | save_config(); 90 | } 91 | public void save_config(){ 92 | settings_manager.update(); 93 | system("killall lxlauncher"); 94 | system("lxlauncher &"); 95 | } 96 | public void cancel_config(){ 97 | exit(0); 98 | } 99 | public static void radio_select(ToggleButton button){ 100 | var name = button.get_label(); 101 | if(button.get_active()) 102 | { 103 | if(name == "Text") settings_manager.option_view_tabs = 0; 104 | if(name == "Icons") settings_manager.option_view_tabs = 1; 105 | if(name == "Text + Icons") settings_manager.option_view_tabs = 2; 106 | } 107 | } 108 | public void background_setup(){ 109 | Box bg = new Box(Orientation.HORIZONTAL,5); 110 | bg.set_homogeneous(true); 111 | Box bg1 = new Box(Orientation.HORIZONTAL,5); 112 | bg1.set_homogeneous(true); 113 | file_link = new Entry(); 114 | file_link.set_text(settings_manager.background); 115 | ToolButton open = new ToolButton.from_stock(Stock.OPEN); 116 | open.clicked.connect(open_file); 117 | //file_link.set_size_request(200,-1); 118 | bg.pack_start(new Label("Desktop Image: "),true,false); 119 | bg.pack_start(file_link,true,false); 120 | bg1.pack_start(new Label("Background Color: "),true,false); 121 | bg.pack_start(open,true,false); 122 | color = new Entry(); 123 | //color.set_size_request(200,-1); 124 | ToolButton color_picker = new ToolButton.from_stock(Stock.COLOR_PICKER); 125 | bg1.pack_start(color,true,false); 126 | bg1.pack_start(color_picker,true,false); 127 | color_picker.clicked.connect(choose_color); 128 | //bg.set_spacing(25); 129 | bg.set_margin_left(15); 130 | //bg1.set_spacing(10); 131 | bg1.set_margin_left(20); 132 | Box button = new Box(Orientation.HORIZONTAL,5); 133 | Button reset = new Button.with_label("Reset"); 134 | reset.clicked.connect(reset_config); 135 | Button cancel = new Button.from_stock(Stock.CANCEL); 136 | cancel.clicked.connect(cancel_config); 137 | Button save = new Button.from_stock(Stock.SAVE); 138 | save.clicked.connect(save_config); 139 | button.pack_end(reset,true,false); 140 | button.pack_end(cancel,true,false); 141 | button.pack_end(save,true,false); 142 | button.show_all(); 143 | bg1.show_all(); 144 | background.set_margin_top(15); 145 | background.set_margin_bottom(15); 146 | background.pack_start(bg,true,false); 147 | background.pack_start(bg1,true,false); 148 | background.pack_start(button,true,false); 149 | bg.show_all(); 150 | background.show_all(); 151 | } 152 | 153 | public void tabs_setup(){ 154 | Box bg = new Box(Orientation.HORIZONTAL,5); 155 | bg.set_homogeneous(true); 156 | bg.pack_start(new Label("Font Color: "),true,false); 157 | f_color = new Entry(); 158 | ToolButton color_picker = new ToolButton.from_stock(Stock.COLOR_PICKER); 159 | bg.pack_start(f_color,true,false); 160 | bg.pack_start(color_picker,true,false); 161 | color_picker.clicked.connect(choose_color_font); 162 | Box font_box = new Box(Orientation.HORIZONTAL,5); 163 | //font_box.set_spacing(20); 164 | font_box.set_homogeneous(true); 165 | font_box.pack_start(new Label("Font "),true, false); 166 | font = new Entry(); 167 | font_box.pack_start(font,true,false); 168 | ToolButton font_dialog = new ToolButton.from_stock(Stock.SELECT_FONT); 169 | font_dialog.clicked.connect(font_choose); 170 | font_box.pack_start(font_dialog,true,false); 171 | font_box.show_all(); 172 | Box option_tab = new Box(Orientation.HORIZONTAL,5); 173 | Label ss = new Label("Show on tabs"); 174 | option_tab.pack_start(ss,true,false); 175 | option_tab.set_homogeneous(true); 176 | Box option_tab1 = new Box(Orientation.VERTICAL,5); 177 | tabs_text = new RadioButton.with_label(null,"Text"); 178 | tabs_text.toggled.connect(radio_select); 179 | if (settings_manager.option_view_tabs == 0) tabs_text.set_active(true); 180 | tabs_icon = new RadioButton.from_widget(tabs_text); 181 | tabs_icon.set_label("Icons"); 182 | tabs_icon.toggled.connect(radio_select); 183 | if (settings_manager.option_view_tabs == 1) tabs_icon.set_active(true); 184 | tabs_all = new RadioButton.from_widget(tabs_text); 185 | tabs_all.set_label("Text + Icons"); 186 | tabs_all.toggled.connect(radio_select); 187 | if (settings_manager.option_view_tabs == 2) tabs_all.set_active(true); 188 | option_tab1.pack_start(tabs_text,true,false); 189 | option_tab1.pack_start(tabs_icon,true,false); 190 | option_tab1.pack_start(tabs_all,true,false); 191 | option_tab1.show_all(); 192 | option_tab1.set_margin_right(30); 193 | option_tab.pack_start(option_tab1,true,false); 194 | option_tab.show_all(); 195 | Box button = new Box(Orientation.HORIZONTAL,5); 196 | Button cancel = new Button.from_stock(Stock.CANCEL); 197 | cancel.clicked.connect(cancel_config); 198 | Button save = new Button.from_stock(Stock.SAVE); 199 | save.clicked.connect(save_config); 200 | button.pack_end(cancel,true,false); 201 | button.pack_end(save,true,false); 202 | button.show_all(); 203 | tabs.set_margin_top(20); 204 | tabs.set_margin_bottom(20); 205 | tabs.pack_start(bg,true,false); 206 | tabs.pack_start(font_box,true,false); 207 | tabs.pack_start(option_tab,true,false); 208 | tabs.pack_start(button,true,false); 209 | bg.show_all(); 210 | tabs.show_all(); 211 | } 212 | /*public void save_favourite(){ 213 | if (show_favourite.get_active()){ 214 | settings_manager.favourites_pos = 1; 215 | }else settings_manager.favourites_pos = 0; 216 | save_config(); 217 | } 218 | public void favourite_setup(){ 219 | Box bg = new Box (Orientation.HORIZONTAL,5); 220 | show_favourite = new CheckButton.with_label("Show Favourite bar in Home tab"); 221 | if (settings_manager.favourites_pos != 0) show_favourite.set_active(true); 222 | destroy.connect(Gtk.main_quit); 223 | bg.pack_start(show_favourite,true,false); 224 | bg.show_all(); 225 | Box button = new Box(Orientation.HORIZONTAL,5); 226 | Button save = new Button.from_stock(Stock.SAVE); 227 | save.clicked.connect(save_favourite); 228 | button.pack_start(save,true,false); 229 | Button cancel = new Button.from_stock(Stock.CANCEL); 230 | cancel.clicked.connect(cancel_config); 231 | button.pack_start(cancel,true,false); 232 | button.show_all(); 233 | favourite.pack_start(bg,true,false); 234 | favourite.pack_start(button,true,false); 235 | favourite.show_all(); 236 | }*/ 237 | public void setui(){ 238 | background = new Box(Orientation.VERTICAL, 5); 239 | tabs = new Box(Orientation.VERTICAL, 5); 240 | favourite = new Box(Orientation.VERTICAL, 5); 241 | main = new Notebook(); 242 | main.show_tabs = true; 243 | main.append_page(background,new Label("Background")); 244 | main.append_page(tabs,new Label("Tabs")); 245 | //main.append_page(favourite,new Label("Favourites")); 246 | background_setup(); 247 | tabs_setup(); 248 | //favourite_setup(); 249 | main.show_all(); 250 | this.add(main); 251 | } 252 | 253 | public DesktopSetting(){ 254 | set_title("Desktop Settings"); 255 | settings_manager = new SettingsManager(profile); 256 | //set_default_size(300,300); 257 | set_resizable(false); 258 | setui(); 259 | set_modal(true); 260 | //set_application(app); 261 | set_position(WindowPosition.CENTER); 262 | decorated = true; 263 | } 264 | } 265 | 266 | public class SettingsManager : Object { 267 | private KeyFile config; 268 | private File file; 269 | public string menu_path = ""; 270 | public int icon_size { get; private set; } 271 | public int columns { get; private set; } 272 | public int favourites_pos; 273 | public int screen_width { get; private set; } 274 | public int screen_height { get; private set; } 275 | public int option_view_tabs; 276 | public string[] favourites { get; private set; } 277 | public string css_style { get; private set; } 278 | public string background ; 279 | public int bg_option; 280 | public string font_family; 281 | public string font_color; 282 | public string tab_bgcolor; 283 | private string load_background(){ 284 | try{ 285 | return config.get_string("CSS","background"); 286 | }catch(Error e){ 287 | } 288 | return ""; 289 | } 290 | private string load_bgtab(){ 291 | try{ 292 | return config.get_string("CSS","bg-color"); 293 | }catch(Error e){ 294 | } 295 | return ""; 296 | } 297 | 298 | private string load_font_family(){ 299 | try{ 300 | return config.get_string("CSS","font"); 301 | }catch(Error e){} 302 | return ""; 303 | } 304 | 305 | private string load_font_color(){ 306 | try{ 307 | return config.get_string("CSS","font-color"); 308 | }catch(Error e){} 309 | return ""; 310 | } 311 | private string init_css_style(){ 312 | string tmp; 313 | tmp =""; 314 | background = load_background(); 315 | font_family = load_font_family(); 316 | font_color = load_font_color(); 317 | tab_bgcolor = load_bgtab(); 318 | if (background != "") 319 | { 320 | tmp += "GtkViewport {background:url('"+background+"'); }\n"; 321 | } 322 | else tmp+="GtkViewport {background-image:none;}\n"; 323 | if (font_family != "") tmp+="GtkWindow#lxlauncher {font:"+font_family+";}\n"; 324 | if (font_color != "") tmp+="GtkWidget {color:"+font_color+";}\n"; 325 | if (tab_bgcolor != "") tmp+="GtkViewport {background-color:"+tab_bgcolor+";}\n"; 326 | tmp+="\nGtkTreeView{background-color:rgba(0,0,0,0);}"; 327 | return tmp; 328 | } 329 | private string[] load_favourites_launchers () { 330 | try { 331 | return config.get_keys("Favourites"); 332 | } catch (Error err) { 333 | 334 | } 335 | return {}; 336 | } 337 | 338 | private string load_menu_path () { 339 | try { 340 | return config.get_string("General", "menu"); 341 | } catch (Error err) { 342 | 343 | } 344 | return ""; 345 | } 346 | 347 | 348 | private int load_n_column () { 349 | try { 350 | return config.get_integer("Interface", "columns"); 351 | } catch (Error err) { 352 | 353 | } 354 | return 6; 355 | } 356 | private int load_option_view () { 357 | try { 358 | return config.get_integer("Interface", "view"); 359 | } catch (Error err) { 360 | 361 | } 362 | return 2; 363 | } 364 | private int load_favourites_pos () { 365 | try { 366 | return config.get_integer("Favourites", "position"); 367 | } catch (Error err) { 368 | 369 | } 370 | return -1; 371 | } 372 | /*private int load_bg_option(){ 373 | try { 374 | return config.get_integer("CSS", "bg_option"); 375 | } catch (Error err) { 376 | 377 | } 378 | return 2; 379 | }*/ 380 | 381 | private bool compare_arrays (string[] first, string[] second) { 382 | int x; 383 | for (x = 0; x <= first.length; x++) { 384 | if (first[x] != second[x]) { 385 | return false; 386 | } 387 | } 388 | return true; 389 | } 390 | private string init_file () { 391 | if (menu_path == "") config.set_string("General", "menu", "/etc/xdg/lubuntu/menus/lxgames-applications.menu"); else 392 | config.set_string("General", "menu", menu_path); 393 | config.set_integer("Interface", "columns", 9); 394 | if (option_view_tabs == -1) config.set_integer("Interface","view",2);else config.set_integer("Interface","view",option_view_tabs); 395 | if (favourites_pos != -1) config.set_integer("Favourites","position",favourites_pos); 396 | config.set_string("Favourites", "pcmanfm", "pcmanfm.desktop"); 397 | if (background != "") config.set_string("CSS","background",background); 398 | if (font_family != "") config.set_string("CSS","font",font_family); 399 | if (font_color != "") config.set_string("CSS","font-color",font_color); 400 | if (tab_bgcolor != "") config.set_string("CSS","bg-color",tab_bgcolor); 401 | if (bg_option == -1 ) config.set_integer("CSS","bg_option",2);else config.set_integer("CSS","bg_option",bg_option); 402 | return config.to_data(); 403 | } 404 | 405 | private void fill_file (File file) { 406 | try{ 407 | file.create(0, null); 408 | string default_content = "[General]\n[Interface]\n[Favourites]\n[CSS]\n"; 409 | FileUtils.set_contents(file.get_path(), default_content, default_content.length); 410 | config.load_from_file(file.get_path(), 0); 411 | default_content = init_file(); 412 | FileUtils.set_contents(file.get_path(), default_content, default_content.length); 413 | }catch(Error e){} 414 | } 415 | private void load_keys () { 416 | menu_path = load_menu_path(); 417 | icon_size = 6;//load_icon_size(); 418 | columns = load_n_column(); 419 | option_view_tabs = load_option_view(); 420 | css_style = init_css_style();//"GtkWindow#lxlauncher {background-image:url('/home/honnguyen/.config/lxlauncher/background.png');}"; 421 | string[] raw_launchers = load_favourites_launchers(); 422 | if (raw_launchers.length > 0 && raw_launchers.length != favourites.length) { 423 | try{string favourites_tmp = config.get_string("Favourites", raw_launchers[0]); 424 | for (int x = 1; x <= raw_launchers.length; x++) { 425 | if (raw_launchers[x] != null) { 426 | favourites_tmp = string.joinv("|", {favourites_tmp, config.get_string("Favourites", raw_launchers[x])}); 427 | } 428 | } 429 | favourites = favourites_tmp.split("|"); 430 | } 431 | catch(Error e){} 432 | } 433 | } 434 | 435 | public void remove_key (string group, string key) { 436 | try{config.remove_key(group, key);}catch(Error e){} 437 | } 438 | 439 | public void set_string (string group, string key, string val) { 440 | config.set_string(group, key, val); 441 | } 442 | 443 | public void set_integer (string group, string key, int val) { 444 | config.set_integer(group, key, val); 445 | } 446 | 447 | public void save_changes () { 448 | try{ 449 | string content = config.to_data(); 450 | FileUtils.set_contents(file.get_path(), content, content.length); 451 | config.load_from_file(file.get_path(), 0); 452 | load_keys(); 453 | }catch(Error e){} 454 | } 455 | public void update(){ 456 | try{ 457 | file.delete(); 458 | fill_file(file); 459 | config.load_from_file(file.get_path(), 0); 460 | load_keys(); 461 | }catch(Error e){} 462 | } 463 | public SettingsManager (string profile) { 464 | try{ 465 | string[] groups = {"General", "Interface", "Favourites","CSS"}; 466 | background = load_background(); 467 | option_view_tabs = load_option_view(); 468 | favourites_pos = load_favourites_pos(); 469 | font_family = ""; 470 | font_color = ""; 471 | config = new KeyFile(); 472 | File dir = File.new_for_path(Environment.get_home_dir()+"/.config/"+"lxlauncher"); 473 | if (dir.query_exists() == false) { dir.make_directory_with_parents(); } 474 | file = File.new_for_path(dir.get_path()+"/"+profile+".conf"); 475 | if (file.query_exists() == false) { 476 | fill_file(file); 477 | config.load_from_file(file.get_path(), 0); 478 | } else { 479 | 480 | config.load_from_file(file.get_path(), 0); 481 | } 482 | if (! compare_arrays(config.get_groups(), groups)) { 483 | file.delete(); 484 | fill_file(file); 485 | config.load_from_file(file.get_path(), 0); 486 | } 487 | load_keys(); 488 | }catch(Error e){ 489 | }; 490 | } 491 | } 492 | static string profile; 493 | static bool verbose = false; 494 | const OptionEntry entries[] = { 495 | {"profile", 'p', 0, OptionArg.FILENAME, out profile, "Use a custom profile"}, 496 | {"verbose", 'v', 0, OptionArg.NONE, out verbose, "Verbose output"}, 497 | {null} 498 | }; 499 | int main(string[] args){ 500 | Gtk.init(ref args); 501 | var argparse = new OptionContext(""); 502 | argparse.add_main_entries(entries, null); 503 | argparse.add_group(Gtk.get_option_group(true)); 504 | if (profile == null) { profile = "default"; } 505 | try { 506 | argparse.parse(ref args); 507 | } catch (Error e) { 508 | return 1; 509 | } 510 | DesktopSetting desktop = new DesktopSetting(); 511 | desktop.show_all(); 512 | Gtk.main(); 513 | return 0; 514 | } 515 | 516 | --------------------------------------------------------------------------------