[libgda] Cleanups to avoid usage of deprecated APIs



commit 62a6d1a36df6684450da82a5b1473e96a7983da4
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun Mar 22 19:03:10 2015 +0100

    Cleanups to avoid usage of deprecated APIs

 libgda-ui/data-entries/gdaui-entry-bin.c         |    4 ++--
 libgda-ui/data-entries/gdaui-entry-common-time.c |    4 ++--
 libgda-ui/data-entries/gdaui-entry-shell.c       |    4 ++--
 libgda-ui/data-entries/widget-embedder.c         |    4 ++--
 libgda-ui/gdaui-raw-grid.c                       |    1 -
 libgda-ui/gdaui-server-operation.c               |    5 ++---
 tools/browser/data-manager/data-widget.c         |    6 +++---
 tools/browser/schema-browser/table-preferences.c |    1 -
 tools/common/web-server.c                        |   12 ++++++++----
 9 files changed, 21 insertions(+), 20 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-entry-bin.c b/libgda-ui/data-entries/gdaui-entry-bin.c
index 1a50b94..5cea961 100644
--- a/libgda-ui/data-entries/gdaui-entry-bin.c
+++ b/libgda-ui/data-entries/gdaui-entry-bin.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 - 2014 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2015 Vivien Malerba <malerba gnome-db org>
  * Copyright (C) 2010 David King <davidk openismus com>
  * Copyright (C) 2011 Murray Cumming <murrayc murrayc com>
  *
@@ -243,7 +243,7 @@ create_entry (GdauiEntryWrapper *mgwrap)
        gtk_box_pack_start (GTK_BOX (hbox), img, FALSE, FALSE, 0);
        dbin->priv->button_image = g_object_ref (G_OBJECT (img));
 
-        arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
+       arrow = gtk_image_new_from_icon_name ("go-down-symbolic", GTK_ICON_SIZE_MENU);
        gtk_widget_set_halign (arrow, GTK_ALIGN_START);
        gtk_box_pack_start (GTK_BOX (hbox), arrow, TRUE, TRUE, 0);
 
diff --git a/libgda-ui/data-entries/gdaui-entry-common-time.c 
b/libgda-ui/data-entries/gdaui-entry-common-time.c
index 1144a8a..90306b2 100644
--- a/libgda-ui/data-entries/gdaui-entry-common-time.c
+++ b/libgda-ui/data-entries/gdaui-entry-common-time.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2015 Vivien Malerba <malerba gnome-db org>
  * Copyright (C) 2010 David King <davidk openismus com>
  * Copyright (C) 2011 Murray Cumming <murrayc murrayc com>
  *
@@ -606,7 +606,7 @@ create_entry_date (GdauiEntryCommonTime *mgtim)
        
        /* button to pop up the calendar */
        wid = gtk_button_new ();
-       arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
+       arrow = gtk_image_new_from_icon_name ("go-down-symbolic", GTK_ICON_SIZE_MENU);
        gtk_container_add (GTK_CONTAINER (wid), arrow);
        gtk_box_pack_start (GTK_BOX (hb), wid, FALSE, FALSE, 0);
        gtk_widget_show_all (wid);
diff --git a/libgda-ui/data-entries/gdaui-entry-shell.c b/libgda-ui/data-entries/gdaui-entry-shell.c
index ce8ff1d..e3110f4 100644
--- a/libgda-ui/data-entries/gdaui-entry-shell.c
+++ b/libgda-ui/data-entries/gdaui-entry-shell.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2009 - 2015 Vivien Malerba <malerba gnome-db org>
  * Copyright (C) 2010 David King <davidk openismus com>
  * Copyright (C) 2011 Murray Cumming <murrayc murrayc com>
  *
@@ -172,7 +172,7 @@ gdaui_entry_shell_init (GdauiEntryShell *shell)
        gtk_widget_show (shell->priv->embedder);
 
        /* button to change the entry's state and to display that state */
-       arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
+       arrow = gtk_image_new_from_icon_name ("go-down-symbolic", GTK_ICON_SIZE_MENU);
        button = gtk_button_new ();
        gtk_container_add (GTK_CONTAINER (button), arrow);
        gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
diff --git a/libgda-ui/data-entries/widget-embedder.c b/libgda-ui/data-entries/widget-embedder.c
index 45f8c9a..a800f9c 100644
--- a/libgda-ui/data-entries/widget-embedder.c
+++ b/libgda-ui/data-entries/widget-embedder.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 David King <davidk openismus com>
- * Copyright (C) 2010 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2010 - 2015 Vivien Malerba <malerba gnome-db org>
  * Copyright (C) 2011 Murray Cumming <murrayc murrayc com>
  *
  * This library is free software; you can redistribute it and/or
@@ -204,7 +204,7 @@ widget_embedder_realize (GtkWidget *widget)
                attributes.width = allocation.width;
                attributes.height = allocation.height;
        }
-       bin->offscreen_window = gdk_window_new (gtk_widget_get_root_window (widget),
+       bin->offscreen_window = gdk_window_new (gdk_screen_get_root_window (gtk_widget_get_screen (widget)),
                                                &attributes, attributes_mask);
        gdk_window_set_user_data (bin->offscreen_window, widget);
        if (bin->child)
diff --git a/libgda-ui/gdaui-raw-grid.c b/libgda-ui/gdaui-raw-grid.c
index f3dbb46..b552f87 100644
--- a/libgda-ui/gdaui-raw-grid.c
+++ b/libgda-ui/gdaui-raw-grid.c
@@ -358,7 +358,6 @@ gdaui_raw_grid_init (GdauiRawGrid *grid)
        grid->priv->write_mode = GDAUI_DATA_PROXY_WRITE_ON_DEMAND;
 
        tree_view = GTK_TREE_VIEW (grid);
-       gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree_view), TRUE);
        gtk_tree_view_set_enable_search (GTK_TREE_VIEW (tree_view), TRUE);
        g_signal_connect (G_OBJECT (tree_view), "event",
                          G_CALLBACK (tree_view_event_cb), grid);
diff --git a/libgda-ui/gdaui-server-operation.c b/libgda-ui/gdaui-server-operation.c
index 63d5c39..46caa6b 100644
--- a/libgda-ui/gdaui-server-operation.c
+++ b/libgda-ui/gdaui-server-operation.c
@@ -1170,9 +1170,8 @@ create_table_fields_array_create_widget (GdauiServerOperation *form, const gchar
        for (col = name_col + 1; col < nbcols; col++)
                gdaui_data_selector_set_column_visible (GDAUI_DATA_SELECTOR (grid_fields), col, FALSE);
 
-       gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), grid_fields);
-       gtk_viewport_set_shadow_type (GTK_VIEWPORT (gtk_bin_get_child (GTK_BIN (sw))),
-                                     GTK_SHADOW_NONE);
+       gtk_container_add (GTK_CONTAINER (sw), grid_fields);
+       gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_NONE);
        gtk_box_pack_start (GTK_BOX (box), sw, TRUE, TRUE, 0);
 
        /* buttons to add/remove fields */
diff --git a/tools/browser/data-manager/data-widget.c b/tools/browser/data-manager/data-widget.c
index a88c43f..20c4f9e 100644
--- a/tools/browser/data-manager/data-widget.c
+++ b/tools/browser/data-manager/data-widget.c
@@ -255,9 +255,9 @@ create_or_reuse_part (DataWidget *dwid, DataSource *source, gboolean *out_reused
        part->nb = GTK_NOTEBOOK (nb);
 
        part->spinner = gtk_spinner_new ();
-       page = gtk_alignment_new (0.5, 0.5, 0., 0.);
-       gtk_container_add (GTK_CONTAINER (page), part->spinner);
-       gtk_notebook_append_page (GTK_NOTEBOOK (nb), page, NULL);
+       gtk_widget_set_halign (part->spinner, GTK_ALIGN_CENTER);
+       gtk_widget_set_valign (part->spinner, GTK_ALIGN_CENTER);
+       gtk_notebook_append_page (GTK_NOTEBOOK (nb), part->spinner, NULL);
        part->data_widget = NULL;
 
        gtk_box_pack_start (GTK_BOX (vbox), nb, TRUE, TRUE, 0);
diff --git a/tools/browser/schema-browser/table-preferences.c 
b/tools/browser/schema-browser/table-preferences.c
index e13817d..3bb572b 100644
--- a/tools/browser/schema-browser/table-preferences.c
+++ b/tools/browser/schema-browser/table-preferences.c
@@ -351,7 +351,6 @@ table_preferences_new (TableInfo *tinfo)
        treeview = ui_make_tree_view (GTK_TREE_MODEL (tpref->priv->columns_store));
        tpref->priv->columns_treeview = GTK_TREE_VIEW (treeview);
        gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
-       gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
        gtk_container_add (GTK_CONTAINER (sw), treeview);
 
        /* treeview's columns */
diff --git a/tools/common/web-server.c b/tools/common/web-server.c
index 4e01a49..8b4e9c5 100644
--- a/tools/common/web-server.c
+++ b/tools/common/web-server.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 - 2014 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2008 - 2015 Vivien Malerba <malerba gnome-db org>
  * Copyright (C) 2009 Bas Driessen <bas driessen xobas com>
  * Copyright (C) 2010 David King <davidk openismus com>
  *
@@ -345,8 +345,7 @@ web_server_new (gint port, const gchar *auth_token)
        WebServer *server;
 
        server = (WebServer*) g_object_new (WEB_TYPE_SERVER, NULL);
-       server->priv->server = soup_server_new (SOUP_SERVER_PORT, port,
-                                               SOUP_SERVER_SERVER_HEADER, "gda-sql-httpd ",
+       server->priv->server = soup_server_new (SOUP_SERVER_SERVER_HEADER, "gda-sql-httpd ",
                                                NULL);
        soup_server_add_handler (server->priv->server, NULL,
                                  (SoupServerCallback) server_callback, server, NULL);
@@ -356,7 +355,12 @@ web_server_new (gint port, const gchar *auth_token)
                server->priv->token = g_strdup (auth_token);
        }
 
-       soup_server_run_async (server->priv->server);
+       if (! soup_server_listen_local (server->priv->server, port, SOUP_SERVER_LISTEN_IPV4_ONLY, NULL)) {
+               g_object_unref (server->priv->server);
+               server->priv->server = NULL;
+               g_object_unref (server);
+               return NULL;
+       }
 
        return server;
 }


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