Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed dependencies for libgee, libgconf and libgnome

  • Loading branch information...
commit b49bf9fed31e57a8ef0f20ab5e8f98554ce16332 1 parent cfdfd91
Pontus Östlund authored
View
97 INSTALL
@@ -4,8 +4,10 @@ Installation Instructions
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
- This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
+ Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without warranty of any kind.
Basic Installation
==================
@@ -13,7 +15,11 @@ Basic Installation
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
+instructions specific to this package. Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below. The lack of an optional feature in a given package is not
+necessarily a bug. More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
@@ -42,7 +48,7 @@ may remove or edit it.
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
-The simplest way to compile this package is:
+ The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
@@ -53,12 +59,22 @@ The simplest way to compile this package is:
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
- the package.
+ the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
+ documentation. When installing into a prefix owned by root, it is
+ recommended that the package be configured and built as a regular
+ user, and only the `make install' phase executed with root
+ privileges.
+
+ 5. Optionally, type `make installcheck' to repeat any self-tests, but
+ this time using the binaries in their final installed location.
+ This target does not install anything. Running this target as a
+ regular user, particularly if the prior `make install' required
+ root privileges, verifies that the installation completed
+ correctly.
+
+ 6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
@@ -67,8 +83,15 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
- 6. Often, you can also type `make uninstall' to remove the installed
- files again.
+ 7. Often, you can also type `make uninstall' to remove the installed
+ files again. In practice, not all packages have tested that
+ uninstallation works correctly, even though it is required by the
+ GNU Coding Standards.
+
+ 8. Some packages, particularly those that use Automake, provide `make
+ distcheck', which can by used by developers to test that all other
+ targets like `make install' and `make uninstall' work correctly.
+ This target is generally not run by end users.
Compilers and Options
=====================
@@ -93,7 +116,8 @@ same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
+source code in the directory that `configure' is in and in `..'. This
+is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
@@ -120,7 +144,8 @@ Installation Names
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
@@ -131,15 +156,46 @@ Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
+you can set and what kinds of files go in them. In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+ The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+ The first method involves providing an override variable for each
+affected directory. For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'. Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated. The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+ The second method involves providing the `DESTDIR' variable. For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names. The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters. On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-Optional Features
-=================
-
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
@@ -152,6 +208,13 @@ find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
+ Some packages offer the ability to configure how verbose the
+execution of `make' will be. For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
Particular systems
==================
@@ -288,7 +351,7 @@ operates.
`configure' can determine that directory automatically.
`--prefix=DIR'
- Use DIR as the installation prefix. *Note Installation Names::
+ Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
View
8 configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([roxenlauncher], [1.0], [pontus@poppa.se], [roxenlauncher])
+AC_INIT([roxenlauncher], [1.0.1], [pontus@poppa.se], [roxenlauncher])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([dist-bzip2])
@@ -36,13 +36,10 @@ AC_SUBST(LDFLAGS)
GLIB_REQUIRED=2.22.2
GTK_REQUIRED=2.18.3
-GEE_REQUIRED=0.5
UNIQUE_REQUIRED=1.1.2
SOUP24_REQUIRED=2.28.1
-GCONF_REQUIRED=2.28.0
GIO_REQUIRED=2.22.2
GDK_REQUIRED=2.18.3
-GNOME_REQUIRED=2.28.0
GDK_PIXBUF_REQUIRED=2.18.3
LIBNOTIFY_REQUIRED=0.4
@@ -62,13 +59,10 @@ PKG_CHECK_MODULES(ROXENLAUNCHER, \
glib-2.0 >= $GLIB_REQUIRED \
gobject-2.0 >= $GLIB_REQUIRED \
gtk+-2.0 >= $GTK_REQUIRED \
- gee-1.0 >= $GEE_REQUIRED \
unique-1.0 >= $UNIQUE_REQUIRED \
libsoup-2.4 >= $SOUP24_REQUIRED \
- gconf-2.0 >= $GCONF_REQUIRED \
gio-2.0 >= $GIO_REQUIRED \
gdk-2.0 >= $GDK_REQUIRED \
- libgnome-2.0 >= $GNOME_REQUIRED \
libnotify >= $LIBNOTIFY_REQUIRED \
gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED)
View
4 src/Makefile.am
@@ -25,14 +25,10 @@ roxenlauncher_SOURCES = \
roxenlauncher_VALAFLAGS = \
--thread \
--pkg=gtk+-2.0 \
- --pkg=gee-1.0 \
--pkg=gdk-2.0 \
- --pkg=gconf-2.0 \
--pkg=unique-1.0 \
--pkg=libsoup-2.4 \
--pkg=gio-2.0 \
- --pkg=gee-1.0 \
- --pkg=libgnome-2.0 \
--pkg=gdk-pixbuf-2.0 \
--pkg=libnotify \
--vapidir=. \
View
159 src/application.vala
@@ -19,7 +19,6 @@
* with RAL. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gee;
using Roxenlauncher;
namespace Roxenlauncher
@@ -29,15 +28,15 @@ namespace Roxenlauncher
public const string VERSION = Config.VERSION;
public const string NAME = _("Roxen Application Launcher");
public const string LIB_UNIQUE_PATH = "com.roxen.launcher";
- public const string DIR = ".roxenlauncher";
+ public const string DIR = ".config/roxenlauncher";
public const string FILES_DIR = "files";
+ public const string CONFIG = DIR + "/ral.conf";
public const string MAIN_UI_FILENAME = "mainwindow.ui";
public const string EDITOR_UI_FILENAME = "application-form.ui";
public const string GCONF_ROOT = "/apps/roxenlauncher/";
public const string DATE_FORMAT = "%Y-%m-%d %H:%M";
public const string USER_AGENT = "Roxen Application Launcher for Linux (" +
VERSION + ")";
- //public const string LAST_FOLDER = "~/";
}
public struct WindowsProperties
@@ -51,17 +50,20 @@ namespace Roxenlauncher
public void init()
{
winprops = { 0, 0, 0, 0 };
- var cli = GConf.Client.get_default();
try {
- string p = App.GCONF_ROOT + "properties/";
- winprops.width = cli.get_int(p + "window-width");
- winprops.height = cli.get_int(p + "window-height");
- winprops.x = cli.get_int(p + "window-x");
- winprops.y = cli.get_int(p + "window-y");
- }
- catch (Error e) {
- warning("Failed to read window properties from GConf: %s", e.message);
+ var cfg = get_config();
+ winprops.width = cfg.get_integer("winprops", "width");
+ winprops.height = cfg.get_integer("winprops", "height");
+ winprops.x = cfg.get_integer("winprops", "left");;
+ winprops.y = cfg.get_integer("winprops", "top");
}
+ catch {}
+ }
+
+ public ConfigFile get_config()
+ {
+ string p = getdir("$home") + "/" + App.CONFIG;
+ return new ConfigFile(p);
}
public string? get_ui_path(string local_path)
@@ -85,91 +87,88 @@ namespace Roxenlauncher
winprops.x = x;
winprops.y = y;
try {
- var cli = GConf.Client.get_default();
- string p = App.GCONF_ROOT + "properties/";
- cli.set_int(p + "window-width", winprops.width);
- cli.set_int(p + "window-height", winprops.height);
- cli.set_int(p + "window-x", winprops.x);
- cli.set_int(p + "window-y", winprops.y);
+ var cli = get_config();
+ cli.set_integer("winprops", "width", winprops.width);
+ cli.set_integer("winprops", "height", winprops.height);
+ cli.set_integer("winprops", "left", winprops.x);
+ cli.set_integer("winprops", "top", winprops.y);
+ cli.save();
}
catch (Error e) {
- warning("Failed to save window properties to GConf: %s", e.message);
+ warning("Failed to save window properties to conf: %s", e.message);
}
}
public string get_last_folder()
{
- var cli = GConf.Client.get_default();
string k = null;
- try { k = cli.get_string(App.GCONF_ROOT + "properties/last-folder"); }
- catch (Error e) {
- warning("Error getting GConf key \"%s\": %s", k, e.message);
- }
-
+ try { k = get_config().get_string("app", "last-folder"); }
+ catch {}
if (k == null) k = getdir("$home");
return k;
}
public void set_last_folder(string path)
{
- var cli = GConf.Client.get_default();
- var key = App.GCONF_ROOT + "properties/last-folder";
- try { cli.set_string(key, path); }
+ var cli = get_config();
+ try {
+ cli.set_string("app", "last-folder", path);
+ cli.save();
+ }
catch (Error e) {
- warning("Error setting GConf key \"%s\": %s", key, e.message);
+ warning("Error setting conf key \"last-folder\": %s", e.message);
}
}
public bool get_enable_notifications()
{
- var cli = GConf.Client.get_default();
bool v = true;
- try { v = cli.get_bool(App.GCONF_ROOT + "properties/notifications"); }
- catch (Error e) {
- warning("Error getting GConf value for notifications!");
- }
-
+ try { v = get_config().get_boolean("app", "notifications"); }
+ catch {}
return v;
}
public void set_enable_notifications(bool val)
{
- var cli = GConf.Client.get_default();
- try { cli.set_bool(App.GCONF_ROOT + "properties/notifications", val); }
- catch (Error e) {
- warning("Error setting GConf value for notifications!");
+ var cli = get_config();
+ try {
+ cli.set_boolean("app", "notifications", val);
+ cli.save();
}
- }
-
- public void set_minimize_to_tray(bool val)
- {
- var cli = GConf.Client.get_default();
- try { cli.set_bool(App.GCONF_ROOT + "properties/minimize-to-tray", val); }
catch (Error e) {
- warning("Error setting GConf value for tray minimization!");
+ warning("Error setting GConf value for notifications!");
}
}
public bool get_minimize_to_tray()
{
- var cli = GConf.Client.get_default();
bool v = true;
- try { v = cli.get_bool(App.GCONF_ROOT + "properties/minimize-to-tray"); }
- catch (Error e) {
- warning("Error getting GConf value for minimization!");
- }
+ try { v = get_config().get_boolean("app", "minimize-to-tray"); }
+ catch {}
return v;
}
+ public void set_minimize_to_tray(bool val)
+ {
+ var cli = get_config();
+ try {
+ cli.set_boolean("app", "minimize-to-tray", val);
+ cli.save();
+ }
+ catch (Error e) {
+ warning("Error setting GConf value for tray minimization!");
+ }
+ }
+
public class Application : Object
{
- private static ArrayList<Application> applications;
+ private static GLib.List<Application> applications;
/**
* Returns the list of applications
*/
- public static ArrayList<Application> get_applications()
+ public static unowned GLib.List<Application> get_applications()
{
return applications;
}
@@ -179,21 +178,15 @@ namespace Roxenlauncher
*
* @param app
*/
- public static void add_application(Application app)
+ public static bool add_application(Application app)
{
- if (applications == null)
- applications = new ArrayList<Application>();
-
Application a = null;
if ((a = get_for_mimetype(app.mimetype)) != null)
- return;
+ return false;
-#if DEBUG
- message("Do add application...");
-#endif
-
- applications.add(app);
+ applications.append(app);
save_list();
+ return true;
}
/**
@@ -212,15 +205,15 @@ namespace Roxenlauncher
{
var list = to_gconf_list();
try {
- var cli = GConf.Client.get_default();
- var key = App.GCONF_ROOT + "settings/applications";
- cli.set_list(key, GConf.ValueType.STRING, list);
+ var cli = get_config();
+ cli.set_string_list("app", "applications", list);
+ cli.save();
}
catch (Error e) {
warning("Failed to save applications to GConf: %s", e.message);
}
}
-
+
/**
* Tries to find an application for mimetype
*
@@ -229,12 +222,6 @@ namespace Roxenlauncher
*/
public static Application? get_for_mimetype(string mimetype)
{
- if (applications == null)
- applications = new ArrayList<Application>();
-
- if (applications.size == 0)
- return null;
-
foreach (Application app in applications)
if (app.mimetype == mimetype)
return app;
@@ -245,15 +232,12 @@ namespace Roxenlauncher
/**
* Creates a list of the applications saveable to GConf
*/
- public static SList<string> to_gconf_list()
+ public static string[] to_gconf_list()
{
- if (applications == null)
- applications = new ArrayList<Application>();
-
- SList<string> list = new SList<string>();
+ string[] list = new string[]{};
foreach (Application app in applications)
- list.append(app.to_gconf_string());
+ list += app.to_gconf_string();
return list;
}
@@ -264,15 +248,12 @@ namespace Roxenlauncher
public static void load_from_gconf()
{
if (applications == null)
- applications = new ArrayList<Application>();
+ applications = new GLib.List<Application>();
- var cli = GConf.Client.get_default();
- var key = App.GCONF_ROOT + "settings/applications";
- SList<string> list = null;
- try { list = cli.get_list(key, GConf.ValueType.STRING); }
- catch (Error e) {
- warning("Error getting GConf list for \"%s\": %s", key, e.message);
- }
+ var cli = get_config();
+ string[] list = null;
+ try { list = cli.get_string_list("app", "applications"); }
+ catch {}
if (list != null) {
foreach (string s in list) {
@@ -281,7 +262,7 @@ namespace Roxenlauncher
if (pts.length > 3 && pts[3].length > 0)
app.arguments = pts[3];
- applications.add(app);
+ applications.append(app);
}
}
}
@@ -305,4 +286,4 @@ namespace Roxenlauncher
return name + "::" + command + "::" + mimetype + "::" + arguments;
}
}
-}
+}
View
24 src/launcherfile.vala
@@ -19,7 +19,6 @@
* with RAL. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gee;
using Roxenlauncher;
public class LauncherFile : Object
@@ -55,15 +54,15 @@ public class LauncherFile : Object
/**
* Array of LauncherFiles
*/
- private static ArrayList<LauncherFile> launcherfiles =
- new ArrayList<LauncherFile>();
+ private static GLib.List<LauncherFile> launcherfiles =
+ new GLib.List<LauncherFile>();
/**
* Returns the list of launcher files
*
* @return
*/
- public static ArrayList<LauncherFile> get_files()
+ public static unowned GLib.List<LauncherFile> get_files()
{
return launcherfiles;
}
@@ -72,12 +71,12 @@ public class LauncherFile : Object
* Returns the list of launcher files in reversed order.
* Called from Roxenlauncher.Tray
*/
- public static ArrayList<LauncherFile> get_reversed_files()
+ public static GLib.List<LauncherFile> get_reversed_files()
{
- ArrayList<LauncherFile> nlist = new Gee.ArrayList<LauncherFile>();
+ GLib.List<LauncherFile> nlist = new GLib.List<LauncherFile>();
- for (int i = launcherfiles.size; i > 0;)
- nlist.add(launcherfiles.get(--i));
+ for (uint i = launcherfiles.length(); i > 0;)
+ nlist.append(launcherfiles.nth_data(--i));
return nlist;
}
@@ -95,7 +94,7 @@ public class LauncherFile : Object
return;
}
- launcherfiles.add(lf);
+ launcherfiles.append(lf);
}
/**
@@ -129,7 +128,8 @@ public class LauncherFile : Object
*/
public static void clear_files()
{
- launcherfiles.clear();
+ foreach (LauncherFile l in launcherfiles)
+ launcherfiles.remove(l);
}
/**
@@ -138,7 +138,7 @@ public class LauncherFile : Object
public static void load_existing()
{
if (launcherfiles == null)
- launcherfiles = new ArrayList<LauncherFile>();
+ launcherfiles = new GLib.List<LauncherFile>();
var p = getdir("files");
@@ -149,7 +149,7 @@ public class LauncherFile : Object
FileInfo fi;
while ((fi = f.next_file(null)) != null) {
var lf = new LauncherFile.from_existing(fi.get_name(), null);
- launcherfiles.add(lf);
+ launcherfiles.append(lf);
}
}
catch (Error e) {
View
1  src/main.vala
@@ -19,7 +19,6 @@
* with RAL. If not, see <http://www.gnu.org/licenses/>.
*/
-using GLib;
using Roxenlauncher;
// Set in ApplicationLauncher.run()
View
30 src/mainwindow.vala
@@ -19,7 +19,6 @@
* with RAL. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gee;
using Notify;
using Roxenlauncher;
@@ -165,7 +164,7 @@ namespace Roxenlauncher
2, last_upload, 3, lf, -1);
}
- if (LauncherFile.get_files().size > 0)
+ if (LauncherFile.get_files().length() > 0)
btn_finish_all.sensitive = true;
set_file_count();
@@ -264,6 +263,8 @@ namespace Roxenlauncher
{
bool state = istate == 2 ? cb_minimize.active : (bool)istate;
cb_minimize.set_active(state);
+ min_to_tray = state;
+ // In application.vala
set_minimize_to_tray(state);
}
@@ -282,11 +283,12 @@ namespace Roxenlauncher
if (d.response) {
Application app = new Application(d.editor_name, d.editor_command,
d.content_type, d.editor_arguments);
- Application.add_application(app);
- Gtk.TreeIter iter;
- ls_apps.append(out iter);
- ls_apps.set(iter, 0, app.mimetype, 1, app.name, 2, app);
- return app;
+ if (Application.add_application(app)) {
+ Gtk.TreeIter iter;
+ ls_apps.append(out iter);
+ ls_apps.set(iter, 0, app.mimetype, 1, app.name, 2, app);
+ return app;
+ }
}
return null;
@@ -328,6 +330,10 @@ namespace Roxenlauncher
d.run();
if (d.response) {
+ if (d.content_type != app.mimetype)
+ if (Application.get_for_mimetype(d.content_type) != null)
+ return;
+
app.mimetype = d.content_type;
app.name = d.editor_name;
app.command = d.editor_command;
@@ -509,7 +515,7 @@ namespace Roxenlauncher
*/
bool on_tv_files_key_release_event(Gtk.Widget source, Gdk.EventKey key)
{
- if (LauncherFile.get_files().size > 0 &&
+ if (LauncherFile.get_files().length() > 0 &&
Gdk.keyval_name(key.keyval).down() == "delete")
{
Gtk.TreeModel model;
@@ -555,7 +561,7 @@ namespace Roxenlauncher
*/
bool on_tv_apps_key_release_event(Gtk.Widget source, Gdk.EventKey key)
{
- if (Application.get_applications().size > 0 &&
+ if (Application.get_applications().length() > 0 &&
Gdk.keyval_name(key.keyval).down() == "delete")
{
Gtk.TreeModel model;
@@ -610,7 +616,7 @@ namespace Roxenlauncher
btn_edit_file.sensitive = is_active;
btn_finish_file.sensitive = is_active;
- btn_finish_all.sensitive = LauncherFile.get_files().size > 0;
+ btn_finish_all.sensitive = LauncherFile.get_files().length() > 0;
}
/**
@@ -748,14 +754,14 @@ namespace Roxenlauncher
void set_file_count()
{
string m = "";
- int num = LauncherFile.get_files().size;
+ uint num = LauncherFile.get_files().length();
if (num == 0)
m = _("No files");
else if (num == 1)
m = _("One file");
else
- m = _("%d active files").printf((int)num);
+ m = _("%d active files").printf(num);
set_status("# " + m);
}
View
102 src/tools.vala
@@ -19,8 +19,6 @@
* with RAL. If not, see <http://www.gnu.org/licenses/>.
*/
-using GLib;
-using Gee;
using Roxenlauncher;
namespace Roxenlauncher
@@ -31,6 +29,106 @@ namespace Roxenlauncher
GENERIC
}
+ public class ConfigFile : Object
+ {
+ string delim = "¤";
+ string path;
+ KeyFile kf;
+
+ public ConfigFile(string path)
+ {
+ if (!file_exists(path)) {
+ try {
+ var file = File.new_for_path(path);
+ var fs = file.create_readwrite(FileCreateFlags.NONE, null);
+ fs.close(null);
+ }
+ catch (Error e) {
+ critical("Unable to create config file \"%s\"!", path);
+ Gtk.main_quit();
+ }
+ }
+
+ this.path = path;
+ kf = new KeyFile();
+ try {
+ kf.load_from_file(path, KeyFileFlags.NONE);
+ }
+ catch (Error e) {
+ message("%s", e.message);
+ }
+ }
+
+ public void set_integer(string section, string key, int val)
+ {
+ kf.set_integer(section, key, val);
+ }
+
+ public int get_integer(string section, string key)
+ throws KeyFileError
+ {
+ return kf.get_integer(section, key);
+ }
+
+ public void set_string(string section, string key, string val)
+ {
+ kf.set_string(section, key, val);
+ }
+
+ public string get_string(string section, string key)
+ throws KeyFileError
+ {
+ return kf.get_string(section, key);
+ }
+
+ public void set_boolean(string section, string key, bool val)
+ {
+ kf.set_boolean(section, key, val);
+ }
+
+ public bool get_boolean(string section, string key)
+ throws KeyFileError
+ {
+ return kf.get_boolean(section, key);
+ }
+
+ public void set_string_list(string section, string key, string[] val)
+ {
+ string v = implode(val, delim);
+ kf.set_string(section, key, v);
+ }
+
+ public string[] get_string_list(string section, string key)
+ throws KeyFileError
+ {
+ string s = kf.get_string(section, key);
+ return s.split(delim);
+ }
+
+ public bool save()
+ throws Error
+ {
+ size_t len;
+ Error e = null;
+ string data = kf.to_data(out len, out e);
+
+ if (e != null)
+ throw e;
+
+ try {
+ var file = File.new_for_path(path);
+ var fs = new DataOutputStream(file.open_readwrite(null).output_stream);
+ fs.put_string(data, null);
+ fs.close(null);
+ }
+ catch (Error e) {
+ warning("Unable to save config: %s", e.message);
+ }
+
+ return true;
+ }
+ }
+
public string? file_get_contents(string file)
{
if (!FileUtils.test(file, FileTest.EXISTS)) {
View
45 src/tray.vala
@@ -70,41 +70,38 @@ namespace Roxenlauncher
void on_trayicon_popup(uint btn, uint time)
{
- var visible = win.get_window().visible;
- popmenu = new Gtk.Menu();
- var item_quit = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_QUIT, null);
- var img_hide = new Gtk.Image.from_stock(Gtk.STOCK_CLOSE,
- Gtk.IconSize.MENU);
- var img_show = new Gtk.Image.from_stock(Gtk.STOCK_OPEN,
- Gtk.IconSize.MENU);
- var item_toggle = new Gtk.ImageMenuItem.with_label(visible ? t_hide :
- t_show);
+ var visible = win.get_window().visible;
+ popmenu = new Menu();
+ var item_quit = new ImageMenuItem.from_stock(Gtk.STOCK_QUIT, null);
+ var img_hide = new Image.from_stock(STOCK_CLOSE, IconSize.MENU);
+ var img_show = new Image.from_stock(STOCK_OPEN, IconSize.MENU);
+ var item_toggle = new ImageMenuItem.with_label(visible ? t_hide : t_show);
item_toggle.set_image(visible ? img_hide : img_show);
- Gee.ArrayList<LauncherFile> lfs = LauncherFile.get_reversed_files();
+ GLib.List<LauncherFile> lfs = LauncherFile.get_reversed_files();
- if (lfs.size == 0) {
- var mi = new Gtk.MenuItem.with_label(_("No active files"));
+ if (lfs.length() == 0) {
+ var mi = new MenuItem.with_label(_("No active files"));
mi.sensitive = false;
popmenu.add(mi);
}
else {
foreach (LauncherFile lf in lfs) {
- Gtk.MenuItem mi = null;
+ MenuItem mi = null;
if (lf.status == LauncherFile.Statuses.DOWNLOADED ||
lf.status == LauncherFile.Statuses.UPLOADED)
{
string img = lf.status == LauncherFile.Statuses.DOWNLOADED ?
- Gtk.STOCK_GO_DOWN : Gtk.STOCK_GO_UP;
- var imi = new Gtk.ImageMenuItem.from_stock(img, null);
+ STOCK_GO_DOWN : STOCK_GO_UP;
+ var imi = new ImageMenuItem.from_stock(img, null);
imi.set_label(lf.get_uri());
mi = (MenuItem)imi;
}
else
- mi = new Gtk.MenuItem.with_label(lf.get_uri());
+ mi = new MenuItem.with_label(lf.get_uri());
mi.activate.connect((widget) => {
- var f = LauncherFile.find_by_uri(((Gtk.MenuItem)widget).label);
+ var f = LauncherFile.find_by_uri(((MenuItem)widget).label);
if (f != null)
f.download();
});
@@ -113,36 +110,36 @@ namespace Roxenlauncher
}
}
- var finish_all = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_CLEAR, null);
+ var finish_all = new ImageMenuItem.from_stock(STOCK_CLEAR, null);
finish_all.activate.connect(() => {
Idle.add(() => { win.finish_all_files(); return false; });
popmenu.popdown();
});
- if (lfs.size == 0)
+ if (lfs.length() == 0)
finish_all.sensitive = false;
item_quit.activate.connect(win.on_window_destroy);
item_toggle.activate.connect(set_window_visibility);
var t_notify = _("Enable notifications");
- var t_tray = _("Minimize to tray");
- var item_notify = new Gtk.CheckMenuItem.with_label(t_notify);
+ var t_tray = _("Minimize to tray");
+ var item_notify = new CheckMenuItem.with_label(t_notify);
item_notify.set_active(get_enable_notifications());
item_notify.activate.connect(() => {
win.toggle_notifications((int)(!get_enable_notifications()));
});
- var item_minimize = new Gtk.CheckMenuItem.with_label(t_tray);
+ var item_minimize = new CheckMenuItem.with_label(t_tray);
item_minimize.set_active(get_minimize_to_tray());
item_minimize.activate.connect(() => {
win.toggle_minimize_to_tray((int)(!get_minimize_to_tray()));
});
- popmenu.add(new Gtk.SeparatorMenuItem());
+ popmenu.add(new SeparatorMenuItem());
popmenu.add(item_notify);
popmenu.add(item_minimize);
- popmenu.add(new Gtk.SeparatorMenuItem());
+ popmenu.add(new SeparatorMenuItem());
popmenu.add(finish_all);
popmenu.add(item_toggle);
popmenu.add(item_quit);
Please sign in to comment.
Something went wrong with that request. Please try again.