[g-a-devel] How to support Combobox items which dynamically created



Hi, guys
I’m new here; I met a problem with combo box.
Our platform modified gtk combobox for performance consideration. Now, it works as following:
There is a variable called: defer_menu_creation, if set to True, then the items under combobox will not be created during combobox creation.
They will be created when user clicking the combobox.
============================ >8===============================
static void
gtk_combo_box_menu_setup (GtkComboBox *combo_box,
                          gboolean     defer_menu_creation)
{
…

  g_signal_connect (combo_box->priv->button, "button_press_event",
                    G_CALLBACK (gtk_combo_box_menu_button_press),
                    combo_box);
  g_signal_connect (combo_box->priv->button, "state_changed",
		    G_CALLBACK (gtk_combo_box_button_state_changed), 
		    combo_box);

  if (!defer_menu_creation)
    gtk_combo_box_menu_create (combo_box);
  else
    combo_box->priv->menu_creation_pending = TRUE;

…
}

void
gtk_combo_box_popup (GtkComboBox *combo_box)
{
…

  if (combo_box->priv->menu_creation_pending)
    gtk_combo_box_menu_create (combo_box);

  if (GTK_WIDGET_MAPPED (combo_box->priv->popup_widget))
    return;
…
}
============================ 8<===============================
So, I firstly let LDTP (http://ldtp.freedesktop.org) to popup the combobox, but, I still can not select item (by name) inside combobox. 
gail_item_get_name inside gailitem.c doesn’t get the item name because GTK_IS_COMBO_BOX(parent) return false. I don’t understand.
============================ 8<===============================
gail_item_get_name (AtkObject * obj)
{
…
	if (name == NULL)
	{
     …
		else if (GTK_IS_MENU_ITEM (widget))
		{
			…
			parent = gtk_widget_get_parent (widget);
			if (GTK_IS_MENU (parent))
			{
				...
				if (GTK_IS_ACCESSIBLE (parent_obj))
				{
					parent = GTK_ACCESSIBLE (parent_obj)->widget;			
					if (GTK_IS_COMBO_BOX (parent))							// Here will be FALSE, 
					{
…
}
============================ >8===============================
Is there anything I need to do to support this kind of combobox?
Thanks very much!

Alex


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]