| 200 | } |
| 201 | |
| 202 | void initArgs( DBusMessage* msg, const char* parentWindow, const char* title, const FileChooserOptions& options ) |
| 203 | { |
| 204 | DBusMessageIter args; |
| 205 | dbus_message_iter_init_append( msg, &args ); |
| 206 | |
| 207 | dbusAppend( args, parentWindow ); |
| 208 | dbusAppend( args, title ); |
| 209 | |
| 210 | dbusAppendArray( args, "{sv}", [&] ( auto& dict ) |
| 211 | { |
| 212 | if ( !options.handleToken.empty() ) |
| 213 | dbusAppend( dict, "handle_token", options.handleToken.c_str() ); |
| 214 | if ( !options.acceptLabel.empty() ) |
| 215 | dbusAppend( dict, "accept_label", options.acceptLabel.c_str() ); |
| 216 | if ( !options.modal ) |
| 217 | dbusAppend( dict, "modal", options.modal ); |
| 218 | if ( options.multiple ) |
| 219 | dbusAppend( dict, "multiple", options.multiple ); |
| 220 | if ( options.directory ) |
| 221 | dbusAppend( dict, "directory", options.directory ); |
| 222 | if ( !options.filters.empty() ) |
| 223 | { |
| 224 | dbusAppendArray( dict, "filters", "(sa(us))", [&] ( auto& arr ) |
| 225 | { |
| 226 | for ( const auto& filter : options.filters ) |
| 227 | dbusAppend( arr, filter ); |
| 228 | } ); |
| 229 | } |
| 230 | if ( options.currentFilter ) |
| 231 | dbusAppend( dict, "current_filter", *options.currentFilter ); |
| 232 | if ( !options.currentName.empty() ) |
| 233 | dbusAppend( dict, "current_name", options.currentName.c_str() ); |
| 234 | if ( !options.currentFolder.empty() ) |
| 235 | { |
| 236 | dbusAppendArray( dict, "current_folder", DBUS_TYPE_BYTE_AS_STRING, [&] ( auto& arr ) |
| 237 | { |
| 238 | for ( auto ch : toByteArray( options.currentFolder ) ) |
| 239 | dbusAppend( arr, ch ); |
| 240 | } ); |
| 241 | } |
| 242 | } ); |
| 243 | } |
| 244 | |
| 245 | struct Response |
| 246 | { |
no test coverage detected