accessor functions in gtk3



I am currently working migrating a web browser names luakit from gtk2 to gtk3.

I have ran ito places where the code needed to changed to use accessor functions per <a 
href="https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html#id-1.6.3.3.5";> the gtk2 to gtk3 
migration guide</a>.

I have for the most part been able to use the documentation at developer.gnome.org and some search through 
google to fix the errors I have come accross. However I am currently stuck and wondering if someone can point 
me in the right direction. Below is the section of code:

widget_t *
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;
}

The error I got was that 'im_context' was no a member of the struct GtkEntry. I believe the accessor function 
that I should use is gtk_entry_im_context_filter_keypress (). However I am having a hard time trying to 
figure out how to implement it. I just want to know am I looking in the wring place? Any advice would be 
appreciated.

Thanks
Herminio


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