diff options
author | Marvin W <git@larma.de> | 2017-03-11 23:52:12 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2017-03-11 23:58:35 +0100 |
commit | e27d63269d0b41fa8d5b5f0f2e4a9dc7de4b9ab9 (patch) | |
tree | 80e547d0e02e770e8bcd912e42f8afa753aeb0f6 | |
parent | cd6b904e970291a63551d0f1d80bbd550e778ec8 (diff) | |
download | dino-e27d63269d0b41fa8d5b5f0f2e4a9dc7de4b9ab9.tar.gz dino-e27d63269d0b41fa8d5b5f0f2e4a9dc7de4b9ab9.zip |
Move UI code into main dir
-rw-r--r-- | cmake/CompileGResources.cmake | 12 | ||||
-rw-r--r-- | libdino/CMakeLists.txt | 69 | ||||
-rw-r--r-- | libdino/data/pgp_stack.ui (renamed from libdino/data/manage_accounts/pgp_stack.ui) | 0 | ||||
-rw-r--r-- | libdino/src/application.vala | 89 | ||||
-rw-r--r-- | libdino/src/service/pgp_manager.vala | 2 | ||||
-rw-r--r-- | main/CMakeLists.txt | 86 | ||||
-rw-r--r-- | main/data/add_conversation/add_contact_dialog.ui (renamed from libdino/data/add_conversation/add_contact_dialog.ui) | 0 | ||||
-rw-r--r-- | main/data/add_conversation/add_groupchat_dialog.ui (renamed from libdino/data/add_conversation/add_groupchat_dialog.ui) | 0 | ||||
-rw-r--r-- | main/data/add_conversation/conference_details_fragment.ui (renamed from libdino/data/add_conversation/conference_details_fragment.ui) | 0 | ||||
-rw-r--r-- | main/data/add_conversation/list_row.ui (renamed from libdino/data/add_conversation/list_row.ui) | 0 | ||||
-rw-r--r-- | main/data/add_conversation/select_jid_fragment.ui (renamed from libdino/data/add_conversation/select_jid_fragment.ui) | 0 | ||||
-rw-r--r-- | main/data/chat_input.ui (renamed from libdino/data/chat_input.ui) | 0 | ||||
-rw-r--r-- | main/data/conversation_list_titlebar.ui (renamed from libdino/data/conversation_list_titlebar.ui) | 0 | ||||
-rw-r--r-- | main/data/conversation_selector/chat_row_tooltip.ui (renamed from libdino/data/conversation_selector/chat_row_tooltip.ui) | 0 | ||||
-rw-r--r-- | main/data/conversation_selector/conversation_row.ui (renamed from libdino/data/conversation_selector/conversation_row.ui) | 0 | ||||
-rw-r--r-- | main/data/conversation_selector/view.ui (renamed from libdino/data/conversation_selector/view.ui) | 0 | ||||
-rw-r--r-- | main/data/conversation_summary/message_item.ui (renamed from libdino/data/conversation_summary/message_item.ui) | 0 | ||||
-rw-r--r-- | main/data/conversation_summary/view.ui (renamed from libdino/data/conversation_summary/view.ui) | 0 | ||||
-rw-r--r-- | main/data/conversation_titlebar.ui (renamed from libdino/data/conversation_titlebar.ui) | 0 | ||||
-rw-r--r-- | main/data/gschemas.compiled (renamed from libdino/data/gschemas.compiled) | bin | 316 -> 316 bytes | |||
-rw-r--r-- | main/data/img/double_tick.svg (renamed from libdino/data/img/double_tick.svg) | 0 | ||||
-rw-r--r-- | main/data/img/send.svg (renamed from libdino/data/img/send.svg) | 0 | ||||
-rw-r--r-- | main/data/img/status_away.svg (renamed from libdino/data/img/status_away.svg) | 0 | ||||
-rw-r--r-- | main/data/img/status_chat.svg (renamed from libdino/data/img/status_chat.svg) | 0 | ||||
-rw-r--r-- | main/data/img/status_dnd.svg (renamed from libdino/data/img/status_dnd.svg) | 0 | ||||
-rw-r--r-- | main/data/img/status_online.svg (renamed from libdino/data/img/status_online.svg) | 0 | ||||
-rw-r--r-- | main/data/img/tick.svg (renamed from libdino/data/img/tick.svg) | 0 | ||||
-rw-r--r-- | main/data/manage_accounts/account_row.ui (renamed from libdino/data/manage_accounts/account_row.ui) | 0 | ||||
-rw-r--r-- | main/data/manage_accounts/add_account_dialog.ui (renamed from libdino/data/manage_accounts/add_account_dialog.ui) | 0 | ||||
-rw-r--r-- | main/data/manage_accounts/dialog.ui (renamed from libdino/data/manage_accounts/dialog.ui) | 0 | ||||
-rw-r--r-- | main/data/menu_add.ui (renamed from libdino/data/menu_add.ui) | 0 | ||||
-rw-r--r-- | main/data/menu_app.ui (renamed from libdino/data/menu_app.ui) | 0 | ||||
-rw-r--r-- | main/data/menu_conversation.ui (renamed from libdino/data/menu_conversation.ui) | 0 | ||||
-rw-r--r-- | main/data/menu_encryption.ui (renamed from libdino/data/menu_encryption.ui) | 0 | ||||
-rw-r--r-- | main/data/occupant_list.ui (renamed from libdino/data/occupant_list.ui) | 0 | ||||
-rw-r--r-- | main/data/occupant_list_item.ui (renamed from libdino/data/occupant_list_item.ui) | 0 | ||||
-rw-r--r-- | main/data/settings.gschema.xml (renamed from libdino/data/settings.gschema.xml) | 0 | ||||
-rw-r--r-- | main/data/settings_dialog.ui (renamed from libdino/data/settings_dialog.ui) | 0 | ||||
-rw-r--r-- | main/data/style.css (renamed from libdino/data/style.css) | 0 | ||||
-rw-r--r-- | main/data/unified_window.ui (renamed from libdino/data/unified_window.ui) | 0 | ||||
-rw-r--r-- | main/src/main.vala | 2 | ||||
-rw-r--r-- | main/src/ui/add_conversation/chat/add_contact_dialog.vala (renamed from libdino/src/ui/add_conversation/chat/add_contact_dialog.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/add_conversation/chat/dialog.vala (renamed from libdino/src/ui/add_conversation/chat/dialog.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/add_conversation/chat/roster_list.vala (renamed from libdino/src/ui/add_conversation/chat/roster_list.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/add_conversation/conference/add_groupchat_dialog.vala (renamed from libdino/src/ui/add_conversation/conference/add_groupchat_dialog.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/add_conversation/conference/conference_details_fragment.vala (renamed from libdino/src/ui/add_conversation/conference/conference_details_fragment.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/add_conversation/conference/conference_list.vala (renamed from libdino/src/ui/add_conversation/conference/conference_list.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/add_conversation/conference/dialog.vala (renamed from libdino/src/ui/add_conversation/conference/dialog.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/add_conversation/list_row.vala (renamed from libdino/src/ui/add_conversation/list_row.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/add_conversation/select_jid_fragment.vala (renamed from libdino/src/ui/add_conversation/select_jid_fragment.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/application.vala | 97 | ||||
-rw-r--r-- | main/src/ui/avatar_generator.vala (renamed from libdino/src/ui/avatar_generator.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/chat_input.vala (renamed from libdino/src/ui/chat_input.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/conversation_list_titlebar.vala (renamed from libdino/src/ui/conversation_list_titlebar.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/conversation_selector/chat_row.vala (renamed from libdino/src/ui/conversation_selector/chat_row.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/conversation_selector/conversation_row.vala (renamed from libdino/src/ui/conversation_selector/conversation_row.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/conversation_selector/groupchat_row.vala (renamed from libdino/src/ui/conversation_selector/groupchat_row.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/conversation_selector/list.vala (renamed from libdino/src/ui/conversation_selector/list.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/conversation_selector/view.vala (renamed from libdino/src/ui/conversation_selector/view.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/conversation_summary/merged_message_item.vala (renamed from libdino/src/ui/conversation_summary/merged_message_item.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/conversation_summary/merged_status_item.vala (renamed from libdino/src/ui/conversation_summary/merged_status_item.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/conversation_summary/status_item.vala (renamed from libdino/src/ui/conversation_summary/status_item.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/conversation_summary/view.vala (renamed from libdino/src/ui/conversation_summary/view.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/conversation_titlebar.vala (renamed from libdino/src/ui/conversation_titlebar.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/manage_accounts/account_row.vala (renamed from libdino/src/ui/manage_accounts/account_row.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/manage_accounts/add_account_dialog.vala (renamed from libdino/src/ui/manage_accounts/add_account_dialog.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/manage_accounts/dialog.vala (renamed from libdino/src/ui/manage_accounts/dialog.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/notifications.vala (renamed from libdino/src/ui/notifications.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/occupant_list.vala (renamed from libdino/src/ui/occupant_list.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/occupant_list_row.vala (renamed from libdino/src/ui/occupant_list_row.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/settings_dialog.vala (renamed from libdino/src/ui/settings_dialog.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/unified_window.vala (renamed from libdino/src/ui/unified_window.vala) | 0 | ||||
-rw-r--r-- | main/src/ui/util.vala (renamed from libdino/src/ui/util.vala) | 0 |
73 files changed, 191 insertions, 166 deletions
diff --git a/cmake/CompileGResources.cmake b/cmake/CompileGResources.cmake index e9a8d179..14d2b2c8 100644 --- a/cmake/CompileGResources.cmake +++ b/cmake/CompileGResources.cmake @@ -131,16 +131,16 @@ function(COMPILE_GRESOURCES output xml_out) ("${res}" STREQUAL "TOPIXDATA"))) add_custom_command( - OUTPUT "${CMAKE_BINARY_DIR}/resources/${res}" - COMMAND ${CMAKE_COMMAND} -E copy "${CG_ARG_SOURCE_DIR}/${res}" "${CMAKE_BINARY_DIR}/resources/${res}" + OUTPUT "${CMAKE_CURRENT_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}") - list(APPEND CG_RESOURCES_DEPENDENCIES "${CMAKE_BINARY_DIR}/resources/${res}") + list(APPEND CG_RESOURCES_DEPENDENCIES "${CMAKE_CURRENT_BINARY_DIR}/resources/${res}") endif() endforeach() # 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. list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") @@ -186,13 +186,13 @@ function(COMPILE_GRESOURCES output xml_out) COMMAND ${CMAKE_COMMAND} ARGS ${CG_CMAKE_SCRIPT_ARGS} DEPENDS ${CG_RESOURCES_DEPENDENCIES} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT ${CG_XML_CUSTOM_COMMAND_COMMENT}) # Create target manually if not set (to make sure glib-compile-resources # doesn't change behaviour with it's naming standards). 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}") endif() diff --git a/libdino/CMakeLists.txt b/libdino/CMakeLists.txt index ece8a56f..15a434e9 100644 --- a/libdino/CMakeLists.txt +++ b/libdino/CMakeLists.txt @@ -9,52 +9,19 @@ set(LIBDINO_PACKAGES glib-2.0 gtk+-3.0 gmodule-2.0 - libnotify sqlite3 ) pkg_check_modules(LIBDINO REQUIRED ${LIBDINO_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 - 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 + pgp_stack.ui ) compile_gresources( LIBDINO_GRESOURCES_TARGET LIBDINO_GRESOURCES_XML - TARGET ${CMAKE_BINARY_DIR}/resources/resources.c + TARGET ${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c TYPE EMBED_C RESOURCES ${RESOURCE_LIST} PREFIX /org/dino-im @@ -96,38 +63,6 @@ SOURCES src/service/stream_interactor.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 "${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi" "${CMAKE_BINARY_DIR}/exports/qlite.vapi" diff --git a/libdino/data/manage_accounts/pgp_stack.ui b/libdino/data/pgp_stack.ui index 4df9f0b8..4df9f0b8 100644 --- a/libdino/data/manage_accounts/pgp_stack.ui +++ b/libdino/data/pgp_stack.ui diff --git a/libdino/src/application.vala b/libdino/src/application.vala index 2acb1479..eb8160a9 100644 --- a/libdino/src/application.vala +++ b/libdino/src/application.vala @@ -1,7 +1,6 @@ using Gtk; using Dino.Entities; -using Dino.Ui; public class Dino.Application : Gtk.Application { @@ -9,13 +8,6 @@ public class Dino.Application : Gtk.Application { public StreamInteractor stream_interaction; 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() { this.db = new Database("store.sqlite3"); this.stream_interaction = new StreamInteractor(db); @@ -29,87 +21,6 @@ public class Dino.Application : Gtk.Application { RosterManager.start(stream_interaction); ConversationManager.start(stream_interaction, db); 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); } } diff --git a/libdino/src/service/pgp_manager.vala b/libdino/src/service/pgp_manager.vala index a91feac6..447c1f7f 100644 --- a/libdino/src/service/pgp_manager.vala +++ b/libdino/src/service/pgp_manager.vala @@ -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 { [GtkChild] private Gtk.Label pgp_label; [GtkChild] private Gtk.Button pgp_button; diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index ce00206e..6547f752 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -1,6 +1,7 @@ find_package(Vala REQUIRED) find_package(PkgConfig REQUIRED) include(${VALA_USE_FILE}) +include(GlibCompileResourcesSupport) set(MAIN_PACKAGES gee-0.8 @@ -8,20 +9,101 @@ set(MAIN_PACKAGES glib-2.0 gtk+-3.0 gmodule-2.0 + libnotify sqlite3 ) 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 SOURCES 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 ${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi ${CMAKE_BINARY_DIR}/exports/qlite.vapi ${CMAKE_BINARY_DIR}/exports/dino_internal.vapi PACKAGES ${MAIN_PACKAGES} +GRESOURCES + ${MAIN_GRESOURCES_XML} OPTIONS --target-glib=2.38 ${GLOBAL_DEBUG_FLAGS} @@ -30,6 +112,6 @@ OPTIONS set(CFLAGS ${VALA_CFLAGS} ${MAIN_CFLAGS}) add_definitions(${CFLAGS}) -add_executable(dino ${MAIN_VALA_C}) +add_executable(dino ${MAIN_VALA_C} ${MAIN_GRESOURCES_TARGET}) add_dependencies(dino dino-vapi) -target_link_libraries(dino libdino)
\ No newline at end of file +target_link_libraries(dino libdino ${MAIN_LIBRARIES})
\ No newline at end of file diff --git a/libdino/data/add_conversation/add_contact_dialog.ui b/main/data/add_conversation/add_contact_dialog.ui index 58c13e7f..58c13e7f 100644 --- a/libdino/data/add_conversation/add_contact_dialog.ui +++ b/main/data/add_conversation/add_contact_dialog.ui diff --git a/libdino/data/add_conversation/add_groupchat_dialog.ui b/main/data/add_conversation/add_groupchat_dialog.ui index c6390374..c6390374 100644 --- a/libdino/data/add_conversation/add_groupchat_dialog.ui +++ b/main/data/add_conversation/add_groupchat_dialog.ui diff --git a/libdino/data/add_conversation/conference_details_fragment.ui b/main/data/add_conversation/conference_details_fragment.ui index 403d9a94..403d9a94 100644 --- a/libdino/data/add_conversation/conference_details_fragment.ui +++ b/main/data/add_conversation/conference_details_fragment.ui diff --git a/libdino/data/add_conversation/list_row.ui b/main/data/add_conversation/list_row.ui index 8f011bb8..8f011bb8 100644 --- a/libdino/data/add_conversation/list_row.ui +++ b/main/data/add_conversation/list_row.ui diff --git a/libdino/data/add_conversation/select_jid_fragment.ui b/main/data/add_conversation/select_jid_fragment.ui index 612f1597..612f1597 100644 --- a/libdino/data/add_conversation/select_jid_fragment.ui +++ b/main/data/add_conversation/select_jid_fragment.ui diff --git a/libdino/data/chat_input.ui b/main/data/chat_input.ui index dac75feb..dac75feb 100644 --- a/libdino/data/chat_input.ui +++ b/main/data/chat_input.ui diff --git a/libdino/data/conversation_list_titlebar.ui b/main/data/conversation_list_titlebar.ui index 6a5996df..6a5996df 100644 --- a/libdino/data/conversation_list_titlebar.ui +++ b/main/data/conversation_list_titlebar.ui diff --git a/libdino/data/conversation_selector/chat_row_tooltip.ui b/main/data/conversation_selector/chat_row_tooltip.ui index 90fbd712..90fbd712 100644 --- a/libdino/data/conversation_selector/chat_row_tooltip.ui +++ b/main/data/conversation_selector/chat_row_tooltip.ui diff --git a/libdino/data/conversation_selector/conversation_row.ui b/main/data/conversation_selector/conversation_row.ui index 5f8498e9..5f8498e9 100644 --- a/libdino/data/conversation_selector/conversation_row.ui +++ b/main/data/conversation_selector/conversation_row.ui diff --git a/libdino/data/conversation_selector/view.ui b/main/data/conversation_selector/view.ui index 4bac39bc..4bac39bc 100644 --- a/libdino/data/conversation_selector/view.ui +++ b/main/data/conversation_selector/view.ui diff --git a/libdino/data/conversation_summary/message_item.ui b/main/data/conversation_summary/message_item.ui index f21b4969..f21b4969 100644 --- a/libdino/data/conversation_summary/message_item.ui +++ b/main/data/conversation_summary/message_item.ui diff --git a/libdino/data/conversation_summary/view.ui b/main/data/conversation_summary/view.ui index 74fb507e..74fb507e 100644 --- a/libdino/data/conversation_summary/view.ui +++ b/main/data/conversation_summary/view.ui diff --git a/libdino/data/conversation_titlebar.ui b/main/data/conversation_titlebar.ui index e173bdf3..e173bdf3 100644 --- a/libdino/data/conversation_titlebar.ui +++ b/main/data/conversation_titlebar.ui diff --git a/libdino/data/gschemas.compiled b/main/data/gschemas.compiled Binary files differindex 3a010b95..3a010b95 100644 --- a/libdino/data/gschemas.compiled +++ b/main/data/gschemas.compiled diff --git a/libdino/data/img/double_tick.svg b/main/data/img/double_tick.svg index d65840f6..d65840f6 100644 --- a/libdino/data/img/double_tick.svg +++ b/main/data/img/double_tick.svg diff --git a/libdino/data/img/send.svg b/main/data/img/send.svg index 8627d4a7..8627d4a7 100644 --- a/libdino/data/img/send.svg +++ b/main/data/img/send.svg diff --git a/libdino/data/img/status_away.svg b/main/data/img/status_away.svg index d976d095..d976d095 100644 --- a/libdino/data/img/status_away.svg +++ b/main/data/img/status_away.svg diff --git a/libdino/data/img/status_chat.svg b/main/data/img/status_chat.svg index 5b427cb6..5b427cb6 100644 --- a/libdino/data/img/status_chat.svg +++ b/main/data/img/status_chat.svg diff --git a/libdino/data/img/status_dnd.svg b/main/data/img/status_dnd.svg index e7e17e78..e7e17e78 100644 --- a/libdino/data/img/status_dnd.svg +++ b/main/data/img/status_dnd.svg diff --git a/libdino/data/img/status_online.svg b/main/data/img/status_online.svg index 13cc6592..13cc6592 100644 --- a/libdino/data/img/status_online.svg +++ b/main/data/img/status_online.svg diff --git a/libdino/data/img/tick.svg b/main/data/img/tick.svg index 4a08848c..4a08848c 100644 --- a/libdino/data/img/tick.svg +++ b/main/data/img/tick.svg diff --git a/libdino/data/manage_accounts/account_row.ui b/main/data/manage_accounts/account_row.ui index ab700daa..ab700daa 100644 --- a/libdino/data/manage_accounts/account_row.ui +++ b/main/data/manage_accounts/account_row.ui diff --git a/libdino/data/manage_accounts/add_account_dialog.ui b/main/data/manage_accounts/add_account_dialog.ui index dd5264f1..dd5264f1 100644 --- a/libdino/data/manage_accounts/add_account_dialog.ui +++ b/main/data/manage_accounts/add_account_dialog.ui diff --git a/libdino/data/manage_accounts/dialog.ui b/main/data/manage_accounts/dialog.ui index e431bfff..e431bfff 100644 --- a/libdino/data/manage_accounts/dialog.ui +++ b/main/data/manage_accounts/dialog.ui diff --git a/libdino/data/menu_add.ui b/main/data/menu_add.ui index 3b2c4c4a..3b2c4c4a 100644 --- a/libdino/data/menu_add.ui +++ b/main/data/menu_add.ui diff --git a/libdino/data/menu_app.ui b/main/data/menu_app.ui index d3fa4cb7..d3fa4cb7 100644 --- a/libdino/data/menu_app.ui +++ b/main/data/menu_app.ui diff --git a/libdino/data/menu_conversation.ui b/main/data/menu_conversation.ui index 9fe2a2b7..9fe2a2b7 100644 --- a/libdino/data/menu_conversation.ui +++ b/main/data/menu_conversation.ui diff --git a/libdino/data/menu_encryption.ui b/main/data/menu_encryption.ui index 216bdd92..216bdd92 100644 --- a/libdino/data/menu_encryption.ui +++ b/main/data/menu_encryption.ui diff --git a/libdino/data/occupant_list.ui b/main/data/occupant_list.ui index deb4716e..deb4716e 100644 --- a/libdino/data/occupant_list.ui +++ b/main/data/occupant_list.ui diff --git a/libdino/data/occupant_list_item.ui b/main/data/occupant_list_item.ui index aabe8a05..aabe8a05 100644 --- a/libdino/data/occupant_list_item.ui +++ b/main/data/occupant_list_item.ui diff --git a/libdino/data/settings.gschema.xml b/main/data/settings.gschema.xml index f3d342cf..f3d342cf 100644 --- a/libdino/data/settings.gschema.xml +++ b/main/data/settings.gschema.xml diff --git a/libdino/data/settings_dialog.ui b/main/data/settings_dialog.ui index 3b939216..3b939216 100644 --- a/libdino/data/settings_dialog.ui +++ b/main/data/settings_dialog.ui diff --git a/libdino/data/style.css b/main/data/style.css index d143ffd3..d143ffd3 100644 --- a/libdino/data/style.css +++ b/main/data/style.css diff --git a/libdino/data/unified_window.ui b/main/data/unified_window.ui index 289c00cf..289c00cf 100644 --- a/libdino/data/unified_window.ui +++ b/main/data/unified_window.ui diff --git a/main/src/main.vala b/main/src/main.vala index 21e45bf4..d0e47213 100644 --- a/main/src/main.vala +++ b/main/src/main.vala @@ -5,7 +5,7 @@ namespace Dino { void main(string[] args) { Gtk.init(ref args); - Application app = new Application(); + Dino.Ui.Application app = new Dino.Ui.Application(); Plugins.Loader loader = new Plugins.Loader(); foreach(string plugin in new string[]{}) { try { diff --git a/libdino/src/ui/add_conversation/chat/add_contact_dialog.vala b/main/src/ui/add_conversation/chat/add_contact_dialog.vala index df8fbeb9..df8fbeb9 100644 --- a/libdino/src/ui/add_conversation/chat/add_contact_dialog.vala +++ b/main/src/ui/add_conversation/chat/add_contact_dialog.vala diff --git a/libdino/src/ui/add_conversation/chat/dialog.vala b/main/src/ui/add_conversation/chat/dialog.vala index cad2b367..cad2b367 100644 --- a/libdino/src/ui/add_conversation/chat/dialog.vala +++ b/main/src/ui/add_conversation/chat/dialog.vala diff --git a/libdino/src/ui/add_conversation/chat/roster_list.vala b/main/src/ui/add_conversation/chat/roster_list.vala index 92388597..92388597 100644 --- a/libdino/src/ui/add_conversation/chat/roster_list.vala +++ b/main/src/ui/add_conversation/chat/roster_list.vala diff --git a/libdino/src/ui/add_conversation/conference/add_groupchat_dialog.vala b/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala index 8cc5ac72..8cc5ac72 100644 --- a/libdino/src/ui/add_conversation/conference/add_groupchat_dialog.vala +++ b/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala diff --git a/libdino/src/ui/add_conversation/conference/conference_details_fragment.vala b/main/src/ui/add_conversation/conference/conference_details_fragment.vala index d42c79bd..d42c79bd 100644 --- a/libdino/src/ui/add_conversation/conference/conference_details_fragment.vala +++ b/main/src/ui/add_conversation/conference/conference_details_fragment.vala diff --git a/libdino/src/ui/add_conversation/conference/conference_list.vala b/main/src/ui/add_conversation/conference/conference_list.vala index 7743ced5..7743ced5 100644 --- a/libdino/src/ui/add_conversation/conference/conference_list.vala +++ b/main/src/ui/add_conversation/conference/conference_list.vala diff --git a/libdino/src/ui/add_conversation/conference/dialog.vala b/main/src/ui/add_conversation/conference/dialog.vala index ff548699..ff548699 100644 --- a/libdino/src/ui/add_conversation/conference/dialog.vala +++ b/main/src/ui/add_conversation/conference/dialog.vala diff --git a/libdino/src/ui/add_conversation/list_row.vala b/main/src/ui/add_conversation/list_row.vala index b53432a6..b53432a6 100644 --- a/libdino/src/ui/add_conversation/list_row.vala +++ b/main/src/ui/add_conversation/list_row.vala diff --git a/libdino/src/ui/add_conversation/select_jid_fragment.vala b/main/src/ui/add_conversation/select_jid_fragment.vala index d0b214b5..d0b214b5 100644 --- a/libdino/src/ui/add_conversation/select_jid_fragment.vala +++ b/main/src/ui/add_conversation/select_jid_fragment.vala diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala new file mode 100644 index 00000000..1adccf8e --- /dev/null +++ b/main/src/ui/application.vala @@ -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); + } +} + diff --git a/libdino/src/ui/avatar_generator.vala b/main/src/ui/avatar_generator.vala index b668444c..b668444c 100644 --- a/libdino/src/ui/avatar_generator.vala +++ b/main/src/ui/avatar_generator.vala diff --git a/libdino/src/ui/chat_input.vala b/main/src/ui/chat_input.vala index 5030fcea..5030fcea 100644 --- a/libdino/src/ui/chat_input.vala +++ b/main/src/ui/chat_input.vala diff --git a/libdino/src/ui/conversation_list_titlebar.vala b/main/src/ui/conversation_list_titlebar.vala index 5ef824d5..5ef824d5 100644 --- a/libdino/src/ui/conversation_list_titlebar.vala +++ b/main/src/ui/conversation_list_titlebar.vala diff --git a/libdino/src/ui/conversation_selector/chat_row.vala b/main/src/ui/conversation_selector/chat_row.vala index 8b36b333..8b36b333 100644 --- a/libdino/src/ui/conversation_selector/chat_row.vala +++ b/main/src/ui/conversation_selector/chat_row.vala diff --git a/libdino/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_row.vala index 0a6b7e70..0a6b7e70 100644 --- a/libdino/src/ui/conversation_selector/conversation_row.vala +++ b/main/src/ui/conversation_selector/conversation_row.vala diff --git a/libdino/src/ui/conversation_selector/groupchat_row.vala b/main/src/ui/conversation_selector/groupchat_row.vala index 7fe52d89..7fe52d89 100644 --- a/libdino/src/ui/conversation_selector/groupchat_row.vala +++ b/main/src/ui/conversation_selector/groupchat_row.vala diff --git a/libdino/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/list.vala index ea2f9622..ea2f9622 100644 --- a/libdino/src/ui/conversation_selector/list.vala +++ b/main/src/ui/conversation_selector/list.vala diff --git a/libdino/src/ui/conversation_selector/view.vala b/main/src/ui/conversation_selector/view.vala index ae641664..ae641664 100644 --- a/libdino/src/ui/conversation_selector/view.vala +++ b/main/src/ui/conversation_selector/view.vala diff --git a/libdino/src/ui/conversation_summary/merged_message_item.vala b/main/src/ui/conversation_summary/merged_message_item.vala index fa198d21..fa198d21 100644 --- a/libdino/src/ui/conversation_summary/merged_message_item.vala +++ b/main/src/ui/conversation_summary/merged_message_item.vala diff --git a/libdino/src/ui/conversation_summary/merged_status_item.vala b/main/src/ui/conversation_summary/merged_status_item.vala index 1fe8ecf3..1fe8ecf3 100644 --- a/libdino/src/ui/conversation_summary/merged_status_item.vala +++ b/main/src/ui/conversation_summary/merged_status_item.vala diff --git a/libdino/src/ui/conversation_summary/status_item.vala b/main/src/ui/conversation_summary/status_item.vala index 0775d8f3..0775d8f3 100644 --- a/libdino/src/ui/conversation_summary/status_item.vala +++ b/main/src/ui/conversation_summary/status_item.vala diff --git a/libdino/src/ui/conversation_summary/view.vala b/main/src/ui/conversation_summary/view.vala index d2599041..d2599041 100644 --- a/libdino/src/ui/conversation_summary/view.vala +++ b/main/src/ui/conversation_summary/view.vala diff --git a/libdino/src/ui/conversation_titlebar.vala b/main/src/ui/conversation_titlebar.vala index 4f472e05..4f472e05 100644 --- a/libdino/src/ui/conversation_titlebar.vala +++ b/main/src/ui/conversation_titlebar.vala diff --git a/libdino/src/ui/manage_accounts/account_row.vala b/main/src/ui/manage_accounts/account_row.vala index 5e4570f0..5e4570f0 100644 --- a/libdino/src/ui/manage_accounts/account_row.vala +++ b/main/src/ui/manage_accounts/account_row.vala diff --git a/libdino/src/ui/manage_accounts/add_account_dialog.vala b/main/src/ui/manage_accounts/add_account_dialog.vala index f6ad40a2..f6ad40a2 100644 --- a/libdino/src/ui/manage_accounts/add_account_dialog.vala +++ b/main/src/ui/manage_accounts/add_account_dialog.vala diff --git a/libdino/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala index 3616c403..3616c403 100644 --- a/libdino/src/ui/manage_accounts/dialog.vala +++ b/main/src/ui/manage_accounts/dialog.vala diff --git a/libdino/src/ui/notifications.vala b/main/src/ui/notifications.vala index 17636995..17636995 100644 --- a/libdino/src/ui/notifications.vala +++ b/main/src/ui/notifications.vala diff --git a/libdino/src/ui/occupant_list.vala b/main/src/ui/occupant_list.vala index ba7c01d1..ba7c01d1 100644 --- a/libdino/src/ui/occupant_list.vala +++ b/main/src/ui/occupant_list.vala diff --git a/libdino/src/ui/occupant_list_row.vala b/main/src/ui/occupant_list_row.vala index 4dc7c0c5..4dc7c0c5 100644 --- a/libdino/src/ui/occupant_list_row.vala +++ b/main/src/ui/occupant_list_row.vala diff --git a/libdino/src/ui/settings_dialog.vala b/main/src/ui/settings_dialog.vala index 2d3c1efa..2d3c1efa 100644 --- a/libdino/src/ui/settings_dialog.vala +++ b/main/src/ui/settings_dialog.vala diff --git a/libdino/src/ui/unified_window.vala b/main/src/ui/unified_window.vala index 269799c2..269799c2 100644 --- a/libdino/src/ui/unified_window.vala +++ b/main/src/ui/unified_window.vala diff --git a/libdino/src/ui/util.vala b/main/src/ui/util.vala index 0a294731..0a294731 100644 --- a/libdino/src/ui/util.vala +++ b/main/src/ui/util.vala |