[Solved] getting rid of libgnomeui in gnome-commander

Hi all,

in the last couple of weeks I spent a lot of time getting rid of libgnome in the gnome-commander (gcmd) project. But still, libgnomeui is a dependency which I want to remove from the project as well. I have the impression that this is a relatively small effort, but I would need some help because I came to a point where I don’t know what to do… Let me describe the issue:

As you can see in main.cc, gcmd is still using gnome_program_init. I tried to get rid of this usage with the help of a commit in another gnome project, where the gtk_init_with_args method is used instead. But after compilation of the changed source and firing up gcmd, I get the following error message in the terminal:

gnome-commander:3374): GnomeUI-ERROR **: 20:29:32.303: You must call gnome_program_init() before creating a GnomeApp
Trace/breakpoint trap (Speicherabzug geschrieben)

As far as I figured out the reason for this is that the class GnomeCmdMainWin, which is initiated in main.cc in line 185 is using GnomeApp as a base class. And here my problem starts… How can I get rid of this base class? I cannot find a migration guide for this outdated usage nor do I have an idea which gtk class I can use instead of it.

The class_init function of GnomeCmdMainWin itself also uses several gnome_app methods from the header file libgnomeui/gnome-app-helper.h. But as said, I don’t know how to migrate to a similar gtk replacement. Any help, or a code example which I can use as a base for doing the last step before getting rid of libgnomeui would be highly appreciated. Please help me in getting rid of this old library.

Thanks in advance

gnome-cmd-main-win.cc doesn’t seem to use GnomeApp much at all

In fact it looks like you can simply use GtkWindow instead with really very little work

Hey Zander,

I have tried that, but simply replacing GnomeApp with GtkWindow seems to be not sufficient.

When replacing GnomeApp with GtkWindow in gnome-cmd-main-win.h and gnome-cmd-main-win.cc, and when commenting out gnome_app_construct(...) and gnome_app_set_contents(...) in the latter file, I get an empty app window when firing up gcmd:

Seems like the commented out methods are needed. But I could not find a replacement for them.

Wait, I think I solved it… With the help of that commit.

Now after simply adding

gtk_window_set_title ((GtkWindow *) mw, gcmd_owner.is_root() ? _("GNOME Commander — ROOT PRIVILEGES") :
                                                                                 _("GNOME Commander"));


gtk_widget_show (mw->priv->vbox);
gtk_container_add ((GtkContainer *) mw, mw->priv->vbox);

as replacements, I can see all widgets as expected. Awesome. Thanks :smiley:

I think we can consider this as resolved… :+1:

Like I said, pretty simple :slight_smile:

(note the correct cast is GTK_WINDOW (mw) / GTK_CONTAINER (mw))

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.