Re: Capture console app output into texview?

2009-11-23 Thread Till Harbaum / Lists
Hi,

thanks a lot for that explanation. I'll try to combine this into the
code from Dov.

Till

Am Samstag 21 November 2009 schrieb Artur Galjamov:
> Hi,
> 
> After exec(), child clib's startup routine determines buffering mode for
> stdout (i.e. calls fdopen(1, "w+")). You can setup pseudo-terminal instead
> of pipe, to make child's stdout line-buffered.
> 
> 
> optimistic snippet:
> =
> #include 
> #include 
> #include 
> #include 
> 
> int
> main(int argc, char *argv[])
> {
> int  master_fd, slave_fd;
> FILE*master_file, *slave_file;
> char buf[80], *device;
> 
> master_fd = posix_openpt(O_RDWR | O_NOCTTY);
> 
> grantpt(master_fd);
> unlockpt(master_fd);
> 
> slave_fd = open(device = ptsname(master_fd), O_RDWR | O_NOCTTY);
> 
> printf("slave device: %s\n", device);
> 
> master_file = fdopen(master_fd, "r");
> slave_file = fdopen(slave_fd, "w+");
> 
> if (fork()) {
> fclose(slave_file);
> while (fgets(buf, sizeof(buf), master_file))
> printf("parent got: %s", buf);
> 
> } else {
> // child
> fclose(master_file);
> for (int i = 0; i < 500; i++) {
> sleep(1);
> fprintf(slave_file, "child's data (%d)\n", i);
> }
> }
> 
> return 0;
> }
> =
> 
> 
> 
> 21.11.09, 09:39, "Till Harbaum / Lists" :
> 
> > Hi,
> > thanks again for that hint. Unfortunately adding 
> >  /* switch to line buffered mode */
> > if(setvbuf(fh, NULL, _IOLBF, 0))
> > perror("setvbuf(_IOLBF)");
> > to the program posted by Dov doesn't change anything.
> > Are there limitations on changing the buffer mode? E.g.
> > only the transmitter side can do that?
> 

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


Re: Capture console app output into texview?

2009-11-21 Thread Till Harbaum / Lists
Hi,

thanks again for that hint. Unfortunately adding 
 /* switch to line buffered mode */
if(setvbuf(fh, NULL, _IOLBF, 0))
perror("setvbuf(_IOLBF)");

to the program posted by Dov doesn't change anything.
Are there limitations on changing the buffer mode? E.g.
only the transmitter side can do that?

Till

Am Freitag 20 November 2009 schrieb David Nečas:
> Terminals are normaly line-buffered while pipes are block-buffered, see
> setvbuf(3) for some info.  So the buffering behaviour differs depending
> on where the output goes.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Capture console app output into texview?

2009-11-20 Thread Till Harbaum / Lists
 // GUI and self destruct when it is done.
> static gpointer thread_worker(JobData *job_data)
> {
> FILE *fh = popen(job_data->cmd,"r");
> printf("thread_worker running %s\n", job_data->cmd);
> GIOChannel *gh = g_io_channel_unix_new(fileno(fh));
> GIOStatus status;
> GError *error = NULL;
> gsize length;
> gsize terminator_pos;
> gchar *str_return;
> 
> while( (status = g_io_channel_read_line(gh,
> &str_return,
> &length,
> &terminator_pos,
> &error)) == G_IO_STATUS_NORMAL)
> {
> job_add_to_text_viewer(job_data,
>str_return);
> g_free(str_return);
> }
> 
> g_io_channel_unref(gh);
> pclose(fh);
> job_add_to_text_viewer(job_data,
>"Job done!");
> 
> g_mutex_unlock(job_data->mutex_to_run);
> g_thread_exit(NULL);
> if (job_data)
> job_data_free(job_data);
> 
> return NULL;
> }
> 
> // Callback for the run button
> void cb_clicked_run(GtkWidget *widget,
> gpointer  user_data)
> {
> const gchar *cmd = gtk_entry_get_text(GTK_ENTRY(w_entry_cmd));
> GError *error = NULL;
> printf("Run %s\n", cmd);
> 
> // create a thread that will run the external command
> // tbd...
> JobData *job_data = job_data_new(cmd, mutex_one_job_at_a_time);
> g_thread_create((GThreadFunc)thread_worker, job_data, FALSE, &error);
> if (error) {
> printf("%s\n", error->message);
> g_error_free(error);
> }
> }
> 
> void create_gui()
> {
> GtkWidget *w_top = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> GtkWidget *w_vbox = gtk_vbox_new(FALSE, 0);
> gtk_container_add(GTK_CONTAINER(w_top), w_vbox);
> 
> GtkWidget *w_scrolled_win = gtk_scrolled_window_new(NULL, NULL);
> gtk_widget_set_size_request(w_scrolled_win, 500, 400);
> gtk_box_pack_start(GTK_BOX(w_vbox), w_scrolled_win,
>TRUE, TRUE, 0);
> w_text_view = gtk_text_view_new();
> gtk_container_add(GTK_CONTAINER(w_scrolled_win),
>   w_text_view);
> 
> // An hbox with an entry for the command to run
> GtkWidget *w_hbox = gtk_hbox_new(FALSE, 0);
> gtk_box_pack_start(GTK_BOX(w_vbox), w_hbox,
>FALSE, FALSE, 0);
> gtk_box_pack_start(GTK_BOX(w_hbox), gtk_label_new("Command:"),
>FALSE, FALSE, 0);
> w_entry_cmd = gtk_entry_new();
> gtk_entry_set_text(GTK_ENTRY(w_entry_cmd),
>"perl -e '$|++; for $i (0..10) { print \"$i\\n\";
> sleep 1 }'");
> gtk_box_pack_start(GTK_BOX(w_hbox), w_entry_cmd,
>TRUE, TRUE, 0);
> GtkWidget *w_button_run = gtk_button_new_with_label("Run");
> gtk_box_pack_start(GTK_BOX(w_hbox), w_button_run,
>FALSE, FALSE, 0);
> g_signal_connect(w_button_run, "clicked",
>          G_CALLBACK(cb_clicked_run), NULL);
> 
> // Finally quit button
> GtkWidget *w_button_quit = gtk_button_new_with_label("Quit");
> gtk_box_pack_start(GTK_BOX(w_vbox), w_button_quit,
>FALSE, FALSE, 0);
> g_signal_connect(w_button_quit, "clicked",
>  G_CALLBACK(gtk_main_quit), NULL);
> 
> 
> gtk_widget_show_all(w_top);
> }
> 
> int main(int argc, char **argv)
> {
> // init threads
> g_thread_init(NULL);
> gtk_init(&argc, &argv);
> 
> // Only allow running one command at a time
> mutex_one_job_at_a_time = g_mutex_new();
> 
> create_gui();
> 
> gtk_main();
> exit(0);
> }
> 
> 
> On Fri, Nov 20, 2009 at 10:38, Emmanuel Rodriguez <
> emmanuel.rodrig...@gmail.com> wrote:
> 
> > On Thu, Nov 19, 2009 at 10:11 PM, Till Harbaum / Lists  > >wrote:
> >
> > > Hi,
> > >
> > > i am trying to run a text mode application in the background of my gtk
> > one
> > > and display its output in a textview. I know this is supposed to be done
> > > using g_spawn_async_with_pipes and then link to the output via
> > > g_io_add_watch. I even got something that sort of works, but the output
> > is
> > > very much delayed and comes in chunks and worse, the CPU load is at max
> > > while and after i run my code.
> > >
> > > Are there any examples for doing this? There must be many programs doing
> > > something similar to run e.g. some little helper program or similar.
> > >
> > > Can you consider using the VteTerminal[1] widget? This is the same
> > terminal
> > widget used in gnome-terminal and in Ubuntu/Debian graphical frontends to
> > dpkg. It lets you embed a ternimal that you can bind to any program, you're
> > not forced to bind it to a shell.
> >
> > VteTerminal will take care of monitoring your process and grabbing all
> > output for you. The only drawback is that the widget doesn't work on win32.
> >
> > [1] http://library.gnome.org/devel/vte/unstable/VteTerminal.html
> >
> > Emmanuel Rodriguez
> > ___
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> >
> 

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


Capture console app output into texview?

2009-11-19 Thread Till Harbaum / Lists
Hi,

i am trying to run a text mode application in the background of my gtk one and 
display its output in a textview. I know this is supposed to be done using 
g_spawn_async_with_pipes and then link to the output via g_io_add_watch. I even 
got something that sort of works, but the output is very much delayed and comes 
in chunks and worse, the CPU load is at max while and after i run my code.

Are there any examples for doing this? There must be many programs doing 
something similar to run e.g. some little helper program or similar. 

Regards,
  Till
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


How to do a graphic overlay?

2009-09-02 Thread Till Harbaum / Lists
Hi,

i'd like to do some graphic overlay. In this particular case i'd like to put 
two buttons on top of a goocanvas.

I tried to hook into the expose event and just draw something to the gdkwindow 
of the widget. That simply doesn't work. It works with a gtkdrawingarea, but 
not with the goocanvas.

What can prevent me from drawing to the gdkwindow of a widget? I also tried to 
use a seperate window, but that's pretty difficult to handle since you e.g. 
have to move those windows when you move the main window etc etc. So just 
painting their seems simpler ... but unfortunately doesn't work 

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


How to adjust the spacing around an icon in a button?

2009-04-15 Thread Till Harbaum / Lists
Hi,

i have buttons with icons inside. For some reason the button is slightly bigger 
than it needs to
be. Where do i adjust the border that's drawn around an icon in a button? Also 
this only affects
the height. Is there some kind of preferred vertical size of a button?

Regards,
  Till
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: compile 2 libs together

2009-01-20 Thread Till Harbaum / Lists
Hi,

Am Dienstag 20 Januar 2009 schrieb frederico schardong:
> But now I must use allegro and libglade together.

Why not:
gcc -o main main.c `pkg-config --cflags --libs libglade-2.0` `allegro-config 
--libs`

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


Wait for gtk events with select?

2008-12-30 Thread Till Harbaum / Lists
Hi,

is there a way to wait for gtk events via some file descriptor 
given to a select call? 

I am porting an application to gtk that calls some "gimme_input"
function every now and then and want's me to do some waiting
for net sockets there. Now i'd like to use the same select call
i am using for the network sockets also to wait for gtk events.
Is this possible? What's the name of the file descriptor to use?

Thanks,
Till
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkProgress demo from tutorial not working on ubuntu hardy?

2008-12-11 Thread Till Harbaum / Lists
Hi,

weird: the same code works as expected on the nokia n810.
My problem with the fact the changing the stausbar backround color
also only happens on the PC and works as expected on the n810.

How comes? Why are there at least two things not working as
advertised on a stock ubuntu hardy unit but on the heavily
customized gtk framework delivered with the nokia n810?

Till

Am Mittwoch 10 Dezember 2008 schrieb Till Harbaum:
> Hi,
> 
> i can't manage to get the activity mode of the progress bar to work
> on a ubuntu hardy running gtk 2.12.9
> 
> Even the example from
>   http://library.gnome.org/devel/gtk-tutorial/stable/x831.html
> 
> just makes the progressbar stop when i activate "Activity mode".
> I was expecting it to show this blob bouncing forth and back, but
> that doesn't happen.
> 
> Is/was activity mode broken? I'll try this on a different machine.
> 
> Till
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


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


Re: Ok button key binding

2008-11-14 Thread Till Harbaum / Lists
Hi,

Am Freitag 14 November 2008 schrieb Garth's KidStuff:
> The one subtle point for me was that any Gtk::Entry controls in the dialog
> ate the return unless I did the following:
> 
> Gtk::Entry m_IDC_ADD_PAGE_TITLE;
> ...
> m_IDC_ADD_PAGE_TITLE.set_activates_default(true); // Enter while editing
> should activate default OK
Thanks, that was my problem! This works in those dialogs that have entries.
Now i am still facing a similar issue with dialogs containing a gtktreeview 
based
list. Pressing return selects an item in that list, but not the default dialog 
button.
Any hint how to cope with the treeview? Unfortunately it doesn't have a
set_activates_default() function ...

Thanks again,
  Till
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Changing gtkstatusbar background color

2008-11-14 Thread Till Harbaum / Lists
Hi,

sorry to bother you again with a question. I am trying to set the background 
color of a
statusbar. I have found several postings in the net indicating that this is 
just a matter
of adding the statusbar to an eventbox and setting the background color of that.

However ... that just doesn't work. The following code shows a statusbar and 
for a fraction of
a second i even see it having a red background. But after that it returns to 
its default
color and stays that way. What am i doing wrong?

Thanks,
   Till


#include 

GtkWidget *statusbartest(void) {
  GdkColor color;
  gdk_color_parse("red", &color);

  GtkWidget *eventbox = gtk_event_box_new();
  GtkWidget *statusbar = gtk_statusbar_new();  
  gtk_container_add(GTK_CONTAINER(eventbox), statusbar);

  gtk_widget_modify_bg(eventbox, GTK_STATE_NORMAL, &color);

  gtk_statusbar_push(GTK_STATUSBAR(statusbar),
 gtk_statusbar_get_context_id(GTK_STATUSBAR(statusbar), "Msg"),
 "This message is meant to have a red background");

  return eventbox;
}

int main(int argc, char *argv[]) {
  gtk_init (&argc, &argv);

  GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size(GTK_WINDOW(window), 500, 50);

  gtk_container_add(GTK_CONTAINER(window), statusbartest());

  g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), 
NULL);

  gtk_widget_show_all(GTK_WIDGET(window));
  gtk_main();

  return 0;
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Ok button key binding

2008-11-13 Thread Till Harbaum / Lists
Hi,

i just noticed, that there seems to be some automatic key binding for
the Escape key to the cancel/No/Close buttons of gtkdialogs. But there
doesn't seem to be a binding for Open/Yes/Ok which i expected to be
the Return key. 

Are these bindings documented somewhere? I can't find anything. 
Also how do i make the Ok button to react on the return key.

Thanks,
  Till
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


A dialog as small as possible, except it needs scrolling

2008-10-31 Thread Till Harbaum / Lists
Hi,

i have the following problem: I have a dialog with variable contents. Since this
content may even exceed the screen size (which isn't too difficult on a nokia
n810) i have put the entire content into a scrolled window.

My problem now is the dialog size. I want the dialog as small as possible but
as big as necessary. Unfortunately the scrolled window causes the dialog to
not use the available screen space. I want the scrolled window to be very small
if possible but to expand if the contents get bigger and as long as there's 
screen
space available.

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


Re: Howto correctly generate "expandable void"?

2008-10-25 Thread Till Harbaum / Lists
Hi,

Am Samstag 25 Oktober 2008 schrieb James Scott Jr:
> -- vbutton_box(x,y,z) -- postioned using end
Argh ... i can't believe i never realized that there's also a 
gtk_box_pack_end. Thanks for pointing this out :-)

Till



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


Howto correctly generate "expandable void"?

2008-10-24 Thread Till Harbaum / Lists
Hi,

i have a vbox with a bunch of buttons. I want some of them to appear at the top
and some of them at the bottom. The buttons should not be expanded and the
space between them should also not expand except the space between the two
groups. Something like this:

(a)
(b)
(c)




(x)
(y)
(z)

How is this done correctly without having some invisible item i can place 
between
both groups and which is set to expand/fill?

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


Re: Passing Struct to g_signal_connect

2008-10-19 Thread Till Harbaum / Lists
Hi,

you have to make sure that the parameters of your callback function
exactly match what's been described for this particular event. In your
case your have to check the "clicked" event for a GtkButton which gives
us:

void user_function(GtkButton *button, gpointer   user_data)  

So this is how your callback function should look like:
void on_button2_clicked(GtkButton *button, struct allStructs *by_ptr)

Your struct should be the _second_ parameter and not the first (any only)
one your made it. What you did is: You got a pointer to the GtkButton structure 
of your button and used _that_ as a pointer to your own struct. You
are likely messing up the Button structure ...

This is one ugly thing with the C bindings and the fact that everything
is just casted by this G_CALLBACK() macro. That way the compiler isn't
able to check these things and errors like yours happen. And these can
be very nasty bugs since they cause people to write to memory they
are not supposed to write to. A classic door for hackers ...

Till

Am Sonntag 19 Oktober 2008 schrieb beginner.c:
> 
> I need to pass a struct using g_signal_connect, but the issue I'm having is
> that I can't alter the elements of the struct within the called function
> e.g.
> 
> void on_button2_clicked (struct allStructs *by_ptr)
> 
> {
>   gtk_label_set_text ((GtkLabel*)by_ptr->widgets.label, "whatever");
> }
> 
> main
> {
> blah blah
> struct allStructs baseStruct;
> 
> g_signal_connect (G_OBJECT(baseStruct.widgets.nextButton), "clicked",
> G_CALLBACK (on_button2_clicked), &baseStruct);
> }
> 
> Any idea's? If I pass this struct to any other function I have no problem
> performing functions like in the callback. For some reason, I can't in the
> callback.
> 


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


Where to ask about gnomecanvas? (How to get all items via gnome_canvas_get_item_at?)

2008-09-11 Thread Till Harbaum / Lists
Hi,

is this the right place to ask a question about gnomecanvas?

I am using gnomecanvas for a mapping application (an openstreetmap editor for
maemo). Sometimes items are stacked (e.g. a building is a polygon which may
be placed in some some park which also is a polygon). The problem is that i need
to get access to all things located on a position, but gnome_canvas_get_item_at
only gives me only the top item. 

How do i get access to all items? The building in the example above may e.g. be 
drawn prior to the park and thus not be the topmost item and thus basically not
accessible. I could of course re-order the items, but my program basically has 
no
knowledge about buildings and the like. Everything is just a polygon (or a 
closed
way in openstreetmap). So i wouldn't know which thing to order in which way.

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


Re: Gtk::ProgressBar doesn't work synchronously

2008-06-28 Thread Till Harbaum / Lists
Hi,

try calling gtk's main processing routine while your task is doing
its work. Something like

 while(gtk_events_pending ())
gtk_main_iteration ();

right after your update of the state of the progress bar should do the trick.

Till

Am Mittwoch 09 April 2008 schrieb Garth's KidStuff:
> Hi All,
> 
> I'm converting a large Windows/Mac project to run on Ubuntu, and I'm a
> little stuck when trying to use a ProgressBar.  We have a cross-platform
> class that assumes I can create a "Progress Monitor" dialog during
> time-intensive tasks, and then periodically update the progress as the task
> completes.
> 
> The problem that I'm having with using Gtk::ProgressBar seems to be a
> fundemental one about when dialogs can actually appear in the main window.
> For example, what I'd like to do is something along the lines of:
> 
> [in my main thread]
> ...
> Start a complex task
> Create a Progress Monitor dialog and show it
> Update the dialog as the task progresses
> Destroy the dialog
> 
> 
> When I try this, nothing shows up *grin*.  As far as I can tell, I need to
> let the run loop process so that the dialog can be shown. (i.e. if I omit
> the "destroy" step in the above, I see the dialog as soon as I drop out of
> "my" code in the main thread, but that's too late -- the task is already
> completed)
> 
> One way to solve this is, of course, to rewrite all the places that use the
> Progress Monitor so that the work is done in a thread and the main thread
> can just be showing the progress bar.  I'd hesitate to try that with this
> code base because of the number of places in cross-platform code that would
> have to be rewritten.
> 
> Do any of you have any thoughts?
> 
> Thanks in advance!
> 


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


Howto copy gtkhtml2 selection to clipboard?

2008-06-12 Thread Till Harbaum / Lists
Hi,

i am searching for the gtkhtml2 pendant of gtk_text_buffer_copy_clipboard() 
which
is the function to be called if the user selects "copy" from an edit menu. 

Any hint?

Thanks,
   Till
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to make gtktextview automatically scroll to cursor?

2008-05-19 Thread Till Harbaum / Lists
Hi,

to answer my own question (i had a look at the maemopad editor source 
code to get my answer):

Never use "gtk_scrolled_window_add_with_viewport" to put the textview into
the scrolled window. Instead use "gtk_container_add" as the textview can
be placed directly in the scrolled window. And in fact it _must_ be placed 
directly to make the scrollbars work as expected.

Till

Am Montag 19 Mai 2008 schrieb Till Harbaum / Lists:
> Hi,
> 
> i have simple problem but hakf an hour of googling didn't give me an answer:
> 
> How do i make an editable gtktextview inside a scrolledwindow to automatically
> scroll to the cursor position? 
> 
> This must be a very basic issue and i am sure it is answered in various simple
> examples. But i just don't find one ...
> 
> Till
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


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


Re: How to make gtktextview automatically scroll to cursor?

2008-05-19 Thread Till Harbaum / Lists
Hi,

coincidentally that's also a thing a needed for my program (a geocaching
application for hildon/maemo named goxview). 

And thanks for that routine, it works perfectly!

Still no hint for the textview. I really can't believe that there's nothing like
this in any tutorial. But all tutorials dealing with textviews inside a scrolled
window do this with non-editable textviews ...

Thanks again,
  Till

Am Montag 19 Mai 2008 schrieb [EMAIL PROTECTED]:
> On Monday 19 May 2008 13:23:39 Till Harbaum / Lists wrote:
> > Hi,
> > 
> > i have simple problem but hakf an hour of googling didn't give me an answer:
> > 
> > How do i make an editable gtktextview inside a scrolledwindow to 
> > automatically
> > scroll to the cursor position? 
> > 
> > This must be a very basic issue and i am sure it is answered in various 
> > simple
> > examples. But i just don't find one ...
> > 
> > Till
> > ___
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> > 
> > 
> 
> Hi,
> maybe this will help you:
> 
>   if (autoscroll) {
>   model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));   
>   path = gtk_tree_model_get_path(GTK_TREE_MODEL(model), &iter);
>   gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(tree), path, NULL, 
> TRUE, 0.0, 0.0);
>   gtk_tree_path_free(path);
>   }
> 
> Ciao,
> ZZ
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


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


How to make gtktextview automatically scroll to cursor?

2008-05-19 Thread Till Harbaum / Lists
Hi,

i have simple problem but hakf an hour of googling didn't give me an answer:

How do i make an editable gtktextview inside a scrolledwindow to automatically
scroll to the cursor position? 

This must be a very basic issue and i am sure it is answered in various simple
examples. But i just don't find one ...

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


Re: Solved: How to make a gtktreeview column flexible?

2008-04-26 Thread Till Harbaum / Lists
Am Samstag 26 April 2008 schrieb Thomas Dybdahl Ahle:
> Interesting, and that make the text eclipse correctly as well?
You have to enable ellipsize seperately of course, but then yes, once 
the window is not wide enough the text in the "flexible" column is being
ellipsized nicely.

Till

> 
> On Sat, 2008-04-26 at 11:16 +0100, Till Harbaum / Lists wrote:
> > Hi,
> > 
> > in have solved this problem. Here's the answer for reference:
> > 
> > Instead of using gtk_tree_view_insert_column_with_attributes to insert
> > a column, one might use seperate calls to  
> > gtk_tree_view_column_new_with_attributes
> > and gtk_tree_view_insert_column as this give us an explicit reference to
> > the column. Thus one can use gtk_tree_view_column_set_expand(TRUE)
> > on that column and voila ... the column scales nicely with the window width.
> > 
> > Till
> > 
> > Am Freitag 25 April 2008 schrieb Till Harbaum / Lists:
> > > Hi,
> > > 
> > > i have a gtktreeview filling the complete width of a window. Now i want 
> > > the 
> > > view to always use the full width. I therefore want the middle column (a 
> > > text
> > > column) to be flexible. I want it to be as wide as possible for any given 
> > > window
> > > width. So if you make the window wider i want this column to become wider.
> > > 
> > > If i just enable ellipsis in the columns text renderer the column gets 
> > > very 
> > > small and only a fraction of the window width is used. If i make it a 
> > > fixed 
> > > width it's exactly that: fixed width.
> > > 
> > > How do i make the column always use a much space as possible but never
> > > more than available?
> > > 
> > > Till
> > > ___
> > > gtk-app-devel-list mailing list
> > > gtk-app-devel-list@gnome.org
> > > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> > > 
> > 
> > 
> > ___
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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


Solved: How to make a gtktreeview column flexible?

2008-04-26 Thread Till Harbaum / Lists
Hi,

in have solved this problem. Here's the answer for reference:

Instead of using gtk_tree_view_insert_column_with_attributes to insert
a column, one might use seperate calls to  
gtk_tree_view_column_new_with_attributes
and gtk_tree_view_insert_column as this give us an explicit reference to
the column. Thus one can use gtk_tree_view_column_set_expand(TRUE)
on that column and voila ... the column scales nicely with the window width.

Till

Am Freitag 25 April 2008 schrieb Till Harbaum / Lists:
> Hi,
> 
> i have a gtktreeview filling the complete width of a window. Now i want the 
> view to always use the full width. I therefore want the middle column (a text
> column) to be flexible. I want it to be as wide as possible for any given 
> window
> width. So if you make the window wider i want this column to become wider.
> 
> If i just enable ellipsis in the columns text renderer the column gets very 
> small and only a fraction of the window width is used. If i make it a fixed 
> width it's exactly that: fixed width.
> 
> How do i make the column always use a much space as possible but never
> more than available?
> 
> Till
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


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


How to make a gtktreeview column flexible?

2008-04-25 Thread Till Harbaum / Lists
Hi,

i have a gtktreeview filling the complete width of a window. Now i want the 
view to always use the full width. I therefore want the middle column (a text
column) to be flexible. I want it to be as wide as possible for any given window
width. So if you make the window wider i want this column to become wider.

If i just enable ellipsis in the columns text renderer the column gets very 
small and only a fraction of the window width is used. If i make it a fixed 
width it's exactly that: fixed width.

How do i make the column always use a much space as possible but never
more than available?

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


Still the multi-textview in scrolled win in notebook problem ...

2008-04-23 Thread Till Harbaum / Lists
Hi,

i am still fighting with a strange problem. Some things need to be combined to
trigger it:

- I have a tabbed notebook
- One initially not visible (read: not the first) tab contains a scrolled win
- Inside this win are mutliple textviews (or gtkhtml views) in a vbox or table
- At least one of these texts contains a newline

Then the textviews will initially not display the entire text but only the part
up to the first newline in the text. Once i click into the text everything is 
corrected and the entire text becomes visible. If any of the above things 
isn't there (e.g. no notebook or not multiple textviews) everything displays 
fine.

But if all four things come together the text is truncated after the first 
newline.
This is even worse with a gtkhtml view as this isn't even updated if i cklick 
into
the view.

I have attached what i think is the shortest program demonstrating the problem.
I am seeing this problem with gtk 2.12.0 under ubuntu as well as with  gtk 
2.10.12
under maemo/hildon on a n810.

Please have a look at the attached example.

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