projects
/
simple-launcher
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
started a hackish implementation of settings dialog for real values
[simple-launcher]
/
simple-launcher.cc
diff --git
a/simple-launcher.cc
b/simple-launcher.cc
index
c8a42c7
..
5fe3aae
100644
(file)
--- a/
simple-launcher.cc
+++ b/
simple-launcher.cc
@@
-30,16
+30,16
@@
#include "sla-list.h"
#include "launchable-item.h"
#include "settings-dialog.h"
#include "sla-list.h"
#include "launchable-item.h"
#include "settings-dialog.h"
+#include "gconf-wrapper.h"
#define SL_APPLET_DBUS_NAME "simple-launcher"
#define SL_APPLET_VERSION "0.0"
#define SL_APPLET_DBUS_NAME "simple-launcher"
#define SL_APPLET_VERSION "0.0"
-#define SL_APPLET_ICON_SIZE 48
#define SL_APPLET_GCONF_PATH "/apps/simple-launcher"
class SimpleLauncherApplet {
public:
#define SL_APPLET_GCONF_PATH "/apps/simple-launcher"
class SimpleLauncherApplet {
public:
- SimpleLauncherApplet();
+ SimpleLauncherApplet(const GConfKey&);
~SimpleLauncherApplet();
bool doInit(void *state_data, int *state_size);
~SimpleLauncherApplet();
bool doInit(void *state_data, int *state_size);
@@
-80,13
+80,20
@@
private:
LauncherItems myItems;
LauncherItems myItems;
+ GConfBooleanOption myTransparent;
+ // bool myShowInfobanner; // FIXME: to implement
+ GConfIntegerOption myIconSize;
+ GConfIntegerOption myCanvasSize;
+
static char *ourDirs[];
};
// Hildon home applet interface functions
void *hildon_home_applet_lib_initialize(void *state_data, int *state_size, GtkWidget **widget) {
static char *ourDirs[];
};
// Hildon home applet interface functions
void *hildon_home_applet_lib_initialize(void *state_data, int *state_size, GtkWidget **widget) {
- SimpleLauncherApplet *applet = new SimpleLauncherApplet();
+ GConfKey baseKey(SL_APPLET_GCONF_PATH);
+
+ SimpleLauncherApplet *applet = new SimpleLauncherApplet(baseKey);
if (applet != NULL) {
if (applet->doInit(state_data, state_size)) {
if (applet != NULL) {
if (applet->doInit(state_data, state_size)) {
@@
-130,7
+137,7
@@
char *SimpleLauncherApplet::ourDirs[] = {
};
// SimpleLauncherApplet::SimpleLauncherApplet() : myMainSettings(myClient.getKey(SL_APPLET_GCONF_PATH)), myContext(NULL), myWidget(NULL), myParent(NULL) {
};
// SimpleLauncherApplet::SimpleLauncherApplet() : myMainSettings(myClient.getKey(SL_APPLET_GCONF_PATH)), myContext(NULL), myWidget(NULL), myParent(NULL) {
-SimpleLauncherApplet::SimpleLauncherApplet() : myContext(NULL), myWidget(NULL), myParent(NULL) {
+SimpleLauncherApplet::SimpleLauncherApplet(const GConfKey& base) : myContext(NULL), myWidget(NULL), myParent(NULL), myTransparent(base, "transparent", true), myIconSize(base, "icon_size", 48), myCanvasSize(base, "canvas_size", 1) {
}
bool SimpleLauncherApplet::doInit(void *state_data, int *state_size) {
}
bool SimpleLauncherApplet::doInit(void *state_data, int *state_size) {
@@
-268,10
+275,14
@@
void SimpleLauncherApplet::updateWidget() {
gtk_widget_set_events(button, GDK_BUTTON_PRESS_MASK);
g_signal_connect(button, "button-press-event", G_CALLBACK(_button_pressed), this);
gtk_widget_set_events(button, GDK_BUTTON_PRESS_MASK);
g_signal_connect(button, "button-press-event", G_CALLBACK(_button_pressed), this);
- gtk_event_box_set_visible_window(GTK_EVENT_BOX(button), false);
- // gtk_button_set_relief(GTK_BUTTON(button),GTK_RELIEF_NONE);
+ gtk_event_box_set_visible_window(GTK_EVENT_BOX(button), !myTransparent.value());
+ gtk_container_set_border_width(GTK_CONTAINER(button), myCanvasSize.value());
- gtk_container_add(GTK_CONTAINER(button), gtk_image_new_from_pixbuf(item->getIcon(SL_APPLET_ICON_SIZE)));
+ {
+ GdkPixbuf *pixbuf = item->getIcon(myIconSize.value());
+ gtk_container_add(GTK_CONTAINER(button), gtk_image_new_from_pixbuf(pixbuf));
+ g_object_unref(G_OBJECT(pixbuf));
+ }
gtk_object_set_user_data(GTK_OBJECT(button), item);
gtk_object_set_user_data(GTK_OBJECT(button), item);
@@
-285,10
+296,12
@@
void SimpleLauncherApplet::updateWidget() {
g_object_unref(G_OBJECT(group));
g_object_unref(G_OBJECT(group));
+ int totalSize = myIconSize.value()+2*myCanvasSize.value();
+
if (button_no == 0) {
if (button_no == 0) {
- gtk_widget_set_size_request(myWidget, SL_APPLET_ICON_SIZE, SL_APPLET_ICON_SIZE);
+ gtk_widget_set_size_request(myWidget, totalSize, totalSize);
} else {
} else {
- gtk_widget_set_size_request(myWidget, button_no*SL_APPLET_ICON_SIZE, SL_APPLET_ICON_SIZE);
+ gtk_widget_set_size_request(myWidget, button_no*totalSize, totalSize);
}
gtk_widget_show_all(myWidget);
}
gtk_widget_show_all(myWidget);
@@
-341,11
+354,14
@@
void SimpleLauncherApplet::runDialog() {
LauncherItems newItems = myItems;
LauncherItems newItems = myItems;
- SettingsDialog dialog(myParent, SL_APPLET_ICON_SIZE, newItems);
+ // TODO: make it nicer... this code is ugly :(
+ SettingsDialog dialog(myParent, newItems, myTransparent, myIconSize, myCanvasSize);
switch (dialog.run()) {
case GTK_RESPONSE_OK:
myItems = newItems;
switch (dialog.run()) {
case GTK_RESPONSE_OK:
myItems = newItems;
+ dialog.updateValues(); // FIXME: hackish :( make it better
+
saveConfig(); // save it immediately!
updateWidget();
break;
saveConfig(); // save it immediately!
updateWidget();
break;