Commit 030f8bac authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

menu: add gp_user_menu_set_append_func

parent 22fa6181
......@@ -23,16 +23,19 @@
struct _GpUserMenu
{
GtkMenu parent;
GtkMenu parent;
GpApplet *applet;
GpApplet *applet;
gboolean empty;
gboolean empty;
guint reload_id;
GpAppendMenuItemsFunc append_func;
gpointer append_data;
gulong locked_down_id;
gulong menu_icon_size_id;
guint reload_id;
gulong locked_down_id;
gulong menu_icon_size_id;
};
enum
......@@ -181,6 +184,9 @@ menu_reload (GpUserMenu *menu)
append_control_center (menu);
if (menu->append_func != NULL)
menu->append_func (GTK_MENU (menu), menu->append_data);
count = 0;
gtk_container_foreach (GTK_CONTAINER (menu), count_visible_item, &count);
empty = count == 0;
......@@ -379,3 +385,14 @@ gp_user_menu_new (GpApplet *applet)
"applet", applet,
NULL);
}
void
gp_user_menu_set_append_func (GpUserMenu *user_menu,
GpAppendMenuItemsFunc append_func,
gpointer user_data)
{
user_menu->append_func = append_func;
user_menu->append_data = user_data;
queue_reload (user_menu);
}
......@@ -18,6 +18,7 @@
#ifndef GP_USER_MENU_H
#define GP_USER_MENU_H
#include "gp-menu-utils.h"
#include <libgnome-panel/gp-applet.h>
G_BEGIN_DECLS
......@@ -25,7 +26,11 @@ G_BEGIN_DECLS
#define GP_TYPE_USER_MENU (gp_user_menu_get_type ())
G_DECLARE_FINAL_TYPE (GpUserMenu, gp_user_menu, GP, USER_MENU, GtkMenu)
GtkWidget *gp_user_menu_new (GpApplet *applet);
GtkWidget *gp_user_menu_new (GpApplet *applet);
void gp_user_menu_set_append_func (GpUserMenu *user_menu,
GpAppendMenuItemsFunc append_func,
gpointer user_data);
G_END_DECLS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment