2017-03-02 14:37:32 +00:00
|
|
|
using Gtk;
|
|
|
|
|
|
|
|
using Dino.Entities;
|
|
|
|
|
2017-03-11 00:25:45 +00:00
|
|
|
public class Dino.Application : Gtk.Application {
|
2017-03-02 14:37:32 +00:00
|
|
|
|
2017-03-11 00:25:45 +00:00
|
|
|
public Database db;
|
|
|
|
public StreamInteractor stream_interaction;
|
|
|
|
public Plugins.Registry plugin_registry = new Plugins.Registry();
|
2017-03-02 14:37:32 +00:00
|
|
|
|
2017-03-12 12:19:04 +00:00
|
|
|
public Application() throws Error {
|
|
|
|
if (DirUtils.create_with_parents(get_storage_dir(), 0700) == -1) {
|
|
|
|
throw new Error(-1, 0, @"Could not create storage dir \"$(get_storage_dir())\": $(FileUtils.error_from_errno(errno))");
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: Legacy import
|
|
|
|
if (FileUtils.test("store.sqlite3", FileTest.IS_REGULAR)) {
|
|
|
|
FileUtils.rename("store.sqlite3", Path.build_filename(get_storage_dir(), "dino.db"));
|
|
|
|
}
|
|
|
|
|
|
|
|
this.db = new Database(Path.build_filename(get_storage_dir(), "dino.db"));
|
2017-03-02 14:37:32 +00:00
|
|
|
this.stream_interaction = new StreamInteractor(db);
|
|
|
|
|
|
|
|
AvatarManager.start(stream_interaction, db);
|
|
|
|
MessageManager.start(stream_interaction, db);
|
|
|
|
CounterpartInteractionManager.start(stream_interaction);
|
|
|
|
PresenceManager.start(stream_interaction);
|
|
|
|
MucManager.start(stream_interaction);
|
|
|
|
RosterManager.start(stream_interaction);
|
|
|
|
ConversationManager.start(stream_interaction, db);
|
|
|
|
ChatInteraction.start(stream_interaction);
|
|
|
|
}
|
2017-03-12 12:19:04 +00:00
|
|
|
|
|
|
|
public static string get_storage_dir() {
|
|
|
|
return Path.build_filename(Environment.get_user_data_dir(), "dino");
|
|
|
|
}
|
2017-03-02 14:37:32 +00:00
|
|
|
}
|
|
|
|
|