Add calls-application class
This commit is contained in:
57
src/main.c
57
src/main.c
@@ -25,60 +25,9 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define HANDY_USE_UNSTABLE_API
|
||||
#include <handy.h>
|
||||
|
||||
#include "calls-call-window.h"
|
||||
#include "calls-encryption-indicator.h"
|
||||
#include "calls-history-box.h"
|
||||
#include "calls-history-header-bar.h"
|
||||
#include "calls-main-window.h"
|
||||
#include "calls-mm-provider.h"
|
||||
#include "calls-new-call-box.h"
|
||||
#include "calls-new-call-header-bar.h"
|
||||
#include "calls-application.h"
|
||||
#include "config.h"
|
||||
|
||||
static void
|
||||
show_window (GtkApplication *app)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GDBusConnection *connection;
|
||||
CallsProvider *provider;
|
||||
CallsMainWindow *main_window;
|
||||
CallsCallWindow *call_window;
|
||||
|
||||
CALLS_TYPE_ENCRYPTION_INDICATOR;
|
||||
CALLS_TYPE_HISTORY_BOX;
|
||||
CALLS_TYPE_HISTORY_HEADER_BAR;
|
||||
CALLS_TYPE_NEW_CALL_BOX;
|
||||
CALLS_TYPE_NEW_CALL_HEADER_BAR;
|
||||
HDY_TYPE_DIALER;
|
||||
|
||||
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
|
||||
if (!connection)
|
||||
{
|
||||
g_error ("Error creating D-Bus connection: %s",
|
||||
error->message);
|
||||
return;
|
||||
}
|
||||
|
||||
provider = CALLS_PROVIDER (calls_mm_provider_new (connection));
|
||||
g_assert (provider != NULL);
|
||||
|
||||
main_window = calls_main_window_new (app, provider);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (main_window), "Calls");
|
||||
|
||||
gtk_widget_show_all (GTK_WIDGET (main_window));
|
||||
|
||||
call_window = calls_call_window_new (app);
|
||||
|
||||
g_signal_connect_swapped (main_window, "call-added",
|
||||
G_CALLBACK (calls_call_window_add_call), call_window);
|
||||
g_signal_connect_swapped (main_window, "call-removed",
|
||||
G_CALLBACK (calls_call_window_remove_call), call_window);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char **argv)
|
||||
@@ -90,9 +39,7 @@ main (int argc,
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
|
||||
app = gtk_application_new (APP_ID, G_APPLICATION_FLAGS_NONE);
|
||||
g_set_prgname (APP_ID);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (show_window), NULL);
|
||||
app = GTK_APPLICATION (calls_application_new ());
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user