Skip to content

Commit

Permalink
Add API methods for controlling position policy
Browse files Browse the repository at this point in the history
Signed-off-by: Ikey Doherty <[email protected]>
  • Loading branch information
ikeydoherty committed Jun 23, 2017
1 parent 131b0b2 commit cec93eb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/popover.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,32 @@ GtkWidget *budgie_popover_new(GtkWidget *relative_to)
NULL);
}

/**
* budgie_popover_set_position_policy:
*
* Set the positioning policy employed by the popover
*
* @policy: New policy to use for positioning the popover
*/
void budgie_popover_set_position_policy(BudgiePopover *self, BudgiePopoverPositionPolicy policy)
{
g_return_if_fail(popover != NULL);
g_object_set(popover, "position-policy", policy);
}

/**
* budgie_popover_get_position_policy:
*
* Retrieve the currently active positioning policy for this popover
*
* Returns: The #BudgiePopoverPositionPolicy currently in use
*/
BudgiePopoverPositionPolicy budgie_popover_get_position_policy(BudgiePopover *self)
{
g_return_val_if_fail(popover != NULL, 0);
return self->priv->policy;
}

/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
Expand Down
7 changes: 7 additions & 0 deletions src/popover.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,15 @@ typedef enum {
#define BUDGIE_POPOVER_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS((o), BUDGIE_TYPE_POPOVER, BudgiePopoverClass))

/**
* API Methods
*/

GtkWidget *budgie_popover_new(GtkWidget *relative_to);

void budgie_popover_set_position_policy(BudgiePopover *popover, BudgiePopoverPositionPolicy policy);
BudgiePopoverPositionPolicy budgie_popover_get_position_policy(BudgiePopover *popover);

GType budgie_popover_get_type(void);

G_END_DECLS
Expand Down

0 comments on commit cec93eb

Please sign in to comment.