[gcalctool] Remove deprecated API usage



commit b68ebca9121a6988aecaf275d827e526c7a6b31f
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Jan 17 18:27:39 2012 +1100

    Remove deprecated API usage

 NEWS                      |    1 +
 configure.ac              |    6 ++++--
 src/math-converter.c      |    2 +-
 src/math-display.c        |    4 ++--
 src/math-equation.c       |   22 ++--------------------
 src/math-variable-popup.c |    7 ++++---
 src/math-window.c         |    4 ++--
 7 files changed, 16 insertions(+), 30 deletions(-)
---
diff --git a/NEWS b/NEWS
index 5953f00..3b84c6b 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Overview of changes in gcalctool 6.3.4
     * Fix a crash in gcalctool when ECB rate file can't be parsed
     * Fix square centimeter conversions
     * Fix incorrect spelling of Celsius
+    * Remove deprecated API usage
 
 Overview of changes in gcalctool 6.2.0
 
diff --git a/configure.ac b/configure.ac
index 4f61b41..8c51e51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,18 +19,20 @@ dnl ###########################################################################
 dnl Dependencies
 dnl ###########################################################################
 
+GLIB_REQUIRED=2.31
 GIO_REQUIRED=2.25.10
-GTK_REQUIRED=2.90.7
+GTK_REQUIRED=3.0
 
 PKG_CHECK_MODULES(GCALCTOOL, [
     gtk+-3.0 >= $GTK_REQUIRED
+    glib-2.0 >= $GLIB_REQUIRED
     gio-2.0 >= $GIO_REQUIRED
     libxml-2.0
     gmodule-export-2.0
 ])
 
 PKG_CHECK_MODULES(GCALCCMD, [
-    glib-2.0
+    glib-2.0 >= $GLIB_REQUIRED
     gio-2.0 >= $GIO_REQUIRED
     libxml-2.0
 ])
diff --git a/src/math-converter.c b/src/math-converter.c
index 2f543fe..ff28500 100644
--- a/src/math-converter.c
+++ b/src/math-converter.c
@@ -391,7 +391,7 @@ math_converter_init(MathConverter *converter)
 
     gtk_box_set_spacing(GTK_BOX(converter), 6);
 
-    hbox = gtk_hbox_new(FALSE, 0);
+    hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
     gtk_widget_show(hbox);
     gtk_box_pack_start(GTK_BOX(converter), hbox, FALSE, TRUE, 0);
 
diff --git a/src/math-display.c b/src/math-display.c
index d466831..6718665 100644
--- a/src/math-display.c
+++ b/src/math-display.c
@@ -326,7 +326,7 @@ create_gui(MathDisplay *display)
     int i;
     GtkStyle *style;
 
-    main_box = gtk_vbox_new(false, 0);
+    main_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
     gtk_container_add(GTK_CONTAINER(display), main_box);
 
     g_signal_connect(display, "key-press-event", G_CALLBACK(key_press_cb), display);
@@ -350,7 +350,7 @@ create_gui(MathDisplay *display)
     g_signal_connect(display->priv->text_view, "key-press-event", G_CALLBACK(display_key_press_cb), display);
     gtk_box_pack_start(GTK_BOX(main_box), display->priv->text_view, TRUE, TRUE, 0);
 
-    info_box = gtk_hbox_new(false, 6);
+    info_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
     gtk_box_pack_start(GTK_BOX(main_box), info_box, FALSE, TRUE, 0);
 
     info_view = gtk_text_view_new();
diff --git a/src/math-equation.c b/src/math-equation.c
index 0183dca..6681ac1 100644
--- a/src/math-equation.c
+++ b/src/math-equation.c
@@ -1300,9 +1300,6 @@ math_equation_look_for_answer(gpointer data)
 void
 math_equation_solve(MathEquation *equation)
 {
-    GError *error = NULL;
-    gulong stacksize = 0;
-
     g_return_if_fail(equation != NULL);
 
     // FIXME: should replace calculation or give error message
@@ -1323,18 +1320,7 @@ math_equation_solve(MathEquation *equation)
 
     math_equation_set_number_mode(equation, NORMAL);
 
-    // Fix for https://bugzilla.gnome.org/show_bug.cgi?id=650174
-    // FIXME: This is a real hack, should be avoidable when parser is rewritten and doesn't require a crazy large stack
-    if (GLIB_SIZEOF_LONG == 8) {
-           stacksize = 0x400000;
-    } else {
-           stacksize = 0x200000;
-    }
-
-    g_thread_create_full(math_equation_solve_real, equation, stacksize, false, false, G_THREAD_PRIORITY_NORMAL, &error);
-
-    if (error)
-        g_warning("Error spawning thread for calculations: %s\n", error->message);
+    g_thread_new("", math_equation_solve_real, equation);
 
     g_timeout_add(50, math_equation_look_for_answer, equation);
     g_timeout_add(100, math_equation_show_in_progress, equation);
@@ -1381,7 +1367,6 @@ void
 math_equation_factorize(MathEquation *equation)
 {
     MPNumber x;
-    GError *error = NULL;
 
     g_return_if_fail(equation != NULL);
 
@@ -1397,10 +1382,7 @@ math_equation_factorize(MathEquation *equation)
 
     equation->priv->in_solve = true;
 
-    g_thread_create(math_equation_factorize_real, equation, false, &error);
-
-    if (error)
-        g_warning("Error spawning thread for calculations: %s\n", error->message);
+    g_thread_new("", math_equation_factorize_real, equation);
 
     g_timeout_add(50, math_equation_look_for_answer, equation);
     g_timeout_add(100, math_equation_show_in_progress, equation);
diff --git a/src/math-variable-popup.c b/src/math-variable-popup.c
index fde5dbf..d033571 100644
--- a/src/math-variable-popup.c
+++ b/src/math-variable-popup.c
@@ -131,7 +131,7 @@ make_variable_entry(MathVariablePopup *popup, const gchar *name, const MPNumber
     GtkWidget *hbox, *button, *label;
     gchar *text;
 
-    hbox = gtk_hbox_new(FALSE, 6);
+    hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
 
     if (value)
     {
@@ -211,7 +211,7 @@ math_variable_popup_set_property(GObject      *object,
         }
         g_strfreev(names);
 
-        entry = gtk_hbox_new(FALSE, 6);
+        entry = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
         gtk_widget_show(entry);
 
         // TODO: Show greyed "variable name" text to give user a hint how to use
@@ -301,7 +301,8 @@ math_variable_popup_init(MathVariablePopup *popup)
     /* Destroy this window when it loses focus */
     g_signal_connect(G_OBJECT(popup), "focus-out-event", G_CALLBACK(variable_focus_out_event_cb), popup);
 
-    popup->priv->vbox = gtk_vbox_new(TRUE, 6);
+    popup->priv->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
+    gtk_box_set_homogeneous(GTK_BOX(popup->priv->vbox), TRUE);
     gtk_container_add(GTK_CONTAINER(popup), popup->priv->vbox);
     gtk_widget_show(popup->priv->vbox);
 }
diff --git a/src/math-window.c b/src/math-window.c
index d32dec6..28b7e98 100644
--- a/src/math-window.c
+++ b/src/math-window.c
@@ -430,7 +430,7 @@ create_gui(MathWindow *window)
     GtkWidget *main_vbox, *vbox;
     GtkWidget *scrolled_window;
   
-    main_vbox = gtk_vbox_new(FALSE, 0);
+    main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
     gtk_container_add(GTK_CONTAINER(window), main_vbox);
     gtk_widget_show(main_vbox);
 
@@ -440,7 +440,7 @@ create_gui(MathWindow *window)
   
     create_menu(window);
 
-    vbox = gtk_vbox_new(FALSE, 6);
+    vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
     gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
     gtk_box_pack_start(GTK_BOX(main_vbox), vbox, TRUE, TRUE, 0);  
     gtk_widget_show(vbox);



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