Skip to content

Commit

Permalink
Add new enum for poppover positioning
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 dd63bd9 commit 48946c4
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 11 deletions.
12 changes: 1 addition & 11 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,4 @@ gnome_minimum_version = '>= 3.18.0'

dep_gtk3 = dependency('gtk+-3.0', version: gnome_minimum_version)


executable(
'popover-test',
[
'src/popover.c',
'src/popover-manager.c',
'src/main.c',
],
dependencies: [dep_gtk3],
install: false,
)
subdir('src')
35 changes: 35 additions & 0 deletions src/budgie-enums.c.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*** BEGIN file-header ***/
#include "budgie-enums.h"

/*** END file-header ***/

/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/

/*** BEGIN value-header ***/
GType
@enum_name@_get_type (void)
{
static GType etype = 0;
if (G_UNLIKELY(etype == 0)) {
static const G@Type@Value values[] = {
/*** END value-header ***/

/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/

/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
etype = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
}
return etype;
}

/*** END value-tail ***/

/*** BEGIN file-tail ***/

/*** END file-tail ***/
25 changes: 25 additions & 0 deletions src/budgie-enums.h.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*** BEGIN file-header ***/

#pragma once

#include <glib-object.h>

#include "popover.h"

G_BEGIN_DECLS
/*** END file-header ***/

/*** BEGIN file-production ***/

/* enumerations from "@filename@" */
/*** END file-production ***/

/*** BEGIN value-header ***/
GType @enum_name@_get_type (void) G_GNUC_CONST;
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/

/*** BEGIN file-tail ***/
G_END_DECLS

/*** END file-tail ***/
33 changes: 33 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
gnome = import('gnome')

# Generate enums for gobject typing
plugin_enums = gnome.mkenums(
'budgie-enums',
sources: 'popover.h',
c_template: 'budgie-enums.c.template',
h_template: 'budgie-enums.h.template',
install_header: false,
)

# Fight meson race conditions..
libenum = static_library(
'enum',
plugin_enums,
dependencies: dep_gtk3,
)

link_libenum = declare_dependency(
sources: plugin_enums,
include_directories: include_directories('.'),
)

executable(
'popover-test',
[
'popover.c',
'popover-manager.c',
'main.c',
],
dependencies: [dep_gtk3, link_libenum],
install: false,
)
5 changes: 5 additions & 0 deletions src/popover.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ struct _BudgiePopover {
BudgiePopoverPrivate *priv;
};

typedef enum {
BUDGIE_POPOVER_POSITION_AUTOMATIC = 1 << 0,
BUDGIE_POPOVER_POSITION_TOPLEVEL_HINT = 1 << 0,
} BudgiePopoverPositionPolicy;

#define BUDGIE_TYPE_POPOVER budgie_popover_get_type()
#define BUDGIE_POPOVER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BUDGIE_TYPE_POPOVER, BudgiePopover))
#define BUDGIE_IS_POPOVER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BUDGIE_TYPE_POPOVER))
Expand Down

0 comments on commit 48946c4

Please sign in to comment.