summaryrefslogtreecommitdiff
path: root/libmenu
diff options
context:
space:
mode:
Diffstat (limited to 'libmenu')
-rw-r--r--libmenu/entry-directories.c3
-rw-r--r--libmenu/matemenu-tree.c73
-rw-r--r--libmenu/menu-layout.c4
-rw-r--r--libmenu/menu-monitor.c3
-rw-r--r--libmenu/menu-util.c4
5 files changed, 37 insertions, 50 deletions
diff --git a/libmenu/entry-directories.c b/libmenu/entry-directories.c
index 2d608bc..3970c95 100644
--- a/libmenu/entry-directories.c
+++ b/libmenu/entry-directories.c
@@ -18,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/matemenu-tree.c b/libmenu/matemenu-tree.c
index 9b47a65..18816b3 100644
--- a/libmenu/matemenu-tree.c
+++ b/libmenu/matemenu-tree.c
@@ -18,6 +18,9 @@
* Boston, MA 02110-1301, USA.
*/
+/* used for realpath() */
+#define _XOPEN_SOURCE 500
+
#include <config.h>
#include "matemenu-tree.h"
@@ -648,7 +651,6 @@ matemenu_tree_finalize (GObject *object)
#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;
}
@@ -682,7 +684,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);
@@ -733,7 +735,6 @@ 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;
}
@@ -1096,8 +1097,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);
}
@@ -1606,34 +1606,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)
@@ -2645,8 +2635,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;
}
@@ -4118,10 +4107,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;
@@ -4841,28 +4828,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/menu-layout.c b/libmenu/menu-layout.c
index 641aff5..f51ef24 100644
--- a/libmenu/menu-layout.c
+++ b/libmenu/menu-layout.c
@@ -2163,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:
@@ -2248,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-monitor.c b/libmenu/menu-monitor.c
index b57174f..ca52403 100644
--- a/libmenu/menu-monitor.c
+++ b/libmenu/menu-monitor.c
@@ -378,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-util.c b/libmenu/menu-util.c
index cfcfc77..94d9968 100644
--- a/libmenu/menu-util.c
+++ b/libmenu/menu-util.c
@@ -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);
}
}