Ejemplo n.º 1
0
static gboolean
move_applet (PanelWidget *panel, int pos, int applet_index)
{
	GSList     *applet_list;
	AppletInfo *info;
	GtkWidget  *parent;

	applet_list = mate_panel_applet_list_applets ();

	info = g_slist_nth_data (applet_list, applet_index);

	if ( ! mate_panel_applet_can_freely_move (info))
		return FALSE;

	if (pos < 0)
		pos = 0;

	parent = gtk_widget_get_parent (info->widget);

	if (info != NULL &&
	    info->widget != NULL &&
	    parent != NULL &&
	    PANEL_IS_WIDGET (parent)) {
		GSList *forb;
		forb = g_object_get_data (G_OBJECT (info->widget),
					  MATE_PANEL_APPLET_FORBIDDEN_PANELS);
		if ( ! g_slist_find (forb, panel))
			panel_widget_reparent (PANEL_WIDGET (parent),
					       panel,
					       info->widget,
					       pos);
	}

	return TRUE;
}
Ejemplo n.º 2
0
static gboolean
move_applet (PanelWidget         *panel,
	     PanelObjectPackType  pack_type,
	     int                  pack_index,
	     int                  applet_index)
{
	GSList     *applet_list;
	AppletInfo *info;
	GtkWidget  *parent;

	applet_list = panel_applet_list_applets ();

	info = g_slist_nth_data (applet_list, applet_index);

	if (info == NULL || info->widget == NULL ||
	    !panel_applet_can_freely_move (info))
		return FALSE;

	parent = gtk_widget_get_parent (info->widget);

	if (parent != NULL &&
	    PANEL_IS_WIDGET (parent)) {
		panel_widget_reparent (PANEL_WIDGET (parent),
				       panel,
				       info->widget,
				       pack_type, pack_index);
	}

	return TRUE;
}