2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi),
4 * Harri Vattulainen (t5vaha01@students.oamk.fi)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "irreco_util.h"
24 #include <sys/socket.h>
28 * @addtogroup IrrecoMisc
31 * All kinds of usefull stuff that isnt really part of Irreco. Does not
32 * pull any other Irreco headers, so it can be safely included inside backends.
39 * Source file of @ref IrrecoMisc.
44 * All kinds of usefull stuff that isnt really part of Irreco. Does not pull
45 * any other Irreco headers, so it can be safely included inside backends.
48 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
50 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
51 void irreco_remove_layouts(IrrecoDirForeachData
*dir_data
);
54 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
55 /* Public Functions */
56 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
60 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
61 /* Files and directories. */
62 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
65 * @name Files and directories
70 * Check if the given filename is a directory.
72 int irreco_is_dir(const char *filename
)
76 char *realpath
= canonicalize_file_name(filename
);
77 rval
= (realpath
!= NULL
) &&
78 (stat(filename
, &buf
) == 0) &&
85 * Check if a given file is a regular file.
87 int irreco_is_file(const char *filename
)
91 char *realpath
= canonicalize_file_name(filename
);
92 rval
= (realpath
!= NULL
) &&
93 (stat(filename
, &buf
) == 0) &&
100 * Does the the file or dir exists.
102 int irreco_file_exists(const char *filename
)
104 struct stat struct_stat
;
105 if (stat(filename
, &struct_stat
) == 0) {
112 * Return length of file
113 * Return 0 if file doesn't exist
115 gint
irreco_file_length(const gchar
*filename
)
117 struct stat struct_stat
;
119 if(!irreco_file_exists(filename
)) {
123 stat(filename
, &struct_stat
);
124 return struct_stat
.st_size
;
128 * Write data to file.
130 gboolean
irreco_write_file(const gchar
* file
, const gchar
* data
,
137 if ((handle
= fopen(file
, "w")) == NULL
) {
138 IRRECO_ERROR("Failed to open \"%s\" for writing.\n", file
);
139 IRRECO_RETURN_BOOL(FALSE
);
142 written
= fwrite(data
, sizeof(gchar
), data_size
, handle
);
145 if (written
!= data_size
) {
146 IRRECO_ERROR("Failed to write data to \"%s\". "
147 "Data size \"%u\", wrote \"%u\".\n",
148 file
, data_size
, written
);
149 IRRECO_RETURN_BOOL(FALSE
);
151 IRRECO_RETURN_BOOL(TRUE
);
155 * Read contents of file into a buffer, or at least as much of the file the
156 * buffer can contain.
158 gboolean
irreco_read_text_file(const gchar
* file
, gchar
*buffer
,
165 if ((fd
= fopen(file
, "r")) == NULL
) return FALSE
;
166 count
= fread(buffer
, 1, buffer_size
, fd
);
167 buffer
[count
] = '\0';
168 if (count
< 1) return FALSE
;
173 * Read contents of binary file into a buffer, or at least as much of the file the
174 * buffer can contain.
176 gboolean
irreco_read_binary_file(const gchar
*file
, guchar
*buffer
,
177 gsize buffer_size
, gint
*binlen
)
182 if ((fd
= g_fopen(file
, "rb")) == NULL
) return FALSE
;
183 count
= (gint
) fread(buffer
, 1, buffer_size
, fd
);
185 if (count
< 1) return FALSE
;
191 * Read a line of text from file to buffer.
193 gboolean
irreco_read_line(const gchar
* file
, gchar
*buffer
,
198 if (!irreco_read_text_file(file
, buffer
, buffer_size
)) return FALSE
;
199 for (i
= 0; i
< buffer_size
; i
++) {
200 if (buffer
[i
] == '\0' || buffer
[i
] == '\n') {
209 * Write GKeyFile contents to file.
211 gboolean
irreco_write_keyfile(GKeyFile
* keyfile
, const gchar
* file
)
215 GError
*error
= NULL
;
219 data
= g_key_file_to_data(keyfile
, &data_size
, &error
);
220 if (irreco_gerror_check_print(&error
)) {
221 IRRECO_RETURN_BOOL(FALSE
);
224 success
= irreco_write_file(file
, data
, data_size
);
226 IRRECO_RETURN_BOOL(success
);
230 * Read all filenames that match suffix from directory.
232 gboolean
irreco_dir_foreach(IrrecoDirForeachData
*dir_data
,
233 IrrecoDirForeachCallback callback
)
235 GError
*error
= NULL
;
240 dir
= g_dir_open(dir_data
->directory
, 0, &error
);
241 if (irreco_gerror_check_print(&error
)) {
242 IRRECO_ERROR("Could not read directory: \"%s\"\n",
243 dir_data
->directory
);
247 IRRECO_RETURN_BOOL(FALSE
);
251 while ((dir_data
->filename
= g_dir_read_name(dir
)) != NULL
) {
252 if (g_str_has_suffix(dir_data
->filename
,
253 dir_data
->filesuffix
)) {
254 dir_data
->filepath
= g_build_path("/",
255 dir_data
->directory
, dir_data
->filename
, NULL
);
257 g_free((void*)dir_data
->filepath
);
261 IRRECO_RETURN_BOOL(TRUE
);
267 * Read all filenames that match suffix.
268 * Searches ONLY thru subdirectories.
270 gboolean
irreco_dir_foreach_subdirectories(IrrecoDirForeachData
*dir_data
,
271 IrrecoDirForeachCallback callback
)
273 GError
*error
= NULL
;
276 gchar
*subpath
= NULL
;
277 const gchar
*buttonsdir
;
278 const gchar
*directorykeeper
= dir_data
->directory
;
282 dir
= g_dir_open(dir_data
->directory
, 0, &error
);
283 if (irreco_gerror_check_print(&error
)) {
284 IRRECO_ERROR("Could not read directory: \"%s\"\n",
285 dir_data
->directory
);
286 IRRECO_RETURN_BOOL(FALSE
);
289 /* Read buttons dir file by file (also directories) */
290 while ((buttonsdir
= g_dir_read_name(dir
)) != NULL
) {
292 /* Create possible subpath from readed files */
293 subpath
= g_build_path("/", dir_data
->directory
,
296 /* Test if subpath is folder */
297 if(g_file_test(subpath
, G_FILE_TEST_IS_DIR
)) {
299 /* Create GDir from directory or multifail instantly */
300 subdir
= g_dir_open(subpath
, 0, &error
);
301 if (irreco_gerror_check_print(&error
)) {
302 IRRECO_ERROR("Could not read dir: \"%s\"\n",
306 IRRECO_RETURN_BOOL(FALSE
);
309 /* Start reading files from subdirectory */
310 while ((dir_data
->filename
= g_dir_read_name(subdir
))
313 /* Find files with wanted suffix */
314 if (g_str_has_suffix(dir_data
->filename
,
315 dir_data
->filesuffix
)) {
317 dir_data
->filepath
= g_build_path("/",
321 dir_data
->directory
= subpath
;
323 dir_data
->directory
= directorykeeper
;
324 g_free((void*)dir_data
->filepath
);
333 if(dir
!= NULL
) g_dir_close(dir
);
334 if(subdir
!= NULL
) g_dir_close(subdir
);
335 if(subpath
!= NULL
) g_free(subpath
);
336 IRRECO_RETURN_BOOL(TRUE
);
340 * Create path to directory $HOME/.APP_NAME, and attempt to create the
341 * directory if it does not exists.
343 * @return Directory path inside a newly allocated string,
344 * or NULL if the directory could not be created.
346 gchar
* irreco_get_config_dir(const gchar
* app_name
)
348 GString
*app_name_with_dot
;
353 if ((home
= getenv("HOME")) == NULL
) IRRECO_RETURN_PTR(NULL
);
355 app_name_with_dot
= g_string_new(".");
356 g_string_append(app_name_with_dot
, app_name
);
357 apphome
= g_build_path("/", home
, app_name_with_dot
->str
, NULL
);
358 g_string_free(app_name_with_dot
, TRUE
);
360 if (irreco_is_dir(apphome
) == TRUE
361 || g_mkdir(apphome
, 0700) == 0)
362 IRRECO_RETURN_PTR(apphome
);
365 IRRECO_RETURN_PTR(NULL
);
369 * Get path to $HOME/.APP_NAME/FILE
371 * @return Newly allocated string which contains path to config file or NULL.
373 gchar
* irreco_get_config_file(const gchar
* app_name
, const gchar
* file
)
379 if ((config_dir
= irreco_get_config_dir(app_name
)) != NULL
) {
380 config_file
= g_build_path("/", config_dir
, file
, NULL
);
382 IRRECO_RETURN_PTR(config_file
);
384 IRRECO_RETURN_PTR(NULL
);
388 * Check that given filename is valid layout conf filename or create new one
390 * @return Newly allocated string containing valid layout filename
392 gchar
*irreco_create_uniq_layout_filename(const gchar
* filename
)
398 /* Check existing file */
399 if(strlen(filename
) > 11) {
401 fname
= irreco_get_config_file("irreco",
403 if(irreco_file_exists(fname
)) {
404 IRRECO_DEBUG("Valid and existing\n");
406 IRRECO_RETURN_PTR(g_strdup(filename
));
409 /* Should never happen */
410 /* Conf removed while using irreco */
414 /* Create new layout[n].conf filename that doesn't already exist */
415 for(i
=1; i
<100; i
++) {
416 gchar
*fname
= g_malloc0(sizeof(gchar
)*25);
418 g_sprintf(fname
, "layout%d.conf", i
);
419 fullfname
= irreco_get_config_file("irreco", fname
);
420 if(irreco_file_exists(fullfname
)) {
425 IRRECO_DEBUG("Created uniq name: %s\n", fname
);
427 IRRECO_RETURN_PTR(fname
);
431 IRRECO_RETURN_PTR(NULL
)
435 * Removes layout*.conf files, exept those on Glist
436 * Frees gchar* type data from list, not the list itself
438 gboolean
irreco_remove_layouts_exept_glist(GList
*list
)
440 IrrecoDirForeachData dir_data
;
444 dir_data
.directory
= irreco_get_config_dir("irreco");
445 dir_data
.filesuffix
= ".conf";
446 dir_data
.user_data_1
= list
;
448 irreco_dir_foreach(&dir_data
, irreco_remove_layouts
);
450 /* Release data in glist */
451 list
= g_list_first(list
);
457 /* TODO get return value from somewhere */
458 IRRECO_RETURN_BOOL(TRUE
)
465 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
467 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
475 * Replace characters.
477 void irreco_char_replace(gchar
* string
, gchar what
, gchar with
)
481 for (i
= 0; string
[i
] != '\0'; i
++) {
482 if (string
[i
] == what
) {
490 * Find first occurrence of character inside string.
492 * @return Position of character or -1.
494 gint
irreco_char_pos(const gchar
* string
, gchar what
)
499 for (i
= 0; string
[i
] != '\0'; i
++) {
500 if (string
[i
] == what
) {
501 IRRECO_RETURN_INT(i
);
504 IRRECO_RETURN_INT(-1);
508 * Check if the string is empty.
510 * String is empty if it is:
513 * @li Full of space characters.
515 gboolean
irreco_str_isempty(const gchar
* string
)
519 if (string
== NULL
|| string
[0] == '\0') IRRECO_RETURN_BOOL(TRUE
);
521 if (g_unichar_isspace(g_utf8_get_char(string
)) == FALSE
) {
522 IRRECO_RETURN_BOOL(FALSE
);
524 printf("\"%s\" %p\n", string
, string
);
525 } while ((string
= g_utf8_find_next_char(string
, NULL
)) != NULL
526 && string
[0] != '\0');
528 IRRECO_RETURN_BOOL(TRUE
);
532 * Copy C-string into GString.
534 void irreco_gstring_set(GString
* g_str
, const gchar
* c_str
)
539 g_string_assign(g_str
, "");
541 g_string_assign(g_str
, c_str
);
548 * Copy C-string into GString and free C-string.
550 void irreco_gstring_set_and_free(GString
* g_str
, gchar
* c_str
)
555 g_string_assign(g_str
, "");
557 g_string_assign(g_str
, c_str
);
567 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
568 /* Error handling. */
569 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
572 * @name Error handling
578 * If GError is set, print message, release GError, and return TRUE.
579 * Otherwise returns FALSE.
581 gboolean
irreco_gerror_check_print(GError
** error
)
583 if (*error
!= NULL
) {
584 IRRECO_PRINTF("GError: %s\n", (*error
)->message
);
585 g_error_free(*error
);
593 * If GError is set, free it, and return TRUE.
594 * Otherwise returns FALSE.
596 gboolean
irreco_gerror_check_free(GError
** error
)
598 if (*error
!= NULL
) {
599 g_error_free(*error
);
608 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
610 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
620 void irreco_info_dlg(GtkWindow
* parent_window
, const gchar
* message
)
625 dialog
= gtk_message_dialog_new(parent_window
,
626 GTK_DIALOG_DESTROY_WITH_PARENT
,
627 GTK_MESSAGE_INFO
, GTK_BUTTONS_OK
, "%s", message
);
628 gtk_dialog_run(GTK_DIALOG(dialog
));
629 gtk_widget_destroy(dialog
);
637 void irreco_error_dlg(GtkWindow
* parent_window
, const gchar
* message
)
642 dialog
= gtk_message_dialog_new(parent_window
,
643 GTK_DIALOG_DESTROY_WITH_PARENT
,
644 GTK_MESSAGE_ERROR
, GTK_BUTTONS_OK
, "%s", message
);
645 gtk_dialog_run(GTK_DIALOG(dialog
));
646 gtk_widget_destroy(dialog
);
652 * Format message, and show error popup.
654 void irreco_info_dlg_printf(GtkWindow
* parent_window
,
655 const gchar
* format
, ...)
659 gchar
*message
= NULL
;
662 va_start(args
, format
);
663 rvalue
= g_vasprintf(&message
, format
, args
);
667 irreco_info_dlg(parent_window
, message
);
670 IRRECO_ERROR("Could not format message.\n");
677 * Format message, and show error popup.
679 void irreco_error_dlg_printf(GtkWindow
* parent_window
,
680 const gchar
* format
, ...)
684 gchar
*message
= NULL
;
687 va_start(args
, format
);
688 rvalue
= g_vasprintf(&message
, format
, args
);
692 irreco_error_dlg(parent_window
, message
);
695 IRRECO_ERROR("Could not format message.\n");
702 * Popup yes / no dialog.
704 * Returns: TRUE if user click YES, FALSE otherwise.
706 gboolean
irreco_yes_no_dlg(GtkWindow
* parent_window
, const gchar
* message
)
712 dialog
= gtk_message_dialog_new(parent_window
,
713 GTK_DIALOG_DESTROY_WITH_PARENT
, GTK_MESSAGE_QUESTION
,
714 GTK_BUTTONS_YES_NO
, "%s", message
);
715 responce
= gtk_dialog_run(GTK_DIALOG(dialog
));
716 gtk_widget_destroy(dialog
);
717 IRRECO_RETURN_BOOL(responce
== GTK_RESPONSE_YES
);
721 * Convenience frapper of gtk_alignment_new().
723 GtkWidget
*irreco_gtk_align(GtkWidget
*child
,
729 guint padding_bottom
,
736 align
= gtk_alignment_new(xalign
, yalign
, xscale
, yscale
);
737 gtk_alignment_set_padding(GTK_ALIGNMENT(align
), padding_top
,
738 padding_bottom
, padding_left
, padding_right
);
739 gtk_container_add(GTK_CONTAINER(align
), child
);
740 IRRECO_RETURN_PTR(align
);
744 * Create, align, and pad label.
746 GtkWidget
*irreco_gtk_label(const gchar
* str
,
750 guint padding_bottom
,
757 label
= gtk_label_new(str
);
758 gtk_misc_set_alignment(GTK_MISC(label
), xalign
, yalign
);
759 IRRECO_RETURN_PTR(irreco_gtk_pad(label
, padding_top
, padding_bottom
,
760 padding_left
, padding_right
));
764 * Create, align, and pad a label with bold text.
766 GtkWidget
*irreco_gtk_label_bold(const gchar
* str
,
770 guint padding_bottom
,
778 label
= irreco_gtk_label(NULL
, xalign
, yalign
, padding_top
,
779 padding_bottom
, padding_left
, padding_right
);
780 markup
= g_markup_printf_escaped("<b>%s</b>", str
);
781 gtk_label_set_markup(GTK_LABEL(gtk_bin_get_child(GTK_BIN(label
))),
784 IRRECO_RETURN_PTR(label
);
788 * Get button widget for dialog buttons.
790 * @param dialog GtkDialog
791 * @param n Index of button to get.
793 GtkWidget
*irreco_gtk_dialog_get_button(GtkWidget
*dialog
, guint n
)
797 GtkBoxChild
*box_child
;
801 action_area
= GTK_BOX(GTK_DIALOG(dialog
)->action_area
);
802 length
= g_list_length(action_area
->children
);
805 IRRECO_ERROR("Cant get button \"%i\". "
806 "Dialog has only \"%i\" buttons", n
, length
);
807 IRRECO_RETURN_PTR(NULL
);
810 box_child
= (GtkBoxChild
*) g_list_nth_data(g_list_first(
811 action_area
->children
), n
);
812 IRRECO_RETURN_PTR(box_child
->widget
);
815 GtkWindow
*irreco_gtk_get_parent_window(GtkWidget
*widget
)
820 parent
= gtk_widget_get_toplevel(widget
);
821 if (GTK_WIDGET_TOPLEVEL(parent
) != TRUE
822 || GTK_IS_WINDOW(parent
) != TRUE
) {
823 IRRECO_RETURN_PTR(GTK_WINDOW(parent
));
825 IRRECO_RETURN_PTR(NULL
);
829 * This function is a modified version of gtk_dialog_new_empty() from GTK
830 * sources, which is used to by gtk_dialog_new_with_buttons() to set the
831 * settings of a dialog.
833 void irreco_gtk_dialog_set(GtkDialog
*dialog
,
836 GtkDialogFlags flags
)
841 gtk_window_set_title(GTK_WINDOW (dialog
), title
);
844 gtk_window_set_transient_for(GTK_WINDOW (dialog
), parent
);
846 if (flags
& GTK_DIALOG_MODAL
)
847 gtk_window_set_modal(GTK_WINDOW (dialog
), TRUE
);
849 if (flags
& GTK_DIALOG_DESTROY_WITH_PARENT
)
850 gtk_window_set_destroy_with_parent(GTK_WINDOW (dialog
), TRUE
);
852 if (flags
& GTK_DIALOG_NO_SEPARATOR
)
853 gtk_dialog_set_has_separator(dialog
, FALSE
);
860 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
862 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
871 * Do not use, use GTimer instead.
875 * Difference of time in microseconds between two GTimeVals.
876 * This works fine as long as the difference is no more than 2146 seconds.
878 glong
irreco_time_diff(GTimeVal
*start
, GTimeVal
*end
)
883 diff
.tv_sec
= end
->tv_sec
- start
->tv_sec
;
884 diff
.tv_usec
= end
->tv_usec
- start
->tv_usec
;
886 /* We run out of space in ulong after 2147 seconds. */
887 if (diff
.tv_sec
>= G_MAXLONG
/ IRRECO_SECOND_IN_USEC
) {
888 IRRECO_RETURN_LONG((G_MAXLONG
/ IRRECO_SECOND_IN_USEC
)
889 * IRRECO_SECOND_IN_USEC
);
892 IRRECO_RETURN_LONG(diff
.tv_sec
* IRRECO_SECOND_IN_USEC
+ diff
.tv_usec
);
897 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
899 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
907 * Check if the socket is valid.
909 gboolean
irreco_is_socket_valid(int socket
)
916 /* This should succeed if socket is valid. */
917 rvalue
= getsockopt(socket
, SOL_SOCKET
, SOCK_STREAM
, &optval
, &optlen
);
920 IRRECO_RETURN_BOOL(TRUE
);
923 /* glibc docs say these are the possible error values. */
925 case EBADF
: IRRECO_PRINTF("Error: EBADF\n"); break;
926 case ENOTSOCK
: IRRECO_PRINTF("Error: ENOTSOCK\n"); break;
927 case ENOPROTOOPT
: IRRECO_PRINTF("Error: ENOPROTOOPT\n"); break;
928 default: IRRECO_PRINTF("Error: Unknown\n"); break;
931 IRRECO_RETURN_BOOL(FALSE
);
938 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
939 /* Private Functions */
940 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
947 * Removes layout* files that are not in (GList) dir_data->user_data_1
950 void irreco_remove_layouts(IrrecoDirForeachData
*dir_data
)
957 if(!g_str_has_prefix(dir_data
->filename
, "layout")) {
958 IRRECO_DEBUG("Not layout file: %s\n", dir_data
->filename
);
962 list
= g_list_first(dir_data
->user_data_1
);
965 IRRECO_DEBUG("file in list: %s file to remove: %s\n",
968 if(strcmp((gchar
*) list
->data
, dir_data
->filename
) == 0) {
969 IRRECO_DEBUG("File in use, break\n");
975 IRRECO_DEBUG("Removing unused conf: %s\n", dir_data
->filename
);
977 /* Build remove command */
978 rm_cmd
= g_strconcat("rm -r ",
979 irreco_get_config_dir("irreco"),