Index: gpomme/gpomme.glade
===================================================================
--- gpomme/gpomme.glade (revision 0)
+++ gpomme/gpomme.glade (revision 0)
@@ -0,0 +1,160 @@
+
+
+
+
+
+ 5
+ gpomme Configuration
+ False
+ GTK_WIN_POS_MOUSE
+ True
+ GDK_WINDOW_TYPE_HINT_UTILITY
+ True
+ False
+
+
+
+
+ 390
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+
+
+ True
+ 13
+
+
+ True
+
+
+ True
+ 0
+ 1
+ <b>Theme:</b>
+ True
+
+
+
+
+ True
+ 10
+
+
+ True
+ 6
+ gnome-settings-theme
+
+
+ False
+
+
+
+
+ True
+ 0
+
+
+ True
+ Set the theme of gpomme
+ <item1>
+
+
+
+
+
+ 10
+ 1
+
+
+
+
+ 1
+
+
+
+
+ False
+ False
+ 1
+
+
+
+
+ True
+
+
+ True
+ 0
+ 1
+ <b>Timeout (in seconds):</b>
+ True
+
+
+
+
+ True
+ 10
+
+
+ True
+ 6
+ appointment
+
+
+ False
+
+
+
+
+ True
+ 0 0 5 0.10000000000000001 0.10000000000000001 0
+ GTK_POS_LEFT
+
+
+
+ 10
+ 1
+
+
+
+
+ False
+ 1
+ 1
+
+
+
+
+ 1
+
+
+
+
+ False
+ 10
+ 1
+
+
+
+
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ GTK_BUTTONBOX_END
+
+
+ True
+ gtk-close
+ True
+
+
+
+
+
+ False
+ GTK_PACK_END
+
+
+
+
+
+
Index: gpomme/gpomme.c
===================================================================
--- gpomme/gpomme.c (revision 294)
+++ gpomme/gpomme.c (working copy)
@@ -5,6 +5,7 @@
*
* Copyright (C) 2006 Soeren SONNENBURG
* Copyright (C) 2006-2007 Julien BLACHE
+ * Copyright (C) 2007 daniel g. siegel
*
* Portions of the GTK code below were shamelessly
* stolen from pbbuttonsd. Thanks ! ;-)
@@ -450,6 +451,7 @@
printf("Usage:\n");
printf("\tgpomme\t\t-- start gpomme\n");
+ printf("\tgpomme -c\t-- open the configuration-gui\n");
printf("\tgpomme -v\t-- print version and exit\n");
}
@@ -474,7 +476,7 @@
exit(1);
}
- while ((c = getopt(argc, argv, "v")) != -1)
+ while ((c = getopt(argc, argv, "cv")) != -1)
{
switch (c)
{
@@ -485,6 +487,12 @@
exit(0);
break;
+ case 'c':
+ config_gui();
+ exit(0);
+
+ break;
+
default:
usage();
Index: gpomme/conffile.c
===================================================================
--- gpomme/conffile.c (revision 294)
+++ gpomme/conffile.c (working copy)
@@ -4,6 +4,7 @@
* $Id$
*
* Copyright (C) 2007 Julien BLACHE
+ * Copyright (C) 2007 daniel g. siegel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,6 +22,7 @@
#include
#include
+#include
#include
#include
@@ -28,6 +30,8 @@
#include
#include
+#include
+#include
#include
#include "inotify-syscalls.h"
@@ -38,8 +42,14 @@
#include "gpomme.h"
#include "theme.h"
-#define CONFFILE "/.gpommerc"
+#include
+#include
+#define _(str) gettext(str)
+
+#define GLADE_FILE "/usr/share/gpomme/gpomme.glade" // FIXME: check for path
+#define CONFFILE "/.gpommerc"
+
static cfg_opt_t cfg_opts[] =
{
CFG_STR("theme", DEFAULT_THEME, CFGF_NONE),
@@ -47,7 +57,12 @@
CFG_END()
};
+GladeXML *gxml;
+GtkWidget *app_window;
+void on_gpomme_window_close_cb (GtkWidget *widget, gpointer user_data);
+void update_gui_config (void);
+
cfg_t *cfg = NULL;
static char *conffile = NULL;
@@ -240,3 +255,108 @@
return fd;
}
+
+void
+config_gui () {
+ GtkWidget *cb_theme;
+ GtkWidget *hs_timeout;
+ struct dirent **namelist;
+ int n;
+
+ // initialize gettext
+ bindtextdomain("gpomme", "/usr/share/locale");
+ textdomain("gpomme");
+
+ glade_init();
+
+ // initialize glade and the window
+ gxml = glade_xml_new(GLADE_FILE, NULL, NULL);
+ app_window = glade_xml_get_widget(gxml, "gpomme_window");
+
+ // setting the strings (for translation)
+ gtk_window_set_title(GTK_WINDOW(app_window), _("gpomme Preferences"));
+
+ GtkWidget *s;
+ s = glade_xml_get_widget(gxml, "lb_theme");
+ gtk_label_set_text(GTK_LABEL(s), _("Theme:"));
+
+ s = glade_xml_get_widget(gxml, "lb_timeout");
+ gtk_label_set_text(GTK_LABEL(s), _("Timeout (in seconds):"));
+
+ // set the default settings
+ hs_timeout = glade_xml_get_widget(gxml, "hs_timeout");
+ gtk_range_set_value(GTK_RANGE(hs_timeout), (gdouble)cfg_getint(cfg, "timeout") / 1000);
+
+ // TODO: check for theme-previews
+ cb_theme = glade_xml_get_widget(gxml, "cb_theme");
+ gtk_combo_box_remove_text(GTK_COMBO_BOX(cb_theme), 0); // remove dummy-text
+
+ gtk_combo_box_append_text(GTK_COMBO_BOX(cb_theme), cfg_getstr(cfg, "theme"));
+ gtk_combo_box_set_active(GTK_COMBO_BOX(cb_theme), 0);
+
+ n = scandir(THEME_BASE, &namelist, 0, alphasort);
+
+ if (n < 0) {
+ fprintf(stderr, "Could not open theme directory: %s\n", strerror(errno));
+ exit(1);
+ }
+ else {
+ while(n--) {
+ if (strcmp(namelist[n]->d_name, cfg_getstr(cfg, "theme")) &&
+ (namelist[n]->d_name[0] != '.')) {
+ //printf("%s\n", namelist[n]->d_name);
+ gtk_combo_box_append_text(GTK_COMBO_BOX(cb_theme), namelist[n]->d_name);
+ }
+ }
+ }
+
+ // signals...
+ glade_xml_signal_connect (gxml, "on_bt_close_clicked",
+ G_CALLBACK(on_gpomme_window_close_cb));
+
+ glade_xml_signal_connect (gxml, "on_gpomme_window_close",
+ G_CALLBACK(on_gpomme_window_close_cb));
+
+ glade_xml_signal_connect (gxml, "on_gpomme_window_destroy",
+ G_CALLBACK(on_gpomme_window_close_cb));
+
+ glade_xml_signal_connect (gxml, "on_hs_timeout_value_changed",
+ G_CALLBACK(update_gui_config));
+
+ glade_xml_signal_connect (gxml, "on_cb_theme_changed",
+ G_CALLBACK(update_gui_config));
+
+ gtk_widget_show (app_window);
+ // do we really need this?
+ gtk_main ();
+}
+
+// window is closed, so write the settings to the config-file
+void
+on_gpomme_window_close_cb (GtkWidget *widget, gpointer user_data)
+{
+ update_gui_config();
+ g_print("gpomme: destroy_event_cb()\n");
+ gtk_widget_hide (app_window);
+ gtk_main_quit();
+}
+
+void
+update_gui_config () {
+ GtkWidget *cb_themes;
+ GtkWidget *hs_timeout;
+
+ // get the actual settings
+ hs_timeout = glade_xml_get_widget(gxml, "hs_timeout");
+ cb_themes = glade_xml_get_widget(gxml, "cb_theme");
+
+ gdouble timeout = gtk_range_get_value(GTK_RANGE(hs_timeout)) * 1000;
+ //g_print("setting timeout to %gs\n", timeout);
+ cfg_setint(cfg, "timeout", timeout);
+
+ //g_print("setting theme to %s\n", gtk_combo_box_get_active_text(GTK_COMBO_BOX(cb_themes)));
+ cfg_setstr(cfg, "theme", gtk_combo_box_get_active_text(GTK_COMBO_BOX(cb_themes)));
+
+ // actually write them
+ config_write();
+}
Index: gpomme/conffile.h
===================================================================
--- gpomme/conffile.h (revision 294)
+++ gpomme/conffile.h (working copy)
@@ -14,4 +14,7 @@
int
config_monitor(void);
+void
+config_gui(void);
+
#endif /* !__CONFFILE_H__ */
Index: gpomme/Makefile
===================================================================
--- gpomme/Makefile (revision 294)
+++ gpomme/Makefile (working copy)
@@ -3,6 +3,9 @@
GTK_CFLAGS = $(shell pkg-config --cflags gtk+-2.0)
GTK_LIBS = $(shell pkg-config --libs gtk+-2.0)
+GLADE_CFLAGS = $(shell pkg-config --cflags libglade-2.0)
+GLADE_LIBS = $(shell pkg-config --libs libglade-2.0)
+
DBUS_CFLAGS = $(shell pkg-config dbus-1 --cflags) -DDBUS_API_SUBJECT_TO_CHANGE
DBUS_LIBS = $(shell pkg-config dbus-1 --libs)
@@ -15,8 +18,8 @@
CONFUSE_CFLAGS = $(shell pkg-config libconfuse --cflags)
CONFUSE_LIBS = $(shell pkg-config libconfuse --libs)
-CFLAGS = -g -O2 -Wall $(ALSA_CFLAGS) $(AUDIOFILE_CFLAGS) $(DBUS_CFLAGS) $(GTK_CFLAGS) $(CONFUSE_CFLAGS)
-LDFLAGS = -lpthread $(ALSA_LIBS) $(AUDIOFILE_LIBS) $(DBUS_LIBS) $(GTK_LIBS) $(CONFUSE_LIBS)
+CFLAGS = -g -O2 -Wall $(ALSA_CFLAGS) $(AUDIOFILE_CFLAGS) $(DBUS_CFLAGS) $(GTK_CFLAGS) $(CONFUSE_CFLAGS) $(GLADE_CFLAGS)
+LDFLAGS = -lpthread $(ALSA_LIBS) $(AUDIOFILE_LIBS) $(DBUS_LIBS) $(GTK_LIBS) $(CONFUSE_LIBS) $(GLADE_LIBS)
SOURCES = gpomme.c theme.c audio.c conffile.c ../dbus-client/dbus-client.c
POFILES = po/fr.po po/de.po po/es.po
Index: gpomme/po/es.po
===================================================================
--- gpomme/po/es.po (revision 294)
+++ gpomme/po/es.po (working copy)
@@ -2,44 +2,54 @@
# Copyright (C) 2006, Eduardo Bellido Bellido
# This file is distributed under the same license as the mbpgtk package.
# Eduardo Bellido Bellido , 2007.
-
msgid ""
msgstr ""
"Project-Id-Version: mbpgtk 0.3\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-12-24 12:29+0100\n"
+"POT-Creation-Date: 2007-03-07 22:05+0100\n"
"PO-Revision-Date: 2007-01-07 08:27+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: "
+"Content-Transfer-Encoding: \n"
-#: gpomme.c:287
+#: gpomme.c:343
msgid "LCD backlight level"
msgstr "Nivel de brillo de la pantalla"
-#: gpomme.c:299
+#: gpomme.c:358
msgid "Keyboard backlight level"
msgstr "Nivel de brillo del teclado"
-#: gpomme.c:313
+#: gpomme.c:373
msgid "Sound volume"
msgstr "Control de volúmen"
-#: gpomme.c:317
+#: gpomme.c:377
msgid "Sound volume (muted)"
msgstr "Control de volúmen (silenciado)"
-#: gpomme.c:326
+#: gpomme.c:386
msgid "Sound muted"
msgstr "Sonido silenciado"
-#: gpomme.c:328
+#: gpomme.c:388
msgid "Sound unmuted"
msgstr "Sonido normal"
-#: gpomme.c:332
+#: gpomme.c:392
msgid "Eject"
msgstr "Expulsando CD/DVD"
+#: conffile.c:286
+msgid "gpomme Preferences"
+msgstr ""
+
+#: conffile.c:290
+msgid "Theme:"
+msgstr ""
+
+#: conffile.c:293
+msgid "Timeout (in seconds):"
+msgstr ""
Index: gpomme/po/fr.po
===================================================================
--- gpomme/po/fr.po (revision 294)
+++ gpomme/po/fr.po (working copy)
@@ -7,7 +7,7 @@
msgstr ""
"Project-Id-Version: mbpgtk 0.3\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-12-24 12:29+0100\n"
+"POT-Creation-Date: 2007-03-07 22:05+0100\n"
"PO-Revision-Date: 2006-12-24 13:15+0100\n"
"Last-Translator: Julien BLACHE \n"
"Language-Team: french \n"
@@ -15,30 +15,42 @@
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: gpomme.c:287
+#: gpomme.c:343
msgid "LCD backlight level"
msgstr "Luminosité écran"
-#: gpomme.c:299
+#: gpomme.c:358
msgid "Keyboard backlight level"
msgstr "Éclairage clavier"
-#: gpomme.c:313
+#: gpomme.c:373
msgid "Sound volume"
msgstr "Volume sonore"
-#: gpomme.c:317
+#: gpomme.c:377
msgid "Sound volume (muted)"
msgstr "Volume sonore (muet)"
-#: gpomme.c:326
+#: gpomme.c:386
msgid "Sound muted"
msgstr "Son désactivé"
-#: gpomme.c:328
+#: gpomme.c:388
msgid "Sound unmuted"
msgstr "Son activé"
-#: gpomme.c:332
+#: gpomme.c:392
msgid "Eject"
msgstr "Éjection"
+
+#: conffile.c:286
+msgid "gpomme Preferences"
+msgstr ""
+
+#: conffile.c:290
+msgid "Theme:"
+msgstr ""
+
+#: conffile.c:293
+msgid "Timeout (in seconds):"
+msgstr ""
Index: gpomme/po/de.po
===================================================================
--- gpomme/po/de.po (revision 294)
+++ gpomme/po/de.po (working copy)
@@ -1,6 +1,7 @@
# gpomme - graphical client for pommed
# Copyright (C) 2006 Soeren SONNENBURG
# Copyright (C) 2006, Julien BLACHE
+# Copyright (C) 2007, daniel g. siegel
# This file is distributed under the same license as the PACKAGE package.
# Julien BLACHE , 2006.
#
@@ -8,38 +9,50 @@
msgstr ""
"Project-Id-Version: mbpgtk 0.3\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-12-24 12:29+0100\n"
+"POT-Creation-Date: 2007-03-07 22:05+0100\n"
"PO-Revision-Date: 2006-12-24 13:15+0100\n"
-"Last-Translator: Soeren SONNENBURG \n"
+"Last-Translator: daniel g. siegel \n"
"Language-Team: german \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: gpomme.c:287
+#: gpomme.c:343
msgid "LCD backlight level"
msgstr "Helligkeit"
-#: gpomme.c:299
+#: gpomme.c:358
msgid "Keyboard backlight level"
msgstr "Tastatur Beleuchtung"
-#: gpomme.c:313
+#: gpomme.c:373
msgid "Sound volume"
msgstr "Lautstärke"
-#: gpomme.c:317
+#: gpomme.c:377
msgid "Sound volume (muted)"
msgstr "Lautstärke (Ton aus)"
-#: gpomme.c:326
+#: gpomme.c:386
msgid "Sound muted"
msgstr "Ton aus"
-#: gpomme.c:328
+#: gpomme.c:388
msgid "Sound unmuted"
msgstr "Ton an"
-#: gpomme.c:332
+#: gpomme.c:392
msgid "Eject"
msgstr "CD Auswerfen"
+
+#: conffile.c:286
+msgid "gpomme Preferences"
+msgstr "gpomme Einstellungen"
+
+#: conffile.c:290
+msgid "Theme:"
+msgstr "Thema:"
+
+#: conffile.c:293
+msgid "Timeout (in seconds):"
+msgstr "Timeout (in Sekunden):"
Index: gpomme/po/gpomme.pot
===================================================================
--- gpomme/po/gpomme.pot (revision 294)
+++ gpomme/po/gpomme.pot (working copy)
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-12-24 12:29+0100\n"
+"POT-Creation-Date: 2007-03-07 22:05+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -16,30 +16,42 @@
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: gpomme.c:287
+#: gpomme.c:343
msgid "LCD backlight level"
msgstr ""
-#: gpomme.c:299
+#: gpomme.c:358
msgid "Keyboard backlight level"
msgstr ""
-#: gpomme.c:313
+#: gpomme.c:373
msgid "Sound volume"
msgstr ""
-#: gpomme.c:317
+#: gpomme.c:377
msgid "Sound volume (muted)"
msgstr ""
-#: gpomme.c:326
+#: gpomme.c:386
msgid "Sound muted"
msgstr ""
-#: gpomme.c:328
+#: gpomme.c:388
msgid "Sound unmuted"
msgstr ""
-#: gpomme.c:332
+#: gpomme.c:392
msgid "Eject"
msgstr ""
+
+#: conffile.c:286
+msgid "gpomme Preferences"
+msgstr ""
+
+#: conffile.c:290
+msgid "Theme:"
+msgstr ""
+
+#: conffile.c:293
+msgid "Timeout (in seconds):"
+msgstr ""