From: mishas Date: Thu, 10 May 2007 15:08:09 +0000 (+0000) Subject: preliminary steps for moving test applications in a separate directory (it does not... X-Git-Url: http://vcs.maemo.org/git/?p=simple-launcher;a=commitdiff_plain;h=5fae1c588d5d6383c91ab0f9b034f4b1914eeae3 preliminary steps for moving test applications in a separate directory (it does not work now) git-svn-id: file:///svnroot/simple-launcher/trunk@202 3ba93dab-e023-0410-b42a-de7732cf370a --- diff --git a/Makefile b/Makefile index 1a4cb5a..54da467 100644 --- a/Makefile +++ b/Makefile @@ -18,20 +18,9 @@ BACKUP_CONF=simple-launcher.backup all: $(TARGET) -tests: test test1 test2 - $(TARGET): simple-launcher.o launchable-item.o launcher-item.o settings-page-items.o utils.o settings-dialog.o gconf-wrapper.o dialog-entry.o settings-page-entries.o $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) -test: test.o launcher-item.o - g++ -o $@ $^ $(GTKLIBS) $(DBUSLIBS) $(LIBS) -losso - -test1: test1.o settings-page-items.o launcher-item.o - g++ -g -o $@ $^ $(GTKLIBS) $(DBUSLIBS) $(LIBS) - -test2: test2.o gconf-wrapper.o - g++ -g -o $@ $^ $(GCONFLIBS) - clean: rm -f *.d *.o $(TARGET) test test1 test2 diff --git a/test.cc b/test.cc deleted file mode 100644 index 393f7fe..0000000 --- a/test.cc +++ /dev/null @@ -1,49 +0,0 @@ -// This file is a part of Simple Launcher -// -// Copyright (C) 2006, 2007, Mikhail Sobolev -// -// Simple Launcher is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License version 2 as published by -// the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -// more details. -// -// You should have received a copy of the GNU General Public License along with -// this program; if not, write to the Free Software Foundation, Inc., 51 -// Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -#include - -#include "launcher-item.h" - -char *files[] = { - "/usr/share/applications/hildon/hildon-control-panel.desktop", - "/usr/share/applications/hildon/hwr-teacher.desktop", - "/usr/share/applications/hildon/osso-backup.desktop", - "/usr/share/applications/hildon/osso-global-search.desktop", - 0 -}; - -int main() { - for (int i = 0 ; files[i] != 0 ; ++i) { - LauncherItem *item = new LauncherItem(); - - if (item->load(files[i])) { - std::cout << "Loaded " << files[i] << std::endl - << " name: " << item->getName() << std::endl - << " comment: " << item->getComment() << std::endl - << " service: " << item->getService() << std::endl; - } else { - std::cout << "Failed to load " << files[i] << std::endl; - } - - delete item; - } - - return 0; -} - -// vim:ts=2:sw=2:et diff --git a/test1.cc b/test1.cc deleted file mode 100644 index f31a965..0000000 --- a/test1.cc +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include - -#include -#include - -#include -#include -#include - -#include "settings-page-items.h" -#include "launcher-item.h" - -static std::string appdir = "/usr/share/applications"; - -int main(int argc, char *argv[]) { - gtk_init(&argc, &argv); - - DIR *handle = opendir(appdir.c_str()); - - if (handle != 0) { - LauncherItems apps; - - struct dirent *entry; - - while ((entry = readdir(handle)) != 0) { - if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) { - continue; - } - - LauncherItem *item = new LauncherItem(); - - if (item->load(appdir + "/" + entry->d_name)) { - std::cout << "Loaded " << entry->d_name << std::endl; - } else { - std::cout << "Failed to load " << entry->d_name << std::endl; - } - - apps.push_back(std::pair(entry->d_name, item)); - } - - if (!apps.empty()) { - SLAList sla_list(26, apps); - - GtkDialog *dialog = GTK_DIALOG(gtk_dialog_new_with_buttons("Launcher settings", 0, (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, 0)); - - gtk_container_add(GTK_CONTAINER(dialog->vbox), sla_list.getWidget()); - - if (gtk_dialog_run(dialog) == GTK_RESPONSE_ACCEPT) { - for (LauncherItems::const_iterator it = apps.begin(); it != apps.end(); ++it) { - std::cout << it->first << (it->second->isEnabled() ? " active" : " passive") << std::endl; - } - } - - gtk_widget_destroy(GTK_WIDGET(dialog)); - } - } else { - std::cerr << "Cannot list applications directory" << std::endl; - } - - return 0; -} diff --git a/test2.cc b/test2.cc deleted file mode 100644 index 261b547..0000000 --- a/test2.cc +++ /dev/null @@ -1,15 +0,0 @@ -#include - -#include "gconf-wrapper.h" - -int main() { - g_type_init(); - - GConfKey sla("/apps/simple-launcher"); - - GConfBooleanOption transparency(sla, "transparency", false); - - std::cout << "Value: " << transparency.value() << std::endl; - - return 0; -} diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..992583a --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,14 @@ + +tests: test test1 test2 + +test: test.o launcher-item.o + g++ -o $@ $^ $(GTKLIBS) $(DBUSLIBS) $(LIBS) -losso + +test1: test1.o settings-page-items.o launcher-item.o + g++ -g -o $@ $^ $(GTKLIBS) $(DBUSLIBS) $(LIBS) + +test2: test2.o gconf-wrapper.o + g++ -g -o $@ $^ $(GCONFLIBS) + +clean: + rm -f *.d *.o test test1 test2 diff --git a/tests/test.cc b/tests/test.cc new file mode 100644 index 0000000..393f7fe --- /dev/null +++ b/tests/test.cc @@ -0,0 +1,49 @@ +// This file is a part of Simple Launcher +// +// Copyright (C) 2006, 2007, Mikhail Sobolev +// +// Simple Launcher is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License version 2 as published by +// the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the Free Software Foundation, Inc., 51 +// Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#include + +#include "launcher-item.h" + +char *files[] = { + "/usr/share/applications/hildon/hildon-control-panel.desktop", + "/usr/share/applications/hildon/hwr-teacher.desktop", + "/usr/share/applications/hildon/osso-backup.desktop", + "/usr/share/applications/hildon/osso-global-search.desktop", + 0 +}; + +int main() { + for (int i = 0 ; files[i] != 0 ; ++i) { + LauncherItem *item = new LauncherItem(); + + if (item->load(files[i])) { + std::cout << "Loaded " << files[i] << std::endl + << " name: " << item->getName() << std::endl + << " comment: " << item->getComment() << std::endl + << " service: " << item->getService() << std::endl; + } else { + std::cout << "Failed to load " << files[i] << std::endl; + } + + delete item; + } + + return 0; +} + +// vim:ts=2:sw=2:et diff --git a/tests/test1.cc b/tests/test1.cc new file mode 100644 index 0000000..f31a965 --- /dev/null +++ b/tests/test1.cc @@ -0,0 +1,62 @@ +#include +#include + +#include +#include + +#include +#include +#include + +#include "settings-page-items.h" +#include "launcher-item.h" + +static std::string appdir = "/usr/share/applications"; + +int main(int argc, char *argv[]) { + gtk_init(&argc, &argv); + + DIR *handle = opendir(appdir.c_str()); + + if (handle != 0) { + LauncherItems apps; + + struct dirent *entry; + + while ((entry = readdir(handle)) != 0) { + if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) { + continue; + } + + LauncherItem *item = new LauncherItem(); + + if (item->load(appdir + "/" + entry->d_name)) { + std::cout << "Loaded " << entry->d_name << std::endl; + } else { + std::cout << "Failed to load " << entry->d_name << std::endl; + } + + apps.push_back(std::pair(entry->d_name, item)); + } + + if (!apps.empty()) { + SLAList sla_list(26, apps); + + GtkDialog *dialog = GTK_DIALOG(gtk_dialog_new_with_buttons("Launcher settings", 0, (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, 0)); + + gtk_container_add(GTK_CONTAINER(dialog->vbox), sla_list.getWidget()); + + if (gtk_dialog_run(dialog) == GTK_RESPONSE_ACCEPT) { + for (LauncherItems::const_iterator it = apps.begin(); it != apps.end(); ++it) { + std::cout << it->first << (it->second->isEnabled() ? " active" : " passive") << std::endl; + } + } + + gtk_widget_destroy(GTK_WIDGET(dialog)); + } + } else { + std::cerr << "Cannot list applications directory" << std::endl; + } + + return 0; +} diff --git a/tests/test2.cc b/tests/test2.cc new file mode 100644 index 0000000..261b547 --- /dev/null +++ b/tests/test2.cc @@ -0,0 +1,15 @@ +#include + +#include "gconf-wrapper.h" + +int main() { + g_type_init(); + + GConfKey sla("/apps/simple-launcher"); + + GConfBooleanOption transparency(sla, "transparency", false); + + std::cout << "Value: " << transparency.value() << std::endl; + + return 0; +}