From d697b4a375314e2e93ee53a1ea4e86c5e30ff7b8 Mon Sep 17 00:00:00 2001 From: Harri Vattulainen Date: Thu, 3 Jul 2008 13:02:35 +0000 Subject: [PATCH] Changed style browser to search buttons only from subdirectories. Changed themes to put buttons to their own folder. New themes depends irreco-core 0.6.1 and have higher version number. Irreco version number shifted up to 0.6.1 --- irreco/trunk/ChangeLog | 4 ++ irreco/trunk/configure.ac | 2 +- irreco/trunk/debian/changelog | 6 +-- irreco/trunk/debian/control | 3 +- irreco/trunk/src/core/irreco.c | 11 ++-- irreco/trunk/src/core/irreco_config.c | 8 ++- irreco/trunk/src/core/irreco_style_browser_dlg.c | 1 + irreco/trunk/src/util/irreco_misc.c | 69 +++++++++++++++++++++++- irreco/trunk/src/util/irreco_misc.h | 5 +- script/theme-deb-creator.sh | 12 ++--- themes/default/debian/changelog | 2 +- themes/default/debian/control | 2 +- themes/evil/debian/changelog | 2 +- themes/evil/debian/control | 2 +- themes/modern/debian/changelog | 2 +- themes/modern/debian/control | 2 +- themes/scifi/debian/changelog | 2 +- themes/scifi/debian/control | 2 +- themes/sunflower/debian/changelog | 2 +- themes/sunflower/debian/control | 2 +- themes/theme-conf-gen.sh | 7 ++- themes/white/debian/changelog | 2 +- themes/white/debian/control | 2 +- 23 files changed, 117 insertions(+), 35 deletions(-) diff --git a/irreco/trunk/ChangeLog b/irreco/trunk/ChangeLog index f99ba3ec..a54c084a 100644 --- a/irreco/trunk/ChangeLog +++ b/irreco/trunk/ChangeLog @@ -1,3 +1,7 @@ +0.6.1 Fri, 27 Jul 2008 15:26:25 +0300 + * Themes on their own folders + * Irreco on kp + 0.6.0 Fri, 27 Jun 2008 15:26:25 +0300 * New packaging. Separated irreco and backend packages. * Improved API for backends. diff --git a/irreco/trunk/configure.ac b/irreco/trunk/configure.ac index c1c7ea4a..036b7391 100644 --- a/irreco/trunk/configure.ac +++ b/irreco/trunk/configure.ac @@ -1,6 +1,6 @@ -AC_INIT([irreco], [0.6.0]) +AC_INIT([irreco], [0.6.1]) AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST diff --git a/irreco/trunk/debian/changelog b/irreco/trunk/debian/changelog index 2b1cdcce..87384c49 100644 --- a/irreco/trunk/debian/changelog +++ b/irreco/trunk/debian/changelog @@ -1,8 +1,6 @@ -irreco-core (0.6.0) unstable; urgency=low +irreco-core (0.6.1) unstable; urgency=low - * New packaging. Separated irreco and backend packages. - * Improved API for backends. - * WebDataBase support for uploading and downloading device configurations. + * Themes on their own folders -- Joni Kokko Fri, 27 Jun 2008 15:33:19 +0200 diff --git a/irreco/trunk/debian/control b/irreco/trunk/debian/control index 8124f02d..48476c3e 100644 --- a/irreco/trunk/debian/control +++ b/irreco/trunk/debian/control @@ -7,9 +7,10 @@ Build-Depends: debhelper (>= 4.0.0), libglib2.0-dev, libdbus-glib-1-dev, libosso-dev, intltool Standards-Version: 3.6.0 -Package: irreco-core-dev +Package: irreco-core Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} +Replaces: irreco Description: Irreco - Ir Remote Control Irreco is a remote control application for Nokia Internet Tablets. With Irreco and the help of external IR transceiver you can control diff --git a/irreco/trunk/src/core/irreco.c b/irreco/trunk/src/core/irreco.c index 7551385c..906008ed 100644 --- a/irreco/trunk/src/core/irreco.c +++ b/irreco/trunk/src/core/irreco.c @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) #if 0 - +/* { gint i = 0; IrrecoStringTable *category_list; @@ -113,6 +113,7 @@ int main(int argc, char *argv[]) IRRECO_STRING_TABLE_FOREACH(category_list, key, void *, data) IRRECO_PRINTF("%u: %p, %s\n", ++i, data, key); IRRECO_STRING_TABLE_FOREACH_END + */ /* gint sum = 0; @@ -120,11 +121,11 @@ int main(int argc, char *argv[]) IRRECO_PRINTF("SUM: %i\n", sum); } */ - + /* } - /*irreco_webdb_test();*/ - irreco_webdb_finalize(); - IRRECO_PRINTF("DEINIT\n"); + + irreco_webdb_finalize();*/ + IRRECO_PRINTF(" Successfully multifailed\n"); return 0; diff --git a/irreco/trunk/src/core/irreco_config.c b/irreco/trunk/src/core/irreco_config.c index 23aaf290..7a9c2462 100644 --- a/irreco/trunk/src/core/irreco_config.c +++ b/irreco/trunk/src/core/irreco_config.c @@ -1,6 +1,7 @@ /* * irreco - Ir Remote Control - * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi) + * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi), + * Harri Vattulainen (t5vaha01@students.oamk.fi) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -100,6 +101,9 @@ void irreco_config_read_styles_from_dir_foreach(IrrecoDirForeachData * dir_data) IRRECO_RETURN } +/** + * Reads configs from subdirectories ONLY + */ void irreco_config_read_styles_from_dir(IrrecoData * irreco_data, const gchar *dir) { @@ -109,7 +113,7 @@ void irreco_config_read_styles_from_dir(IrrecoData * irreco_data, dir_data.directory = dir; dir_data.filesuffix = ".bstyleconf"; dir_data.user_data_1 = irreco_data; - irreco_dir_foreach(&dir_data, + irreco_dir_foreach_subdirectories(&dir_data, irreco_config_read_styles_from_dir_foreach); IRRECO_RETURN diff --git a/irreco/trunk/src/core/irreco_style_browser_dlg.c b/irreco/trunk/src/core/irreco_style_browser_dlg.c index f195b5f1..e28cc6ab 100644 --- a/irreco/trunk/src/core/irreco_style_browser_dlg.c +++ b/irreco/trunk/src/core/irreco_style_browser_dlg.c @@ -167,6 +167,7 @@ static void irreco_style_browser_dlg_add_style(IrrecoStyleBrowserDlg *self, static void irreco_style_browser_dlg_loading_start(IrrecoStyleBrowserDlg *self) { IRRECO_ENTER + if (self->loading == NULL) { self->loading = g_slice_new0(IrrecoStyleBrowserDlgLoading); self->loading->self = self; diff --git a/irreco/trunk/src/util/irreco_misc.c b/irreco/trunk/src/util/irreco_misc.c index 595a5ef0..caa2ebb7 100644 --- a/irreco/trunk/src/util/irreco_misc.c +++ b/irreco/trunk/src/util/irreco_misc.c @@ -1,6 +1,7 @@ /* * irreco - Ir Remote Control - * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi) + * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi), + * Harri Vattulainen (t5vaha01@students.oamk.fi) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -197,6 +198,72 @@ gboolean irreco_dir_foreach(IrrecoDirForeachData *dir_data, IRRECO_RETURN_BOOL(TRUE); } + + +/** + * Read all filenames that match suffix. + * Searches ONLY thru subdirectories. + */ +gboolean irreco_dir_foreach_subdirectories(IrrecoDirForeachData *dir_data, + IrrecoDirForeachCallback callback) +{ + GError *error = NULL; + GDir* dir = NULL; + GDir* subdir = NULL; + const gchar *subpath = NULL; + const gchar *buttonsdir; + const gchar *directorykeeper = dir_data->directory; + IRRECO_ENTER + + /* Open Dir. */ + dir = g_dir_open(dir_data->directory, 0, &error); + if (irreco_gerror_check_print(&error)) { + IRRECO_ERROR("Could not read directory: \"%s\"\n", + dir_data->directory); + g_dir_close(dir); IRRECO_RETURN_BOOL(FALSE);} + + /* Read buttons dir file by file (also directories) */ + while ((buttonsdir = g_dir_read_name(dir)) != NULL) { + + /* Create possible subpath from readed files */ + subpath = g_build_path("/", dir_data->directory, + buttonsdir, NULL); + + /* Test if subpath is folder */ + if(g_file_test(subpath, G_FILE_TEST_IS_DIR)) { + + /* Create GDir from directory or multifail instantly */ + subdir = g_dir_open(subpath, 0, &error); + if (irreco_gerror_check_print(&error)) { + IRRECO_ERROR("Could not read dir: \"%s\"\n", subpath); + g_dir_close(subdir); IRRECO_RETURN_BOOL(FALSE);} + + /* Start reading files from subdirectory */ + while ((dir_data->filename = g_dir_read_name(subdir)) + != NULL) { + + /* Find files with wanted suffix */ + if (g_str_has_suffix(dir_data->filename, + dir_data->filesuffix)) { + + dir_data->filepath = g_build_path("/", + subpath, + dir_data->filename, + NULL); + dir_data->directory = subpath; + callback(dir_data); + dir_data->directory = directorykeeper; + g_free((void*)dir_data->filepath); + } + } + } + g_free((void*)subpath); + } + g_dir_close(dir); + g_dir_close(subdir); + IRRECO_RETURN_BOOL(TRUE); +} + /** * Create path to directory $HOME/.APP_NAME, and attempt to create the * directory if it does not exists. diff --git a/irreco/trunk/src/util/irreco_misc.h b/irreco/trunk/src/util/irreco_misc.h index 0d6441c6..57fa4ca4 100644 --- a/irreco/trunk/src/util/irreco_misc.h +++ b/irreco/trunk/src/util/irreco_misc.h @@ -1,6 +1,7 @@ /* * irreco - Ir Remote Control - * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi) + * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi), + * Harri Vattulainen (t5vaha01@students.oamk.fi) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -158,6 +159,8 @@ gboolean irreco_read_line(const gchar * file, gchar *buffer, gboolean irreco_write_keyfile(GKeyFile * keyfile, const gchar * file); gboolean irreco_dir_foreach(IrrecoDirForeachData *dir_data, IrrecoDirForeachCallback callback); +gboolean irreco_dir_foreach_subdirectories(IrrecoDirForeachData *dir_data, + IrrecoDirForeachCallback callback); gchar* irreco_get_config_dir(const gchar * app_name); gchar* irreco_get_config_file(const gchar * app_name, const gchar * file); diff --git a/script/theme-deb-creator.sh b/script/theme-deb-creator.sh index 6c5d0e97..e2ff06ec 100755 --- a/script/theme-deb-creator.sh +++ b/script/theme-deb-creator.sh @@ -21,7 +21,7 @@ info_print() echo "" echo " Commands:" echo " --deb | -deb | deb" - echo " This creates theme .deb's into ../debs/" + echo " This creates theme .deb's" echo " of evil, scifi, sunflower, default, modern and white." echo "" } @@ -120,13 +120,13 @@ make_deb() # Check there is place to ditch deb's - echo " Check debs directory exists" - if [ ! -e "../../debs/" ]; then - mkdir -v ../../debs/ - fi + #echo " Check debs directory exists" + #if [ ! -e "../../debs/" ]; then + # mkdir -v ../../debs/ + #fi # Ditch .deb to correct directory - echo " Move deb's and changes's" + # echo " Move deb's and changes's" #mv -fv ../irreco-theme-*.deb ../../debs/ #mv -fv ../irreco-theme-*.changes ../../debs/ diff --git a/themes/default/debian/changelog b/themes/default/debian/changelog index 650fe4e6..1d09e6d7 100644 --- a/themes/default/debian/changelog +++ b/themes/default/debian/changelog @@ -1,4 +1,4 @@ -irreco-theme-default (0.0.3) unstable; urgency=low +irreco-theme-default (0.0.4) unstable; urgency=low * Default theme for Irreco. diff --git a/themes/default/debian/control b/themes/default/debian/control index fdbf5533..ebef275d 100644 --- a/themes/default/debian/control +++ b/themes/default/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.7.2 Package: irreco-theme-default Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, irreco-core (>=0.6.1) Suggests: irreco Replaces: irreco Description: Default theme for Irreco. diff --git a/themes/evil/debian/changelog b/themes/evil/debian/changelog index 8fb0b346..186c6c06 100644 --- a/themes/evil/debian/changelog +++ b/themes/evil/debian/changelog @@ -1,4 +1,4 @@ -irreco-theme-evil (0.0.3) unstable; urgency=low +irreco-theme-evil (0.0.4) unstable; urgency=low * Evil theme for Irreco. diff --git a/themes/evil/debian/control b/themes/evil/debian/control index 75955e04..e45d5141 100644 --- a/themes/evil/debian/control +++ b/themes/evil/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.7.2 Package: irreco-theme-evil Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, irreco-core (>=0.6.1) Suggests: irreco Description: Evil theme for Irreco. diff --git a/themes/modern/debian/changelog b/themes/modern/debian/changelog index 803b50ff..89102a55 100644 --- a/themes/modern/debian/changelog +++ b/themes/modern/debian/changelog @@ -1,4 +1,4 @@ -irreco-theme-modern (0.0.3) unstable; urgency=low +irreco-theme-modern (0.0.4) unstable; urgency=low * Modern theme for Irreco. diff --git a/themes/modern/debian/control b/themes/modern/debian/control index 504d9dbe..71bc0f9d 100644 --- a/themes/modern/debian/control +++ b/themes/modern/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.7.2 Package: irreco-theme-modern Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, irreco-core (>=0.6.1) Suggests: irreco Description: Modern theme for Irreco. diff --git a/themes/scifi/debian/changelog b/themes/scifi/debian/changelog index d2071e19..c18055cf 100644 --- a/themes/scifi/debian/changelog +++ b/themes/scifi/debian/changelog @@ -1,4 +1,4 @@ -irreco-theme-scifi (0.0.3) unstable; urgency=low +irreco-theme-scifi (0.0.4) unstable; urgency=low * Scifi theme for Irreco. diff --git a/themes/scifi/debian/control b/themes/scifi/debian/control index 04006a6f..1a27dcbe 100644 --- a/themes/scifi/debian/control +++ b/themes/scifi/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.7.2 Package: irreco-theme-scifi Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, irreco-core (>=0.6.1) Suggests: irreco Description: Scifi theme for Irreco. diff --git a/themes/sunflower/debian/changelog b/themes/sunflower/debian/changelog index 4ff36157..5984200e 100644 --- a/themes/sunflower/debian/changelog +++ b/themes/sunflower/debian/changelog @@ -1,4 +1,4 @@ -irreco-theme-sunflower (0.0.3) unstable; urgency=low +irreco-theme-sunflower (0.0.4) unstable; urgency=low * Sunflower theme for Irreco. diff --git a/themes/sunflower/debian/control b/themes/sunflower/debian/control index 18cffc9b..9619e4d4 100644 --- a/themes/sunflower/debian/control +++ b/themes/sunflower/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.7.2 Package: irreco-theme-sunflower Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, irreco-core (>=0.6.1) Suggests: irreco Description: Sunflower theme for Irreco. diff --git a/themes/theme-conf-gen.sh b/themes/theme-conf-gen.sh index 70ab6ce6..190f68fa 100755 --- a/themes/theme-conf-gen.sh +++ b/themes/theme-conf-gen.sh @@ -31,9 +31,12 @@ theme_gen_help() theme_gen_erate() { SOURCE="$1" + + THEME_NAME=`cat "$SOURCE"/name` + DESTINATION="$2" IRRECO_DIR="$DESTINATION/lib/irreco/" - BUTTON_DIR="$IRRECO_DIR/buttons/" + BUTTON_DIR="$IRRECO_DIR/buttons/$THEME_NAME" BG_DIR="$IRRECO_DIR/images/bg/" [[ "$SOURCE" == "" ]] && theme_gen_error \ @@ -52,7 +55,7 @@ theme_gen_erate() "Theme name file does not exist." - THEME_NAME=`cat "$SOURCE"/name` + #THEME_NAME=`cat "$SOURCE"/name` THEME_PREFIX=`basename "$( realpath -f $SOURCE )"` BUTTONDIR="$SOURCE/buttons" diff --git a/themes/white/debian/changelog b/themes/white/debian/changelog index ed6a0d92..0b2b3cc3 100644 --- a/themes/white/debian/changelog +++ b/themes/white/debian/changelog @@ -1,4 +1,4 @@ -irreco-theme-white (0.0.4-1) unstable; urgency=low +irreco-theme-white (0.0.5-1) unstable; urgency=low * White theme for Irreco. diff --git a/themes/white/debian/control b/themes/white/debian/control index 94508175..81d1af95 100644 --- a/themes/white/debian/control +++ b/themes/white/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.7.2 Package: irreco-theme-white Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, irreco-core (>=0.6.1) Suggests: irreco Description: White theme for Irreco. -- 2.11.4.GIT