* a bit of re-factoring
[simple-launcher] / simple-launcher.cc
index 0044068..6001d30 100644 (file)
@@ -1,6 +1,6 @@
 // This file is a part of Simple Launcher
 //
-// Copyright (C) 2006, 2007, Mikhail Sobolev
+// Copyright (C) 2006, 2007, 2008 Mikhail Sobolev <mss@mawhrin.net>
 //
 // 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
 
 #include <gtk/gtk.h>
 
-#include <libosso.h>
-
-#include "launcher-item.h"
-#include "launchable-item.h"
-#include "settings-dialog.h"
-#include "gconf-wrapper.h"
+#include "simple-launcher.h"
 
 #define SL_APPLET_DBUS_NAME  "simple-launcher"
 #define SL_APPLET_VERSION    "0.0"
 
-#define SL_APPLET_GCONF_PATH  "/apps/simple-launcher"
-
-class SimpleLauncherApplet {
-public:
-  SimpleLauncherApplet(const GConfKey&);
- ~SimpleLauncherApplet();
-
-  bool doInit(void *state_data, int *state_size);
-
-  int saveState(void **state_data, int *state_size);
-  GtkWidget *settings(GtkWindow *parent);
-
-  GtkWidget *getWidget() { return myWidget; }
-
-private:
-  static void addItem(LauncherItems&, const std::string&, bool);
-
-  void loadConfig();
-  void saveConfig();
-
-  static void updateItems(LauncherItems&);
-  static void processDirectory(LauncherItems&, const std::string&);
-
-  bool initWidget();
-  void updateWidget();
-
-  void buttonPressed(GtkWidget *button, GdkEventButton *event);
-  void runDialog();
-
-  static void _button_pressed(GtkWidget *button, GdkEventButton *event, void *self);
-  static void _run_dialog(GtkMenuItem *, void *);
-
-private:
-  // GConfClientWrapper myClient;
-  // GConfKey myMainSettings;
-
-  osso_context_t *myContext;
-
-  GtkWidget *myWidget;
-  GtkWindow *myParent;
-
-  LauncherItems myItems;
-
-  GConfBooleanOption myTransparent;
-  // bool myShowInfobanner; // FIXME: to implement
-  GConfIntegerOption myIconSize;
-
-  static char *ourDirs[];
-};
-
 // Hildon home applet interface functions
 
 void *hildon_home_applet_lib_initialize(void *state_data, int *state_size, GtkWidget **widget) {
-  GConfKey baseKey(SL_APPLET_GCONF_PATH);
-
-  SimpleLauncherApplet *applet = new SimpleLauncherApplet(baseKey);
+  SimpleLauncherApplet *applet = new SimpleLauncherApplet(SL_APPLET_GCONF_PATH);
 
   if (applet != NULL) {
     if (applet->doInit(state_data, state_size)) {
@@ -124,7 +67,7 @@ char *SimpleLauncherApplet::ourDirs[] = {
 };
 
 // SimpleLauncherApplet::SimpleLauncherApplet() : myMainSettings(myClient.getKey(SL_APPLET_GCONF_PATH)), myContext(NULL), myWidget(NULL), myParent(NULL) {
-SimpleLauncherApplet::SimpleLauncherApplet(const GConfKey& base) : myContext(NULL), myWidget(NULL), myParent(NULL), myTransparent(base, "transparent", false), myIconSize(base, "icon_size", 48) {
+SimpleLauncherApplet::SimpleLauncherApplet(const std::string& base) : myContext(NULL), myWidget(NULL), myParent(NULL), myTransparent(GConfKey(base), "transparent", false), myIconSize(GConfKey(base), "icon_size", 48) {
 }
 
 bool SimpleLauncherApplet::doInit(void *state_data, int *state_size) {