aboutsummaryrefslogtreecommitdiff
path: root/libdino/src
diff options
context:
space:
mode:
Diffstat (limited to 'libdino/src')
-rw-r--r--libdino/src/application.vala14
-rw-r--r--libdino/src/plugin/interfaces.vala28
-rw-r--r--libdino/src/service/avatar_manager.vala2
-rw-r--r--libdino/src/util.vala4
4 files changed, 29 insertions, 19 deletions
diff --git a/libdino/src/application.vala b/libdino/src/application.vala
index c8834288..72dbfeae 100644
--- a/libdino/src/application.vala
+++ b/libdino/src/application.vala
@@ -1,13 +1,11 @@
-using Gtk;
-
using Dino.Entities;
-public class Dino.Application : Gtk.Application {
+public interface Dino.Application : GLib.Application {
- public Database db;
- public StreamInteractor stream_interaction;
- public Plugins.Registry plugin_registry = new Plugins.Registry();
- public SearchPathGenerator? search_path_generator { get; set; }
+ public abstract Database db { get; set; }
+ public abstract StreamInteractor stream_interaction { get; set; }
+ public abstract Plugins.Registry plugin_registry { get; set; }
+ public abstract SearchPathGenerator? search_path_generator { get; set; }
static string print_xmpp;
@@ -16,7 +14,7 @@ public class Dino.Application : Gtk.Application {
{ null }
};
- public Application() throws Error {
+ public void init() throws Error {
if (DirUtils.create_with_parents(get_storage_dir(), 0700) == -1) {
throw new Error(-1, 0, "Could not create storage dir \"%s\": %s", get_storage_dir(), FileUtils.error_from_errno(errno).to_string());
}
diff --git a/libdino/src/plugin/interfaces.vala b/libdino/src/plugin/interfaces.vala
index dbed6a00..729f7b26 100644
--- a/libdino/src/plugin/interfaces.vala
+++ b/libdino/src/plugin/interfaces.vala
@@ -1,5 +1,3 @@
-using Gtk;
-
using Dino.Entities;
namespace Dino.Plugins {
@@ -12,6 +10,10 @@ public enum Priority {
HIGHEST
}
+public enum WidgetType {
+ GTK
+}
+
public interface RootInterface : Object {
public abstract void registered(Dino.Application app);
@@ -31,10 +33,10 @@ public abstract class AccountSettingsEntry : Object {
public abstract string name { get; }
public virtual int16 label_top_padding { get { return -1; } }
- public abstract AccountSettingsWidget get_widget();
+ public abstract AccountSettingsWidget? get_widget(WidgetType type);
}
-public interface AccountSettingsWidget : Gtk.Widget {
+public interface AccountSettingsWidget : Object {
public abstract void set_account(Account account);
public abstract signal void activated();
@@ -42,24 +44,30 @@ public interface AccountSettingsWidget : Gtk.Widget {
public abstract void deactivate();
}
-public abstract class ContactDetailsProvider : Object {
+public interface ContactDetailsProvider : Object {
public abstract string id { get; }
- public abstract void populate(Conversation conversation, ContactDetails contact_details);
+ public abstract void populate(Conversation conversation, ContactDetails contact_details, WidgetType type);
}
public class ContactDetails : Object {
public signal void save();
- public signal void add(string category, string label, string? desc, Widget widget);
+ public signal void add(string category, string label, string? desc, Object widget);
+}
+
+public interface TextCommand : Object {
+ public abstract string cmd { get; }
+
+ public abstract string? handle_command(string? text, Entities.Conversation? conversation);
}
-public abstract class ConversationTitlebarEntry : Object {
+public interface ConversationTitlebarEntry : Object {
public abstract string id { get; }
public abstract double order { get; }
- public abstract ConversationTitlebarWidget get_widget();
+ public abstract ConversationTitlebarWidget get_widget(WidgetType type);
}
-public interface ConversationTitlebarWidget : Gtk.Widget {
+public interface ConversationTitlebarWidget : Object {
public abstract void set_conversation(Conversation conversation);
}
diff --git a/libdino/src/service/avatar_manager.vala b/libdino/src/service/avatar_manager.vala
index 42a08168..61e1faef 100644
--- a/libdino/src/service/avatar_manager.vala
+++ b/libdino/src/service/avatar_manager.vala
@@ -31,7 +31,7 @@ public class AvatarManager : StreamInteractionModule, Object {
}
public static string get_storage_dir() {
- return Path.build_filename(Application.get_storage_dir(), "avatars");
+ return Path.build_filename(Dino.get_storage_dir(), "avatars");
}
private AvatarManager(StreamInteractor stream_interactor, Database db) {
diff --git a/libdino/src/util.vala b/libdino/src/util.vala
index 03d6ee26..85047dd8 100644
--- a/libdino/src/util.vala
+++ b/libdino/src/util.vala
@@ -20,6 +20,10 @@ public class SearchPathGenerator {
}
}
+public static string get_storage_dir() {
+ return Path.build_filename(Environment.get_user_data_dir(), "dino");
+}
+
[CCode (cname = "dino_gettext", cheader_filename = "dino_i18n.h")]
public static extern unowned string _(string s);