Drop me a postcard -dialog implemented with GConf flag.
authorwellu <wellu@wellu.org>
Thu, 11 Sep 2008 17:25:49 +0000 (17:25 +0000)
committerwellu <wellu@wellu.org>
Thu, 11 Sep 2008 17:25:49 +0000 (17:25 +0000)
git-svn-id: file:///svnroot/speedometer/trunk@33 df364472-da61-43ef-8a67-511c89aa921b

callbacks.c
debian/changelog
util.c

index 57964cb..950c202 100644 (file)
@@ -25,7 +25,7 @@ static void print_location(LocationGPSDevice* device) {
        g_print("Latitude: %.2f\n"
                        "Longitude: %.2f\n"
                        "Altitude: %.2f\n"
-                       "Speed: %d\n",
+                       "Speed: %.2d\n",
                        device->fix->latitude,
                        device->fix->longitude,
                        device->fix->altitude,
index e9ecae7..00c5d43 100644 (file)
@@ -1,3 +1,9 @@
+speedometer (0.3-alpha3) unstable; urgency=low
+
+  * Drop me a postcard -dialog implemented with GConf flag.
+
+ -- Wellu Mäkinen <wellu@wellu.org>  Thu, 11 Sep 2008 20:24:21 +0300
+
 speedometer (0.3-alpha2) unstable; urgency=low
 
   * Fixes to interpret_speed_from_gps.
diff --git a/util.c b/util.c
index dee79a0..2d8c498 100644 (file)
--- a/util.c
+++ b/util.c
@@ -25,7 +25,7 @@
 #include "callbacks.h"
 #include "ui.h"
 
-#define GCONF_DIR "/apps/Maemo/speedometer/"
+#define GCONF_KEY "/apps/Maemo/speedometer/disclaimer"
 
 static LocationGPSDevice *device = NULL;
 static LocationGPSDControl *control = NULL;
@@ -99,20 +99,37 @@ void interpret_speed_from_gps(AppData* appdata, gdouble speed) {
        g_strfreev(splitted);
 }
 
+static show_dialog() {
+       GtkWidget *dialog = gtk_message_dialog_new(
+                       NULL,
+                       GTK_DIALOG_MODAL,
+                       GTK_MESSAGE_INFO,
+                       GTK_BUTTONS_OK,
+                       "This program is licensed under GNU General Public License, "
+                       "which means (among other things) that you don't have to pay "
+                       "a dime for it. "
+                       "If you think, however, that this software is worth it, you "
+                       "can always drop me a postcard.\n\n"
+                       "Wellu Mäkinen\n"
+                       "PO BOX\n"
+                       "33580 Tampere\n"
+                       "FINLAND");
+       gtk_dialog_run(dialog);
+       gtk_widget_destroy(dialog);
+}
+
 void show_postcard_dialog() {
        GConfClient* client = gconf_client_get_default();
        g_assert(GCONF_IS_CLIENT(client));
 
 
        GConfValue* gcvalue = NULL;
-       gcvalue = gconf_client_get_without_default(client, GCONF_DIR "disclaimer", NULL);
+       gcvalue = gconf_client_get_without_default(client, GCONF_KEY, NULL);
 
        if(gcvalue == NULL) {
-               g_warning("key %sdisclaimer not found\n", GCONF_DIR);
-               gconf_client_set_bool(client, GCONF_DIR "disclaimer", TRUE, NULL);
-       }
-       else {
-               g_print("key %sdisclaimer was found\n", GCONF_DIR);
+               g_print("sjot");
+               show_dialog();
+               gconf_client_set_bool(client, GCONF_KEY, TRUE, NULL);
        }
        g_object_unref(client);
 }