Re: glib main loop without gtk

2008-11-13 Thread Alexander Semenov

Thomas Stover wrote:
So if one wants to use g_io_channels with out gtk (console / server 
app), what exactly is the idea? Does glib need an initialization 
function called first? I see the g_main_loop_new() and friends 
functions, and that part make sense. The thing is 
g_io_add_watch_full() type functions don't have a main loop parameter. 
In other words were does this default main loop come from?

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


From giochannel.c:

guint
g_io_add_watch_full (
  GIOChannel *channel,
  gint priority,
  GIOCondition condition,
  GIOFunc func,
  gpointer user_data,
  GDestroyNotify notify)
{
  GSource *source;
  guint id;

  g_return_val_if_fail (channel != NULL, 0);

  source = g_io_create_watch (channel, condition);

  if (priority != G_PRIORITY_DEFAULT)
g_source_set_priority (source, priority);
  g_source_set_callback (source, (GSourceFunc)func, user_data, notify);

  id = g_source_attach (source, NULL);
  g_source_unref (source);

  return id;
}

g_source_attach docs say:

Adds a GSource cid:part1.08000109.07070102@gmail.com to a /|context|/ 
so that it will be executed within that context.


/|source|/ :

a GSource cid:part1.08000109.07070102@gmail.com

/|context|/ :

	a GMainContext cid:part3.06080301.01060802@gmail.com (if |NULL| 
cid:part4.06010104.01000906@gmail.com, the default context will be used)


/Returns/ :

	the ID (greater than 0) for the source within the GMainContext 
cid:part3.06080301.01060802@gmail.com.



From gmain.c (g_source_attach func):

if (!context)
  context = g_main_context_default ();

So, main loop is found throw GMainContext.

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


Re: glib main loop without gtk

2008-11-13 Thread Alexander Semenov

Alexander Semenov wrote:

Thomas Stover wrote:
So if one wants to use g_io_channels with out gtk (console / server 
app), what exactly is the idea? Does glib need an initialization 
function called first? I see the g_main_loop_new() and friends 
functions, and that part make sense. The thing is 
g_io_add_watch_full() type functions don't have a main loop 
parameter. In other words were does this default main loop come from?

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


Oops, sorry for formatting (copy-paste from devhelp).
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: combobox entries background color

2008-11-13 Thread Xavier Toth
I didn't get any responses so I'm trying again.

On Mon, Nov 3, 2008 at 8:37 AM, Xavier Toth [EMAIL PROTECTED] wrote:
 I'd like to have different background colors on combobox entries.
 Potentially each entry would have a different background color. Is
 there a way to do this?

 Ted

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


Re: glib main loop without gtk

2008-11-13 Thread Emmanuele Bassi
On Wed, 2008-11-12 at 15:20 -0600, Thomas Stover wrote:
 So if one wants to use g_io_channels with out gtk (console / server 
 app), what exactly is the idea? Does glib need an initialization 
 function called first?

only if you use GObject and the rest of the type system - in which case
you'll need to use g_type_init(); or if you use threads - in which case
you'll need g_thread_init(). otherwise you don't need initialization
functions.

  I see the g_main_loop_new() and friends 
 functions, and that part make sense. The thing is g_io_add_watch_full() 
 type functions don't have a main loop parameter. In other words were 
 does this default main loop come from?

all the sources attach themselves to the default *context*, not main
loop. a GMainContext can have multiple main loops. the default context
is created and managed by GLib.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net

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


TextView paste-clipboard callback no text but I can see it

2008-11-13 Thread Xavier Toth
In a TextView paste-clipboard signal callback when I do a get_text on
the TextViews TextBuffer I get nothing but the text is displaying. Is
there some kind of timing issue? Does anyone have an example of this
that works?

Ted
___
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


Re: glib main loop without gtk

2008-11-13 Thread Thomas Stover
First thanks to Alexander Semenov, and Emmanuele Bassi for your 
responses. It took some poking around, but I think get it now. Here is a 
concept demo for any future searches that find this thread. I'm not sure 
how to get out of the infinite loop though, since _iteration() returns 
both TRUE and FALSE on normal execution. I can see how the approach glib 
is using for events would allow for all sorts of stuff like mixing main 
loops with other libraries and delegating events to helper threads. Good 
stuff.



#include glib-2.0/glib.h

gboolean timeout_callback(gpointer opaq)
{
g_print(got here\n);
}

int main(int argc, char **argv)
{
g_timeout_add(3000, timeout_callback, NULL);

while(1)
{
 g_main_context_iteration(NULL, TRUE);
}

return 0;
}

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


GTK_STOCK icons vs. named spec

2008-11-13 Thread John Daiker

Hello All,

First off, apologies for the widespread distribution of this e-mail.  I 
figure start big, and then the appropriate list can assist from there.


Second, I just signed up to the list (gtk-app-devel-list), but had a 
specific question about using the GTK_STOCK_* naming convention versus 
the 'defined text'.  (eg: GTK_STOCK_SAVE vs 'gtk-save'  and   
GTK_STOCK_CLOSE vs 'gtk-close')
Rhythmbox currently uses the GTK_STOCK_* convention, but it has been 
brought up recently 
(http://bugzilla.gnome.org/show_bug.cgi?id=560349#c5) that perhaps this 
convention is 'bad habit'.


Just looking for some insight into this, and maybe to get a feel for 
what the community views as the 'best practice'.


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