void OMXControl::init(OMXClock *m_av_clock, OMXPlayerAudio *m_player_audio, OMXPlayerSubtitles *m_player_subtitles, OMXReader *m_omx_reader, std::string& dbus_name) { clock = m_av_clock; audio = m_player_audio; subtitles = m_player_subtitles; reader = m_omx_reader; if (dbus_connect(dbus_name) < 0) { CLog::Log(LOGWARNING, "DBus connection failed, trying alternate"); dbus_disconnect(); std::stringstream ss; ss << getpid(); dbus_name += ".instance"; dbus_name += ss.str(); if (dbus_connect(dbus_name) < 0) { CLog::Log(LOGWARNING, "DBus connection failed, alternate failed, will continue without DBus"); dbus_disconnect(); } else { CLog::Log(LOGDEBUG, "DBus connection succeeded"); dbus_threads_init_default(); } } else { CLog::Log(LOGDEBUG, "DBus connection succeeded"); dbus_threads_init_default(); } }
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; }
Keyboard::Keyboard() { if (isatty(STDIN_FILENO)) { struct termios new_termios; tcgetattr(STDIN_FILENO, &orig_termios); new_termios = orig_termios; new_termios.c_lflag &= ~(ICANON | ECHO | ECHOCTL | ECHONL); new_termios.c_cflag |= HUPCL; new_termios.c_cc[VMIN] = 0; tcsetattr(STDIN_FILENO, TCSANOW, &new_termios); } else { orig_fl = fcntl(STDIN_FILENO, F_GETFL); fcntl(STDIN_FILENO, F_SETFL, orig_fl | O_NONBLOCK); } if (dbus_connect() < 0) { CLog::Log(LOGWARNING, "DBus connection failed"); } else { CLog::Log(LOGDEBUG, "DBus connection succeeded"); } dbus_threads_init_default(); Create(); }
OMXControl::OMXControl() { if (dbus_connect() < 0) { CLog::Log(LOGWARNING, "DBus connection failed"); } else { CLog::Log(LOGDEBUG, "DBus connection succeeded"); } dbus_threads_init_default(); }
static DBusGProxy *get_dbus_proxy (MoonshotError **error) { static DBusGProxy *dbus_proxy = NULL; static GStaticMutex init_lock = G_STATIC_MUTEX_INIT; g_static_mutex_lock (&init_lock); if (dbus_proxy == NULL) { /* Make sure GObject is initialised, in case we are the only user * of GObject in the process */ g_type_init (); dbus_proxy = dbus_connect (error); } if (dbus_proxy != NULL) g_object_ref (dbus_proxy); g_static_mutex_unlock (&init_lock); return dbus_proxy; }