Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Using glib to create menu file

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
barr_jaffe
Posts: 1
Joined: 2015-05-12 14:11

Using glib to create menu file

#1 Post by barr_jaffe »

Hey all,

I am helpless as I tried all day to find answer to this.
I am using GTK and C and on my application I have a Drag and drop feature. Code:

Code: Select all

icon_view = gtk_icon_view_new_with_model(create_and_fill_model(pALP));
	g_object_unref(pALP->list_store);		/* destroy model automatically with view */
	gtk_icon_view_set_selection_mode(GTK_ICON_VIEW(icon_view), GTK_SELECTION_SINGLE);
	gtk_icon_view_set_reorderable(GTK_ICON_VIEW(icon_view), TRUE);
	gtk_icon_view_set_text_column(GTK_ICON_VIEW(icon_view), COL_DISPLAY_NAME);
	gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(icon_view), COL_PIXBUF);
	gtk_icon_view_set_tooltip_column(GTK_ICON_VIEW(icon_view), COL_TOOLTIP);
	g_signal_connect(icon_view, "button-press-event", G_CALLBACK(icon_view_onButtonPressed), pALP);
	g_signal_connect(icon_view, "item-activated", G_CALLBACK(icon_view_onItemActivated), pALP);

static GtkTreeModel * create_and_fill_model(AppLauncherPlugin * pALP)
{
	MenuCacheDir* root_dir;
	GtkTreeIter iter;
	
	pALP->list_store = gtk_list_store_new(NUM_COLS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
	
	root_dir = menu_cache_get_root_dir(pALP->menu_cache);
    if(root_dir) 
		fill_model_from_menu_cache(pALP, root_dir, &iter);

	return GTK_TREE_MODEL(pALP->list_store);
}
The drag and drop works fine but when I exit the application and enter again, the changes of the drops are not saved, meaning the new location is not saved.
I understand that in order to save the location of the drops I need to create a menu file and write some xml,

But how do I do this? it there another way?

I need help :/

Post Reply