[gcalctool] Fix the conversion of nautical miles



commit f3713691ce588affb703e261c90bafe8e9c66399
Author: Bruce Cowan <bruce bcowan me uk>
Date:   Wed Apr 20 09:42:21 2011 +1000

    Fix the conversion of nautical miles

 NEWS               |    4 ++++
 src/gcalctool.c    |    8 ++++++--
 src/math-window.c  |   27 ++-------------------------
 src/unit-manager.c |    2 +-
 4 files changed, 13 insertions(+), 28 deletions(-)
---
diff --git a/NEWS b/NEWS
index 1d42780..ee5dd06 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Overview of changes in gcalctool 6.1.0
+
+    * Fix conversion of nautical miles (Bruce Cowan, Bug #648205)
+
 Overview of changes in gcalctool 6.0.0
 
     * Use /org/gnome as location for gsettings keys.  This will mean
diff --git a/src/gcalctool.c b/src/gcalctool.c
index 3c03670..a439725 100644
--- a/src/gcalctool.c
+++ b/src/gcalctool.c
@@ -170,11 +170,13 @@ get_options(int argc, char *argv[])
 }
 
 
-static void
+static gboolean
 quit_cb(MathWindow *window)
 {
     MathEquation *equation;
     MathButtons *buttons;
+  
+  g_debug ("!");
 
     equation = math_window_get_equation(window);
     buttons = math_window_get_buttons(window);
@@ -194,6 +196,8 @@ quit_cb(MathWindow *window)
     g_settings_sync();
 
     gtk_main_quit();
+
+    return FALSE;
 }
 
 
@@ -254,7 +258,7 @@ main(int argc, char **argv)
     gtk_init(&argc, &argv);
 
     window = math_window_new(equation);
-    g_signal_connect(G_OBJECT(window), "quit", G_CALLBACK(quit_cb), NULL);
+    g_signal_connect_after(G_OBJECT(window), "destroy-event", G_CALLBACK(quit_cb), NULL);
     math_buttons_set_programming_base(math_window_get_buttons(window), base);
     math_buttons_set_mode(math_window_get_buttons(window), button_mode); // FIXME: We load the basic buttons even if we immediately switch to the next type
 
diff --git a/src/math-window.c b/src/math-window.c
index 3aeb975..7021d98 100644
--- a/src/math-window.c
+++ b/src/math-window.c
@@ -34,12 +34,6 @@ struct MathWindowPrivate
 
 G_DEFINE_TYPE (MathWindow, math_window, GTK_TYPE_WINDOW);
 
-enum {
-    QUIT,
-    LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL] = { 0, };
-
 
 MathWindow *
 math_window_new(MathEquation *equation)
@@ -91,7 +85,7 @@ math_window_critical_error(MathWindow *window, const gchar *title, const gchar *
 
     gtk_dialog_run(GTK_DIALOG(dialog));
 
-    g_signal_emit(window, signals[QUIT], 0);
+    gtk_widget_destroy(GTK_WIDGET(window));
 }
 
 
@@ -232,7 +226,7 @@ about_cb(GtkWidget *widget, MathWindow *window)
 static void
 quit_cb(GtkWidget *widget, MathWindow *window)
 {
-    g_signal_emit(window, signals[QUIT], 0);
+    gtk_widget_destroy(GTK_WIDGET(window));
 }
 
 
@@ -246,13 +240,6 @@ key_press_cb(MathWindow *window, GdkEventKey *event)
 
 
 static void
-delete_cb(MathWindow *window, GdkEvent *event)
-{
-    g_signal_emit(window, signals[QUIT], 0);
-}
-
-
-static void
 scroll_changed_cb(GtkAdjustment *adjustment, MathWindow *window)
 {
     if (window->priv->right_aligned)
@@ -493,15 +480,6 @@ math_window_class_init(MathWindowClass *klass)
                                                         "Equation being calculated",
                                                         math_equation_get_type(),
                                                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-    signals[QUIT] =
-        g_signal_new("quit",
-                     G_TYPE_FROM_CLASS (klass),
-                     G_SIGNAL_RUN_LAST,
-                     G_STRUCT_OFFSET (MathWindowClass, quit),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID,
-                     G_TYPE_NONE, 0);
 }
 
 
@@ -516,5 +494,4 @@ math_window_init(MathWindow *window)
     gtk_window_set_role(GTK_WINDOW(window), "gcalctool");
     gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
     g_signal_connect_after(G_OBJECT(window), "key-press-event", G_CALLBACK(key_press_cb), NULL);
-    g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(delete_cb), NULL);
 }
diff --git a/src/unit-manager.c b/src/unit-manager.c
index 5cfb151..1a3eca4 100644
--- a/src/unit-manager.c
+++ b/src/unit-manager.c
@@ -57,7 +57,7 @@ unit_manager_get_default(void)
         {"length",   "parsec",              N_("Parsecs"),           NC_("unit-format", "%s pc"),       "30857000000000000x", "x/30857000000000000", NC_("unit-symbols", "parsec,parsecs,pc")},
         {NULL,       "lightyear",           N_("Light Years"),       NC_("unit-format", "%s ly"),       "9460730472580800x",  "x/9460730472580800",  NC_("unit-symbols", "lightyear,lightyears,ly")},
         {NULL,       "astronomical-unit",   N_("Astronomical Units"), NC_("unit-format", "%s au"),      "149597870691x",      "x/149597870691", NC_("unit-symbols", "au")},
-        {NULL,       "nautical-mile",       N_("Nautical Miles"),    NC_("unit-format", "%s nm"),       "1852000x",           "x/1852000",      NC_("unit-symbols", "nm")},
+        {NULL,       "nautical-mile",       N_("Nautical Miles"),    NC_("unit-format", "%s nm"),       "1852x",              "x/1852",         NC_("unit-symbols", "nm")},
         {NULL,       "mile",                N_("Miles"),             NC_("unit-format", "%s mi"),       "1609.344x",          "x/1609.344",     NC_("unit-symbols", "mile,miles,mi")},
         {NULL,       "kilometer",           N_("Kilometers"),        NC_("unit-format", "%s km"),       "1000x",              "x/1000",         NC_("unit-symbols", "kilometer,kilometers,km,kms")},
         {NULL,       "cable",               N_("Cables"),            NC_("unit-format", "%s cb"),       "219.456x",           "x/219.456",      NC_("unit-symbols", "cable,cables,cb")},



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]