// this program; if not, write to the Free Software Foundation, Inc., 51
// Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#include "settings-dialog.h"
+
+SettingsDialog::SettingsDialog(GtkWindow *parent, int size, LauncherItems& items) : myList(size, items) {
+ myDialog = GTK_DIALOG(gtk_dialog_new_with_buttons("Launcher Settings", parent, (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), "OK", GTK_RESPONSE_OK, "Cancel", GTK_RESPONSE_CANCEL, NULL));
+
+ gtk_container_add(GTK_CONTAINER(myDialog->vbox), myList.getWidget());
+
+ gtk_widget_set_size_request(GTK_WIDGET(myDialog), 540, 257);
+}
+
+SettingsDialog::~SettingsDialog() {
+ gtk_widget_destroy(GTK_WIDGET(myDialog));
+}
+
+gint SettingsDialog::run() {
+ return gtk_dialog_run(myDialog);
+}
#ifndef __SETTINGS_DIALOG_H_
#define __SETTINGS_DIALOG_H_
+#include <gtk/gtkdialog.h>
+
+#include "sla-list.h"
+#include "launcher-item.h"
+
+class SettingsDialog {
+public:
+ SettingsDialog(GtkWindow *, int, LauncherItems&);
+ ~SettingsDialog();
+
+ gint run();
+
+private:
+ SLAList myList;
+
+ GtkDialog *myDialog;
+};
+
#endif
#include "launcher-item.h"
#include "sla-list.h"
#include "launchable-item.h"
+#include "settings-dialog.h"
#define SL_APPLET_DBUS_NAME "simple-launcher"
#define SL_APPLET_VERSION "0.0"
LauncherItems newItems = myItems;
- SLAList list(SL_APPLET_ICON_SIZE, newItems);
+ SettingsDialog dialog(myParent, SL_APPLET_ICON_SIZE, newItems);
- GtkDialog *dialog = GTK_DIALOG(gtk_dialog_new_with_buttons("Launcher Settings", myParent, (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), "OK", GTK_RESPONSE_OK, "Cancel", GTK_RESPONSE_CANCEL, NULL));
-
- gtk_container_add(GTK_CONTAINER(dialog->vbox), list.getWidget());
-
- gtk_widget_set_size_request(GTK_WIDGET(dialog), 540, 257);
-
- int response = gtk_dialog_run(dialog);
-
- gtk_widget_destroy(GTK_WIDGET(dialog));
-
- switch (response) {
+ switch (dialog.run()) {
case GTK_RESPONSE_OK:
myItems = newItems;
saveConfig(); // save it immediately!