Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

moving app to gtk3

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
ricanlinux
Posts: 63
Joined: 2007-05-02 00:02

moving app to gtk3

#1 Post by ricanlinux »

I am working port the web browser luakit from libwebkitgtk-1.0 to libwebkit2gtk-4.0. The newer version requires I build against gtk3. So for I have been able to use google to resolve most of my compile errors. However I have one that I would like some input. I am getting this error:

Code: Select all

widgets/notebook.c:243:27: error: unknown type name ‘GtkNotebookPage’
 switch_cb(GtkNotebook *n, GtkNotebookPage* UNUSED(p), guint i, widget_t *w)
I looked and this was defined in gtk2 but it is no longer in gtk3. Does anyone have any advice on how to deal with this. Any documentation? I looked at the developer.gnome.org site and could not fins any help.

Thanks!

Iskra42463
Posts: 3
Joined: 2013-06-10 12:50

Re: moving app to gtk3

#2 Post by Iskra42463 »

That looks like a callback function for signal "switch-page" (check this). In gtk3 the second argument for this is of type GtkWidget* (see docs). You may get away with simply changing the type, since the argument **appears** to be unused.

ricanlinux
Posts: 63
Joined: 2007-05-02 00:02

Re: moving app to gtk3

#3 Post by ricanlinux »

Iskra42463 wrote:That looks like a callback function for signal "switch-page" (check this). In gtk3 the second argument for this is of type GtkWidget* (see docs). You may get away with simply changing the type, since the argument **appears** to be unused.
I am assuming you meant post links?

Iskra42463
Posts: 3
Joined: 2013-06-10 12:50

Re: moving app to gtk3

#4 Post by Iskra42463 »

switch-page in gtk2
switch-page in gtk3
You should check that that function is actually connected to this signal.

ricanlinux
Posts: 63
Joined: 2007-05-02 00:02

Re: moving app to gtk3

#5 Post by ricanlinux »

Thanks for the suggestion! I got furtther alone in my porting. I hit another road block and was looking for some more advice. The section of code that I am working on is as follows:

Code: Select all

widget_entry(widget_t *w, luakit_token_t UNUSED(token))
{
    w->index = luaH_entry_index;
    w->newindex = luaH_entry_newindex;
    w->destructor = widget_destructor;

    /* create gtk label widget as main widget */
    w->widget = gtk_entry_new();

    /* setup default settings */
    gtk_entry_set_inner_border(GTK_ENTRY(w->widget), NULL);

    g_object_connect(G_OBJECT(w->widget),
      LUAKIT_WIDGET_SIGNAL_COMMON(w)
      "signal::activate",                          G_CALLBACK(activate_cb),   w,
      "signal::key-press-event",                   G_CALLBACK(key_press_cb),  w,
      "signal::notify::cursor-position",           G_CALLBACK(position_cb),   w,
      // The following signals replace the old "signal::changed", since that
      // does not allow for the selection to be changed in it's callback.
      "swapped-signal-after::backspace",           G_CALLBACK(changed_cb),    w,
      "swapped-signal-after::delete-from-cursor",  G_CALLBACK(changed_cb),    w,
      "swapped-signal-after::insert-at-cursor",    G_CALLBACK(changed_cb),    w,
      "swapped-signal-after::paste-clipboard",     G_CALLBACK(changed_cb),    w,
      "swapped-signal::button-release-event",      G_CALLBACK(changed_cb),    w,
      NULL);

    // Further signal to replace "signal::changed"
    GtkEntry* entry = GTK_ENTRY(w->widget);
    g_object_connect(G_OBJECT(entry->im_context),
      "swapped-signal::commit", G_CALLBACK(changed_cb), w,
      NULL);

    gtk_widget_show(w->widget);
    return w;
}
I would get the following error during compile

Code: Select all

'GtkEntry' has no member named 'im_context'
I found an explanation of this error in the developer.gnome.org site it discuss the migration of gtk2 -> gtk3.: https://developer.gnome.org/gtk3/stable ... -1.6.3.3.4

I believe I need to replace 'im_context' with a member of the GtkIMContext struct here: https://developer.gnome.org/gtk3/stable ... ext-struct

However I am hitting a dead end. Am I off base? Just as full disclosure I am really new to development.

Thanks

Post Reply