Select conversation on startup, placeholder for "No conversation selected", start services before UI
This commit is contained in:
parent
db57a97353
commit
6f3225979c
|
@ -29,10 +29,28 @@ public class Dino.Application : Gtk.Application {
|
||||||
RosterManager.start(stream_interaction);
|
RosterManager.start(stream_interaction);
|
||||||
ConversationManager.start(stream_interaction, db);
|
ConversationManager.start(stream_interaction, db);
|
||||||
ChatInteraction.start(stream_interaction);
|
ChatInteraction.start(stream_interaction);
|
||||||
|
|
||||||
|
activate.connect(() => {
|
||||||
|
restore();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string get_storage_dir() {
|
public static string get_storage_dir() {
|
||||||
return Path.build_filename(Environment.get_user_data_dir(), "dino");
|
return Path.build_filename(Environment.get_user_data_dir(), "dino");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void add_connection(Account account) {
|
||||||
|
stream_interaction.connect(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void remove_connection(Account account) {
|
||||||
|
stream_interaction.disconnect(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void restore() {
|
||||||
|
foreach (Account account in db.get_accounts()) {
|
||||||
|
if (account.enabled) add_connection(account);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ public class ConversationManager : StreamInteractionModule, Object {
|
||||||
public string id { get { return IDENTITY.id; } }
|
public string id { get { return IDENTITY.id; } }
|
||||||
|
|
||||||
public signal void conversation_activated(Conversation conversation);
|
public signal void conversation_activated(Conversation conversation);
|
||||||
|
public signal void conversation_deactivated(Conversation conversation);
|
||||||
|
|
||||||
private StreamInteractor stream_interactor;
|
private StreamInteractor stream_interactor;
|
||||||
private Database db;
|
private Database db;
|
||||||
|
@ -37,6 +38,16 @@ public class ConversationManager : StreamInteractionModule, Object {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Gee.List<Conversation> get_active_conversations() {
|
||||||
|
ArrayList<Conversation> ret = new ArrayList<Conversation>(Conversation.equals_func);
|
||||||
|
foreach (Account account in conversations.keys) {
|
||||||
|
foreach (Conversation conversation in conversations[account].values) {
|
||||||
|
if(conversation.active) ret.add(conversation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
public Conversation get_add_conversation(Jid jid, Account account) {
|
public Conversation get_add_conversation(Jid jid, Account account) {
|
||||||
ensure_add_conversation(jid, account, Conversation.Type.CHAT);
|
ensure_add_conversation(jid, account, Conversation.Type.CHAT);
|
||||||
return get_conversation(jid, account);
|
return get_conversation(jid, account);
|
||||||
|
@ -52,7 +63,11 @@ public class ConversationManager : StreamInteractionModule, Object {
|
||||||
conversation_activated(conversation);
|
conversation_activated(conversation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close_conversation(Conversation conversation) {
|
||||||
|
conversation.active = false;
|
||||||
|
conversation_deactivated(conversation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void on_account_added(Account account) {
|
private void on_account_added(Account account) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class ModuleIdentity<T> : Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
public T? cast(StreamInteractionModule module) {
|
public T? cast(StreamInteractionModule module) {
|
||||||
return (T?) module;
|
return module.get_type().is_a(typeof(T)) ? (T?) module : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool matches(StreamInteractionModule module) {
|
public bool matches(StreamInteractionModule module) {
|
||||||
|
|
|
@ -10,8 +10,10 @@
|
||||||
<object class="GtkScrolledWindow" id="scrolled">
|
<object class="GtkScrolledWindow" id="scrolled">
|
||||||
<property name="max_content_height">300</property>
|
<property name="max_content_height">300</property>
|
||||||
<property name="propagate_natural_height">True</property>
|
<property name="propagate_natural_height">True</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkFrame">
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTextView" id="text_input">
|
<object class="GtkTextView" id="text_input">
|
||||||
<property name="wrap-mode">GTK_WRAP_WORD_CHAR</property>
|
<property name="wrap-mode">GTK_WRAP_WORD_CHAR</property>
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
<interface>
|
<interface>
|
||||||
<template class="DinoUiConversationSummaryView">
|
<template class="DinoUiConversationSummaryView">
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="spacing">0</property>
|
<property name="spacing">0</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStack" id="stack">
|
<object class="GtkStack" id="stack">
|
||||||
<property name="transition_type">crossfade</property>
|
<property name="transition_type">crossfade</property>
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="margin">15</property>
|
<property name="margin">15</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="main">
|
<object class="GtkBox" id="main">
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox" id="box">
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="spacing">10</property>
|
<property name="spacing">10</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
@ -23,8 +23,7 @@
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="label">
|
||||||
<property name="label">No accounts active</property>
|
|
||||||
<property name="xalign">0.5</property>
|
<property name="xalign">0.5</property>
|
||||||
<property name="yalign">0.5</property>
|
<property name="yalign">0.5</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -34,8 +33,7 @@
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="no_accounts_add">
|
<object class="GtkButton" id="primary_button">
|
||||||
<property name="label">Manage accounts</property>
|
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<style>
|
<style>
|
||||||
|
@ -44,6 +42,15 @@
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="secondary_button">
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<property name="no_show_all">True</property>
|
||||||
|
<style>
|
||||||
|
<class name="text-button"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -13,13 +13,12 @@ public class Dino.Ui.Application : Dino.Application {
|
||||||
notifications.start();
|
notifications.start();
|
||||||
Environment.set_application_name("Dino");
|
Environment.set_application_name("Dino");
|
||||||
IconTheme.get_default().add_resource_path("/org/dino-im/icons");
|
IconTheme.get_default().add_resource_path("/org/dino-im/icons");
|
||||||
}
|
|
||||||
|
|
||||||
public override void activate() {
|
activate.connect(() => {
|
||||||
create_set_app_menu();
|
create_set_app_menu();
|
||||||
window = new UnifiedWindow(this, stream_interaction);
|
window = new UnifiedWindow(this, stream_interaction);
|
||||||
window.show_all();
|
window.show();
|
||||||
restore();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void show_accounts_window() {
|
private void show_accounts_window() {
|
||||||
|
@ -55,19 +54,5 @@ public class Dino.Ui.Application : Dino.Application {
|
||||||
|
|
||||||
set_app_menu(menu);
|
set_app_menu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restore() {
|
|
||||||
foreach (Account account in db.get_accounts()) {
|
|
||||||
if (account.enabled) add_connection(account);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void add_connection(Account account) {
|
|
||||||
stream_interaction.connect(account);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void remove_connection(Account account) {
|
|
||||||
stream_interaction.disconnect(account);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ public abstract class ConversationRow : ListBoxRow {
|
||||||
main_revealer.set_reveal_child(false);
|
main_revealer.set_reveal_child(false);
|
||||||
closed();
|
closed();
|
||||||
main_revealer.notify["child-revealed"].connect(() => {
|
main_revealer.notify["child-revealed"].connect(() => {
|
||||||
conversation.active = false;
|
stream_interactor.get_module(ConversationManager.IDENTITY).close_conversation(conversation);
|
||||||
disappeared();
|
disappeared();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,17 @@ public class List : ListBox {
|
||||||
foreach (ConversationRow row in rows.values) row.update();
|
foreach (ConversationRow row in rows.values) row.update();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
foreach (Conversation conversation in stream_interactor.get_module(ConversationManager.IDENTITY).get_active_conversations()) {
|
||||||
|
add_conversation(conversation);
|
||||||
|
}
|
||||||
|
realize.connect(() => {
|
||||||
|
ListBoxRow? first_row = get_row_at_index(0);
|
||||||
|
if (first_row != null) {
|
||||||
|
select_row(first_row);
|
||||||
|
row_activated(first_row);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void row_activated(ListBoxRow r) {
|
public override void row_activated(ListBoxRow r) {
|
||||||
|
@ -117,15 +128,14 @@ public class List : ListBox {
|
||||||
}
|
}
|
||||||
rows[conversation] = row;
|
rows[conversation] = row;
|
||||||
add(row);
|
add(row);
|
||||||
row.closed.connect(() => { on_conversation_closed(conversation); });
|
row.closed.connect(() => { select_next_conversation(conversation); });
|
||||||
row.disappeared.connect(() => { on_conversation_disappeared(conversation); });
|
row.disappeared.connect(() => { remove_conversation(conversation); });
|
||||||
row.main_revealer.set_reveal_child(true);
|
row.main_revealer.set_reveal_child(true);
|
||||||
}
|
}
|
||||||
invalidate_sort();
|
invalidate_sort();
|
||||||
queue_draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void on_conversation_closed(Conversation conversation) {
|
private void select_next_conversation(Conversation conversation) {
|
||||||
if (get_selected_row() == rows[conversation]) {
|
if (get_selected_row() == rows[conversation]) {
|
||||||
int index = rows[conversation].get_index();
|
int index = rows[conversation].get_index();
|
||||||
ListBoxRow? index_p1 = get_row_at_index(index + 1);
|
ListBoxRow? index_p1 = get_row_at_index(index + 1);
|
||||||
|
@ -142,7 +152,7 @@ public class List : ListBox {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void on_conversation_disappeared(Conversation conversation) {
|
private void remove_conversation(Conversation conversation) {
|
||||||
if (rows.has_key(conversation) && !conversation.active) {
|
if (rows.has_key(conversation) && !conversation.active) {
|
||||||
remove(rows[conversation]);
|
remove(rows[conversation]);
|
||||||
rows.unset(conversation);
|
rows.unset(conversation);
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class View : Box {
|
||||||
[GtkChild] private ScrolledWindow scrolled;
|
[GtkChild] private ScrolledWindow scrolled;
|
||||||
|
|
||||||
public View(StreamInteractor stream_interactor) {
|
public View(StreamInteractor stream_interactor) {
|
||||||
conversation_list = new List(stream_interactor);
|
conversation_list = new List(stream_interactor) { visible=true };
|
||||||
scrolled.add(conversation_list);
|
scrolled.add(conversation_list);
|
||||||
search_entry.key_release_event.connect(search_key_release_event);
|
search_entry.key_release_event.connect(search_key_release_event);
|
||||||
search_entry.search_changed.connect(search_changed);
|
search_entry.search_changed.connect(search_changed);
|
||||||
|
|
|
@ -7,16 +7,17 @@ namespace Dino.Ui {
|
||||||
|
|
||||||
public class UnifiedWindow : Window {
|
public class UnifiedWindow : Window {
|
||||||
|
|
||||||
private UnifiedWindowPlaceholder main_placeholder = new UnifiedWindowPlaceholder();
|
private NoAccountsPlaceholder accounts_placeholder = new NoAccountsPlaceholder() { visible=true };
|
||||||
|
private NoConversationsPlaceholder conversations_placeholder = new NoConversationsPlaceholder() { visible=true };
|
||||||
private ChatInput chat_input;
|
private ChatInput chat_input;
|
||||||
private ConversationListTitlebar conversation_list_titlebar;
|
private ConversationListTitlebar conversation_list_titlebar;
|
||||||
private ConversationSelector.View filterable_conversation_list;
|
private ConversationSelector.View filterable_conversation_list;
|
||||||
private ConversationSummary.View conversation_frame;
|
private ConversationSummary.View conversation_frame;
|
||||||
private ConversationTitlebar conversation_titlebar;
|
private ConversationTitlebar conversation_titlebar;
|
||||||
private Paned headerbar_paned = new Paned(Orientation.HORIZONTAL);
|
private Paned headerbar_paned = new Paned(Orientation.HORIZONTAL) { visible=true };
|
||||||
private Paned paned = new Paned(Orientation.HORIZONTAL);
|
private Paned paned = new Paned(Orientation.HORIZONTAL) { visible=true };
|
||||||
private Stack headerbar_stack = new Stack();
|
private Stack headerbar_stack = new Stack() { visible=true };
|
||||||
private Stack stack = new Stack();
|
private Stack stack = new Stack() { visible=true };
|
||||||
|
|
||||||
private StreamInteractor stream_interactor;
|
private StreamInteractor stream_interactor;
|
||||||
private Conversation? conversation;
|
private Conversation? conversation;
|
||||||
|
@ -27,7 +28,7 @@ public class UnifiedWindow : Window {
|
||||||
|
|
||||||
setup_headerbar();
|
setup_headerbar();
|
||||||
setup_unified();
|
setup_unified();
|
||||||
setup_stacks();
|
setup_stack();
|
||||||
|
|
||||||
conversation_list_titlebar.search_button.bind_property("active", filterable_conversation_list.search_bar, "search-mode-enabled",
|
conversation_list_titlebar.search_button.bind_property("active", filterable_conversation_list.search_bar, "search-mode-enabled",
|
||||||
BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
|
BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
|
||||||
|
@ -38,7 +39,11 @@ public class UnifiedWindow : Window {
|
||||||
|
|
||||||
stream_interactor.account_added.connect((account) => { check_stack(true); });
|
stream_interactor.account_added.connect((account) => { check_stack(true); });
|
||||||
stream_interactor.account_removed.connect((account) => { check_stack(); });
|
stream_interactor.account_removed.connect((account) => { check_stack(); });
|
||||||
main_placeholder.no_accounts_add.clicked.connect(() => { get_application().activate_action("accounts", null); });
|
stream_interactor.get_module(ConversationManager.IDENTITY).conversation_activated.connect((conversation) => { check_stack(); });
|
||||||
|
stream_interactor.get_module(ConversationManager.IDENTITY).conversation_deactivated.connect((conversation) => { check_stack(); });
|
||||||
|
accounts_placeholder.primary_button.clicked.connect(() => { get_application().activate_action("accounts", null); });
|
||||||
|
conversations_placeholder.primary_button.clicked.connect(() => { get_application().activate_action("add_chat", null); });
|
||||||
|
conversations_placeholder.secondary_button.clicked.connect(() => { get_application().activate_action("add_conference", null); });
|
||||||
filterable_conversation_list.conversation_list.conversation_selected.connect(on_conversation_selected);
|
filterable_conversation_list.conversation_list.conversation_selected.connect(on_conversation_selected);
|
||||||
conversation_list_titlebar.conversation_opened.connect(on_conversation_selected);
|
conversation_list_titlebar.conversation_opened.connect(on_conversation_selected);
|
||||||
|
|
||||||
|
@ -46,32 +51,31 @@ public class UnifiedWindow : Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setup_unified() {
|
private void setup_unified() {
|
||||||
chat_input = new ChatInput(stream_interactor);
|
chat_input = new ChatInput(stream_interactor) { visible=true };
|
||||||
conversation_frame = new ConversationSummary.View(stream_interactor);
|
conversation_frame = new ConversationSummary.View(stream_interactor) { visible=true };
|
||||||
filterable_conversation_list = new ConversationSelector.View(stream_interactor);
|
filterable_conversation_list = new ConversationSelector.View(stream_interactor) { visible=true };
|
||||||
|
|
||||||
Grid grid = new Grid() { orientation=Orientation.VERTICAL };
|
Grid grid = new Grid() { orientation=Orientation.VERTICAL, visible=true };
|
||||||
grid.add(conversation_frame);
|
grid.add(conversation_frame);
|
||||||
grid.add(new Separator(Orientation.HORIZONTAL));
|
grid.add(new Separator(Orientation.HORIZONTAL) { visible=true });
|
||||||
grid.add(chat_input);
|
grid.add(chat_input);
|
||||||
|
|
||||||
paned.set_position(300);
|
paned.set_position(300);
|
||||||
paned.add1(filterable_conversation_list);
|
paned.add1(filterable_conversation_list);
|
||||||
paned.add2(grid);
|
paned.add2(grid);
|
||||||
|
|
||||||
conversation_frame.show_all();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setup_headerbar() {
|
private void setup_headerbar() {
|
||||||
conversation_titlebar = new ConversationTitlebar(stream_interactor);
|
conversation_titlebar = new ConversationTitlebar(stream_interactor) { visible=true };
|
||||||
conversation_list_titlebar = new ConversationListTitlebar(this, stream_interactor);
|
conversation_list_titlebar = new ConversationListTitlebar(this, stream_interactor) { visible=true };
|
||||||
headerbar_paned.add1(conversation_list_titlebar);
|
headerbar_paned.add1(conversation_list_titlebar);
|
||||||
headerbar_paned.add2(conversation_titlebar);
|
headerbar_paned.add2(conversation_titlebar);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setup_stacks() {
|
private void setup_stack() {
|
||||||
stack.add_named(paned, "main");
|
stack.add_named(paned, "main");
|
||||||
stack.add_named(main_placeholder, "placeholder");
|
stack.add_named(accounts_placeholder, "accounts_placeholder");
|
||||||
|
stack.add_named(conversations_placeholder, "conversations_placeholder");
|
||||||
add(stack);
|
add(stack);
|
||||||
|
|
||||||
headerbar_stack.add_named(headerbar_paned, "main");
|
headerbar_stack.add_named(headerbar_paned, "main");
|
||||||
|
@ -81,19 +85,15 @@ public class UnifiedWindow : Window {
|
||||||
|
|
||||||
private void check_stack(bool know_exists = false) {
|
private void check_stack(bool know_exists = false) {
|
||||||
ArrayList<Account> accounts = stream_interactor.get_accounts();
|
ArrayList<Account> accounts = stream_interactor.get_accounts();
|
||||||
bool exists_active = know_exists;
|
if (!know_exists && accounts.size == 0) {
|
||||||
foreach (Account account in accounts) {
|
stack.set_visible_child_name("accounts_placeholder");
|
||||||
if (account.enabled) {
|
headerbar_stack.set_visible_child_name("placeholder");
|
||||||
exists_active = true;
|
} else if (stream_interactor.get_module(ConversationManager.IDENTITY).get_active_conversations().size == 0) {
|
||||||
break;
|
stack.set_visible_child_name("conversations_placeholder");
|
||||||
}
|
headerbar_stack.set_visible_child_name("placeholder");
|
||||||
}
|
} else {
|
||||||
if (exists_active) {
|
|
||||||
stack.set_visible_child_name("main");
|
stack.set_visible_child_name("main");
|
||||||
headerbar_stack.set_visible_child_name("main");
|
headerbar_stack.set_visible_child_name("main");
|
||||||
} else {
|
|
||||||
stack.set_visible_child_name("placeholder");
|
|
||||||
headerbar_stack.set_visible_child_name("placeholder");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,9 +119,28 @@ public class UnifiedWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class NoAccountsPlaceholder : UnifiedWindowPlaceholder {
|
||||||
|
public NoAccountsPlaceholder() {
|
||||||
|
label.label = "No accounts active";
|
||||||
|
primary_button.label = "Manage accounts";
|
||||||
|
secondary_button.visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NoConversationsPlaceholder : UnifiedWindowPlaceholder {
|
||||||
|
public NoConversationsPlaceholder() {
|
||||||
|
label.label = "No conversation active";
|
||||||
|
primary_button.label = "Add Chat";
|
||||||
|
secondary_button.label = "Join Conference";
|
||||||
|
secondary_button.visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[GtkTemplate (ui = "/org/dino-im/unified_window_placeholder.ui")]
|
[GtkTemplate (ui = "/org/dino-im/unified_window_placeholder.ui")]
|
||||||
public class UnifiedWindowPlaceholder : Box {
|
public class UnifiedWindowPlaceholder : Box {
|
||||||
[GtkChild] public Button no_accounts_add;
|
[GtkChild] public Label label;
|
||||||
|
[GtkChild] public Button primary_button;
|
||||||
|
[GtkChild] public Button secondary_button;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -53,6 +53,7 @@ public class Row {
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RowIterator {
|
public class RowIterator {
|
||||||
|
private Database db;
|
||||||
private Statement stmt;
|
private Statement stmt;
|
||||||
|
|
||||||
public RowIterator.from_query_builder(QueryBuilder query) throws DatabaseError {
|
public RowIterator.from_query_builder(QueryBuilder query) throws DatabaseError {
|
||||||
|
@ -60,6 +61,7 @@ public class RowIterator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public RowIterator(Database db, string sql, string[]? args = null) throws DatabaseError {
|
public RowIterator(Database db, string sql, string[]? args = null) throws DatabaseError {
|
||||||
|
this.db = db;
|
||||||
this.stmt = db.prepare(sql);
|
this.stmt = db.prepare(sql);
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
@ -68,11 +70,11 @@ public class RowIterator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Row? next_value() {
|
public Row? next_value() throws DatabaseError {
|
||||||
if (stmt.step() == Sqlite.ROW) {
|
int r = stmt.step();
|
||||||
return new Row(stmt);
|
if (r == Sqlite.ROW) return new Row(stmt);
|
||||||
}
|
if (r == Sqlite.DONE) return null;
|
||||||
return null;
|
throw new DatabaseError.EXEC_ERROR(@"SQLite error: $(db.errcode()) - $(db.errmsg())");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,8 +237,8 @@ public class FlagIdentity<T> : Object {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T? cast(XmppStreamFlag module) {
|
public T? cast(XmppStreamFlag flag) {
|
||||||
return (T?) module;
|
return flag.get_type().is_a(typeof(T)) ? (T?) flag : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool matches(XmppStreamFlag module) {
|
public bool matches(XmppStreamFlag module) {
|
||||||
|
@ -246,7 +246,7 @@ public class FlagIdentity<T> : Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class XmppStreamFlag {
|
public abstract class XmppStreamFlag : Object {
|
||||||
public abstract string get_ns();
|
public abstract string get_ns();
|
||||||
public abstract string get_id();
|
public abstract string get_id();
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ public class ModuleIdentity<T> : Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
public T? cast(XmppStreamModule module) {
|
public T? cast(XmppStreamModule module) {
|
||||||
return (T?) module;
|
return module.get_type().is_a(typeof(T)) ? (T?) module : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool matches(XmppStreamModule module) {
|
public bool matches(XmppStreamModule module) {
|
||||||
|
|
Loading…
Reference in a new issue