qulogic/libgnt

Add getter for GntWindow struct members.
release-2.x.y
2019-04-06, Elliott Sales de Andrade
b3d988638ca1
Parents 5c1f4abb169b
Children 7dd03b1bd21f
Add getter for GntWindow struct members.
  • +8 -0
    gntwindow.c
  • +12 -0
    gntwindow.h
  • +1 -1
    gntwm.c
  • --- a/gntwindow.c Mon Apr 08 04:20:38 2019 -0400
    +++ b/gntwindow.c Sat Apr 06 06:05:21 2019 -0400
    @@ -209,6 +209,14 @@
    }
    }
    +GntMenu *
    +gnt_window_get_menu(GntWindow *window)
    +{
    + g_return_val_if_fail(GNT_IS_WINDOW(window), NULL);
    +
    + return window->menu;
    +}
    +
    const char * gnt_window_get_accel_item(GntWindow *window, const char *key)
    {
    if (window->priv->accels)
    --- a/gntwindow.h Mon Apr 08 04:20:38 2019 -0400
    +++ b/gntwindow.h Sat Apr 06 06:05:21 2019 -0400
    @@ -107,6 +107,18 @@
    void gnt_window_set_menu(GntWindow *window, GntMenu *menu);
    /**
    + * gnt_window_get_menu:
    + * @window: The window.
    + *
    + * Get the menu for a window.
    + *
    + * Returns: (transfer none) (nullable): The menu for the window.
    + *
    + * Since: 2.9.0
    + */
    +GntMenu *gnt_window_get_menu(GntWindow *window);
    +
    +/**
    * Return the id of a menuitem specified to a keystroke.
    *
    * @param window The window.
    --- a/gntwm.c Mon Apr 08 04:20:38 2019 -0400
    +++ b/gntwm.c Sat Apr 06 06:05:21 2019 -0400
    @@ -2048,7 +2048,7 @@
    else if (wm->cws->ordered) {
    GntWidget *win = wm->cws->ordered->data;
    if (GNT_IS_WINDOW(win)) {
    - GntMenu *menu = GNT_WINDOW(win)->menu;
    + GntMenu *menu = gnt_window_get_menu(GNT_WINDOW(win));
    if (menu) {
    const char *id = gnt_window_get_accel_item(GNT_WINDOW(win), keys);
    if (id) {