Re: gtk-2 tutorial in alternative format?

2005-05-14 Thread stian
Chapter one (availabilty) contains this link:

ftp://ftp.gtk.org/pub/gtk/tutorial/

..


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: printing problem

2005-05-12 Thread stian
> hi
>
> I was wanting to divide my page in two columns. One
> column with images and the other with text. Could
> someone give me an idea of how to do this. I have been
> trying libgnomeprint library.
>
> Printing a char * in multiline and restricted to a
> certain column of the page is my main problem. Any
> suggestions.

Since you use gnomeprint, I understand that you want to print this stuff out.

pango_layout_set_width() is what you want to use. Something like this
perhaps:

(width, margin_left and margin_right comes from gnome_print_config)

pango_layout_set_width (pango_layout, (width - margin_left - margin_right)
* PANGO_SCALE / 2);



Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: amd64 installation

2005-05-12 Thread stian
> Hi,
> thanks for the reply...
> yes, pango seems to be working correctly.
>
> I've also noticed that if I run gtk-demo as root, rather than a user,
> instead of the segmentation fault I get:
> gtk-demo: relocation error: gtk-demo: undefined symbol: g_fopen

Sounds like you have multiple glib versions installed at different
locations (like one in /usr and one in /usr/local). Remove the one you
don't want.


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GtkProgressBar

2005-05-12 Thread stian
> hi
>
> I was wanting to add a progress bar to a function, but
> the problem is that progress bar is only shown after
> the function is over even though the first thing i do
> in the function is to show the progress bar.
>
> So maybe i should give a delay after showing. Is there
> any function which causes a delay, or if someone could
> suggest some other idea.

Please search the mail-arhive before asking. This is the most frequently
asked thing I believe.

http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html#gtk-events-pending

while (gtk_events_pending ())
  gtk_main_iteration ();

That will update the display (events are not handled unless control is
returned to gtk_main, or gtk_main_iteration() is performed as above.


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Using progress bar without timeout

2005-05-11 Thread stian
> I run the above C++ code from python by clicking a button. The problem
> is that when I print the percentage from the python side, it works
> fine, but when I call the pulse() method for ProgressBar, nothing gets
> updated on my GUI. Do I have to do anything else with the pbar object
> to make it display properly?

Either return to gtk-main-loop or empty the event-queue (gtk doesn't flush
events until it returns to it's main loop):

while (gtk_events_pending())
 gtk_main_iteration ();

http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html#gtk-events-pending



Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: .gtkrc

2005-05-04 Thread stian
> hi
>
> I did that too, but there still isnt any difference in my application. Any
> ideas

try to run a random gtk application like this (install strace if you don't
already have it):

strace gedit 2>&1 |grep opem

This will show all os-calls that matches the word open. It's the hard way,
but gives you a clue. If no gtkrc file is found, it reads an atom-string
from the XServer telling it what theme to use (freedesktop.org spec,
implemented by gnome/gtk and kde)



Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GTK window and thread

2005-05-02 Thread stian
> (:20080): GLib-WARNING **: g_main_context_check() called
> recursively from within a source's check() or prepare() member.
>
> (:20080): GLib-WARNING **: g_main_context_prepare() called
> recursively from within a source's check() or prepare() member.

Read the thread section of the gtk api and the usage of
gdk_threads_enter() and gdk_threads_leave() and that you have to init
gthreads BEFORE gtk.

Another approach could be not to init gtk in the main-program, but when an
event occure, fork, and let the child do some logging, init gtk, popup a
window, and when window close, just let the child die.



Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Multiple lines in statusbar

2005-04-29 Thread stian
> And in fact if you open a file in text-mode on Windows, \n is converted
> to CR+LF - that is one of the ideas behind using "\n" and text-mode.
>
> So I can't really see why "\n" should not be correct when I write a
> string to the statusbar, just as well as it works correct when it is a
> label.
>
> And it is a disaster for portability, if "\n" should be "\r\n" on
> Windows and even something else on Mac.

Did you test it, just to sort out if the issue is the \n not automatically
being translated into \r\n or not.


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to find your shell

2005-04-28 Thread stian
>>
>> $ uname -s -r
>> FreeBSD 4.9-STABLE
>> $ ls -l /proc/self/exe
>> ls: /proc/self/exe: No such file or directory
>
> None of the proposed methods work on Win32 anyway.
> Maybe it's time to define where you want to find the
> shell...

Nothing works on win32 by any means of standards :-p

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to find your shell

2005-04-28 Thread stian
> I agree with Mr Kletnieks. I was mistaken. The $SHELL
> does not give the currently executing shell. It
> continues to give the original shell (given in the
> /etc/passwd).

Don't make it any harder than needed :-p

# ls -l /proc/self/exe

That will show where the current shell executable file is located, and
hence its name.

Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Gtk windows - how move it off screen?

2005-04-28 Thread stian
> When using non-gtk app (VMware 4.5.2) you can move its window off screen
> in upper direction.
> It is usefull sometimes. Now VMware has a gtk window and it doesn't move
> up anymore higher
> than the upper limit of a GNOME desktop. Is there something that can be
> done to move those
> windows higher?
> Igor Gorbounov

That is a "limitation" in the window-manager and not Gtk+.

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


RE: [gtk+-2.6.7] configure problem

2005-04-21 Thread stian
 > Most packages (like glib, gtk, etc) requires the use of GNU make, instead
> of inborn make. So I downloaded GNU make 3.80 and compiled, installed into
> /usr/local/bin. And to use it conveniently, I made a symbolic link "ln -s
> /usr/local/bin/make /usr/bin/gmake". But when I typed "gmake" in the
> package's src folder, it tolde me "gmake: Command not found".
>
> I "echo $PATH", just to confirm "/usr/bin" and "/usr/local/bin" are all in
> my working path.
>
> So why doesn't it work as expected?

You're synlink is somehow broken. ls -las /usr/bin/gmake will reveal this.
Or the shell hash (cache of where executable files are located) are a bit
to aggressive. Try hash  or  hash --help  to see what you can find.

Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Canvas background color

2005-04-20 Thread stian
> typedef struct {
> guint32 pixel;
> gunit16 red;
> guint16 green;
> guint16 blue;
> } GdkColor;
>
> What's purpose of GdkColor.pixel ?  Why it's 32 bits instead of
> 16*3 = 48 bits (for RGB) ?  When I try to set background color,
> what value should I use for GdkColor.pixel ?

pixel is internal value against Xlib. It makes a lot of sense when for
instance you have 8bit resolution and all colours has to be allocated
against  X. (As far as I can understand)

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Does compiler gcc support reference arguments?

2005-04-18 Thread stian
> Hello everyone,
>
> I declare a function like below:
>  void AA(int&  i);
>
> but gcc give an error message.

That is c++ syntax.. use g++ instead.


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to display different nodes with different styles in GtkTreeView?

2005-04-18 Thread stian
> Hi:
>   Everybody!Nowdays,I'am developping an application with gtk+,and in the
> user interface,there needs a GtkTreeView to display all files and folders
> in a file system.When display folder,it just needs a pixbuf and
> cellrenderertext to display the folder's name,while when displaying the
> file,there needs an additional checkbox besides the pixbuf and
> cellrenderertext,and how to implement this treeview?

Look at the gtk-demo program. It is shipped along gtk 2.x source (and some
distros ship this with the gtk package)


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to put send an option to GUI app in a console wothout DISPLAY

2005-04-14 Thread stian
> I don't  think the code after you organize it is ok because the
> variable "node" always will be empty

Sorry, I red it too fast, but the eneral ide is to read the options
without invoking gtk_init. Interprate the argc/argv yourself or by other
functions than the gtk one.

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to put send an option to GUI app in a console wothout DISPLAY

2005-04-14 Thread stian
> Hi
>
> I have a GUI program and one of the thing is that I want my user to be
> able to parse options to the program (e.g. adding new record) from the
> command line without DISPLAY variable defined
>
> basically I want the program when it start to check if the user parse
> the option "--add "  then just add the name to the db and exist
> (The user in this case will run the program in a console and there is
> no DISPLAY defined), and if the user didn't parse any option then run
> the program GUI in the defined DISPLAY
>
> I tried gtk_init_with_args but this will not work if the DISPLAY is
> undefined
>
>
> any help ?
>
> Here is my code
>

Don't init gtk unless you are going to use it.

int
main (int argc, char *argv[])
{
static gchar *node = NULL;
 GOptionEntry options[] = {
 { "new-node", 'n', 0, G_OPTION_ARG_STRING, &node,
 _("Add new node"), _("hostname") },
{ NULL, '\0', 0, 0, NULL, NULL, NULL }
 };

if(node) {
 g_print("NEW NODE\n");
 g_print("node=%s)\n",node);
 return 0;  // now exit because the user don't want the 
program, he
 just want to add something
 }

  gtk_init_with_args (&argc, &argv,NULL,options,NULL,NULL);

   gtk_main ();
   return 0;

}
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: problem with libpangoxft-1.0.so (symbol definition missing??)

2005-04-12 Thread stian
> This is in reply to the original message from September 2004, while trying
> to compile gtk 2.6 or 2.4 it looks like I ran into the same problem.
> When I looked at the -l flags passed to gcc by configure I noticed that
> pangoft2 was not being linked in, and pangoft2 is the library that would
> resolve the references gcc wasn't able to resolve.

I think I came across simular problems before with fontconfig
http://bugs.gentoo.org/show_bug.cgi?id=83623


Problem is very visible if you try to link statically, since the static
libraries doesn't have dependencies internally as the .so files do (ELF
format)


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Help Newbie cause updates of Notebook with textview

2005-04-08 Thread stian
> but got the complaint (DUH) "GLIB-WARNING: g_main_context_prepare(): main
> loop already active in another thread"
> which makes sense, since this call of UpdateDisplay() is on the thread of
> my external application.

Please read the thread section of the gtk api spec / documentation and the
usage of gdk_thread_enter() and gdk_thread_leave(). Callbacks from glib
needs to use these (signals from gtk widgets are already holding this
lock)


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Getting hex string from a GdkColor

2005-04-08 Thread stian
> Hi all,
>
> i've a color button from which i obtain a GdkColor with
> gtk_color_button_get_color(). Now i need the hex string representing this
> color but all that i find searching in the api docs is a function that
> obtain a GdkColor from an hex string. Any hints? Thanks to you all :)
>
> Greetings
> Stefano

sprintf(target, "#%02x%02x%02x", redvalue, greenvalue, bluevalue);


Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Displaying intermediate values in widgets

2005-04-08 Thread stian
>   Begin:
>   A = A + 5
>   Display in an entry_type Widget
>   if A > 100  exit
>   Goto Begin
>
> In my case, unless it completes the whole loop, it
> does not show intermediate values. I wish to show
> values displayed in the widget 5, 10, 15 etc.

If you do this, the gui will update:

  while (gtk_events_pending())
    gtk_main_iteration();



Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Newbey Question

2005-04-08 Thread stian
> Thanks Marcel for your prompt response.
> I did as you suggested, however, I now get an error saying that the
> '-lXext'
> library was not found. I ran 'find /usr -name *Xext*' and I did find
> '/usr/X11R6/bin/cygXext-6.dll'. Is there anything I can do to solve this
> problem?

I saw you are using a gtk 1.x version so I have first one question. When
you are linking the program, do you use `gtk-config --libs` or `gtk-config
--libs --cflags` then. Both those two should set options you need to link
gtk itself. If you do, you need to manually send a
-L/path/to/where/searchforlib to gcc or ld when linking. You can have as
many -L options as you would like.


Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Where could i download a sample code using Xlib in a GTK program?

2005-04-05 Thread stian
> Hi,
>
> I am a fresh man in XWindow/linux. Where could i download a sample code
> using Xlib in a GTK program? I will need draw graphics on some widgets.

The point of Gtk+ is to not having to talk to X directly. You can draw
graphic with the widget-set available in Gtk.

http://www.gtk.org/api/2.6/gtk/GtkDrawingArea.html

The above widget is a buffer you can draw on.

Stian

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: motion-notify-event problems

2005-04-04 Thread stian
> Hi
>
>
> I have a window with a label and an entry, when I connect
> motion-notify-event to the window the signal is only emmited when the
> mouse passes over the entry... wasn't it supposed to be emitted anywhere
> inside the window?
>
> Is there another signal that is emmited on mouse movements?

What widget did you attach it to?

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: signals (and disconnecting them)

2005-04-04 Thread stian
> [EMAIL PROTECTED] wrote:
>
>>I'm not an expert but:
>>
>>Events that are queue'd are not scheduled until glib iterates again, so
>>they will be "lost" yes. Even signals you emit by hand will be "lost"
>>after the handler is unhooked. Atleast logic should be like that.
>>
>>
> I may be a bit crazy but it can make sense to let all the events queued
> for that handler to be processed before disconnecting it.
> I know I could just force all the queued events to be processed before
> disconnecting the handler, but it's not the right thing to do.

Not really, since when you disconnect it, you might free the data
user_data points to, so a new signal after that point would be unsecure.
Else, when would you know that the user_data pointer will never be
mentioned again.

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: signals (and disconnecting them)

2005-04-04 Thread stian
> Let's say we have the following code:
>
> some_func();
> g_signal_handlers_disconnect_by_func(obj, func, param);
>
>
> If some_func() causes a signal to be emitted on "obj" and then almost
> immediately I disconnect the handler, will my handler receive the
> event before being disconnected or is there a chance it might not.
> (for example if the event is queued).

I'm not an expert but:

Events that are queue'd are not scheduled until glib iterates again, so
they will be "lost" yes. Even signals you emit by hand will be "lost"
after the handler is unhooked. Atleast logic should be like that.

I can also mention that glib is to be access by only one thread at any
given time aswell, so other threads should be sleeping too while a thread
is activly talking to glib, and events are to be enqueued.



Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: gtk_events_pending() seems to spin sometimes?

2005-03-28 Thread stian
> I'm using a (traditional POSIX) signal handler to run this code.  I use
> setitimer() to tell the OS to interrupt my application with a SIGALRM
> signal after something like 1 second, every second.

Naughty boy :-p setitimer can be very nasty if the signal handler
interacts with gtk code. However, you can do it more nice by doing a
trylock() call and just exit silenty if that fails. Glib has a
timer-callback, but it requires that you are within the gtk_main context
when it times out, else it will linger until it does, and then send the
g_signal.

> I see that gtk_events_pending() looks like this:
>
> 1031gtk_events_pending (void)
> 1032{
> 1033  gboolean result;
> 1034
> 1035  GDK_THREADS_LEAVE ();
> 1036  result = g_main_context_pending (NULL);
> 1037  GDK_THREADS_ENTER ();
> 1038
> 1039  return result;
> 1040}

GDK_THREAD_LEAVE() and GDK_THREAD_ENTER are macroes that tests if
threading is enabled or not before lock/unlock. You can look up those
macroes and check if threading is enabled by poking the functions it uses.

> this is unfortunate though.  my perl handler can block for a long time
> and I'd rather not wait for it to return before updating my form.  maybe
> I should try using threads instead.

Use two threads. One for perl and one for the rest of the program. Unless
you are able to make the perl-script async instead.


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: gtk_events_pending() seems to spin sometimes?

2005-03-27 Thread stian
> I imagine select() doesn't block too long because my program is keeping
> the cpu so busy.  Is it possible I'm screwing up my environment somehow
> that's causing this breakage?  Am I using gtk_events_pending()
> incorrectly?  What should I look for?

Is this a threaded application? If so, you should check the
gdk_thread_leave/gdk_thread_enter balance and usage.

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GTK 2.6.4 - XOpenDisplay in -lX11......no - libX11 not found

2005-03-26 Thread stian
> and i can't finish with "Configure"
> it's possible to use X from "/usr/openwin/lib" ?
CFLAGS="-L/usr/openwin/lib" ./configure

and that style of options



Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: problems with threads

2005-03-23 Thread stian
> I create a aplication with gtkmm (C++) and the aplication start
> various threads and this threads interact with gtk and change the
> screen, but sometimes the aplication crash? what it is happening?

Read the thread section of glib and gtk api-reference. It describes how
and when to use gdk_thread_enter() and gdk_thread_leave().


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Force sorting of an GtkListStore

2005-03-17 Thread stian
> Is it posibile to proper reset the default sort function? There is the
> GtkTreeModelSort which provides such a function
> (gtk_tree_model_sort_reset_default_sort_func) but i don't want to change
> my whole application to use GtkTreeModelSort instead of GtkListStore
> just to reset the default sort function.

Why would you need to rewrite your application? GtkTreeModelSort is a
virtual model you stack on top of another model, and send to GtkTreeView
instead of the model you usually send.


Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: changing expand/fill pane parameters (without repacking)

2005-03-15 Thread stian
> Is it possible to change the expand/fill parameters of a paned's children
> without repacking them?
> (Repacking them is a huge performance hit)

http://www.gtk.org/api/2.6/gtk/GtkPaned.html

See the "Child Properties" section.
The child gets the two properties you question about. You can set them
using g_object_set(). Atleast that is what the API says.

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: gtk_label_set_text() not working .

2005-03-15 Thread stian
> hi all,
>   I'am a newbie here. i'am developing a user agent
> client , for a Telephony application using GTK+-1.2. The whole
> application has 5 threads running , i try to update a label , with
> gtk_label_set_text () , when some event occurs in the application , but
> it doesnt seem to take affect . When i use it with a debugger and when i
> single step code , everything appears to be fine . Could someone help me
> to overcome this problem.

Read the threads section of the api-manual of gtk and gdk, and the usage
of gdk_threads_enter() and gdk_threads_leave(). Sounds very like thread
race problem. For all glib events, you need to call
gdk_threads_enter()/gdk_threads_leave by hand. Events that comes from gtk,
already holds this lock.

gtk main looks like this

while (!quit)
{
 gdk_threads_leave(); /* unlock */
 let_glib_run_until_we_have_a_event;
 gdk_threads_enter(); /* lock*/
 handle_events;
}

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Error intalling gtk+2.6.0

2005-03-15 Thread stian
> Hi All,
>
> I am facing an error while trying to configure (when I run
> ./configure) for the gtk+2.6.0.
>
> "configure: error: Xft Pango backend is required for x11 target"

You need pango 1.8.0.

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GTK Script?

2005-03-13 Thread stian
> Hi,
>
> Being used to Desktop Korn Shell (DTKSH) with the Digital Unix Common
> Desktop Environment, I wonder if something similar can be created for
> GTK? Would it not be nice to have a scripting language which is also
> capable of creating graphical user interfaces?

Gtk+ has several language bindings. C, C++, perl, python, PHP and Free
Pascal... More can be created if anybody bothers to make it/needs it.


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GtkCellRendererCombo questions

2005-03-12 Thread stian
> At least for the first question, you should be able to set up a row
> separator function in the handler for the
> GtkCellRenderer::editing-started signal, which was introduced for this
> purpose...

Of-course, since it is the GtkCellRenderer that emits the signal after the
widget class has done start-editing-thingy. But still it is hard to
retrieve the iter, since edited signal from returnes a text-string.
Perheps it is possible to hook up some signals on the cell?

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GtkCellRendererCombo questions

2005-03-12 Thread stian
> 1) Is there any way to add a "separator" item into the list?
>
> 2) Is there any better way to differentiate which item was selected in
> the combo?
> Right now, by hooking into the changed event, the callback simply
> receives the text of the item.
> I want to at least know which row in the backing store was selected. (So
> that I can store/retreive other information in the store)

No and no. You can however copy out the widget from the gtk source tarball
and modify it after your own specifications, and make the edited signal
return an iter instead. I did this for one my projects (even made it using
a different model than the treeview uses). Only one problem, and that is
that you can't detect that a user cancels the edit, since it uses a
private function (atleast in 2.6.0) to detect this. That should be fixed,
if it isn't that already.


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: TreeModel and visible rows

2005-03-11 Thread stian
>>a) you always keep the model up-to-date
>>
>>b) you fetch the view position of the treeview and update only that part
>>of the model:
>>http://www.gtk.org/api/2.6/gtk/GtkTreeView.html#gtk-tree-view-get-visible-rect
>>
>>
> With this function i'm just getting the size in pixel (height and width),
> could a determine the height of a single row?

You can find out which rows are visible, by retriving the visible box, and
resolve the cordinates from pixels into iters.



Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: TreeModel and visible rows

2005-03-11 Thread stian
> Currently i'm setting a constant value (e.g. 13), and display only
> the latest # datasets in a row.
>
> My software updates the TreeModel (Liststore) every 0.5sec., to
> update the TreeModel i'm clearing it and appending my latest
> datasets.
>
> I'm having 3k datasets and couldn't append every 0.5sec. all
> my datasets just to display the latests visible rows. But the
> TreeModel or the Liststore should know how many rows are
> visible, cause they are drawing it, i thought/hoped there where
> a function like gtk_list_store_get_visible_rows().
>
> If i would drop the ScrollingWidget, is there a way to determine
> the visible rows?

The store_model's work indepentently of the views. You can have several
views and virtual models stacked on top of a list/tree_store.

a) you always keep the model up-to-date

b) you fetch the view position of the treeview and update only that part
of the model:
http://www.gtk.org/api/2.6/gtk/GtkTreeView.html#gtk-tree-view-get-visible-rect


Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Model View Controller. How to implement?

2005-03-10 Thread stian
> you are already using threads, so this is enough. the problem,
> i think, is that GObject signals are not inherently cross-thread
> constructs. Emitting a signal from your computation thread and hoping
> that the view will update itself correctly will only work if you are
> doing the appropriate locking/unlocking using gdk_threads_enter() and
> gdk_threads_leave(). Otherwise you have two threads potentially trying
> to do GUI operations at the same time, leading to many problems.

Read the thread-section in glib and gtk reference manual, they describe
the usage og gdk_threads_enter/gdk_threads_leave. Any thread can update
any widget, since a change will enqueue a draw event that will be executed
in the  gtk_main() thread.

A classic example for mvc is to store your data in a gtk_list_store og
gtk_tree_store. You can even filter and sort, by stacking models. And
Treeview is the presentation. However, to mangle and change values in the
model you would need to do by hand.



Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Gtk themes link doesnt open.

2005-03-09 Thread stian
> hello gtk webpage admin,
>
> the gtk themes page isnt working. i just wanted to put it into your
> notice.

http://www.gtk.org/api/

has a dead links aswell.

http://www.gtk.org/api/2.6/pango-1.8.0/index.html is wrong



http://www.gtk.org/api/2.6/gdk-pixbuf/index.html
has some strange letters around that was ment to be spaces (comes as (?)
things on my font)



Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: dateformat

2005-03-08 Thread stian
> Is there dateformat function in gtk? I have date dd/mm/ and I want
to change to /yy/dd Mysql format.
> thx

That would be plain playing

void convert(char *dst, const char *src)
{
 dst[0]=src[6];
 dst[1]=src[7];
 dst[2]=src[8];
 dst[3]=src[9];
 dst[4]='/';
 dst[5]=src[3];
 dst[6]=src[4];
 dst[7]='/';
 dst[8]=src[0];
 dst[9]=src[1];
 dst[10]=0;
}

Stian


___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Gtk will not configure

2005-03-04 Thread stian
> I type sudo ./configure PKG_CONFIG_PATH=/usr/X11R6/bin --without-libjpeg
>
> And here are the errors.
>
> checking for freetype-config... /usr/X11R6/bin/freetype-config
> checking For sufficiently new FreeType (at least 2.0.1)... no
> configure: error: Xft Pango backend is required for x11 target
>
> I have installed freetype.  Where does GTK look for the 'sufficiently new
> FreeType'.

freetype-configwill reveal the freetype version you are using. But you
need pango between. gtk talks with pango, and pango talks to whatever
font-system is available at the host.

What gtk version are you trying to compile?


Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: where do i look for help with glib installation?

2005-03-04 Thread stian
> i suspect i've come to the wrong place, but, where's the right place?

http://bugzilla.gnome.org/

> i need help getting glib-2.6.0 to __completely__ make.
> gutils.c evidently isn't getting put into the libglib-2.0.so.
> (i've tracked that down.)  that is, these are defined in gutils.c,
> and, presumably, once that gets into the library, i should be okay.

great you are looking into it. To find symbol-definations etc, you can use
objdump.

objdump -r -R -t -T test.sowill give you all symbols (provided, and
needed).


All bugs should be posted at bugzilla, and if you are able to track down
the source of the problem and/or solve it, post a patch there aswell.

These mailinglists are for discussion and general user-help aswell.


Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Newbie Question about installing GTK+-2.6

2005-02-25 Thread stian
> I was using root account, but I got "-bash: ./configure: Permission
> denied", why could this happen?

You have uncompressed it onto a partition that is mounted noexec. Or to a
filesystem that doesn't have filemodes like fat.

Or you are not the same user as uncompressed it (but it should not be a
problem, since the script has mode 755)

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GTK...

2005-02-24 Thread stian
> I have tryed to install GTK on Fedora Core 3. I ot glib to install,
> but when trying to configure the pango and AK, i get errors, on atk it
> says my glib is not of the version it needs, but i installed 2.6.2.
> Also when intalling PANGO, it sys i need fontonfig, but i installed
> the latest fontconfig and it till didn't work, what can i go, becuase
> i can't install gtk with out those.

You need fontconfig-devel probably.


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: TreeFilterModel and sorting

2005-02-24 Thread stian
> I've just run into this problem (using pygtk).
>
> I'd like to have a liststore that is both sortable and filterable.
>
> In fact, I had such a beast, but I was using my own nasty hacks to
> implement the filtering.  I've had on my to-do list to switch to the
> TreeModelFilter + I've just tried that -- unfortunately it seems I can
> either have filtering or sorting, but not both.
>
> Am I missing some trick?

You can stack models

GtkListStore
GtkFilterStore
GtkSortStore

And use the Store are the model in the GtkTreeview

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Installing On OpenBSD

2005-02-20 Thread stian
> I am attempting to build on OpenBSD. I have included
> the config.log generated. It seems to think I don't
> have iconv installed. I do have iconv on my system,
> and I did install the libiconv-1.9.1 package.
>
> Please help.

It tries to find iconv_open function from libc and libiconv. Can you find
out what the library is named on your machine. Perhaps it is in a
directory not listed in /etc/ld.so.conf or you haven't ran ldconfig for a
long time. (if OpenBSD uses the same ld semantics as gnu linux libc)


Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: problems installing pango...

2005-02-20 Thread stian
> I have a debian distro (woody) with X server running, the X font server
> is also running (xfs).
>
> I tried to get info from the Pango web site but could not find any, or
> understand it :)

Backend = a place to fetch font data and display it.

You need to have the development packages installed aswell. On debian I
recall that they have the same name, byt suffixed by -dev, so if you have
binary package "foo" you would install "foo-bar" aswell. Install the
development package to X and fontconfig and you can compile pango.

But doesn't debian woody already provide binary-packges for pango 1.8.0 etc?


Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to change the font of GtkComboBox popup list

2005-02-15 Thread stian
> I think you are talking about GtkCombo, i was talking about GtkComboBox.
Sorry

I was a bit tired.. GtkComboBox uses a GtkTreeViewColumn, which I believe
you can change the look of by this little thingy

gtk_combo_box_cell_layout_add_attribute




Stian Skjelstad aka mw|
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to change the font of GtkComboBox popup list

2005-02-15 Thread stian
> Hi,
>
> I'm trying to change the font of a GtkComboBox but i can only change the
> font of the the 'label' part (that what's visible when popup is inactive)
> I cannot find a way to change the font of the popup entry's, i tried with
> gtk_container_forall() but that didn't work.
> I have found a couple of simular questions with google, but no answers.
> (hope i will have more luck this time)
> Has anyone successfully done this?, is it even possible?
> I'm using gtk+ 2.4

I don't have to to write a sample, but this shoule be enough:

GTK_LIST(GTK_COMBO(mywidget)->list)

And look up the docs for GtkList for how to change the look of it.


Stian Skjelstad aka mw|
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: newbie question

2005-02-12 Thread stian
> I have a program which was written in gtk+1.2. What steps do I need to
> take to
> convert it to gtk-2? Are there any tools available for such an enterprise?

The online documentations has some info about this (Also availble locally
with the development package of gtk+ on most distroes) aswell as most
other aspects of gtk+

http://developer.gnome.org/doc/API/2.0/gtk/gtk-changes-2-0.html


Not all low-level changes are mentioned though.

Stian Skjelstad aka mw|
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: stupid suggestion about themes

2005-02-11 Thread stian
>> I was talking about what you say as "host-
>> dependent themes".
>
> You can do this with X appilcations via X resources.
> Yet another reason why I wish Gtk could be configured
> using X resources. Any chance of Gtk supporting widget configuration
> via X resources in the future?

Gtk already partly does this. Some stuff mentioned on freedesktop.org. In
part of making kde og gtk having the same theme-feeling, and Gtk stores
some few things in X resources as font-size etc. if I recall right.


Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GTK & MPI

2005-02-11 Thread stian
> Basically, I'm running some heavy computation on a Beowulf cluster...  I
> need the main node (the one with the monitor) to do some graphical output
> of the computations...  I have tried this in two ways: 1) I write my MPI
> code, and then start inserting GTK code into it...  I want the main node
> to set up the GUI and then wait for it to start receiving information...
> However, I found out that as soon as this node calls gtk_main, it can no
> longer continue to the rest of its code (the data gathering)

don't use gtk_main. Use g_main_context_iteration instead and call that
from the the internal-main loops of your program. That is a good start..


Stian Skjelstad


___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: multiple declaration error

2005-02-09 Thread stian
>   does anyone know why i get the following error even
> though i've only declared the function once?
>
> callbacks.o(.text+0x0): In function
> `draw_button_clicked':
> /home/programs/animation4/src/callbacks.c:17: multiple
> definition of `draw_button_clicked'
> main.o(.text+0x0):/home/programs/animation4/src/callbacks.c:17:
> first defined here
> collect2: ld returned 1 exit status
> make: *** [a] Error 1


2 possible faults:

1) You have a function named draw_button_clicked that is not static
defined two places (c files).

2) You have linked a .o file twice into your target.

for instance

gcc callbacks.c callbacks.o -o main

gcc callbacks.o callbacks.o -o main




Stian Skjelstad aka mw|
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Are g_try_malloc() and g_free() thread-safe?

2005-02-07 Thread stian
> Can anyone say with certainty whether g_try_malloc() and g_free() are
> thread-safe?  I've spent considerable time searching mailing lists and
> googling and have found only sketchy opinions at best.

glib itself is thread safe, while the user-side is not. g_malloc and
g_free is thread safe. a GList for instance is not.

> Historically, I have been wrapping all of my allocations and releases in
> a global mutex, but this seems far from optimal.  I assume that these
> functions are implementations of malloc() and free(), but again it seems
> there is no definitive answer to my question.

malloc and free are not thread-safe unless you define _REENTRANT or such
alike. g_malloc/g_free do not wrap around malloc/free. glib has its own
internal memory management as far as I know.

> If these functions lock the heap during memory allocations and releases
> then my wrappers are pointless.  However, I have noticed that when I
> don't use the global mutex wrapper, g_try_malloc will often return an
> invalid address (not NULL as documented) or my data will be corrupt when
> it is access across threads.

That should not happen.

> Basically, my application has several threads which push and pop
> "messages" to/from a linked-list.  The data (message) for each node is
> allocated from the heap when it is "pushed" and freed by the processing
> loop when it is "popped".  The result is that there can be several
> hundred messages which are allocated and freed within a very microscopic
> time frame.  Since my linked-list is independently locked
> (g_static_mutex_lock), I am confident the problem lies outside the list
> mechanism.

In that case. there is a glib but out there. Atleast that is my toughts.



Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Can someone tell me how I can copy a binary file

2005-02-07 Thread stian
> Can someone tell me how I can copy a binary file. Is glib not good for
> this? And how should the code be then. A code example would be really
> welcome! thx

Increase your buffer to be 4096 bytes atleast even much bigger like a
megabyte to lessen the number of iterations you need and number of
syscalls done.

You will need to loop reading/writing until you aren't able to read any
more data. If you are in Gtk it can be a good ide to call g_main_iterate
inside the loop, so the program doesn't freeze for the user.




Stian Skjelstad aka mw|
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to implement the GUI interface with a tranfer files window

2005-02-06 Thread stian
> Hi Everyone,
> I've been thinking about making new widgets with the
> file selection widgets inside. But I don't know how.
>
> Please let me know if anyone knows about this or some
> examples on the web.

Download the a gtk+-2.6.x source and look inside the gtk folder. Each
widget is dedicted to its own .c and .h file. Use a simple widget as a
template.

Good luck,
Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to static link a program?

2005-02-06 Thread stian
> I tried on one of my projects, and the only static libraries are those
> compiled inside the project.
> It seems that those flags are intended for libraries production. To have
> static linking of the libraries in the executable, you must probably
> list the libraires in the LDFLAGS, i.e. /usr/lib/libglib.a instead of
> -lglib, which will need some editing in Makefile.am.

Correct, the configure flags are to determine if you want to make static
and/or dynamic/shared libraries.

If you add -shared or -dynamic, you make gcc/ld have a preferred choice if
it finds both shared and dynamic libraries. -shared is the default.


Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: How to static link a program?

2005-02-05 Thread stian
> [EMAIL PROTECTED]:~/Projects/hpntpos$ vi configure.in
> [EMAIL PROTECTED]:~/Projects/hpntpos$ autoconf
> configure.in:14: error: possibly undefined macro: AC_ENABLE_STATIC
>   If this token and others are legitimate, please use
>   m4_pattern_allow.
> See the Autoconf documentation.

aclocal is your friend



Stian




___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: is GtkRadioButton thread safe? how do I make sure my similar widget is also thread safe?

2005-02-03 Thread stian
> I'm sure I understand you because of the following, but to make
> absolutely certain...  you mean: locking shared structures from within
> generic widget code (such as that defined by the GtkRadioButton) is a
> terrible idea.  right?  (don't bother answering this question, unless my
> head is really on backwards.)

GtkWidget's are thread-safe when you use the gdk_threads_enter and
gdk_threads_leave right.

> Thank you very much for removing my confusion.  I'll let my simple
> widgets continue to be non-thread-safe.

Yes. Since the widgets don't do the thread-locking. User-code does, and
the gtk-main-loops.


Stian Skjelstad
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Hello there

2005-01-30 Thread stian
> You probably hate threading questions by know, so bare with me.
never mind.. I found the misstake..

One of the gdk_threads_leave had been replaced with and gdk_threads_enter.

*knock myself in the head and get some more coca cola*

Stian
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Hello there

2005-01-30 Thread stian
You probably hate threading questions by know, so bare with me.

Are you supposed to use gdk_threads_enter() and gdk_threads_leave from
within a glib callback?

I have this code

static gboolean pollin(GIOChannel *source,
   GIOCondition condition,
   gpointer data)
{

gdk_threads_enter();
 do some stuff to a GtkListStore to append some info the source gave me
gdk_threads_leave();   <- here it hangs
return TRUE;
}


I'm now recompiling glibc, glib and gtk in order to get symbols in gdb,
back-traces.


Stian Skjelstad aka mw|
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list