gboolean sflphone_init(GError **error, SFLPhoneClient *client) { if (!dbus_connect(error, client) || !dbus_register(getpid(), "Gtk+ Client", error)) return FALSE; abook_init(); // Init icons theme init_icon_theme(); current_calls_tab = calltab_init(FALSE, CURRENT_CALLS, client); contacts_tab = calltab_init(TRUE, CONTACTS, client); history_tab = calltab_init(TRUE, HISTORY, client); codecs_load(); conferencelist_init(current_calls_tab); // Fetch the configured accounts sflphone_fill_account_list(); // Fetch the ip2ip profile sflphone_fill_ip2ip_profile(); return TRUE; }
int main(int argc, char **argv) { XmrApp *app; GOptionContext *context; GError *error = NULL; PlayerAction player_action = ActionNone; #if !GLIB_CHECK_VERSION(2, 32, 0) g_thread_init(NULL); #endif // !!! glib manual says since version 2.36 // but ubuntu 13.04 !!! #if !GLIB_CHECK_VERSION(2, 35, 7) g_type_init(); #endif // to make non-installed schemas loadable { gchar *schema_dir; schema_dir = g_build_filename(xmr_app_dir(), "glib-2.0/schemas", NULL); if (g_file_test(schema_dir, G_FILE_TEST_EXISTS)) g_setenv("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE); g_free(schema_dir); } setlocale(LC_ALL, NULL); #ifdef ENABLE_NLS /* initialize i18n */ { gchar *locale_dir = g_build_filename(xmr_app_dir(), "locale", NULL); if (g_file_test(locale_dir, G_FILE_TEST_EXISTS) && g_file_test(locale_dir, G_FILE_TEST_IS_DIR)) { bindtextdomain(GETTEXT_PACKAGE, locale_dir); } else { bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); } bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); g_free(locale_dir); } textdomain(GETTEXT_PACKAGE); #endif context = g_option_context_new(NULL); g_option_context_add_main_entries(context, options, GETTEXT_PACKAGE); g_option_context_add_group(context, gtk_get_option_group(TRUE)); g_option_context_add_group(context, gst_init_get_option_group()); if (g_option_context_parse(context, &argc, &argv, &error) == FALSE) { g_print(_("%s\nRun '%s --help' to see a full list of available command line options.\n"), error->message, argv[0]); g_error_free(error); g_option_context_free(context); exit(1); } g_option_context_free(context); if (action_play){ player_action = ActionPlay; }else if (action_pause){ player_action = ActionPause; }else if(action_next){ player_action = ActionNext; }else if(action_love){ player_action = ActionLove; }else if(action_hate){ player_action = ActionHate; } if (player_action != ActionNone) { DBusConnection *bus; DBusError dbus_error; dbus_error_init(&dbus_error); bus = dbus_bus_get(DBUS_BUS_SESSION, &dbus_error); if (!bus) { g_warning ("Failed to connect to the D-BUS daemon: %s", dbus_error.message); dbus_error_free(&dbus_error); exit(1); } dbus_connection_setup_with_g_main(bus, NULL); send_action(bus, player_action); xmr_utils_cleanup(); // exit directly return 0; } xmr_debug_enable(debug); gst_init(&argc, &argv); curl_global_init(CURL_GLOBAL_ALL); // this make our XmrRadio always works g_object_set(gtk_settings_get_default(), "gtk-button-images", TRUE, NULL); app = xmr_app_instance(); init_icon_theme(); g_application_run(G_APPLICATION(app), argc, argv); // remove ... list_file(xmr_tmp_dir(), FALSE, remove_file, NULL); g_object_unref(app); curl_global_cleanup(); xmr_utils_cleanup(); return 0; }