started implementation of the settings dialog list
authormishas <mikhail.sobolev@gmail.com>
Wed, 6 Dec 2006 22:46:38 +0000 (22:46 +0000)
committermishas <mikhail.sobolev@gmail.com>
Wed, 6 Dec 2006 22:46:38 +0000 (22:46 +0000)
git-svn-id: file:///svnroot/simple-launcher/trunk@52 3ba93dab-e023-0410-b42a-de7732cf370a

Makefile
debian/changelog
simple-launcher.cc
sla-list.cc [new file with mode: 0644]
sla-list.h [new file with mode: 0644]

index 411d429..cf18254 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ TARGET=simple-launcher.so
 
 all: $(TARGET)
 
-$(TARGET): simple-launcher.o launcher-item.o
+$(TARGET): simple-launcher.o launcher-item.o sla-list.o
        $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
 
 test: test.o launcher-item.o
index 1005fdc..5239c73 100644 (file)
@@ -1,3 +1,9 @@
+simple-launcher (0.7) UNRELEASED; urgency=low
+
+  * NOT RELEASED YET
+
+ -- Mikhail Sobolev <mss@mawhrin.net>  Wed,  6 Dec 2006 22:26:28 +0200
+
 simple-launcher (0.6) unstable; urgency=low
 
   * do not use theming for borders, some other way should be used
index c275104..ff71b68 100644 (file)
@@ -24,6 +24,7 @@
 #include <libosso.h>
 
 #include "launcher-item.h"
+#include "sla-list.h"
 
 #define SL_APPLET_DBUS_NAME  "simple-launcher"
 #define SL_APPLET_VERSION    "0.0"
@@ -237,8 +238,14 @@ void SimpleLauncherApplet::_run_dialog(GtkMenuItem *, void *self) {
 }
 
 void SimpleLauncherApplet::runDialog() {
+  SLAList list(SL_APPLET_ICON_SIZE);
+
   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, 0));
 
+  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));
diff --git a/sla-list.cc b/sla-list.cc
new file mode 100644 (file)
index 0000000..efe5875
--- /dev/null
@@ -0,0 +1,68 @@
+// This file is a part of Simple Launcher
+//
+// Copyright (C) 2006, 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 <gtk/gtkscrolledwindow.h>
+#include <gtk/gtkcellrendererpixbuf.h>
+#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtkcellrenderertoggle.h>
+
+#include "sla-list.h"
+
+SLAList::SLAList(int icon_size): myWidget(0), myStore(0), myView(0) {
+  GtkTreeViewColumn *column;
+  GtkCellRenderer *renderer;
+
+  myStore = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN);
+  myView = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(myStore)));
+
+  gtk_tree_view_set_headers_visible(myView, FALSE);
+
+  renderer = gtk_cell_renderer_pixbuf_new();
+  g_object_set(renderer, "yalign", 0.0, 0);
+  gtk_cell_renderer_set_fixed_size(renderer, icon_size+4, -1);
+  column = GTK_TREE_VIEW_COLUMN(gtk_tree_view_column_new_with_attributes("", renderer, "pixbuf", 0, 0));
+
+  gtk_tree_view_insert_column(myView, column, -1);
+
+  renderer = gtk_cell_renderer_text_new();
+  g_object_set(renderer, "yalign", 0.0, 0);
+  column = GTK_TREE_VIEW_COLUMN(gtk_tree_view_column_new_with_attributes("", renderer, "text", 1, 0));
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
+  gtk_tree_view_column_set_expand(column, TRUE);
+
+  gtk_tree_view_insert_column(myView, column, -1);
+
+  renderer = gtk_cell_renderer_toggle_new();
+  column = GTK_TREE_VIEW_COLUMN(gtk_tree_view_column_new_with_attributes("", renderer, "active", 2, 0));
+
+  gtk_tree_view_insert_column(myView, column, -1);
+
+  myWidget = gtk_scrolled_window_new(0, 0);
+
+  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(myWidget), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+  gtk_container_add(GTK_CONTAINER(myWidget), GTK_WIDGET(myView));
+}
+
+void SLAList::addItem(GdkPixbuf *pixbuf, const char *name, bool active) {
+  GtkTreeIter iter;
+  
+  gtk_list_store_append(myStore, &iter);
+
+  gtk_list_store_set(myStore, &iter, 0, pixbuf, 1, name, 2, active, -1);
+}
+
+// vim:ts=2:sw=2:et
diff --git a/sla-list.h b/sla-list.h
new file mode 100644 (file)
index 0000000..8944598
--- /dev/null
@@ -0,0 +1,41 @@
+// This file is a part of Simple Launcher
+//
+// Copyright (C) 2006, 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
+
+#ifndef __SLA_LIST_H__
+#define __SLA_LIST_H__
+
+#include <gtk/gtkliststore.h>
+#include <gtk/gtktreeview.h>
+
+class SLAList {
+public:
+  SLAList(int);
+ ~SLAList();
+
+  void addItem(GdkPixbuf *pixbuf, const char *name, bool active);
+
+  GtkWidget *getWidget() { return myWidget; }
+
+private:
+  GtkWidget *myWidget;
+  GtkListStore *myStore;
+  GtkTreeView *myView;
+};
+
+#endif
+
+// vim:ts=2:sw=2:et