After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 463010 - Port gnome-screensaver from libglade to gtkbuilder
Port gnome-screensaver from libglade to gtkbuilder
Status: RESOLVED FIXED
Product: gnome-screensaver
Classification: Deprecated
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-screensaver maintainers
gnome-screensaver maintainers
Depends on:
Blocks: 572883
 
 
Reported: 2007-08-03 06:59 UTC by christopher taylor
Modified: 2009-08-21 02:33 UTC
See Also:
GNOME target: ---
GNOME version: 2.27/2.28


Attachments
patch (142.29 KB, patch)
2007-08-03 07:00 UTC, christopher taylor
needs-work Details | Review
updated patch (72.63 KB, patch)
2007-08-28 12:55 UTC, christopher taylor
none Details | Review
New patch (142.81 KB, patch)
2007-08-28 14:47 UTC, christopher taylor
none Details | Review
Updated patch, should compile fine against svn (141.37 KB, patch)
2008-02-14 22:41 UTC, christopher taylor
needs-work Details | Review
Updated patch (165.35 KB, patch)
2009-07-05 13:54 UTC, christopher taylor
needs-work Details | Review
Remove some unused files (51.76 KB, patch)
2009-07-16 19:55 UTC, Javier Jardón (IRC: jjardon)
none Details | Review

Description christopher taylor 2007-08-03 06:59:32 UTC
Please describe the problem:
I'll attach a patch to port gnome-screensaver to the new gtkbuilder.

Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 christopher taylor 2007-08-03 07:00:22 UTC
Created attachment 92966 [details] [review]
patch

Any comments are welcome.
Comment 2 William Jon McCann 2007-08-27 22:55:13 UTC
Cool.  Thanks for working on this.  I'd like to get this in early in the next development cycle.

I haven't had time to play with GtkBuilder yet so the only comment I have so far on the patch is that the indentation seems to be inconsistent with the style of the files.  Hopefully that should be easy to fix (the emacs mode thingy should make that simple).

If you can fix that up we'll get this in right after we branch.  Thanks!
Comment 3 christopher taylor 2007-08-28 12:55:14 UTC
Created attachment 94501 [details] [review]
updated patch

I eliminated the indentation inconsistency.
Comment 4 christopher taylor 2007-08-28 14:47:14 UTC
Created attachment 94506 [details] [review]
New patch

This one should work again.
Comment 5 William Jon McCann 2007-11-09 22:42:00 UTC
Is there a good gui tool to use to work with gtkbuilder files?
Comment 6 Luis Menina 2007-12-10 01:24:48 UTC
Well, isn't glade 3 appropriate ?
Oh, and one remark about the patch: it should check for (ui == NULL) before using it (src/gnome-screensaver-preferences.c and src/gs-lock-plug.c).
Comment 7 João Matos 2008-02-13 02:36:47 UTC
Status on this?
Comment 8 christopher taylor 2008-02-14 22:41:56 UTC
Created attachment 105291 [details] [review]
Updated patch, should compile fine against svn
Comment 9 Luis Menina 2008-02-23 13:27:11 UTC
There's still some indentation issues. Oh, and while you're at it, as I told you previously, xml loading should be checked before it's used, unless you consided it's a separate problem that you're patch is not supposed to fix.

This code:
==========
xml = gtk_builder_new ();
gtk_builder_add_from_file (xml, gtkbuilder, &error);
gtk_builder_set_translation_domain(xml, GETTEXT_PACKAGE);
 
if (xml == NULL) {
       /* Some error management */
       return FALSE;
}


Would be better written:
========================
xml = gtk_builder_new ();
if (xml == NULL) {
       /* Some error management */
       return FALSE;
}

gtk_builder_add_from_file (xml, gtkbuilder, &error);
gtk_builder_set_translation_domain (xml, GETTEXT_PACKAGE);
Comment 10 Bastien Nocera 2008-12-12 13:14:12 UTC
And that's not needed, and would break with the single-include GTK+
-#include <glade/glade-xml.h>
+#include <gtk/gtkbuilder.h>
Comment 11 Luis Menina 2008-12-12 22:08:34 UTC
Yep, should be :
-#include <glade/glade-xml.h>
+#include <gtk/gtk.h>

But at the time the patch was written, I'm not sure this was an official policy :-)
Comment 12 Luca Ferretti 2009-01-06 22:35:42 UTC
Two notes:
 * some modules, for instance nautilus, prepends "[type: gettext/glade]" to
   GtkBuilder file in POTFILES.in (dunno if this is required, suggested or else)
 * why not direclty jump to GTK+ 2.16 and use new GtkEntry features such as 
   CapsLock warning and "gtk-stock-authenticate" as primary icon
   (see this[1])?

> Is there a good gui tool to use to work with gtkbuilder files?

Latest glade3 supports all gtkbuilder feautures (except some advanced stuff not needed by gnome-screensaver) so IMHO there are no more issues to perform this switch in 2.26 release.

Of course this will break existing themes, so you need to add some good updating guide: "Pick up glade3 version 3.5.x. Open your theme. Save choosing GtkBuilder instead glade" (needs to be tested, of course).

BTW there is a theme creation guide on live.gnome.org or elsewhere?

[1] http://svn.gnome.org/viewvc/gtk%2B/trunk/tests/testentryicons.c
Comment 13 Luca Ferretti 2009-01-10 09:53:51 UTC
(In reply to comment #12)

>  * why not direclty jump to GTK+ 2.16 and use new GtkEntry features such as 
>    CapsLock warning and "gtk-stock-authenticate" as primary icon
>    (see this[1])?
> 

It seems that CapsLock warning is automatically added to GtkEntries using invisible characters.
Comment 14 André Klapper 2009-05-05 12:17:00 UTC
ping.
Comment 15 André Klapper 2009-05-15 15:14:03 UTC
Someone willing to come up with an updated patch?
Comment 16 christopher taylor 2009-07-05 13:54:49 UTC
Created attachment 137876 [details] [review]
Updated patch

Any comments?
Comment 17 Jaap A. Haitsma 2009-07-12 14:47:46 UTC
Patch looks good but needs a couple of changes

1) Prepend "[type: gettext/glade]" to GtkBuilder file in POTFILES.in

2) Please take a look at indentation. gnome-screensaver uses identation of 8 spaces it doest not use tabs.

A couple of examples
-----
-static GladeXML       *xml = NULL;
+static GtkBuilder       *builder = NULL;
 static GSThemeManager *theme_manager = NULL;
-------
+        if (!gtk_builder_add_from_file (builder,filename ,&error)) {
+                g_warning ("Couldn't load builder file: %s", error->message);
+		g_error_free(error);
+                g_free (gtkbuilder);
                 return FALSE;
         }

------
+	if (!gtk_builder_add_from_file(builder, gtk_builder_file, &error))
+		{
+			g_warning("Couldn't load builder file: %s", error->message);
+			g_error_free(error);
+		}	
+        g_free (gtk_builder_file);
------ 
gnome-screensaver uses 
if (blah) {
        do_something ();
}
-----------

At the top of each sourcefile there is
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-

When you use an editor that supports that syntax such as vim or gedit it will make sure automatically that you have the right indentation

Comment 18 Matthias Clasen 2009-07-16 19:17:54 UTC
Committed with those cleanups (since I need the GtkBuilder conversion for something else)
Comment 19 Javier Jardón (IRC: jjardon) 2009-07-16 19:55:10 UTC
Created attachment 138556 [details] [review]
Remove some unused files

I've reopened this bug because there are some unused files after the port
Comment 20 Claude Paroz 2009-08-17 21:14:30 UTC
Shouldn't $(glade_DATA) be replaced by $(gtkbuilder_DATA) ?
Except of that, I suppose your patch is right. If noone complains, I suggest you commit it.
Comment 21 William Jon McCann 2009-08-21 02:33:05 UTC
Should be fixed now.  Thanks.