summaryrefslogtreecommitdiff
path: root/libmenu
diff options
context:
space:
mode:
Diffstat (limited to 'libmenu')
-rw-r--r--libmenu/desktop-entries.c1
-rw-r--r--libmenu/desktop-entries.h1
-rw-r--r--libmenu/entry-directories.c4
-rw-r--r--libmenu/entry-directories.h1
-rw-r--r--libmenu/matemenu-tree.c139
-rw-r--r--libmenu/matemenu-tree.h1
-rw-r--r--libmenu/menu-layout.c9
-rw-r--r--libmenu/menu-layout.h1
-rw-r--r--libmenu/menu-monitor.c4
-rw-r--r--libmenu/menu-monitor.h1
-rw-r--r--libmenu/menu-util.c6
-rw-r--r--libmenu/menu-util.h22
-rw-r--r--libmenu/meson.build72
13 files changed, 177 insertions, 85 deletions
diff --git a/libmenu/desktop-entries.c b/libmenu/desktop-entries.c
index 820f3ea..2cbe385 100644
--- a/libmenu/desktop-entries.c
+++ b/libmenu/desktop-entries.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2002 - 2004 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/libmenu/desktop-entries.h b/libmenu/desktop-entries.h
index 5878068..75827f1 100644
--- a/libmenu/desktop-entries.h
+++ b/libmenu/desktop-entries.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2002 - 2004 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/libmenu/entry-directories.c b/libmenu/entry-directories.c
index 7ebbb0f..3970c95 100644
--- a/libmenu/entry-directories.c
+++ b/libmenu/entry-directories.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2002 - 2004 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,6 +18,9 @@
* Boston, MA 02110-1301, USA.
*/
+/* used for realpath() */
+#define _XOPEN_SOURCE 500
+
#include <config.h>
#include "entry-directories.h"
diff --git a/libmenu/entry-directories.h b/libmenu/entry-directories.h
index c1d159a..0bf8215 100644
--- a/libmenu/entry-directories.h
+++ b/libmenu/entry-directories.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2002 - 2004 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/libmenu/matemenu-tree.c b/libmenu/matemenu-tree.c
index 370025b..0260a6d 100644
--- a/libmenu/matemenu-tree.c
+++ b/libmenu/matemenu-tree.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2003, 2004 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,6 +18,9 @@
* Boston, MA 02110-1301, USA.
*/
+/* used for realpath() */
+#define _XOPEN_SOURCE 500
+
#include <config.h>
#include "matemenu-tree.h"
@@ -47,6 +51,7 @@ enum {
PROP_FLAGS
};
+#ifdef WITH_COLLECTION
typedef enum
{
OBJECT_DRAWER,
@@ -57,6 +62,7 @@ typedef enum
OBJECT_MENU_BAR,
OBJECT_SEPARATOR,
} ObjectType;
+#endif /* WITH_COLLECTION */
/* Signals */
enum
@@ -75,7 +81,13 @@ struct _MateMenuTree
char *non_prefixed_basename;
char *path;
char *canonical_path;
+
+#ifdef WITH_COLLECTION
GPtrArray *collection_applet;
+ GSettings *settings;
+ guint emit_changed_signal;
+#endif /* WITH_COLLECTION */
+
MateMenuTreeFlags flags;
GSList *menu_file_monitors;
@@ -86,7 +98,6 @@ struct _MateMenuTree
guint canonical : 1;
guint loaded : 1;
- GSettings *settings;
};
G_DEFINE_TYPE (MateMenuTree, matemenu_tree, G_TYPE_OBJECT)
@@ -179,9 +190,11 @@ static void matemenu_tree_invoke_monitors (MateMenuTree *tree);
static void matemenu_tree_item_unref_and_unset_parent (gpointer itemp);
+#ifdef WITH_COLLECTION
static void collection_applet_changed (GSettings *settings,
gchar *key,
MateMenuTree *self);
+#endif /* WITH_COLLECTION */
typedef enum
{
@@ -635,20 +648,28 @@ matemenu_tree_finalize (GObject *object)
g_hash_table_destroy (tree->entries_by_id);
tree->entries_by_id = NULL;
+
+#ifdef WITH_COLLECTION
if (tree->collection_applet != NULL)
{
- g_ptr_array_foreach (tree->collection_applet, (GFunc) g_free, NULL);
g_ptr_array_free (tree->collection_applet, TRUE);
tree->collection_applet = NULL;
}
+
g_signal_handlers_disconnect_by_func (tree->settings,
G_CALLBACK (collection_applet_changed),
tree);
g_object_unref (tree->settings);
+ if (tree->emit_changed_signal != 0)
+ g_source_remove (tree->emit_changed_signal);
+ tree->emit_changed_signal = 0;
+#endif /* WITH_COLLECTION */
+
G_OBJECT_CLASS (matemenu_tree_parent_class)->finalize (object);
}
+#ifdef WITH_COLLECTION
static void
load_object (char *id,
MateMenuTree *self)
@@ -667,7 +688,7 @@ load_object (char *id,
char *desktop_name;
if (self->collection_applet == NULL)
- self->collection_applet = g_ptr_array_new ();
+ self->collection_applet = g_ptr_array_new_with_free_func ((GDestroyNotify) g_free);
location = g_settings_get_string (settings, "launcher-location");
desktop_name = g_path_get_basename (location);
@@ -691,6 +712,8 @@ static gboolean
emit_changed_signal (gpointer data)
{
MateMenuTree *self = data;
+ self->emit_changed_signal = 0;
+
matemenu_tree_force_rebuild (self);
matemenu_tree_invoke_monitors (self);
@@ -718,24 +741,28 @@ collection_applet_changed (GSettings *settings,
{
if (self->collection_applet != NULL)
{
- g_ptr_array_foreach (self->collection_applet, (GFunc) g_free, NULL);
g_ptr_array_free (self->collection_applet, TRUE);
self->collection_applet = NULL;
}
get_panel_collection_applet (self);
- g_idle_add (emit_changed_signal, (gpointer)self);
+ if (self->emit_changed_signal == 0)
+ self->emit_changed_signal = g_idle_add (emit_changed_signal, (gpointer)self);
}
+#endif /* WITH_COLLECTION */
static void
matemenu_tree_init (MateMenuTree *self)
{
self->entries_by_id = g_hash_table_new (g_str_hash, g_str_equal);
+#ifdef WITH_COLLECTION
self->collection_applet = NULL;
self->settings = g_settings_new ("org.mate.panel");
get_panel_collection_applet (self);
g_signal_connect (self->settings, "changed::object-id-list",
G_CALLBACK (collection_applet_changed),
self);
+ self->emit_changed_signal = 0;
+#endif /* WITH_COLLECTION */
}
static void
@@ -1078,8 +1105,7 @@ matemenu_tree_iter_unref (MateMenuTreeIter *iter)
if (!g_atomic_int_dec_and_test (&iter->refcount))
return;
- g_slist_foreach (iter->contents, (GFunc)matemenu_tree_item_unref, NULL);
- g_slist_free (iter->contents);
+ g_slist_free_full (iter->contents, (GDestroyNotify)matemenu_tree_item_unref);
g_slice_free (MateMenuTreeIter, iter);
}
@@ -1588,34 +1614,24 @@ matemenu_tree_directory_finalize (MateMenuTreeDirectory *directory)
{
g_assert (directory->item.refcount == 0);
- g_slist_foreach (directory->contents,
- (GFunc) matemenu_tree_item_unref_and_unset_parent,
- NULL);
- g_slist_free (directory->contents);
+ g_slist_free_full (directory->contents,
+ (GDestroyNotify) matemenu_tree_item_unref_and_unset_parent);
directory->contents = NULL;
- g_slist_foreach (directory->default_layout_info,
- (GFunc) menu_layout_node_unref,
- NULL);
- g_slist_free (directory->default_layout_info);
+ g_slist_free_full (directory->default_layout_info,
+ (GDestroyNotify) menu_layout_node_unref);
directory->default_layout_info = NULL;
- g_slist_foreach (directory->layout_info,
- (GFunc) menu_layout_node_unref,
- NULL);
- g_slist_free (directory->layout_info);
+ g_slist_free_full (directory->layout_info,
+ (GDestroyNotify) menu_layout_node_unref);
directory->layout_info = NULL;
- g_slist_foreach (directory->subdirs,
- (GFunc) matemenu_tree_item_unref_and_unset_parent,
- NULL);
- g_slist_free (directory->subdirs);
+ g_slist_free_full (directory->subdirs,
+ (GDestroyNotify) matemenu_tree_item_unref_and_unset_parent);
directory->subdirs = NULL;
- g_slist_foreach (directory->entries,
- (GFunc) matemenu_tree_item_unref_and_unset_parent,
- NULL);
- g_slist_free (directory->entries);
+ g_slist_free_full (directory->entries,
+ (GDestroyNotify) matemenu_tree_item_unref_and_unset_parent);
directory->entries = NULL;
if (directory->directory_entry)
@@ -1790,14 +1806,13 @@ matemenu_tree_entry_compare_by_id (MateMenuTreeItem *a,
gpointer
matemenu_tree_item_ref (gpointer itemp)
{
- MateMenuTreeItem* item = (MateMenuTreeItem*) itemp;
-
- g_return_val_if_fail(item != NULL, NULL);
- g_return_val_if_fail(item->refcount > 0, NULL);
+ MateMenuTreeItem* item = (MateMenuTreeItem*) itemp;
+ g_return_val_if_fail(item != NULL, NULL);
+ g_return_val_if_fail(item->refcount > 0, NULL);
g_atomic_int_inc (&item->refcount);
- return item;
+ return item;
}
void
@@ -1897,15 +1912,12 @@ matemenu_tree_item_compare_get_name_helper (MateMenuTreeItem *item,
}
static int
-matemenu_tree_item_compare (MateMenuTreeItem *a,
- MateMenuTreeItem *b,
- gpointer flags_p)
+matemenu_tree_item_compare (MateMenuTreeItem *a,
+ MateMenuTreeItem *b,
+ MateMenuTreeFlags flags)
{
const char *name_a;
const char *name_b;
- MateMenuTreeFlags flags;
-
- flags = GPOINTER_TO_INT (flags_p);
name_a = matemenu_tree_item_compare_get_name_helper (a, flags);
name_b = matemenu_tree_item_compare_get_name_helper (b, flags);
@@ -2628,8 +2640,7 @@ add_menu_for_legacy_dir (MenuLayoutNode *parent,
desktop_entry_set_unref (desktop_entries);
- g_slist_foreach (subdirs, (GFunc) g_free, NULL);
- g_slist_free (subdirs);
+ g_slist_free_full (subdirs, (GDestroyNotify) g_free);
return menu_added;
}
@@ -3243,6 +3254,7 @@ get_by_category_foreach (const char *file_id,
desktop_entry_set_add_entry (data->set, entry, file_id);
}
+#ifdef WITH_COLLECTION
static void
get_by_desktop_foreach (const char *file_id,
DesktopEntry *entry,
@@ -3251,6 +3263,7 @@ get_by_desktop_foreach (const char *file_id,
if (g_strcmp0 (file_id, data->category) == 0)
desktop_entry_set_add_entry (data->set, entry, file_id);
}
+#endif /* WITH_COLLECTION */
static void
get_by_category (DesktopEntrySet *entry_pool,
@@ -3267,6 +3280,7 @@ get_by_category (DesktopEntrySet *entry_pool,
&data);
}
+#ifdef WITH_COLLECTION
static void
get_by_desktop (DesktopEntrySet *entry_pool,
DesktopEntrySet *set,
@@ -3281,6 +3295,7 @@ get_by_desktop (DesktopEntrySet *entry_pool,
(DesktopEntrySetForeachFunc) get_by_desktop_foreach,
&data);
}
+#endif /* WITH_COLLECTION */
static DesktopEntrySet *
process_include_rules (MenuLayoutNode *layout,
@@ -3574,7 +3589,6 @@ process_layout (MateMenuTree *tree,
menu_verbose ("=== Menu name = %s ===\n", directory->name);
-
deleted = FALSE;
only_unallocated = FALSE;
@@ -3790,6 +3804,8 @@ process_layout (MateMenuTree *tree,
matemenu_tree_item_unref (directory);
return NULL;
}
+
+#ifdef WITH_COLLECTION
if (tree->collection_applet && !g_strcmp0 (directory->name, "Collection"))
{
guint i;
@@ -3799,6 +3815,7 @@ process_layout (MateMenuTree *tree,
get_by_desktop (entry_pool, entries, desktop_name);
}
}
+#endif /* WITH_COLLECTION */
desktop_entry_set_foreach (entries,
(DesktopEntrySetForeachFunc) entries_listify_foreach,
@@ -4095,10 +4112,8 @@ preprocess_layout_info_subdir_helper (MateMenuTree *tree,
alias = matemenu_tree_alias_new (directory, subdir, item);
- g_slist_foreach (list,
- (GFunc) matemenu_tree_item_unref_and_unset_parent,
- NULL);
- g_slist_free (list);
+ g_slist_free_full (list,
+ (GDestroyNotify) matemenu_tree_item_unref_and_unset_parent);
subdir->subdirs = NULL;
subdir->entries = NULL;
@@ -4505,8 +4520,8 @@ merge_subdirs (MateMenuTree *tree,
directory->subdirs = NULL;
subdirs = g_slist_sort_with_data (subdirs,
- (GCompareDataFunc) matemenu_tree_item_compare,
- GINT_TO_POINTER (MATEMENU_TREE_FLAGS_NONE));
+ (GCompareDataFunc) matemenu_tree_item_compare,
+ (void *) MATEMENU_TREE_FLAGS_NONE);
tmp = subdirs;
while (tmp != NULL)
@@ -4551,7 +4566,7 @@ merge_entries (MateMenuTree *tree,
entries = g_slist_sort_with_data (entries,
(GCompareDataFunc) matemenu_tree_item_compare,
- GINT_TO_POINTER (tree->flags));
+ (void *) tree->flags);
tmp = entries;
while (tmp != NULL)
@@ -4599,8 +4614,8 @@ merge_subdirs_and_entries (MateMenuTree *tree,
directory->entries = NULL;
items = g_slist_sort_with_data (items,
- (GCompareDataFunc) matemenu_tree_item_compare,
- GINT_TO_POINTER (tree->flags));
+ (GCompareDataFunc) matemenu_tree_item_compare,
+ (void *) tree->flags);
tmp = items;
while (tmp != NULL)
@@ -4818,28 +4833,20 @@ process_layout_info (MateMenuTree *tree,
}
}
- g_slist_foreach (directory->subdirs,
- (GFunc) matemenu_tree_item_unref,
- NULL);
- g_slist_free (directory->subdirs);
+ g_slist_free_full (directory->subdirs,
+ matemenu_tree_item_unref);
directory->subdirs = NULL;
- g_slist_foreach (directory->entries,
- (GFunc) matemenu_tree_item_unref,
- NULL);
- g_slist_free (directory->entries);
+ g_slist_free_full (directory->entries,
+ matemenu_tree_item_unref);
directory->entries = NULL;
- g_slist_foreach (directory->default_layout_info,
- (GFunc) menu_layout_node_unref,
- NULL);
- g_slist_free (directory->default_layout_info);
+ g_slist_free_full (directory->default_layout_info,
+ (GDestroyNotify) menu_layout_node_unref);
directory->default_layout_info = NULL;
- g_slist_foreach (directory->layout_info,
- (GFunc) menu_layout_node_unref,
- NULL);
- g_slist_free (directory->layout_info);
+ g_slist_free_full (directory->layout_info,
+ (GDestroyNotify) menu_layout_node_unref);
directory->layout_info = NULL;
}
diff --git a/libmenu/matemenu-tree.h b/libmenu/matemenu-tree.h
index 3fd3260..a5ba712 100644
--- a/libmenu/matemenu-tree.h
+++ b/libmenu/matemenu-tree.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2004 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/libmenu/menu-layout.c b/libmenu/menu-layout.c
index fd5c830..f51ef24 100644
--- a/libmenu/menu-layout.c
+++ b/libmenu/menu-layout.c
@@ -2,6 +2,7 @@
/*
* Copyright (C) 2002 - 2004 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -120,7 +121,6 @@ typedef struct
gpointer user_data;
} MenuLayoutNodeEntriesMonitor;
-
static inline MenuLayoutNode *
node_next (MenuLayoutNode *node)
{
@@ -1129,7 +1129,6 @@ menu_layout_node_root_remove_entries_monitor (MenuLayoutNode *
}
}
-
/*
* Menu file parsing
*/
@@ -1171,7 +1170,6 @@ static void passthrough_handler (GMarkupParseContext *context,
gpointer user_data,
GError **error);
-
static GMarkupParser menu_funcs = {
start_element_handler,
end_element_handler,
@@ -1582,7 +1580,6 @@ start_matching_rule_element (MenuParser *parser,
error))
return;
-
if (ELEMENT_IS ("Filename"))
{
push_node (parser, MENU_LAYOUT_NODE_FILENAME);
@@ -2166,6 +2163,8 @@ end_element_handler (GMarkupParseContext *context,
if (!fixup_move_node (context, parser, parser->stack_top, error))
goto out;
break;
+ default:
+ g_assert_not_reached();
}
out:
@@ -2251,6 +2250,8 @@ text_handler (GMarkupParseContext *context,
g_markup_parse_context_get_element (context));
}
break;
+ default:
+ g_assert_not_reached();
}
add_context_to_error (error, context);
diff --git a/libmenu/menu-layout.h b/libmenu/menu-layout.h
index 3cfdcbc..127f788 100644
--- a/libmenu/menu-layout.h
+++ b/libmenu/menu-layout.h
@@ -2,6 +2,7 @@
/*
* Copyright (C) 2002 - 2004 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/libmenu/menu-monitor.c b/libmenu/menu-monitor.c
index 48215c5..ca52403 100644
--- a/libmenu/menu-monitor.c
+++ b/libmenu/menu-monitor.c
@@ -3,6 +3,7 @@
* Copyright (C) 2006 Mark McLoughlin
* Copyright (C) 2007 Sebastian Dröge
* Copyright (C) 2008 Vincent Untz
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -377,12 +378,13 @@ static void mate_menu_monitor_notify_unref(MenuMonitorNotify* notify)
void menu_monitor_add_notify(MenuMonitor* monitor, MenuMonitorNotifyFunc notify_func, gpointer user_data)
{
+ GSList* tmp;
MenuMonitorNotify* notify;
g_return_if_fail(monitor != NULL);
g_return_if_fail(notify_func != NULL);
- GSList* tmp = monitor->notifies;
+ tmp = monitor->notifies;
while (tmp != NULL)
{
diff --git a/libmenu/menu-monitor.h b/libmenu/menu-monitor.h
index 868bc89..93d1638 100644
--- a/libmenu/menu-monitor.h
+++ b/libmenu/menu-monitor.h
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2011 Perberos
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/libmenu/menu-util.c b/libmenu/menu-util.c
index 9d92dc1..94d9968 100644
--- a/libmenu/menu-util.c
+++ b/libmenu/menu-util.c
@@ -2,6 +2,7 @@
/*
* Copyright (C) 2003 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -26,7 +27,6 @@
#include <stdio.h>
#include <stdarg.h>
-
#ifdef G_ENABLE_DEBUG
static gboolean verbose = FALSE;
@@ -177,7 +177,7 @@ static void append_layout(MenuLayoutNode* node, int depth, const char* node_name
layout_values->inline_menus ? "true" : "false",
layout_values->inline_header ? "true" : "false",
layout_values->inline_alias ? "true" : "false",
- layout_values->inline_limit,
+ (gint) layout_values->inline_limit,
escaped,
node_name);
@@ -193,7 +193,7 @@ static void append_layout(MenuLayoutNode* node, int depth, const char* node_name
layout_values->inline_menus ? "true" : "false",
layout_values->inline_header ? "true" : "false",
layout_values->inline_alias ? "true" : "false",
- layout_values->inline_limit);
+ (gint) layout_values->inline_limit);
}
}
diff --git a/libmenu/menu-util.h b/libmenu/menu-util.h
index 3496b27..ea50f71 100644
--- a/libmenu/menu-util.h
+++ b/libmenu/menu-util.h
@@ -2,6 +2,7 @@
/*
* Copyright (C) 2003 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -31,21 +32,20 @@ G_BEGIN_DECLS
#ifdef G_ENABLE_DEBUG
- void menu_verbose(const char* format, ...) G_GNUC_PRINTF(1, 2);
-
- void menu_debug_print_layout(MenuLayoutNode* node, gboolean onelevel);
+void menu_verbose(const char* format, ...) G_GNUC_PRINTF(1, 2);
+void menu_debug_print_layout(MenuLayoutNode* node, gboolean onelevel);
#else /* !defined(G_ENABLE_DEBUG) */
- #ifdef G_HAVE_ISO_VARARGS
- #define menu_verbose(...)
- #elif defined(G_HAVE_GNUC_VARARGS)
- #define menu_verbose(format...)
- #else
- #error "Cannot disable verbose mode due to lack of varargs macros"
- #endif
+#ifdef G_HAVE_ISO_VARARGS
+#define menu_verbose(...)
+#elif defined(G_HAVE_GNUC_VARARGS)
+#define menu_verbose(format...)
+#else
+#error "Cannot disable verbose mode due to lack of varargs macros"
+#endif
- #define menu_debug_print_layout(n, o)
+#define menu_debug_print_layout(n, o)
#endif /* G_ENABLE_DEBUG */
diff --git a/libmenu/meson.build b/libmenu/meson.build
new file mode 100644
index 0000000..5fbc93e
--- /dev/null
+++ b/libmenu/meson.build
@@ -0,0 +1,72 @@
+source_h = [
+ 'matemenu-tree.h',
+]
+
+install_headers(source_h, subdir : 'mate-menus')
+
+sources = [
+ 'desktop-entries.h',
+ 'entry-directories.h',
+ 'menu-layout.h',
+ 'menu-monitor.h',
+ 'menu-util.h',
+ 'desktop-entries.c',
+ 'entry-directories.c',
+ 'matemenu-tree.c',
+ 'menu-layout.c',
+ 'menu-monitor.c',
+ 'menu-util.c',
+]
+
+gnome = import('gnome')
+pkg = import('pkgconfig')
+
+libmate_menu = shared_library('mate-menu',
+ sources,
+ dependencies: [gio_unix_dep],
+ soversion: soversion,
+ version: libversion,
+ include_directories: top_srcdir,
+ install : true,
+ install_dir : get_option('libdir')
+ )
+
+libmate_menu_deps = declare_dependency(sources: source_h,
+ include_directories: [top_srcdir, include_directories('.')],
+ dependencies: [gio_unix_dep],
+ link_with: libmate_menu)
+
+pkg.generate(
+ name: 'mate-menu',
+ version: meson.project_version(),
+ description: 'Desktop Menu Specification Implementation',
+ requires_private: 'gio-unix-2.0',
+ filebase: 'libmate-menu',
+ libraries: '-lmate-menu',
+ subdirs: 'mate-menus',
+ )
+
+if get_option('introspection')
+ libmate_menu_gir = gnome.generate_gir(libmate_menu,
+ sources: [source_h, sources],
+ nsversion : api_version,
+ namespace : 'MateMenu',
+ symbol_prefix : 'matemenu',
+ export_packages: 'libmatemenu',
+ identifier_prefix : 'MateMenu',
+ link_with: libmate_menu,
+ includes : ['Gio-2.0'],
+ install : true,
+ install_dir_gir: girdir,
+ install_dir_typelib: typelibdir,
+ extra_args: [ '--c-include=mate-menus/matemenu-tree.h' ],
+ )
+ if get_option('vapi')
+ mate_menu_vapi = gnome.generate_vapi('libmate-menu',
+ sources: libmate_menu_gir.get(0),
+ packages: 'gio-unix-2.0',
+ install: true,
+ install_dir: vapidir,
+ )
+ endif
+endif