aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/src/ui/application.vala8
-rw-r--r--main/src/ui/contact_details/dialog.vala6
-rw-r--r--main/src/ui/contact_details/muc_config_form_provider.vala7
-rw-r--r--main/src/ui/contact_details/settings_provider.vala7
-rw-r--r--main/src/ui/conversation_titlebar/encryption_entry.vala13
-rw-r--r--main/src/ui/conversation_titlebar/menu_entry.vala13
-rw-r--r--main/src/ui/conversation_titlebar/occupants_entry.vala13
-rw-r--r--main/src/ui/conversation_titlebar/view.vala8
-rw-r--r--main/src/ui/manage_accounts/dialog.vala12
9 files changed, 57 insertions, 30 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index 72bd4d0d..75b82352 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -3,11 +3,17 @@ using Gtk;
using Dino.Entities;
using Dino.Ui;
-public class Dino.Ui.Application : Dino.Application {
+public class Dino.Ui.Application : Gtk.Application, Dino.Application {
private Notifications notifications;
private UnifiedWindow window;
+ public Database db { get; set; }
+ public StreamInteractor stream_interaction { get; set; }
+ public Plugins.Registry plugin_registry { get; set; default = new Plugins.Registry(); }
+ public SearchPathGenerator? search_path_generator { get; set; }
+
public Application() throws Error {
+ init();
Notify.init("dino");
Environment.set_application_name("Dino");
Gtk.Window.set_default_icon_name("dino");
diff --git a/main/src/ui/contact_details/dialog.vala b/main/src/ui/contact_details/dialog.vala
index a5b8ea38..4e61a3f5 100644
--- a/main/src/ui/contact_details/dialog.vala
+++ b/main/src/ui/contact_details/dialog.vala
@@ -45,7 +45,7 @@ public class Dialog : Gtk.Dialog {
app.plugin_registry.register_contact_details_entry(new MucConfigFormProvider(stream_interactor));
foreach (Plugins.ContactDetailsProvider provider in app.plugin_registry.contact_details_entries) {
- provider.populate(conversation, contact_details);
+ provider.populate(conversation, contact_details, Plugins.WidgetType.GTK);
}
destroy.connect(() => {
@@ -72,7 +72,9 @@ public class Dialog : Gtk.Dialog {
Util.image_set_from_scaled_pixbuf(avatar, (new AvatarGenerator(50, 50, avatar.scale_factor)).draw_conversation(stream_interactor, conversation));
}
- private void add_entry(string category, string label, string? description, Widget w) {
+ private void add_entry(string category, string label, string? description, Object wo) {
+ if (!(wo is Widget)) return;
+ Widget w = (Widget) wo;
add_category(category);
ListBoxRow list_row = new ListBoxRow() { activatable=false, visible=true };
diff --git a/main/src/ui/contact_details/muc_config_form_provider.vala b/main/src/ui/contact_details/muc_config_form_provider.vala
index 438f41c4..47bbbe28 100644
--- a/main/src/ui/contact_details/muc_config_form_provider.vala
+++ b/main/src/ui/contact_details/muc_config_form_provider.vala
@@ -6,15 +6,16 @@ using Xmpp.Xep;
namespace Dino.Ui.ContactDetails {
-public class MucConfigFormProvider : Plugins.ContactDetailsProvider {
- public override string id { get { return "muc_config_form"; } }
+public class MucConfigFormProvider : Plugins.ContactDetailsProvider, Object {
+ public string id { get { return "muc_config_form"; } }
private StreamInteractor stream_interactor;
public MucConfigFormProvider(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
}
- public override void populate(Conversation conversation, Plugins.ContactDetails contact_details) {
+ public void populate(Conversation conversation, Plugins.ContactDetails contact_details, Plugins.WidgetType type) {
+ if (type != Plugins.WidgetType.GTK) return;
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
Xmpp.Core.XmppStream? stream = stream_interactor.get_stream(conversation.account);
if (stream == null) return;
diff --git a/main/src/ui/contact_details/settings_provider.vala b/main/src/ui/contact_details/settings_provider.vala
index 70eab72c..64d4598c 100644
--- a/main/src/ui/contact_details/settings_provider.vala
+++ b/main/src/ui/contact_details/settings_provider.vala
@@ -4,8 +4,8 @@ using Dino.Entities;
namespace Dino.Ui.ContactDetails {
-public class SettingsProvider : Plugins.ContactDetailsProvider {
- public override string id { get { return "chat_settings"; } }
+public class SettingsProvider : Plugins.ContactDetailsProvider, Object {
+ public string id { get { return "chat_settings"; } }
private StreamInteractor stream_interactor;
@@ -13,7 +13,8 @@ public class SettingsProvider : Plugins.ContactDetailsProvider {
this.stream_interactor = stream_interactor;
}
- public override void populate(Conversation conversation, Plugins.ContactDetails contact_details) {
+ public void populate(Conversation conversation, Plugins.ContactDetails contact_details, Plugins.WidgetType type) {
+ if (type != Plugins.WidgetType.GTK) return;
if (conversation.type_ == Conversation.Type.CHAT) {
ComboBoxText[] comboboxes = new ComboBoxText[2];
for (int i = 0; i < 3; i++) {
diff --git a/main/src/ui/conversation_titlebar/encryption_entry.vala b/main/src/ui/conversation_titlebar/encryption_entry.vala
index 18c09773..12b73409 100644
--- a/main/src/ui/conversation_titlebar/encryption_entry.vala
+++ b/main/src/ui/conversation_titlebar/encryption_entry.vala
@@ -5,12 +5,15 @@ using Dino.Entities;
namespace Dino.Ui {
-class EncryptionEntry : Plugins.ConversationTitlebarEntry {
- public override string id { get { return "encryption"; } }
+class EncryptionEntry : Plugins.ConversationTitlebarEntry, Object {
+ public string id { get { return "encryption"; } }
- public override double order { get { return 2; } }
- public override Plugins.ConversationTitlebarWidget get_widget() {
- return new EncryptionWidget() { visible=true };
+ public double order { get { return 2; } }
+ public Plugins.ConversationTitlebarWidget get_widget(Plugins.WidgetType type) {
+ if (type == Plugins.WidgetType.GTK) {
+ return new EncryptionWidget() { visible=true };
+ }
+ return null;
}
}
diff --git a/main/src/ui/conversation_titlebar/menu_entry.vala b/main/src/ui/conversation_titlebar/menu_entry.vala
index 6cead69d..6cdd11c2 100644
--- a/main/src/ui/conversation_titlebar/menu_entry.vala
+++ b/main/src/ui/conversation_titlebar/menu_entry.vala
@@ -4,8 +4,8 @@ using Dino.Entities;
namespace Dino.Ui {
-class MenuEntry : Plugins.ConversationTitlebarEntry {
- public override string id { get { return "menu"; } }
+class MenuEntry : Plugins.ConversationTitlebarEntry, Object {
+ public string id { get { return "menu"; } }
StreamInteractor stream_interactor;
@@ -13,9 +13,12 @@ class MenuEntry : Plugins.ConversationTitlebarEntry {
this.stream_interactor = stream_interactor;
}
- public override double order { get { return 0; } }
- public override Plugins.ConversationTitlebarWidget get_widget() {
- return new MenuWidget(stream_interactor) { visible=true };
+ public double order { get { return 0; } }
+ public Plugins.ConversationTitlebarWidget get_widget(Plugins.WidgetType type) {
+ if (type == Plugins.WidgetType.GTK) {
+ return new MenuWidget(stream_interactor) { visible=true };
+ }
+ return null;
}
}
diff --git a/main/src/ui/conversation_titlebar/occupants_entry.vala b/main/src/ui/conversation_titlebar/occupants_entry.vala
index c305bed7..904a832a 100644
--- a/main/src/ui/conversation_titlebar/occupants_entry.vala
+++ b/main/src/ui/conversation_titlebar/occupants_entry.vala
@@ -4,8 +4,8 @@ using Dino.Entities;
namespace Dino.Ui {
-class OccupantsEntry : Plugins.ConversationTitlebarEntry {
- public override string id { get { return "occupants"; } }
+class OccupantsEntry : Plugins.ConversationTitlebarEntry, Object {
+ public string id { get { return "occupants"; } }
StreamInteractor stream_interactor;
Window window;
@@ -15,9 +15,12 @@ class OccupantsEntry : Plugins.ConversationTitlebarEntry {
this.window = window;
}
- public override double order { get { return 3; } }
- public override Plugins.ConversationTitlebarWidget get_widget() {
- return new OccupantsWidget(stream_interactor, window) { visible=true };
+ public double order { get { return 3; } }
+ public Plugins.ConversationTitlebarWidget get_widget(Plugins.WidgetType type) {
+ if (type == Plugins.WidgetType.GTK) {
+ return new OccupantsWidget(stream_interactor, window) { visible=true };
+ }
+ return null;
}
}
diff --git a/main/src/ui/conversation_titlebar/view.vala b/main/src/ui/conversation_titlebar/view.vala
index 7debddd6..34191995 100644
--- a/main/src/ui/conversation_titlebar/view.vala
+++ b/main/src/ui/conversation_titlebar/view.vala
@@ -25,9 +25,11 @@ public class ConversationTitlebar : Gtk.HeaderBar {
app.plugin_registry.register_contact_titlebar_entry(new OccupantsEntry(stream_interactor, window));
foreach(var e in app.plugin_registry.conversation_titlebar_entries) {
- Plugins.ConversationTitlebarWidget widget = e.get_widget();
- widgets.add(widget);
- pack_end(widget);
+ Plugins.ConversationTitlebarWidget widget = e.get_widget(Plugins.WidgetType.GTK);
+ if (widget != null) {
+ widgets.add(widget);
+ pack_end((Gtk.Widget)widget);
+ }
}
stream_interactor.get_module(MucManager.IDENTITY).subject_set.connect((account, jid, subject) => {
diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala
index 548cb713..dae2fa73 100644
--- a/main/src/ui/manage_accounts/dialog.vala
+++ b/main/src/ui/manage_accounts/dialog.vala
@@ -56,16 +56,22 @@ public class Dialog : Gtk.Dialog {
int16 default_top_padding = new Gtk.Button().get_style_context().get_padding(Gtk.StateFlags.NORMAL).top + 1;
Application app = GLib.Application.get_default() as Application;
foreach (var e in app.plugin_registry.account_settings_entries) {
- Plugins.AccountSettingsWidget widget = e.get_widget();
+ Plugins.AccountSettingsWidget widget = e.get_widget(Plugins.WidgetType.GTK);
plugin_widgets.add(widget);
- widget.visible = true;
Label label = new Label(e.name) { xalign=1, yalign=0, visible=true };
label.get_style_context().add_class("dim-label");
label.set_padding(0, e.label_top_padding == -1 ? default_top_padding : e.label_top_padding);
settings_list.attach(label, 0, row_index);
- settings_list.attach(widget, 1, row_index, 2);
+ if (widget is Widget) {
+ Widget gtkw = (Widget) widget;
+ plugin_widgets.add(widget);
+ gtkw.visible = true;
+ settings_list.attach(gtkw, 1, row_index, 2);
+ } else {
+ // TODO
+ }
row_index++;
}
}