Re: [gtk-list] Re: Dynamic Style/Color change - I don't find the solution...



-----BEGIN PGP SIGNED MESSAGE-----

Hi Tim !

In fact I found out several things during yesterday afternoon already
- - a few questions I actually cannot answer myself remain, though.

Tim Janik <timj@gtk.org> writes:
> you should first add all widgets to their containers, and then do:

Did that before - just didn't write it down... (I thought that was the
right way, anyways)

>  style = gtk_rc_get_style (myobject->widget);
> and then
>  if (!style)
>    style = gtk_widget_get_default_style ();

  stdstyle = gtk_rc_get_style(window);
  if ( ! stdstyle ) stdstyle = gtk_widget_get_style(window);

is what I do now. Stdstyle it used throughout the program to set up
the styles. I do it with gtk_widget_get_style because that main window
has a certain name and the gtkrc allows to set the style application
specific. This works great.

> now, after you assured style != NULL, you can copy it:
>  myobject->style = gtk_style_copy (style);

Doing that.

> assuming that you have not yet realized myobject->widget, you set up the
> style like this:
>  myobject->style->bg[GTK_PRELIGHT].red = 0;
>  myobject->style->bg[GTK_PRELIGHT].green = 0;
>  myobject->style->bg[GTK_PRELIGHT].blue = 65535;
> and then attach it:
>  gtk_widget_set_style (myobject->widget, myobject->style);
> the colors of this style will then be allocated upon realization of the widget.

Doing that as well. In fact I got the color shift working
yesterday. What is bothering me is that I have to do a copy and and a
set every time. Am I allocating more and more memory there ???

How are the widget styles handled ?? Does the old one get destroyed
automatically when the new one is being attached ?? It seems to be
that way... if it is the case I got the thing ready. I am doing:

    style = gtk_style_copy(stdstyle);
    style->bg[GTK_STATE_NORMAL].red = normal.red;
    style->bg[GTK_STATE_NORMAL].green = normal.green;
    style->bg[GTK_STATE_NORMAL].blue = normal.blue;
    style->bg[GTK_STATE_PRELIGHT].red = plight.red;
    style->bg[GTK_STATE_PRELIGHT].green = plight.green;
    style->bg[GTK_STATE_PRELIGHT].blue = plight.blue;
    gtk_widget_set_style(button, style);

But this can be called pretty often over time, so I'd like to make
sure no resources are wasted this way.

> BTW: what is this fusebox-ml.gtk newsgroup stuff about?

Pretty easy: I hate it when mailinglists jam up my mailbox (I am
subscribed to about 15 and some of them have high traffic), so I set
up mail-to-news gateways (practically just pipings into inews after a
Approved:[ ml-demon@fusebox.hanse.de ] has been added to the
header). This way I can have them locally on my computer and even
allow friends to read them here. Since the newsgroups are set up as
moderated all I need to do is to give the posting address of the
mailinglist as the moderator and voila ! 
Since I am using gnus for news&mail it doesn't make that much of a
difference anymore, but I got my keyboard led's blinking to tell me
how many new messages arrived, so I can actually see if there are
emails without turning on the monitor... so it is pretty clear I don't
want mailinglists to end up in my personal mailbox. :-)

Later,
	Georg

- -- 
Georg C. F. Greve <greve@fusebox.hanse.de>
http://porter.desy.de/~greve/ - ICQ#10016966
"People who fight may lose. People who do not
fight have already lost." -- Bertolt Brecht

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: Processed

iQCVAwUBNaMdDFZXgZXDxqJtAQFA9QP/WG6yQtCfTO3Ea7fE6pif4wUZUhY37KC2
HR2D1cNqS1QYg2MIWkJ8N1LyQ/NobipfzONKmkySCtXdFzq9+cCgqu860Uu7fcTS
3BiSoTKc0r58C9iwW95L2EpCnfOuQsXS5LzvMUTMapzOTMq5h2EenKxzN4InCYkK
g8pTaTu4Y2g=
=Y6cI
-----END PGP SIGNATURE-----



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