2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "irreco_cmd.h"
21 #include "irreco_config.h"
24 * @addtogroup IrrecoCmd
27 * Stores a command which is called when a button is pressed.
28 * Serves also as an abstraction between built in commands and backend commands.
35 * Source file of @ref IrrecoCmd.
39 void irreco_cmd_clean(IrrecoCmd
* irreco_cmd
);
40 gboolean
irreco_cmd_get_current_layout_pos(IrrecoData
* irreco_data
,
41 guint
* pos
, guint
* len
);
42 void irreco_cmd_set_current_layout_pos(IrrecoData
* irreco_data
,
47 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
48 /* Construction & Destruction */
49 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
52 * @name Construction & Destruction
57 IrrecoCmd
*irreco_cmd_create()
59 IrrecoCmd
*irreco_cmd
;
62 irreco_cmd
= g_slice_new0(IrrecoCmd
);
63 IRRECO_RETURN_PTR(irreco_cmd
);
66 void irreco_cmd_destroy(IrrecoCmd
* irreco_cmd
)
69 irreco_cmd_clean(irreco_cmd
);
70 g_slice_free(IrrecoCmd
, irreco_cmd
);
78 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
79 /* Public Functions */
80 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
83 * @name Public Functions
87 void irreco_cmd_clean(IrrecoCmd
* irreco_cmd
)
90 switch (irreco_cmd
->type
) {
91 case IRRECO_COMMAND_NONE
:
92 case IRRECO_COMMAND_NEXT_REMOTE
:
93 case IRRECO_COMMAND_PREVIOUS_REMOTE
:
94 case IRRECO_COMMAND_FULLSCREEN_TOGGLE
:
97 case IRRECO_COMMAND_BACKEND
:
98 irreco_backend_instance_remove_cmd_dependency(
99 irreco_cmd
->backend
.instance
, irreco_cmd
);
100 irreco_cmd
->backend
.instance
= NULL
;
101 g_free(irreco_cmd
->backend
.device_name
);
102 irreco_cmd
->backend
.device_name
= NULL
;
103 g_free(irreco_cmd
->backend
.command_name
);
104 irreco_cmd
->backend
.command_name
= NULL
;
105 g_string_free(irreco_cmd
->backend
.title
, TRUE
);
106 irreco_cmd
->backend
.title
= NULL
;
109 case IRRECO_COMMAND_SHOW_LAYOUT
:
110 g_free(irreco_cmd
->layout
.name
);
111 irreco_cmd
->layout
.name
= NULL
;
112 g_string_free(irreco_cmd
->layout
.title
, TRUE
);
113 irreco_cmd
->backend
.title
= NULL
;
116 case IRRECO_COMMAND_WAIT
:
117 g_string_free(irreco_cmd
->wait
.title
, TRUE
);
118 irreco_cmd
->wait
.title
= NULL
;
121 irreco_cmd
->type
= IRRECO_COMMAND_NONE
;
125 void irreco_cmd_set_builtin(IrrecoCmd
* irreco_cmd
,
129 irreco_cmd_clean(irreco_cmd
);
132 case IRRECO_COMMAND_NONE
:
133 case IRRECO_COMMAND_NEXT_REMOTE
:
134 case IRRECO_COMMAND_PREVIOUS_REMOTE
:
135 case IRRECO_COMMAND_FULLSCREEN_TOGGLE
:
136 irreco_cmd
->type
= type
;
140 IRRECO_ERROR("Type id \"%i\" is not reserved for"
141 "built-in commands.\n", type
);
148 void irreco_cmd_set_backend(IrrecoCmd
* irreco_cmd
,
149 IrrecoBackendInstance
* instance
,
150 const gchar
* device_name
,
151 const gchar
* command_name
)
154 irreco_cmd_clean(irreco_cmd
);
155 irreco_cmd
->type
= IRRECO_COMMAND_BACKEND
;
156 irreco_cmd
->backend
.instance
= instance
;
157 irreco_cmd
->backend
.device_name
= g_strdup(device_name
);
158 irreco_cmd
->backend
.command_name
= g_strdup(command_name
);
159 irreco_cmd
->backend
.title
= g_string_new("");
160 irreco_backend_instance_add_cmd_dependency(instance
, irreco_cmd
);
164 void irreco_cmd_set_layout(IrrecoCmd
* irreco_cmd
,
168 irreco_cmd_clean(irreco_cmd
);
169 irreco_cmd
->type
= IRRECO_COMMAND_SHOW_LAYOUT
;
170 irreco_cmd
->layout
.name
= g_strdup(name
);
171 irreco_cmd
->layout
.title
= g_string_new("");
175 void irreco_cmd_set_wait(IrrecoCmd
* irreco_cmd
, gulong delay
)
178 irreco_cmd_clean(irreco_cmd
);
179 irreco_cmd
->type
= IRRECO_COMMAND_WAIT
;
180 irreco_cmd
->wait
.delay
= delay
;
181 irreco_cmd
->wait
.title
= g_string_new("");
187 * Copy data from one IrrecoCmd object to another.
189 void irreco_cmd_copy(IrrecoCmd
* from
, IrrecoCmd
* to
)
192 switch (from
->type
) {
193 case IRRECO_COMMAND_NONE
:
194 case IRRECO_COMMAND_NEXT_REMOTE
:
195 case IRRECO_COMMAND_PREVIOUS_REMOTE
:
196 case IRRECO_COMMAND_FULLSCREEN_TOGGLE
:
197 irreco_cmd_set_builtin(to
, from
->type
);
200 case IRRECO_COMMAND_BACKEND
:
201 irreco_cmd_set_backend(to
,
202 from
->backend
.instance
,
203 from
->backend
.device_name
,
204 from
->backend
.command_name
);
207 case IRRECO_COMMAND_SHOW_LAYOUT
:
208 irreco_cmd_set_layout(to
, from
->layout
.name
);
211 case IRRECO_COMMAND_WAIT
:
212 irreco_cmd_set_wait(to
, from
->wait
.delay
);
220 * Create a new IrrecoCmd based on an old IrrecoCmd.
222 IrrecoCmd
*irreco_cmd_dublicate(IrrecoCmd
* old
)
227 new = irreco_cmd_create();
228 irreco_cmd_copy(old
, new);
229 IRRECO_RETURN_PTR(new);
233 * Get descriptive title for the command.
235 const gchar
*irreco_cmd_get_long_name(IrrecoCmd
* irreco_cmd
)
238 switch (irreco_cmd
->type
) {
239 case IRRECO_COMMAND_NONE
:
240 IRRECO_RETURN_STR(_(IRRECO_COMMAND_NONE_TITLE
));
241 case IRRECO_COMMAND_NEXT_REMOTE
:
242 IRRECO_RETURN_STR(_(IRRECO_COMMAND_NEXT_REMOTE_TITLE
));
243 case IRRECO_COMMAND_PREVIOUS_REMOTE
:
244 IRRECO_RETURN_STR(_(IRRECO_COMMAND_PREVIOUS_REMOTE_TITLE
));
245 case IRRECO_COMMAND_FULLSCREEN_TOGGLE
:
246 IRRECO_RETURN_STR(_(IRRECO_COMMAND_FULLSCREEN_TOGGLE_TITLE
));
248 case IRRECO_COMMAND_BACKEND
:
249 if (irreco_str_isempty(irreco_cmd
->backend
.title
->str
)) {
250 g_string_printf(irreco_cmd
->backend
.title
, "%s: %s",
251 irreco_cmd
->backend
.device_name
,
252 irreco_cmd
->backend
.command_name
);
254 IRRECO_RETURN_STR(irreco_cmd
->backend
.title
->str
);
256 case IRRECO_COMMAND_SHOW_LAYOUT
:
257 if (irreco_str_isempty(irreco_cmd
->layout
.title
->str
)) {
258 g_string_printf(irreco_cmd
->layout
.title
, "%s%s",
259 _(IRRECO_COMMAND_SHOW_LAYOUT_TITLE_PREFIX
),
260 irreco_cmd
->layout
.name
);
262 IRRECO_RETURN_STR(irreco_cmd
->layout
.title
->str
);
264 case IRRECO_COMMAND_WAIT
:
265 if (irreco_str_isempty(irreco_cmd
->wait
.title
->str
)) {
266 g_string_printf(irreco_cmd
->wait
.title
,
267 IRRECO_COMMAND_WAIT_TITLE_FORMAT
,
268 (float)(irreco_cmd
->wait
.delay
) /
269 (float)IRRECO_SECOND_IN_USEC
);
271 IRRECO_RETURN_STR(irreco_cmd
->wait
.title
->str
);
274 IRRECO_ERROR("Could not get title for command. "
275 "Which should not be possible!\n");
276 IRRECO_RETURN_PTR(NULL
);
281 * Get short name of the command.
283 const gchar
*irreco_cmd_get_short_name(IrrecoCmd
* irreco_cmd
)
286 switch (irreco_cmd
->type
) {
287 case IRRECO_COMMAND_NONE
:
288 IRRECO_RETURN_STR(_(IRRECO_COMMAND_NONE_TITLE
));
289 case IRRECO_COMMAND_NEXT_REMOTE
:
290 IRRECO_RETURN_STR(_(IRRECO_COMMAND_NEXT_REMOTE_TITLE
));
291 case IRRECO_COMMAND_PREVIOUS_REMOTE
:
292 IRRECO_RETURN_STR(_(IRRECO_COMMAND_PREVIOUS_REMOTE_TITLE
));
293 case IRRECO_COMMAND_FULLSCREEN_TOGGLE
:
294 IRRECO_RETURN_STR(_(IRRECO_COMMAND_FULLSCREEN_TOGGLE_NAME
));
295 case IRRECO_COMMAND_BACKEND
:
296 IRRECO_RETURN_STR(irreco_cmd
->backend
.command_name
);
297 case IRRECO_COMMAND_SHOW_LAYOUT
:
298 IRRECO_RETURN_STR(irreco_cmd
->layout
.name
);
299 case IRRECO_COMMAND_WAIT
:
300 g_string_printf(irreco_cmd
->wait
.title
,
302 (float)(irreco_cmd
->wait
.delay
) /
303 (float)IRRECO_SECOND_IN_USEC
);
304 IRRECO_RETURN_STR(irreco_cmd
->wait
.title
->str
);
307 IRRECO_ERROR("Could not get title for command. "
308 "Which should not be possible!\n");
309 IRRECO_RETURN_PTR(NULL
);
314 void irreco_cmd_print(IrrecoCmd
* irreco_cmd
)
317 switch (irreco_cmd
->type
) {
318 case IRRECO_COMMAND_NONE
:
319 IRRECO_PRINTF("Type: IRRECO_COMMAND_NONE\n");
322 case IRRECO_COMMAND_NEXT_REMOTE
:
323 IRRECO_PRINTF("Type: IRRECO_COMMAND_NEXT_REMOTE\n");
326 case IRRECO_COMMAND_PREVIOUS_REMOTE
:
327 IRRECO_PRINTF("Type: IRRECO_COMMAND_PREVIOUS_REMOTE\n");
330 case IRRECO_COMMAND_FULLSCREEN_TOGGLE
:
331 IRRECO_PRINTF("Type: IRRECO_COMMAND_FULLSCREEN_TOGGLE\n");
334 case IRRECO_COMMAND_BACKEND
: {
335 const gchar
*name
= irreco_backend_instance_get_name(
336 irreco_cmd
->backend
.instance
);
338 IRRECO_PRINTF("Type: IRRECO_COMMAND_BACKEND\n");
339 IRRECO_PRINTF("Int/dev/cmd: \"%s\" \"%s\" \"%s\"\n",
341 irreco_cmd
->backend
.device_name
,
342 irreco_cmd
->backend
.command_name
);
345 case IRRECO_COMMAND_SHOW_LAYOUT
:
346 IRRECO_PRINTF("Type: IRRECO_COMMAND_SHOW_LAYOUT\n");
347 IRRECO_PRINTF("Layout: \"%s\"\n",
348 irreco_cmd
->layout
.name
);
351 case IRRECO_COMMAND_WAIT
:
352 IRRECO_PRINTF("Type: IRRECO_COMMAND_WAIT\n");
353 IRRECO_PRINTF("Delay: \"%lu\"\n",
354 irreco_cmd
->wait
.delay
);
362 gboolean
irreco_cmd_execute(IrrecoCmd
* irreco_cmd
, IrrecoData
* irreco_data
)
365 IrrecoButtonLayout
*layout
;
368 IRRECO_PRINTF("Execuging command.\n");
369 irreco_cmd_print(irreco_cmd
);
371 switch (irreco_cmd
->type
) {
372 case IRRECO_COMMAND_NONE
: break;
374 /* Display next layout in UserUi. */
375 case IRRECO_COMMAND_NEXT_REMOTE
:
376 if (!irreco_cmd_get_current_layout_pos(irreco_data
,
377 &pos
, &len
) || len
< 2) break;
378 if (++pos
>= len
) pos
= 0;
379 irreco_cmd_set_current_layout_pos(irreco_data
, pos
);
380 IRRECO_RETURN_BOOL(FALSE
);
382 /* Display previous layout in UserUi. */
383 case IRRECO_COMMAND_PREVIOUS_REMOTE
:
384 if (!irreco_cmd_get_current_layout_pos(irreco_data
,
385 &pos
, &len
) || len
< 2) break;
389 pos
= irreco_string_table_lenght(
390 irreco_data
->irreco_layout_array
) - 1;
393 irreco_cmd_set_current_layout_pos(irreco_data
, pos
);
394 IRRECO_RETURN_BOOL(FALSE
);
396 case IRRECO_COMMAND_FULLSCREEN_TOGGLE
:
397 if (irreco_data
->window_manager
->user_window
!= NULL
) {
398 irreco_window_toggle_fullscreen(
399 irreco_data
->window_manager
->user_window
->window
);
401 IRRECO_RETURN_BOOL(TRUE
);
403 case IRRECO_COMMAND_BACKEND
:
404 IRRECO_RETURN_BOOL(irreco_backend_instance_send_command(
405 irreco_cmd
->backend
.instance
,
406 irreco_cmd
->backend
.device_name
,
407 irreco_cmd
->backend
.command_name
));
409 case IRRECO_COMMAND_SHOW_LAYOUT
:
410 if (irreco_string_table_get(
411 irreco_data
->irreco_layout_array
,
412 irreco_cmd
->layout
.name
,
413 (gpointer
*) &layout
)) {
414 irreco_window_manager_set_layout(
415 irreco_data
->window_manager
, layout
);
417 IRRECO_RETURN_BOOL(FALSE
);
419 case IRRECO_COMMAND_WAIT
:
421 IRRECO_ERROR("Wait command should be handled in "
422 "command chain execution function.\n");
423 IRRECO_RETURN_BOOL(TRUE
);
426 IRRECO_ERROR("Could not execute command. Unknown type id \"%i\".\n",
428 IRRECO_RETURN_BOOL(FALSE
);
435 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
436 /* Layout position finding and setting. */
437 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
440 * @name Layout position finding and setting
446 * Get the position of the current layout inside the
447 * irreco_data->irreco_layout_array, and the lenght of the array.
449 gboolean
irreco_cmd_get_current_layout_pos(IrrecoData
* irreco_data
,
450 guint
* pos
, guint
* len
)
452 IrrecoButtonLayout
*layout
;
453 IrrecoStringTable
*table
= irreco_data
->irreco_layout_array
;
456 layout
= irreco_data
->window_manager
->current_layout
;
457 if (layout
== NULL
) IRRECO_RETURN_BOOL(FALSE
);
459 if (!irreco_string_table_get_index(table
, layout
, pos
)) {
460 IRRECO_RETURN_BOOL(FALSE
);
463 *len
= irreco_string_table_lenght(table
);
464 IRRECO_RETURN_BOOL(TRUE
);
468 * Set active layout of User ui by using a position index of the layout in
469 * irreco_data->irreco_layout_array.
471 void irreco_cmd_set_current_layout_pos(IrrecoData
* irreco_data
,
474 IrrecoButtonLayout
*layout
;
475 IrrecoStringTable
*table
= irreco_data
->irreco_layout_array
;
478 if (irreco_string_table_index(table
, pos
, NULL
, (gpointer
*) &layout
)){
479 irreco_window_manager_set_layout(irreco_data
->window_manager
,
482 irreco_window_manager_set_layout(irreco_data
->window_manager
,
492 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
494 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
497 * @name Public Functions
502 const gchar
*irreco_cmd_type_to_str(IrrecoCmdType type
)
506 case IRRECO_COMMAND_NONE
:
507 IRRECO_RETURN_STR(IRRECO_COMMAND_NONE_STRING
);
509 case IRRECO_COMMAND_NEXT_REMOTE
:
510 IRRECO_RETURN_STR(IRRECO_COMMAND_NEXT_REMOTE_STRING
);
512 case IRRECO_COMMAND_PREVIOUS_REMOTE
:
513 IRRECO_RETURN_STR(IRRECO_COMMAND_PREVIOUS_REMOTE_STRING
);
515 case IRRECO_COMMAND_FULLSCREEN_TOGGLE
:
516 IRRECO_RETURN_STR(IRRECO_COMMAND_FULLSCREEN_TOGGLE_STRING
);
518 case IRRECO_COMMAND_BACKEND
:
519 IRRECO_RETURN_STR(IRRECO_COMMAND_SHOW_BACKEND_STRING
);
521 case IRRECO_COMMAND_SHOW_LAYOUT
:
522 IRRECO_RETURN_STR(IRRECO_COMMAND_SHOW_LAYOUT_STRING
);
524 case IRRECO_COMMAND_WAIT
:
525 IRRECO_RETURN_STR(IRRECO_COMMAND_WAIT_STRING
);
527 IRRECO_RETURN_PTR(NULL
);
530 IrrecoCmdType
irreco_cmd_str_to_type(const gchar
* type
)
533 if (strcmp(type
, IRRECO_COMMAND_NONE_STRING
) == 0) {
534 IRRECO_RETURN_INT(IRRECO_COMMAND_NONE
);
536 } else if (strcmp(type
, IRRECO_COMMAND_NEXT_REMOTE_STRING
) == 0) {
537 IRRECO_RETURN_INT(IRRECO_COMMAND_NEXT_REMOTE
);
539 } else if (strcmp(type
, IRRECO_COMMAND_PREVIOUS_REMOTE_STRING
) == 0) {
540 IRRECO_RETURN_INT(IRRECO_COMMAND_PREVIOUS_REMOTE
);
542 } else if (strcmp(type
, IRRECO_COMMAND_FULLSCREEN_TOGGLE_STRING
) == 0) {
543 IRRECO_RETURN_INT(IRRECO_COMMAND_FULLSCREEN_TOGGLE
);
545 } else if (strcmp(type
, IRRECO_COMMAND_SHOW_BACKEND_STRING
) == 0) {
546 IRRECO_RETURN_INT(IRRECO_COMMAND_BACKEND
);
548 } else if (strcmp(type
, IRRECO_COMMAND_SHOW_LAYOUT_STRING
) == 0) {
549 IRRECO_RETURN_INT(IRRECO_COMMAND_SHOW_LAYOUT
);
551 } else if (strcmp(type
, IRRECO_COMMAND_WAIT_STRING
) == 0) {
552 IRRECO_RETURN_INT(IRRECO_COMMAND_WAIT
);
555 IRRECO_RETURN_INT(-1);
559 void irreco_cmd_to_keyfile(IrrecoCmd
*command
,
565 irreco_gkeyfile_set_string(keyfile
, group
, "type",
566 irreco_cmd_type_to_str(command
->type
));
568 if (command
->type
== IRRECO_COMMAND_BACKEND
) {
569 const gchar
*name
= irreco_backend_instance_get_name(
570 command
->backend
.instance
);
572 irreco_gkeyfile_set_string(keyfile
, group
, "type",
573 IRRECO_COMMAND_SHOW_BACKEND_STRING
);
574 irreco_gkeyfile_set_string(keyfile
, group
, "instance-name",
576 irreco_gkeyfile_set_string(keyfile
, group
, "device-name",
577 command
->backend
.device_name
);
578 irreco_gkeyfile_set_string(keyfile
, group
, "command-name",
579 command
->backend
.command_name
);
581 } else if (command
->type
== IRRECO_COMMAND_SHOW_LAYOUT
) {
582 irreco_gkeyfile_set_string(keyfile
, group
, "type",
583 IRRECO_COMMAND_SHOW_LAYOUT_STRING
);
584 irreco_gkeyfile_set_string(keyfile
, group
, "show-layout",
585 command
->layout
.name
);
587 } else if (command
->type
== IRRECO_COMMAND_WAIT
) {
588 g_key_file_set_integer(keyfile
, group
, "delay",
589 command
->wait
.delay
);
595 static IrrecoCmdType
irreco_cmd_type_from_keyfile(IrrecoKeyFile
* keyfile
)
598 gchar
*type_name
= NULL
;
601 if (irreco_keyfile_get_str(keyfile
, "type", &type_name
) == FALSE
) {
602 IRRECO_RETURN_INT(-1);
605 if ((type
= irreco_cmd_str_to_type(type_name
)) == -1) {
606 IRRECO_ERROR("Unknown command type \"%s\"\n", type_name
);
610 IRRECO_RETURN_INT(type
);
613 IrrecoCmd
* irreco_cmd_from_keyfile(IrrecoData
* irreco_data
,
614 IrrecoKeyFile
* keyfile
)
621 type
= irreco_cmd_type_from_keyfile(keyfile
);
622 if (type
== -1) IRRECO_RETURN_PTR(NULL
);
624 /* Create IrrecoCmd. */
626 case IRRECO_COMMAND_NONE
:
627 case IRRECO_COMMAND_NEXT_REMOTE
:
628 case IRRECO_COMMAND_PREVIOUS_REMOTE
:
629 case IRRECO_COMMAND_FULLSCREEN_TOGGLE
:
630 command
= irreco_cmd_create();
631 irreco_cmd_set_builtin(command
, type
);
632 IRRECO_RETURN_PTR(command
);
635 case IRRECO_COMMAND_BACKEND
: {
636 gchar
*instance_name
= NULL
;
637 gchar
*device_name
= NULL
;
638 gchar
*command_name
= NULL
;
639 IrrecoBackendInstance
* backend_instance
;
641 if (!irreco_keyfile_get_str(keyfile
, "instance-name",
643 !irreco_keyfile_get_str(keyfile
, "device-name",
645 !irreco_keyfile_get_str(keyfile
, "command-name",
647 g_free(instance_name
);
649 g_free(command_name
);
650 IRRECO_RETURN_PTR(NULL
);
653 if (!irreco_backend_manager_find_instance(
654 irreco_data
->irreco_backend_manager
,
656 &backend_instance
)) {
657 IRRECO_ERROR("Could not find instance with name "
658 "\"%s\"\n", instance_name
);
659 IRRECO_RETURN_PTR(NULL
);
661 command
= irreco_cmd_create();
662 irreco_cmd_set_backend(command
,
667 g_free(instance_name
);
669 g_free(command_name
);
670 IRRECO_RETURN_PTR(command
);
673 case IRRECO_COMMAND_SHOW_LAYOUT
: {
675 if (!irreco_keyfile_get_str(keyfile
, "show-layout",
677 IRRECO_RETURN_PTR(NULL
);
680 command
= irreco_cmd_create();
681 irreco_cmd_set_layout(command
, show_layout
);
683 IRRECO_RETURN_PTR(command
);
686 case IRRECO_COMMAND_WAIT
: {
688 if (!irreco_keyfile_get_uint(keyfile
, "delay", &delay
)) {
689 IRRECO_RETURN_PTR(NULL
);
692 command
= irreco_cmd_create();
693 irreco_cmd_set_wait(command
, delay
);
694 IRRECO_RETURN_PTR(command
);
698 IRRECO_DEBUG("Unknown command type id \"%i\".\n", type
);
699 IRRECO_RETURN_PTR(NULL
);