Re: A question about deprecated widget



On Mon, Dec 18, 2006 at 09:58:35PM +0100, galtgendo o2 pl wrote:
You got it all wrong.

Thank you.  I wish people told me this more often.  Really.
Preferably when I get it all wrong, but one takes what one
can get.

As "appears-as-list" is a style property, it's read-only, so it would be 
pointless for me.

The funny thing is that setting style properties is not only
possible but also discussed here often.  But maybe I just
got it all wrong again.

The effect I'm looking for is a non-depreciated widget 
combination that would look and act like GTK_COMBO did, I mean a 
scrolled window and all,

You set appears-as-list in your gtkrc.  Everyone who wants
the list-like look sets appears-as-list in their gtkrc.
Everyone who does *not* like the list look will unset it.
And everyone will live happily ever after -- or at least
until people who like a particular look and feel learn how
to change style properties in their apps and start enforcing
their preferences on users.

As it goes for the second point, glist (char**) is a result of calling a 
function from a separate library, so I'm interested in a way of 
converting it back and forth in an efficient way.

void
gtk_combo_set_popdown_strings (GtkCombo *combo, 
                               GList    *strings)
{
  GList *list;
  GtkWidget *li;

  g_return_if_fail (GTK_IS_COMBO (combo));

  gtk_combo_popdown_list (combo);

  gtk_list_clear_items (GTK_LIST (combo->list), 0, -1);
  list = strings;
  while (list)
    {
      li = gtk_list_item_new_with_label ((gchar *) list->data);
      gtk_widget_show (li);
      gtk_container_add (GTK_CONTAINER (combo->list), li);
      list = list->next;
    }
}

The code speaks for itself.  I suggest to read the source
code, including all the pango stuff, and count how many
times the string is copied before it's finally rendered (and
all the other bizarre shows that take place along the way).
Then think about the efficiency of copying of a handful of
strings again.

Of course it is possible to use static arrays as tree view/
icon view/combo box backends with with a simple wrapper
model that does not allocate any data itself, but the reason
for doing this is convenience not efficiency.

While GTK_COMBO to 
GTK_COMBO_BOX transition was what triggered the need for it,

You evidently disagree with other design decisions, so what
prevents you from disagreeing GtkCombo should not be used in
newly written code?  Does it do what you want?  Certainly.
Is it going to disappear?  Definitely not sooner than in 3.0.

In addition, you seem to be rewritting code in the name of
some transition which is a questionable goal of itself.

Yeti


--
Whatever.



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