GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sun Apr 20, 2014 11:28 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: GtkScrolledWindow is mapped but visible child is not mapped
PostPosted: Tue Dec 04, 2012 2:05 am 
Offline
Familiar Face

Joined: Thu Nov 22, 2012 3:46 pm
Posts: 19
How do I manage this warning:

Quote:
Gtk-WARNING **: GtkScrolledWindow 0x8a40128 is mapped but visible child GtkScrollbar 0x8baf2b0 is not mapped

This warning occurs when load playlist file item in gtktreeview with container scrolled windows.

Thanks.


Top
 Profile  
 
 Post subject: Re: GtkScrolledWindow is mapped but visible child is not map
PostPosted: Tue Dec 04, 2012 3:54 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
Can't really tell based on the little information you have provided.
Please provide all code related to your scrolledwindow and its child widget.
Compile your code with debug symbols -g so you know which line this warning is associated with and let us know where it is happening.

visible implies that you have set it to be shown; however unmapped implies it has not been realised. Anywhere there might be a gtk_widget_unrealize is the obvious candidate for a bug, but there may be other more subtle possibilities.

I have seen duplicate errors marked for evolution but all information about it is hidden as a private bug.


Top
 Profile  
 
 Post subject: Re: GtkScrolledWindow is mapped but visible child is not map
PostPosted: Tue Dec 04, 2012 12:29 pm 
Offline
Familiar Face

Joined: Thu Nov 22, 2012 3:46 pm
Posts: 19
I trying to save and load a treeview from a text file

reeview with scroll windows container:

Code:
GtkWidget *scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
   gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_SHADOW_IN);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

   GtkListStore *store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
   GtkWidget *view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
   gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(view), TRUE);
   gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);

   selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
   gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
   gtk_container_add(GTK_CONTAINER(scrolledwindow), view);



Scenario:

1.
In first case, treeview contains three rows with information entered in them. At this moment scrollbar isn't visible because treeview "request size" is for three row (See screenshot 1):

Attachment:
File comment: screenshot 1
1.png
1.png [ 4.13 KiB | Viewed 772 times ]

Code:
-------------------
1. RED       100.00
-------------------
2. YELLOW    101.00
-------------------
3. BLUE      102.00
-------------------


I write a code to update, save and load a treeview from/to a text file (I use "Load from file" button and "GTK_FILE_CHOOSER")

When import from this text file with contains more items (four, five, ...) (See screenshot 2), list is updated with all new rows but get this warning:
Code:
GtkScrolledWindow 0x922f1e0 is mapped but visible child GtkScrollbar 0x93812b0 is not mapped


Attachment:
File comment: screenshot 2
2.png
2.png [ 4.37 KiB | Viewed 772 times ]

Code:
-------------------
1. RED       100.00
-------------------
2. YELLOW    101.00
-------------------
3. BLUE      102.00
-------------------   
4. GREEN     103.00
-------------------
     .....


Same message is show up and when I export list to text file.

This message is show up after File chooser dialog is destroyed.

Also this happens when scrollbar is visible, file chosser dialog is up, I changed my mind and I choose to cancel action from "Cancel" button of GTK_FILE_CHOOSER.

Thanks


Top
 Profile  
 
 Post subject: Re: GtkScrolledWindow is mapped but visible child is not map
PostPosted: Tue Dec 04, 2012 5:54 pm 
Offline
Familiar Face

Joined: Thu Nov 22, 2012 3:46 pm
Posts: 19
I don't now if this is GtkScrolledWindow or overlay scrollbars bug (ubuntu).

I got these warning in Totem Movie Player.

Test case:

Open totem -> Fill with items playlist panel from right of player until scrollbar show-up -> scroll to botton of panel -> import more playlist items from file, and this warning come out:

Code:
(totem:4060): Gtk-WARNING **: GtkScrolledWindow 0xb81ef2b0 is mapped but visible child GtkScrollbar 0xb82bc2a8 is not mapped


This bug come out in Rhythmbox Music Player if import playlist from file:

Code:
(rhythmbox:4149): Gtk-WARNING **: RBEntryView 0xa093080 is mapped but visible child GtkScrollbar 0x9ee72b0 is not mapped


Top
 Profile  
 
 Post subject: Re: GtkScrolledWindow is mapped but visible child is not map
PostPosted: Tue Dec 04, 2012 7:25 pm 
Offline
Familiar Face

Joined: Mon Jul 11, 2011 10:24 am
Posts: 15
To me your posted code looks correct, it seems also likely to me that this warning is caused by a problem of the interplay between Gtk and something else, could be a theme or anything. I made the experience that I sometimes get warnings for a treeview even if the code is correct, treeview wtih tree-/liststore is such a complex widget that it's easy to imagine it is prone to minor or major issues.


Top
 Profile  
 
 Post subject: Re: GtkScrolledWindow is mapped but visible child is not map
PostPosted: Tue Dec 04, 2012 10:07 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
I agree with damarcus. Particularly if you are seeing this bug appear in so many different applications.
You mentioned the file chooser dialogue widget. I have often found things go wrong with this one too. Is your scrolledwindow placed in the window of the file chooser or is it in your main application.
You haven't mentioned which version (major and minor) of gtk you are using. Sometimes the internals of gtk change in subtle ways that create existing applications to break.
Gather a list of all the applications you have seen this bug in and report it to launchpad. If the bug is in gtk itself then having the weight of evidence from many key applications will help in pushing for a fix.


Top
 Profile  
 
 Post subject: Re: GtkScrolledWindow is mapped but visible child is not map
PostPosted: Tue Dec 04, 2012 11:13 pm 
Offline
Familiar Face

Joined: Thu Nov 22, 2012 3:46 pm
Posts: 19
Thanks for your reply.

The scrolled windows is placed in main of application and file dialog chooser is "pop up" dialog:

Code:
/* Go through each row and add its data to the xmlDocPtr */
static gboolean save_to_file_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, xmlNodePtr root, gpointer user_data)
{
   gchar *name, *number, *position;
   xmlNodePtr current;

   gtk_tree_model_get(model, iter, 0, &name, 1, &number, -1);
   path_str = gtk_tree_path_to_string(path);
   current = xmlNewChild(root, NULL, (guchar*)"colour", NULL);
   xmlSetProp(current, (guchar*)"name", (guchar*name);
   xmlSetProp(current, (guchar*)"number", (guchar*)number);
   xmlSetProp(current, (guchar*)"position", (guchar*)positon);
   g_free(title);
   g_free(number);
   g_free(path_str);

   return FALSE;
}

static void save_to_file(gchar *filename)
{
   GtkTreeModel *model;
   xmlDocPtr doc;
   xmlNodePtr root;

   doc = xmlNewDoc((guchar*)"1.0");
   root = xmlNewDocNode(doc, NULL, (guchar*)"colour", NULL);
   xmlDocSetRootElement(doc, root);
   model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
   gtk_tree_model_foreach(model, (GtkTreeModelForeachFunc)save_to_file_foreach, (gpointer)root);
   xmlSaveFile(filename, doc);
   xmlFreeDoc(doc);
}

static void save_to_file_cb(GtkWidget *button, gpointer data)
{
   GtkWidget *dialog;
   GtkFileFilter *file_filter_all;
   GtkFileFilter *file_filter_xml;
   gchar *filename;

   dialog = gtk_file_chooser_dialog_new("Select file name...", NULL,
                  GTK_FILE_CHOOSER_ACTION_SAVE,
                  GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
                  GTK_STOCK_CANCEL,
                  GTK_RESPONSE_CANCEL, NULL);

   file_filter_all = gtk_file_filter_new();
   gtk_file_filter_set_name(file_filter_all, _("All Files"));
   gtk_file_filter_add_pattern(file_filter_all, "*.*");
   gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), file_filter_all);

   file_filter_xml = gtk_file_filter_new();
   gtk_file_filter_set_name(file_filter_xml, _("XML Files (*.xml)"));
   gtk_file_filter_add_pattern(file_filter_xml, "*.xml");
   gtk_file_filter_add_pattern(file_filter_xml, "*.XML");
   gtk_file_filter_add_mime_type(file_filter_xml, "text/xml");
   gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), file_filter_xml);

   gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
        gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), file_filter_xml);
   gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), "colour.xml");

   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
      filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
      /* Check if .xml extension is added, if not add */
      if (strstr(filename, ".xml") == NULL) {
         char *tmp_file;
         /* create copy of filename to release it and create a new one, using old name */
         tmp_file = g_strdup(filename);
         g_free(filename);
              filename = g_strdup_printf("%s.xml", tmp_file);
         g_free(tmp_file);
      }
      save_to_file(filename);
      g_free(filename);
   }
   gtk_widget_destroy(dialog);
}


Top
 Profile  
 
 Post subject: Re: GtkScrolledWindow is mapped but visible child is not map
PostPosted: Wed Dec 05, 2012 11:36 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
It looks like pretty clean code (I take it that those are just typos in the save_to_file_foreach function) so yes I'd go with lodging a bug report and see what might eventuate. Doesn't seem to be your code at all.
Two minor things to note:
"*.*" does not represent all files, but rather all files with extensions. You might want to stick with just "*" in order to cover all bases.
As you are using glib functions, the last bit of your dialog can be done with "if (g_str_has_suffix..."


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group