Move UI code into main dir
|
@ -131,16 +131,16 @@ function(COMPILE_GRESOURCES output xml_out)
|
||||||
("${res}" STREQUAL "TOPIXDATA")))
|
("${res}" STREQUAL "TOPIXDATA")))
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT "${CMAKE_BINARY_DIR}/resources/${res}"
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/resources/${res}"
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy "${CG_ARG_SOURCE_DIR}/${res}" "${CMAKE_BINARY_DIR}/resources/${res}"
|
COMMAND ${CMAKE_COMMAND} -E copy "${CG_ARG_SOURCE_DIR}/${res}" "${CMAKE_CURRENT_BINARY_DIR}/resources/${res}"
|
||||||
MAIN_DEPENDENCY "${CG_ARG_SOURCE_DIR}/${res}")
|
MAIN_DEPENDENCY "${CG_ARG_SOURCE_DIR}/${res}")
|
||||||
list(APPEND CG_RESOURCES_DEPENDENCIES "${CMAKE_BINARY_DIR}/resources/${res}")
|
list(APPEND CG_RESOURCES_DEPENDENCIES "${CMAKE_CURRENT_BINARY_DIR}/resources/${res}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
# Construct .gresource.xml path.
|
# Construct .gresource.xml path.
|
||||||
set(CG_XML_FILE_PATH "${CMAKE_BINARY_DIR}/resources/.gresource.xml")
|
set(CG_XML_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/resources/.gresource.xml")
|
||||||
|
|
||||||
# Generate gresources XML target.
|
# Generate gresources XML target.
|
||||||
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
|
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
|
||||||
|
@ -186,13 +186,13 @@ function(COMPILE_GRESOURCES output xml_out)
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
ARGS ${CG_CMAKE_SCRIPT_ARGS}
|
ARGS ${CG_CMAKE_SCRIPT_ARGS}
|
||||||
DEPENDS ${CG_RESOURCES_DEPENDENCIES}
|
DEPENDS ${CG_RESOURCES_DEPENDENCIES}
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
COMMENT ${CG_XML_CUSTOM_COMMAND_COMMENT})
|
COMMENT ${CG_XML_CUSTOM_COMMAND_COMMENT})
|
||||||
|
|
||||||
# Create target manually if not set (to make sure glib-compile-resources
|
# Create target manually if not set (to make sure glib-compile-resources
|
||||||
# doesn't change behaviour with it's naming standards).
|
# doesn't change behaviour with it's naming standards).
|
||||||
if (NOT CG_ARG_TARGET)
|
if (NOT CG_ARG_TARGET)
|
||||||
set(CG_ARG_TARGET "${CMAKE_BINARY_DIR}/resources")
|
set(CG_ARG_TARGET "${CMAKE_CURRENT_BINARY_DIR}/resources")
|
||||||
set(CG_ARG_TARGET "${CG_ARG_TARGET}.${CG_TARGET_FILE_ENDING}")
|
set(CG_ARG_TARGET "${CG_ARG_TARGET}.${CG_TARGET_FILE_ENDING}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -9,52 +9,19 @@ set(LIBDINO_PACKAGES
|
||||||
glib-2.0
|
glib-2.0
|
||||||
gtk+-3.0
|
gtk+-3.0
|
||||||
gmodule-2.0
|
gmodule-2.0
|
||||||
libnotify
|
|
||||||
sqlite3
|
sqlite3
|
||||||
)
|
)
|
||||||
|
|
||||||
pkg_check_modules(LIBDINO REQUIRED ${LIBDINO_PACKAGES})
|
pkg_check_modules(LIBDINO REQUIRED ${LIBDINO_PACKAGES})
|
||||||
|
|
||||||
set(RESOURCE_LIST
|
set(RESOURCE_LIST
|
||||||
img/double_tick.svg
|
pgp_stack.ui
|
||||||
img/status_away.svg
|
|
||||||
img/status_chat.svg
|
|
||||||
img/status_dnd.svg
|
|
||||||
img/status_online.svg
|
|
||||||
img/tick.svg
|
|
||||||
|
|
||||||
add_conversation/add_contact_dialog.ui
|
|
||||||
add_conversation/add_groupchat_dialog.ui
|
|
||||||
add_conversation/conference_details_fragment.ui
|
|
||||||
add_conversation/list_row.ui
|
|
||||||
add_conversation/select_jid_fragment.ui
|
|
||||||
chat_input.ui
|
|
||||||
conversation_list_titlebar.ui
|
|
||||||
conversation_selector/view.ui
|
|
||||||
conversation_selector/chat_row_tooltip.ui
|
|
||||||
conversation_selector/conversation_row.ui
|
|
||||||
conversation_summary/message_item.ui
|
|
||||||
conversation_summary/view.ui
|
|
||||||
conversation_titlebar.ui
|
|
||||||
manage_accounts/account_row.ui
|
|
||||||
manage_accounts/add_account_dialog.ui
|
|
||||||
manage_accounts/dialog.ui
|
|
||||||
manage_accounts/pgp_stack.ui
|
|
||||||
menu_add.ui
|
|
||||||
menu_app.ui
|
|
||||||
menu_conversation.ui
|
|
||||||
menu_encryption.ui
|
|
||||||
occupant_list.ui
|
|
||||||
occupant_list_item.ui
|
|
||||||
style.css
|
|
||||||
settings_dialog.ui
|
|
||||||
unified_window.ui
|
|
||||||
)
|
)
|
||||||
|
|
||||||
compile_gresources(
|
compile_gresources(
|
||||||
LIBDINO_GRESOURCES_TARGET
|
LIBDINO_GRESOURCES_TARGET
|
||||||
LIBDINO_GRESOURCES_XML
|
LIBDINO_GRESOURCES_XML
|
||||||
TARGET ${CMAKE_BINARY_DIR}/resources/resources.c
|
TARGET ${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c
|
||||||
TYPE EMBED_C
|
TYPE EMBED_C
|
||||||
RESOURCES ${RESOURCE_LIST}
|
RESOURCES ${RESOURCE_LIST}
|
||||||
PREFIX /org/dino-im
|
PREFIX /org/dino-im
|
||||||
|
@ -96,38 +63,6 @@ SOURCES
|
||||||
src/service/stream_interactor.vala
|
src/service/stream_interactor.vala
|
||||||
|
|
||||||
src/settings.vala
|
src/settings.vala
|
||||||
|
|
||||||
src/ui/add_conversation/chat/add_contact_dialog.vala
|
|
||||||
src/ui/add_conversation/chat/roster_list.vala
|
|
||||||
src/ui/add_conversation/chat/dialog.vala
|
|
||||||
src/ui/add_conversation/conference/add_groupchat_dialog.vala
|
|
||||||
src/ui/add_conversation/conference/conference_details_fragment.vala
|
|
||||||
src/ui/add_conversation/conference/conference_list.vala
|
|
||||||
src/ui/add_conversation/conference/dialog.vala
|
|
||||||
src/ui/add_conversation/list_row.vala
|
|
||||||
src/ui/add_conversation/select_jid_fragment.vala
|
|
||||||
src/ui/avatar_generator.vala
|
|
||||||
src/ui/chat_input.vala
|
|
||||||
src/ui/conversation_list_titlebar.vala
|
|
||||||
src/ui/conversation_selector/chat_row.vala
|
|
||||||
src/ui/conversation_selector/conversation_row.vala
|
|
||||||
src/ui/conversation_selector/groupchat_row.vala
|
|
||||||
src/ui/conversation_selector/list.vala
|
|
||||||
src/ui/conversation_selector/view.vala
|
|
||||||
src/ui/conversation_summary/merged_message_item.vala
|
|
||||||
src/ui/conversation_summary/merged_status_item.vala
|
|
||||||
src/ui/conversation_summary/status_item.vala
|
|
||||||
src/ui/conversation_summary/view.vala
|
|
||||||
src/ui/conversation_titlebar.vala
|
|
||||||
src/ui/manage_accounts/account_row.vala
|
|
||||||
src/ui/manage_accounts/add_account_dialog.vala
|
|
||||||
src/ui/manage_accounts/dialog.vala
|
|
||||||
src/ui/notifications.vala
|
|
||||||
src/ui/occupant_list.vala
|
|
||||||
src/ui/occupant_list_row.vala
|
|
||||||
src/ui/settings_dialog.vala
|
|
||||||
src/ui/unified_window.vala
|
|
||||||
src/ui/util.vala
|
|
||||||
CUSTOM_VAPIS
|
CUSTOM_VAPIS
|
||||||
"${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi"
|
"${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi"
|
||||||
"${CMAKE_BINARY_DIR}/exports/qlite.vapi"
|
"${CMAKE_BINARY_DIR}/exports/qlite.vapi"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using Gtk;
|
using Gtk;
|
||||||
|
|
||||||
using Dino.Entities;
|
using Dino.Entities;
|
||||||
using Dino.Ui;
|
|
||||||
|
|
||||||
public class Dino.Application : Gtk.Application {
|
public class Dino.Application : Gtk.Application {
|
||||||
|
|
||||||
|
@ -9,13 +8,6 @@ public class Dino.Application : Gtk.Application {
|
||||||
public StreamInteractor stream_interaction;
|
public StreamInteractor stream_interaction;
|
||||||
public Plugins.Registry plugin_registry = new Plugins.Registry();
|
public Plugins.Registry plugin_registry = new Plugins.Registry();
|
||||||
|
|
||||||
private Notifications notifications;
|
|
||||||
private UnifiedWindow? window;
|
|
||||||
private ConversationSelector.View? filterable_conversation_list;
|
|
||||||
private ConversationSelector.List? conversation_list;
|
|
||||||
private ConversationSummary.View? conversation_frame;
|
|
||||||
private ChatInput? chat_input;
|
|
||||||
|
|
||||||
public Application() {
|
public Application() {
|
||||||
this.db = new Database("store.sqlite3");
|
this.db = new Database("store.sqlite3");
|
||||||
this.stream_interaction = new StreamInteractor(db);
|
this.stream_interaction = new StreamInteractor(db);
|
||||||
|
@ -29,87 +21,6 @@ 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);
|
||||||
|
|
||||||
Notify.init("dino");
|
|
||||||
notifications = new Notifications(stream_interaction);
|
|
||||||
notifications.start();
|
|
||||||
|
|
||||||
load_css();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void activate() {
|
|
||||||
create_set_app_menu();
|
|
||||||
create_window();
|
|
||||||
window.show_all();
|
|
||||||
restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void create_window() {
|
|
||||||
window = new UnifiedWindow(this, stream_interaction);
|
|
||||||
|
|
||||||
filterable_conversation_list = window.filterable_conversation_list;
|
|
||||||
conversation_list = window.filterable_conversation_list.conversation_list;
|
|
||||||
conversation_frame = window.conversation_frame;
|
|
||||||
chat_input = window.chat_input;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void show_accounts_window() {
|
|
||||||
ManageAccounts.Dialog dialog = new ManageAccounts.Dialog(stream_interaction, db);
|
|
||||||
dialog.set_transient_for(window);
|
|
||||||
dialog.account_enabled.connect(add_connection);
|
|
||||||
dialog.account_disabled.connect(remove_connection);
|
|
||||||
dialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void show_settings_window() {
|
|
||||||
SettingsDialog dialog = new SettingsDialog();
|
|
||||||
dialog.set_transient_for(window);
|
|
||||||
dialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void create_set_app_menu() {
|
|
||||||
SimpleAction accounts_action = new SimpleAction("accounts", null);
|
|
||||||
accounts_action.activate.connect(show_accounts_window);
|
|
||||||
add_action(accounts_action);
|
|
||||||
|
|
||||||
SimpleAction settings_action = new SimpleAction("settings", null);
|
|
||||||
settings_action.activate.connect(show_settings_window);
|
|
||||||
add_action(settings_action);
|
|
||||||
|
|
||||||
SimpleAction quit_action = new SimpleAction("quit", null);
|
|
||||||
quit_action.activate.connect(quit);
|
|
||||||
add_action(quit_action);
|
|
||||||
add_accelerator("<Ctrl>Q", "app.quit", null);
|
|
||||||
|
|
||||||
Builder builder = new Builder.from_resource("/org/dino-im/menu_app.ui");
|
|
||||||
MenuModel menu = builder.get_object("menu_app") as MenuModel;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void load_css() {
|
|
||||||
var css_provider = new Gtk.CssProvider ();
|
|
||||||
try {
|
|
||||||
var file = File.new_for_uri("resource:///org/dino-im/style.css");
|
|
||||||
css_provider.load_from_file (file);
|
|
||||||
} catch (GLib.Error e) {
|
|
||||||
warning ("loading css: %s", e.message);
|
|
||||||
}
|
|
||||||
Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default(), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace Dino {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[GtkTemplate (ui = "/org/dino-im/manage_accounts/pgp_stack.ui")]
|
[GtkTemplate (ui = "/org/dino-im/pgp_stack.ui")]
|
||||||
private class AccountSettingsWidget : Gtk.Stack, Plugins.AccountSettingsWidget {
|
private class AccountSettingsWidget : Gtk.Stack, Plugins.AccountSettingsWidget {
|
||||||
[GtkChild] private Gtk.Label pgp_label;
|
[GtkChild] private Gtk.Label pgp_label;
|
||||||
[GtkChild] private Gtk.Button pgp_button;
|
[GtkChild] private Gtk.Button pgp_button;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
find_package(Vala REQUIRED)
|
find_package(Vala REQUIRED)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
include(${VALA_USE_FILE})
|
include(${VALA_USE_FILE})
|
||||||
|
include(GlibCompileResourcesSupport)
|
||||||
|
|
||||||
set(MAIN_PACKAGES
|
set(MAIN_PACKAGES
|
||||||
gee-0.8
|
gee-0.8
|
||||||
|
@ -8,20 +9,101 @@ set(MAIN_PACKAGES
|
||||||
glib-2.0
|
glib-2.0
|
||||||
gtk+-3.0
|
gtk+-3.0
|
||||||
gmodule-2.0
|
gmodule-2.0
|
||||||
|
libnotify
|
||||||
sqlite3
|
sqlite3
|
||||||
)
|
)
|
||||||
|
|
||||||
pkg_check_modules(MAIN REQUIRED ${MAIN_PACKAGES})
|
pkg_check_modules(MAIN REQUIRED ${MAIN_PACKAGES})
|
||||||
|
|
||||||
|
set(RESOURCE_LIST
|
||||||
|
img/double_tick.svg
|
||||||
|
img/status_away.svg
|
||||||
|
img/status_chat.svg
|
||||||
|
img/status_dnd.svg
|
||||||
|
img/status_online.svg
|
||||||
|
img/tick.svg
|
||||||
|
|
||||||
|
add_conversation/add_contact_dialog.ui
|
||||||
|
add_conversation/add_groupchat_dialog.ui
|
||||||
|
add_conversation/conference_details_fragment.ui
|
||||||
|
add_conversation/list_row.ui
|
||||||
|
add_conversation/select_jid_fragment.ui
|
||||||
|
chat_input.ui
|
||||||
|
conversation_list_titlebar.ui
|
||||||
|
conversation_selector/view.ui
|
||||||
|
conversation_selector/chat_row_tooltip.ui
|
||||||
|
conversation_selector/conversation_row.ui
|
||||||
|
conversation_summary/message_item.ui
|
||||||
|
conversation_summary/view.ui
|
||||||
|
conversation_titlebar.ui
|
||||||
|
manage_accounts/account_row.ui
|
||||||
|
manage_accounts/add_account_dialog.ui
|
||||||
|
manage_accounts/dialog.ui
|
||||||
|
menu_add.ui
|
||||||
|
menu_app.ui
|
||||||
|
menu_conversation.ui
|
||||||
|
menu_encryption.ui
|
||||||
|
occupant_list.ui
|
||||||
|
occupant_list_item.ui
|
||||||
|
style.css
|
||||||
|
settings_dialog.ui
|
||||||
|
unified_window.ui
|
||||||
|
)
|
||||||
|
|
||||||
|
compile_gresources(
|
||||||
|
MAIN_GRESOURCES_TARGET
|
||||||
|
MAIN_GRESOURCES_XML
|
||||||
|
TARGET ${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c
|
||||||
|
TYPE EMBED_C
|
||||||
|
RESOURCES ${RESOURCE_LIST}
|
||||||
|
PREFIX /org/dino-im
|
||||||
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data
|
||||||
|
)
|
||||||
|
|
||||||
vala_precompile(MAIN_VALA_C
|
vala_precompile(MAIN_VALA_C
|
||||||
SOURCES
|
SOURCES
|
||||||
src/main.vala
|
src/main.vala
|
||||||
|
|
||||||
|
src/ui/application.vala
|
||||||
|
src/ui/add_conversation/chat/add_contact_dialog.vala
|
||||||
|
src/ui/add_conversation/chat/roster_list.vala
|
||||||
|
src/ui/add_conversation/chat/dialog.vala
|
||||||
|
src/ui/add_conversation/conference/add_groupchat_dialog.vala
|
||||||
|
src/ui/add_conversation/conference/conference_details_fragment.vala
|
||||||
|
src/ui/add_conversation/conference/conference_list.vala
|
||||||
|
src/ui/add_conversation/conference/dialog.vala
|
||||||
|
src/ui/add_conversation/list_row.vala
|
||||||
|
src/ui/add_conversation/select_jid_fragment.vala
|
||||||
|
src/ui/avatar_generator.vala
|
||||||
|
src/ui/chat_input.vala
|
||||||
|
src/ui/conversation_list_titlebar.vala
|
||||||
|
src/ui/conversation_selector/chat_row.vala
|
||||||
|
src/ui/conversation_selector/conversation_row.vala
|
||||||
|
src/ui/conversation_selector/groupchat_row.vala
|
||||||
|
src/ui/conversation_selector/list.vala
|
||||||
|
src/ui/conversation_selector/view.vala
|
||||||
|
src/ui/conversation_summary/merged_message_item.vala
|
||||||
|
src/ui/conversation_summary/merged_status_item.vala
|
||||||
|
src/ui/conversation_summary/status_item.vala
|
||||||
|
src/ui/conversation_summary/view.vala
|
||||||
|
src/ui/conversation_titlebar.vala
|
||||||
|
src/ui/manage_accounts/account_row.vala
|
||||||
|
src/ui/manage_accounts/add_account_dialog.vala
|
||||||
|
src/ui/manage_accounts/dialog.vala
|
||||||
|
src/ui/notifications.vala
|
||||||
|
src/ui/occupant_list.vala
|
||||||
|
src/ui/occupant_list_row.vala
|
||||||
|
src/ui/settings_dialog.vala
|
||||||
|
src/ui/unified_window.vala
|
||||||
|
src/ui/util.vala
|
||||||
CUSTOM_VAPIS
|
CUSTOM_VAPIS
|
||||||
${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi
|
${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi
|
||||||
${CMAKE_BINARY_DIR}/exports/qlite.vapi
|
${CMAKE_BINARY_DIR}/exports/qlite.vapi
|
||||||
${CMAKE_BINARY_DIR}/exports/dino_internal.vapi
|
${CMAKE_BINARY_DIR}/exports/dino_internal.vapi
|
||||||
PACKAGES
|
PACKAGES
|
||||||
${MAIN_PACKAGES}
|
${MAIN_PACKAGES}
|
||||||
|
GRESOURCES
|
||||||
|
${MAIN_GRESOURCES_XML}
|
||||||
OPTIONS
|
OPTIONS
|
||||||
--target-glib=2.38
|
--target-glib=2.38
|
||||||
${GLOBAL_DEBUG_FLAGS}
|
${GLOBAL_DEBUG_FLAGS}
|
||||||
|
@ -30,6 +112,6 @@ OPTIONS
|
||||||
|
|
||||||
set(CFLAGS ${VALA_CFLAGS} ${MAIN_CFLAGS})
|
set(CFLAGS ${VALA_CFLAGS} ${MAIN_CFLAGS})
|
||||||
add_definitions(${CFLAGS})
|
add_definitions(${CFLAGS})
|
||||||
add_executable(dino ${MAIN_VALA_C})
|
add_executable(dino ${MAIN_VALA_C} ${MAIN_GRESOURCES_TARGET})
|
||||||
add_dependencies(dino dino-vapi)
|
add_dependencies(dino dino-vapi)
|
||||||
target_link_libraries(dino libdino)
|
target_link_libraries(dino libdino ${MAIN_LIBRARIES})
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
@ -5,7 +5,7 @@ namespace Dino {
|
||||||
|
|
||||||
void main(string[] args) {
|
void main(string[] args) {
|
||||||
Gtk.init(ref args);
|
Gtk.init(ref args);
|
||||||
Application app = new Application();
|
Dino.Ui.Application app = new Dino.Ui.Application();
|
||||||
Plugins.Loader loader = new Plugins.Loader();
|
Plugins.Loader loader = new Plugins.Loader();
|
||||||
foreach(string plugin in new string[]{}) {
|
foreach(string plugin in new string[]{}) {
|
||||||
try {
|
try {
|
||||||
|
|
97
main/src/ui/application.vala
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
using Gtk;
|
||||||
|
|
||||||
|
using Dino.Entities;
|
||||||
|
using Dino.Ui;
|
||||||
|
|
||||||
|
public class Dino.Ui.Application : Dino.Application {
|
||||||
|
private Notifications notifications;
|
||||||
|
private UnifiedWindow? window;
|
||||||
|
private ConversationSelector.View? filterable_conversation_list;
|
||||||
|
private ConversationSelector.List? conversation_list;
|
||||||
|
private ConversationSummary.View? conversation_frame;
|
||||||
|
private ChatInput? chat_input;
|
||||||
|
|
||||||
|
public Application() {
|
||||||
|
Notify.init("dino");
|
||||||
|
notifications = new Notifications(stream_interaction);
|
||||||
|
notifications.start();
|
||||||
|
|
||||||
|
load_css();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void activate() {
|
||||||
|
create_set_app_menu();
|
||||||
|
create_window();
|
||||||
|
window.show_all();
|
||||||
|
restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void create_window() {
|
||||||
|
window = new UnifiedWindow(this, stream_interaction);
|
||||||
|
|
||||||
|
filterable_conversation_list = window.filterable_conversation_list;
|
||||||
|
conversation_list = window.filterable_conversation_list.conversation_list;
|
||||||
|
conversation_frame = window.conversation_frame;
|
||||||
|
chat_input = window.chat_input;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void show_accounts_window() {
|
||||||
|
ManageAccounts.Dialog dialog = new ManageAccounts.Dialog(stream_interaction, db);
|
||||||
|
dialog.set_transient_for(window);
|
||||||
|
dialog.account_enabled.connect(add_connection);
|
||||||
|
dialog.account_disabled.connect(remove_connection);
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void show_settings_window() {
|
||||||
|
SettingsDialog dialog = new SettingsDialog();
|
||||||
|
dialog.set_transient_for(window);
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void create_set_app_menu() {
|
||||||
|
SimpleAction accounts_action = new SimpleAction("accounts", null);
|
||||||
|
accounts_action.activate.connect(show_accounts_window);
|
||||||
|
add_action(accounts_action);
|
||||||
|
|
||||||
|
SimpleAction settings_action = new SimpleAction("settings", null);
|
||||||
|
settings_action.activate.connect(show_settings_window);
|
||||||
|
add_action(settings_action);
|
||||||
|
|
||||||
|
SimpleAction quit_action = new SimpleAction("quit", null);
|
||||||
|
quit_action.activate.connect(quit);
|
||||||
|
add_action(quit_action);
|
||||||
|
add_accelerator("<Ctrl>Q", "app.quit", null);
|
||||||
|
|
||||||
|
Builder builder = new Builder.from_resource("/org/dino-im/menu_app.ui");
|
||||||
|
MenuModel menu = builder.get_object("menu_app") as MenuModel;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void load_css() {
|
||||||
|
var css_provider = new Gtk.CssProvider ();
|
||||||
|
try {
|
||||||
|
var file = File.new_for_uri("resource:///org/dino-im/style.css");
|
||||||
|
css_provider.load_from_file (file);
|
||||||
|
} catch (GLib.Error e) {
|
||||||
|
warning ("loading css: %s", e.message);
|
||||||
|
}
|
||||||
|
Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default(), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|