void FcitxIMClientFocusIn(FcitxIMClient* client) { if (client->icproxy) { dbus_g_proxy_call_no_reply(client->icproxy, "FocusIn", G_TYPE_INVALID); } }
void FcitxIMClientSetCursorLocation(FcitxIMClient* client, int x, int y) { if (client->icproxy) { dbus_g_proxy_call_no_reply(client->icproxy, "SetCursorLocation", G_TYPE_INT, x, G_TYPE_INT, y, G_TYPE_INVALID); } }
void FcitxIMClientReset(FcitxIMClient* client) { if (client->icproxy) { dbus_g_proxy_call_no_reply(client->icproxy, "Reset", G_TYPE_INVALID); } }
static gboolean set_powered_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { DBusGProxy *proxy = NULL; GValue value = { 0, }; gtk_tree_model_get (model, iter, BLUETOOTH_COLUMN_PROXY, &proxy, -1); if (proxy == NULL) return FALSE; g_value_init (&value, G_TYPE_BOOLEAN); g_value_set_boolean (&value, TRUE); dbus_g_proxy_call_no_reply (proxy, "SetProperty", G_TYPE_STRING, "Powered", G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID); g_value_unset (&value); g_object_unref (proxy); return FALSE; }
void FcitxIMClientCloseIC(FcitxIMClient* client) { if (client->icproxy) { dbus_g_proxy_call_no_reply(client->icproxy, "CloseIC", G_TYPE_INVALID); } }
int _bt_opp_client_cancel_push(void) { DBusGConnection *g_conn; DBusGProxy *client_proxy; retv_if(sending_info == NULL, BLUETOOTH_ERROR_NOT_IN_OPERATION); sending_info->is_canceled = TRUE; if (sending_info->transfer_info) { dbus_g_proxy_call_no_reply(sending_info->transfer_info->proxy, "Cancel", G_TYPE_INVALID); } else { retv_if(sending_info->sending_proxy == NULL, BLUETOOTH_ERROR_INTERNAL); g_conn = _bt_get_session_gconn(); retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL); client_proxy = dbus_g_proxy_new_for_name(g_conn, BT_OBEX_SERVICE_NAME, "/", BT_OBEX_CLIENT_INTERFACE); retv_if(client_proxy == NULL, BLUETOOTH_ERROR_INTERNAL); dbus_g_proxy_cancel_call(client_proxy, sending_info->sending_proxy); g_idle_add(__bt_cancel_push_cb, NULL); } return BLUETOOTH_ERROR_NONE; }
static void show_network_panel (void) { DBusGConnection *session_bus; GError *error = NULL; DBusGProxy *proxy; session_bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); if (connection == NULL) { g_printerr ("Cannot connect to DBus: %s\n", error->message); g_error_free (error); return; } proxy = dbus_g_proxy_new_for_name (session_bus, "com.meego.UX.Shell.Toolbar", "/com/meego/UX/Shell/Toolbar", "com.meego.UX.Shell.Toolbar"); dbus_g_proxy_call_no_reply (proxy, "ShowPanel", G_TYPE_STRING, "network", G_TYPE_INVALID); /* Need to flush because we're out of the main loop by now */ dbus_g_connection_flush (connection); g_object_unref (proxy); }
static void dun_cleanup (PluginInfo *info, const char *message, gboolean uncheck) { GSList *iter; for (iter = info->modem_proxies; iter; iter = g_slist_next (iter)) g_object_unref (DBUS_G_PROXY (iter->data)); g_slist_free (info->modem_proxies); info->modem_proxies = NULL; if (info->dun_proxy) { if (info->rfcomm_iface) { dbus_g_proxy_call_no_reply (info->dun_proxy, "Disconnect", G_TYPE_STRING, info->rfcomm_iface, G_TYPE_INVALID); } dbus_g_proxy_disconnect_signal (info->dun_proxy, "PropertyChanged", G_CALLBACK (dun_property_changed), info); g_object_unref (info->dun_proxy); info->dun_proxy = NULL; } g_free (info->rfcomm_iface); info->rfcomm_iface = NULL; if (info->bus) { dbus_g_connection_unref (info->bus); info->bus = NULL; } if (info->dun_timeout_id) { g_source_remove (info->dun_timeout_id); info->dun_timeout_id = 0; } if (info->window_group) { g_object_unref (info->window_group); info->window_group = NULL; } if (info->wizard) { mobile_wizard_destroy (info->wizard); info->wizard = NULL; } if (info->spinner) { nma_bling_spinner_stop (BMA_BLING_SPINNER (info->spinner)); gtk_widget_hide (info->spinner); } gtk_label_set_text (GTK_LABEL (info->label), message); gtk_widget_set_sensitive (info->dun_button, TRUE); if (uncheck) { g_signal_handler_block (info->dun_button, info->dun_toggled_id); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->dun_button), FALSE); g_signal_handler_unblock (info->dun_button, info->dun_toggled_id); } }
void nm_supplicant_manager_iface_release (NMSupplicantManager *self, NMSupplicantInterface *iface) { NMSupplicantManagerPrivate *priv; const char *ifname, *op; g_return_if_fail (NM_IS_SUPPLICANT_MANAGER (self)); g_return_if_fail (NM_IS_SUPPLICANT_INTERFACE (iface)); ifname = nm_supplicant_interface_get_ifname (iface); g_assert (ifname); priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); g_return_if_fail (g_hash_table_lookup (priv->ifaces, ifname) == iface); /* Ask wpa_supplicant to remove this interface */ op = nm_supplicant_interface_get_object_path (iface); if (priv->running && priv->proxy && op) { dbus_g_proxy_call_no_reply (priv->proxy, "RemoveInterface", DBUS_TYPE_G_OBJECT_PATH, op, G_TYPE_INVALID); } g_hash_table_remove (priv->ifaces, ifname); }
/** * gpm_networkmanager_wake: * * Tell NetworkManager to wake up all the network devices * * Return value: TRUE if NetworkManager is now awake. **/ gboolean gpm_networkmanager_wake (void) { DBusGConnection *connection = NULL; DBusGProxy *nm_proxy = NULL; GError *error = NULL; connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (error) { egg_warning ("%s", error->message); g_error_free (error); return FALSE; } nm_proxy = dbus_g_proxy_new_for_name (connection, NM_LISTENER_SERVICE, NM_LISTENER_PATH, NM_LISTENER_INTERFACE); if (!nm_proxy) { egg_warning ("Failed to get name owner"); return FALSE; } dbus_g_proxy_call_no_reply (nm_proxy, "wake", G_TYPE_INVALID); g_object_unref (G_OBJECT (nm_proxy)); return TRUE; }
guint modem_tones_start_full(ModemTones *self, int event, int volume, unsigned duration, ModemTonesStoppedNotify *notify, gpointer data) { ModemTonesPrivate *priv = self->priv; g_return_val_if_fail(!priv->dispose_has_run, 0); volume += priv->volume; if (volume > 0) volume = 0; else if (volume < -63) volume = -63; if (event == TONES_EVENT_DROPPED) { if (duration > 1200) duration = 1200; } modem_tones_stop(self, 0); if (event < 0) return 0; if (priv->source == 0) priv->source++; priv->playing = priv->source++; priv->event = event; priv->evolume = volume; priv->duration = duration; if (duration) { priv->timeout = g_timeout_add_full(G_PRIORITY_DEFAULT, duration, modem_tones_timeout, self, modem_tones_timeout_removed); } priv->data = data; priv->notify = notify; g_timer_start(priv->timer); DEBUG("calling StartEventTone(%u, %d, %u) with %u", priv->event, priv->evolume, priv->duration, priv->playing); dbus_g_proxy_call_no_reply(priv->proxy, "StartEventTone", G_TYPE_UINT, priv->event, G_TYPE_INT, priv->evolume, G_TYPE_UINT, priv->duration, G_TYPE_INVALID); return priv->playing; }
static gboolean emit_signal (gpointer arg) { DBusGProxy *proxy = arg; dbus_g_proxy_call_no_reply (proxy, "emitHelloSignal", G_TYPE_INVALID); return TRUE; }
void FcitxIMClientSetCapacity(FcitxIMClient* client, CapacityFlags flags) { uint32_t iflags = flags; if (client->icproxy) { dbus_g_proxy_call_no_reply(client->icproxy, "SetCapacity", G_TYPE_UINT, iflags, G_TYPE_INVALID); } }
void MainWindowImpl::PokeScreensaver(void) { XResetScreenSaver (QX11Info::display ()); if( pProxy ) { dbus_g_proxy_call_no_reply (pProxy, "SimulateUserActivity",G_TYPE_INVALID); } }
/** Tell to a remote instance of Ekiga to connect to a remote SIP or H.323 * address. * You will typically use this function when claim_ownership failed. */ void ekiga_dbus_client_connect (const gchar *uri) { DBusGProxy *proxy = get_ekiga_client_proxy (); g_return_if_fail (DBUS_IS_G_PROXY (proxy)); dbus_g_proxy_call_no_reply (proxy, "Call", G_TYPE_STRING, uri, G_TYPE_INVALID); g_object_unref (proxy); }
/** Tell to a remote instance of Ekiga to show the main window. * You will typically use this function when claim_ownership failed. */ void ekiga_dbus_client_show () { DBusGProxy *proxy = get_ekiga_client_proxy (); g_return_if_fail (DBUS_IS_G_PROXY (proxy)); dbus_g_proxy_call_no_reply (proxy, "Show", G_TYPE_INVALID); g_object_unref (proxy); }
static TpProxyPendingCall * hev_cli_authentication_tls_certificate_call_reject(TpProxy *proxy, gint timeout_ms, const GPtrArray *in_rejections, hev_cli_authentication_tls_certificate_callback_for_reject callback, gpointer user_data, GDestroyNotify destroy, GObject *weak_object) { GError *error = NULL; GQuark interface = TP_IFACE_QUARK_AUTHENTICATION_TLS_CERTIFICATE; DBusGProxy *iface = NULL; TpProxyPendingCall *data = NULL; g_debug("%s:%d[%s]", __FILE__, __LINE__, __FUNCTION__); iface = tp_proxy_borrow_interface_by_id(proxy, interface, &error); if(NULL == iface) { if(NULL != callback) callback(proxy, error, user_data, weak_object); if(NULL != destroy) destroy(user_data); g_error_free(error); return NULL; } if(NULL == callback) { dbus_g_proxy_call_no_reply(iface, "Reject", (dbus_g_type_get_collection("GPtrArray", (dbus_g_type_get_struct("GValueArray", G_TYPE_UINT, G_TYPE_STRING, (dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)), G_TYPE_INVALID)))), in_rejections, G_TYPE_INVALID); return NULL; } data = tp_proxy_pending_call_v0_new(proxy, interface, "Reject", iface, hev_cli_authentication_tls_certificate_invoke_callback_reject, G_CALLBACK(callback), user_data, destroy, weak_object, FALSE); tp_proxy_pending_call_v0_take_pending_call(data, dbus_g_proxy_begin_call_with_timeout(iface, "Reject", hev_cli_authentication_tls_certificate_collect_callback_reject, data, tp_proxy_pending_call_v0_completed, timeout_ms, (dbus_g_type_get_collection("GPtrArray", (dbus_g_type_get_struct("GValueArray", G_TYPE_UINT, G_TYPE_STRING, (dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)), G_TYPE_INVALID)))), in_rejections, G_TYPE_INVALID)); return data; }
/** * gpm_session_logout: **/ gboolean gpm_session_logout (GpmSession *session) { g_return_val_if_fail (GPM_IS_SESSION (session), FALSE); /* no mate-session */ if (session->priv->proxy == NULL) { egg_warning ("no mate-session"); return FALSE; } /* we have to use no reply, as the SM calls into g-p-m to get the can_suspend property */ dbus_g_proxy_call_no_reply (session->priv->proxy, "Shutdown", G_TYPE_INVALID); return TRUE; }
/** * gpk_session_logout: **/ gboolean gpk_session_logout (GpkSession *session) { g_return_val_if_fail (GPK_IS_SESSION (session), FALSE); /* no gnome-session */ if (session->priv->proxy == NULL) { g_warning ("no gnome-session"); return FALSE; } /* we have to use no reply, as the SM calls into g-p-m to get the can_suspend property */ dbus_g_proxy_call_no_reply (session->priv->proxy, "Logout", G_TYPE_UINT, 1, /* no confirmation, but use inhibitors */ G_TYPE_INVALID); return TRUE; }
int _bt_obex_server_cancel_transfer(int transfer_id) { bt_transfer_info_t *transfer = NULL; DBusGProxy *proxy; transfer = __bt_find_transfer_by_id(transfer_id); retv_if(transfer == NULL, BLUETOOTH_ERROR_NOT_FOUND); proxy = __bt_get_transfer_proxy(transfer->path); retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL); dbus_g_proxy_call_no_reply(proxy, "Cancel", G_TYPE_INVALID); g_object_unref(proxy); return BLUETOOTH_ERROR_NONE; }
/* Controle du lecteur (permet d'effectuer les actions de bases sur le lecteur) */ void cd_rhythmbox_control (MyPlayerControl pControl, const char* song) { cd_debug (""); gchar *cCommand = NULL; switch (pControl) { case PLAYER_PREVIOUS : cCommand = myData.DBus_commands.previous; // ou bien rhythmbox-client --previous break; case PLAYER_PLAY_PAUSE : cCommand = myData.DBus_commands.play; // ou bien rhythmbox-client --pause/--play break; case PLAYER_NEXT : cCommand = myData.DBus_commands.next; // ou bien rhythmbox-client --next break; case PLAYER_ENQUEUE : cCommand = g_strdup_printf ("rhythmbox-client --enqueue %s", song); g_spawn_command_line_async (cCommand, NULL); g_free (cCommand); cCommand = NULL; break; default : return; break; } if (pControl == PLAYER_PLAY_PAUSE) // Cas special pour RB qui necessite un argument pour le PlayPause { gboolean bStartPlaying = (myData.iPlayingStatus != PLAYER_PLAYING); dbus_g_proxy_call_no_reply (myData.dbus_proxy_player, cCommand, G_TYPE_BOOLEAN, bStartPlaying, G_TYPE_INVALID, G_TYPE_INVALID); } else if (cCommand != NULL) { cd_debug ("MP : Handler rhythmbox : will use '%s'", cCommand); cairo_dock_dbus_call (myData.dbus_proxy_player, cCommand); } }
static gboolean poke_modem_cb (gpointer user_data) { NMModemManager *self = NM_MODEM_MANAGER (user_data); NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self); DBusGConnection *g_connection; DBusGProxy *proxy; g_connection = nm_dbus_manager_get_connection (priv->dbus_mgr); proxy = dbus_g_proxy_new_for_name (g_connection, MM_DBUS_SERVICE, MM_DBUS_PATH, MM_DBUS_INTERFACE); dbus_g_proxy_call_no_reply (proxy, "EnumerateDevices", G_TYPE_INVALID); g_object_unref (proxy); return TRUE; }
void FcitxIMClientClose(FcitxIMClient* client) { if (client->icproxy) { dbus_g_proxy_call_no_reply(client->icproxy, "DestroyIC", G_TYPE_INVALID); } DBusGProxy* icproxy = client->icproxy; DBusGProxy* proxy = client->proxy; client->icproxy = NULL; client->proxy = NULL; if (client->dbusproxy) g_object_unref(client->dbusproxy); if (proxy) g_signal_handlers_disconnect_by_func(proxy, G_CALLBACK( _destroy_cb), client); if (icproxy) g_object_unref(icproxy); if (proxy) g_object_unref(proxy); free(client); }
static void try_remove_iface (DBusGConnection *g_connection, const char *path) { DBusGProxy *proxy; g_return_if_fail (g_connection != NULL); g_return_if_fail (path != NULL); proxy = dbus_g_proxy_new_for_name (g_connection, WPAS_DBUS_SERVICE, WPAS_DBUS_PATH, WPAS_DBUS_INTERFACE); if (!proxy) return; dbus_g_proxy_call_no_reply (proxy, "removeInterface", DBUS_TYPE_G_OBJECT_PATH, path, G_TYPE_INVALID); g_object_unref (proxy); }
static void dun_cleanup (NmaBtDevice *self) { NmaBtDevicePrivate *priv = NMA_BT_DEVICE_GET_PRIVATE (self); GSList *iter; /* ModemManager */ for (iter = priv->modem_proxies; iter; iter = g_slist_next (iter)) g_object_unref (DBUS_G_PROXY (iter->data)); g_slist_free (priv->modem_proxies); priv->modem_proxies = NULL; g_clear_object (&priv->mm_proxy); #if WITH_MODEM_MANAGER_1 g_clear_object (&priv->dbus_connection); g_clear_object (&priv->modem_manager_1); #endif if (priv->dun_proxy && priv->rfcomm_iface) { dbus_g_proxy_call_no_reply (priv->dun_proxy, "Disconnect", G_TYPE_STRING, priv->rfcomm_iface, G_TYPE_INVALID); } g_clear_object (&priv->dun_proxy); g_free (priv->rfcomm_iface); priv->rfcomm_iface = NULL; if (priv->dun_timeout_id) { g_source_remove (priv->dun_timeout_id); priv->dun_timeout_id = 0; } if (priv->wizard) { nma_mobile_wizard_destroy (priv->wizard); priv->wizard = NULL; } }
/* * Inform the Network Manager when we do suspend/hibernate */ gboolean xfpm_network_manager_sleep (gboolean sleep) { #ifdef WITH_NETWORK_MANAGER DBusGConnection *bus = NULL; DBusGProxy *proxy = NULL; GError *error = NULL; bus = dbus_g_bus_get ( DBUS_BUS_SYSTEM, &error); if ( error ) { g_warning("%s", error->message); g_error_free (error); return FALSE; } proxy = dbus_g_proxy_new_for_name (bus, "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.NetworkManager"); if (!proxy) { g_warning ("Failed to create proxy for Network Manager interface"); return FALSE; } dbus_g_proxy_call_no_reply (proxy, "Sleep", G_TYPE_BOOLEAN, sleep, G_TYPE_INVALID); g_object_unref (G_OBJECT(proxy)); dbus_g_connection_unref (bus); /* Sleep 0.5 second to allow the nm applet to disconnect*/ g_usleep (500000); #endif /* WITH_NETWORK_MANAGER */ return TRUE; }
BT_EXPORT_API int bluetooth_obex_server_cancel_all_transfers(void) { obex_server_info_t *obex_server_info = &g_obex_server_info; GSList *l; DBG("+\n"); _bluetooth_internal_session_init(); if (FALSE == _bluetooth_internal_is_adapter_enabled()) { DBG("Adapter not enabled"); return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED; } if (NULL == obex_server_info->obex_server_agent) { DBG("Agent not registered"); return BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST; } if (obex_server_info->obex_proxy == NULL) { DBG("obex_proxy is NULL \n"); return BLUETOOTH_ERROR_INTERNAL; } for (l = transfers; l != NULL; l = l->next) { transfer_info_t *transfer = l->data; if (transfer && transfer->transfer_proxy) { dbus_g_proxy_call_no_reply(transfer->transfer_proxy, "Cancel", G_TYPE_INVALID, G_TYPE_INVALID); } } DBG("+\n"); return BLUETOOTH_ERROR_NONE; }
BT_EXPORT_API int bluetooth_obex_server_cancel_transfer(int transfer_id) { obex_server_info_t *obex_server_info = &g_obex_server_info; transfer_info_t *transfer = NULL; DBG("+\n"); _bluetooth_internal_session_init(); if (FALSE == _bluetooth_internal_is_adapter_enabled()) { DBG("Adapter not enabled"); return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED; } if (NULL == obex_server_info->obex_server_agent) { DBG("Agent not registered"); return BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST; } if (obex_server_info->obex_proxy == NULL) { DBG("obex_proxy is NULL \n"); return BLUETOOTH_ERROR_INTERNAL; } transfer = _bt_find_transfer_by_id(transfer_id); if (transfer == NULL) { DBG("No transfer information"); return BLUETOOTH_ERROR_NOT_FOUND; } dbus_g_proxy_call_no_reply(transfer->transfer_proxy, "Cancel", G_TYPE_INVALID, G_TYPE_INVALID); DBG("+\n"); return BLUETOOTH_ERROR_NONE; }
void _nm_dbus_set_property (DBusGProxy *proxy, const char *interface, const char *prop_name, GValue *value) { DBusGProxy *properties_proxy; g_return_if_fail (proxy != NULL); g_return_if_fail (interface != NULL); g_return_if_fail (prop_name != NULL); properties_proxy = dbus_g_proxy_new_from_proxy (proxy, "org.freedesktop.DBus.Properties", dbus_g_proxy_get_path (proxy)); dbus_g_proxy_call_no_reply (properties_proxy, "Set", G_TYPE_STRING, interface, G_TYPE_STRING, prop_name, G_TYPE_VALUE, value, G_TYPE_INVALID); g_object_unref (properties_proxy); }
int main (int argc, char **argv) { DBusGConnection *session_bus; GError *error = NULL; RBShell *rb_shell; gboolean activated; gboolean autostarted; char *accel_map_file = NULL; char *desktop_file_path; GOptionContext *context; static const GOptionEntry options [] = { { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug, N_("Enable debug output"), NULL }, { "debug-match", 'D', 0, G_OPTION_ARG_STRING, &debug_match, N_("Enable debug output matching a specified string"), NULL }, { "no-update", 0, 0, G_OPTION_ARG_NONE, &no_update, N_("Do not update the library with file changes"), NULL }, { "no-registration", 'n', 0, G_OPTION_ARG_NONE, &no_registration, N_("Do not register the shell"), NULL }, { "dry-run", 0, 0, G_OPTION_ARG_NONE, &dry_run, N_("Don't save any data permanently (implies --no-registration)"), NULL }, { "disable-plugins", 0, 0, G_OPTION_ARG_NONE, &disable_plugins, N_("Disable loading of plugins"), NULL }, { "rhythmdb-file", 0, 0, G_OPTION_ARG_STRING, &rhythmdb_file, N_("Path for database file to use"), NULL }, { "playlists-file", 0, 0, G_OPTION_ARG_STRING, &playlists_file, N_("Path for playlists file to use"), NULL }, { "quit", 'q', 0, G_OPTION_ARG_NONE, &quit, N_("Quit Rhythmbox"), NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining_args, NULL, N_("[URI...]") }, { NULL } }; g_thread_init (NULL); rb_profile_start ("starting rhythmbox"); autostarted = (g_getenv ("DESKTOP_AUTOSTART_ID") != NULL); #ifdef USE_UNINSTALLED_DIRS desktop_file_path = g_build_filename (SHARE_UNINSTALLED_BUILDDIR, "rhythmbox.desktop", NULL); g_setenv ("GSETTINGS_SCHEMA_DIR", SHARE_UNINSTALLED_BUILDDIR, TRUE); #else desktop_file_path = g_build_filename (DATADIR, "applications", "rhythmbox.desktop", NULL); #endif egg_set_desktop_file (desktop_file_path); g_free (desktop_file_path); context = g_option_context_new (NULL); g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); rb_profile_start ("initializing gstreamer"); g_option_context_add_group (context, gst_init_get_option_group ()); rb_profile_end ("initializing gstreamer"); g_option_context_add_group (context, egg_sm_client_get_option_group ()); g_option_context_add_group (context, gtk_get_option_group (TRUE)); setlocale (LC_ALL, NULL); rb_profile_start ("parsing command line options"); 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); rb_profile_end ("parsing command line options"); g_random_set_seed (time (0)); #ifdef ENABLE_NLS /* initialize i18n */ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); /* ask for utf-8 message text from GStreamer too, * since it doesn't do that itself. */ bind_textdomain_codeset ("gstreamer-0.10", "UTF-8"); textdomain (GETTEXT_PACKAGE); #endif if (!debug && debug_match) rb_debug_init_match (debug_match); else rb_debug_init (debug); rb_debug ("initializing Rhythmbox %s", VERSION); #if defined(USE_UNINSTALLED_DIRS) g_irepository_prepend_search_path (SHARE_UNINSTALLED_BUILDDIR "/../bindings/gi"); #endif /* TODO: kill this function */ rb_threads_init (); gdk_threads_enter (); activated = FALSE; rb_debug ("going to create DBus object"); dbus_g_thread_init (); session_bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); if (session_bus == NULL) { g_warning ("couldn't connect to session bus: %s", (error) ? error->message : "(null)"); g_clear_error (&error); } else if (!no_registration) { guint request_name_reply; int flags; #ifndef DBUS_NAME_FLAG_DO_NOT_QUEUE flags = DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT; #else flags = DBUS_NAME_FLAG_DO_NOT_QUEUE; #endif DBusGProxy *bus_proxy; bus_proxy = dbus_g_proxy_new_for_name (session_bus, "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus"); if (!dbus_g_proxy_call (bus_proxy, "RequestName", &error, G_TYPE_STRING, "org.gnome.Rhythmbox", G_TYPE_UINT, flags, G_TYPE_INVALID, G_TYPE_UINT, &request_name_reply, G_TYPE_INVALID)) { g_warning ("Failed to invoke RequestName: %s", error->message); } g_object_unref (bus_proxy); if (request_name_reply == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER || request_name_reply == DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER) activated = FALSE; else if (request_name_reply == DBUS_REQUEST_NAME_REPLY_EXISTS || request_name_reply == DBUS_REQUEST_NAME_REPLY_IN_QUEUE) activated = TRUE; else { g_warning ("Got unhandled reply %u from RequestName", request_name_reply); activated = FALSE; } } if (!activated) { if (quit) { rb_debug ("was asked to quit, but no instance was running"); gdk_notify_startup_complete (); exit (0); } #ifdef WITH_RHYTHMDB_GDA gda_init (PACKAGE, VERSION, argc, argv); #endif rb_refstring_system_init (); #ifdef USE_UNINSTALLED_DIRS rb_file_helpers_init (TRUE); #else rb_file_helpers_init (FALSE); #endif /* XXX not sure what to do with this. should we move it to * the config dir, or leave it where it is? */ accel_map_file = g_build_filename (g_get_home_dir (), ".gnome2", "accels", "rhythmbox", NULL); gtk_accel_map_load (accel_map_file); rb_debug ("Going to create a new shell"); rb_stock_icons_init (); g_setenv ("PULSE_PROP_media.role", "music", TRUE); rb_shell = rb_shell_new (no_registration, no_update, dry_run, autostarted, disable_plugins, rhythmdb_file, playlists_file); g_object_weak_ref (G_OBJECT (rb_shell), main_shell_weak_ref_cb, NULL); if (!no_registration && session_bus != NULL) { dbus_g_object_type_install_info (RB_TYPE_SHELL, &dbus_glib_rb_shell_object_info); dbus_g_connection_register_g_object (session_bus, "/org/gnome/Rhythmbox/Shell", G_OBJECT (rb_shell)); g_signal_connect (G_OBJECT (rb_shell), "database-load-complete", G_CALLBACK (database_load_complete), NULL); } } else if (!no_registration && session_bus != NULL) { DBusGProxy *shell_proxy; guint32 current_time; current_time = gdk_x11_display_get_user_time (gdk_display_get_default ()); shell_proxy = dbus_g_proxy_new_for_name_owner (session_bus, "org.gnome.Rhythmbox", "/org/gnome/Rhythmbox/Shell", "org.gnome.Rhythmbox.Shell", &error); if (!shell_proxy) { g_warning ("Couldn't create proxy for Rhythmbox shell: %s", error->message); } else { if (quit) { dbus_g_proxy_call_no_reply (shell_proxy, "quit", G_TYPE_INVALID); } else { load_uri_args ((const char **) remaining_args, (GFunc) dbus_load_uri, shell_proxy); dbus_g_proxy_call_no_reply (shell_proxy, "present", G_TYPE_UINT, current_time, G_TYPE_INVALID); } g_object_unref (G_OBJECT (shell_proxy)); } } if (activated) { gdk_notify_startup_complete (); } else { rb_profile_start ("mainloop"); #ifdef ENABLE_PYTHON if (rb_python_init_successful ()) { pyg_begin_allow_threads; gtk_main (); pyg_end_allow_threads; } else { gtk_main (); } #else gtk_main (); #endif rb_profile_end ("mainloop"); rb_debug ("out of toplevel loop"); rb_file_helpers_shutdown (); rb_stock_icons_shutdown (); rb_refstring_system_shutdown (); } gst_deinit (); rb_debug ("THE END"); rb_profile_end ("starting rhythmbox"); if (accel_map_file != NULL) { gtk_accel_map_save (accel_map_file); } gdk_threads_leave (); exit (0); }