pspp-dev
[Top][All Lists]
Advanced

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

[PATCH 1/2] gui: Fix Glib warnings for dialogs in realize and configure


From: Ben Pfaff
Subject: [PATCH 1/2] gui: Fix Glib warnings for dialogs in realize and configure callbacks.
Date: Sat, 9 Apr 2011 16:53:34 -0700

The GtkBuilder documentation says:

    Prior to 2.20, GtkBuilder was setting the "name" property of
    constructed widgets to the "id" attribute. In GTK+ 2.20 or newer,
    you have to use gtk_buildable_get_name() instead of
    gtk_widget_get_name() to obtain the "id", or set the "name"
    property in your UI definition.

This commit fixes the problem by switching from using the "name"
property to calling gtk_buildable_get_name().
---
 src/ui/gui/helper.c         |    5 ++---
 src/ui/gui/psppire-dialog.c |   10 ++++------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c
index a68c0c2..a85b80b 100644
--- a/src/ui/gui/helper.c
+++ b/src/ui/gui/helper.c
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2007, 2009, 2010  Free Software Foundation
+   Copyright (C) 2007, 2009, 2010, 2011  Free Software Foundation
 
    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
@@ -208,9 +208,8 @@ connect_help (GtkBuilder *xml)
       GObject *o = i->data;
       if ( GTK_IS_WIDGET (o) )
        {
-         gchar *name = NULL;
+         const gchar *name = gtk_buildable_get_name (GTK_BUILDABLE (o));
          gchar s[12] = {0};
-         g_object_get (o, "name", &name, NULL);
 
          if ( name)
            strncpy (s, name, 11);
diff --git a/src/ui/gui/psppire-dialog.c b/src/ui/gui/psppire-dialog.c
index e4d04a1..977f08e 100644
--- a/src/ui/gui/psppire-dialog.c
+++ b/src/ui/gui/psppire-dialog.c
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2007, 2010  Free Software Foundation
+   Copyright (C) 2007, 2010, 2011  Free Software Foundation
 
    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
@@ -296,14 +296,14 @@ static gboolean
 configure_event_callback (GtkDialog *dialog,
                          GdkEvent *event, gpointer data)
 {
-  gchar *base = NULL;
+  const gchar *base;
 
   PsppireConf *conf = psppire_conf_new ();
 
   if ( ! GTK_WIDGET_MAPPED (dialog))
     return FALSE;
 
-  g_object_get (dialog, "name", &base, NULL);
+  base = gtk_buildable_get_name (GTK_BUILDABLE (dialog));
 
   psppire_conf_save_window_geometry (conf, base, GTK_WINDOW (dialog));
 
@@ -316,9 +316,7 @@ on_realize (GtkWindow *dialog, gpointer data)
 {
   PsppireConf *conf = psppire_conf_new ();
 
-  const gchar *base = NULL;
-
-  g_object_get (dialog, "name", &base, NULL);
+  const gchar *base = gtk_buildable_get_name (GTK_BUILDABLE (dialog));
 
   psppire_conf_set_window_geometry (conf, base, dialog);
 }
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]