strangeness of g_signal_connect

2005-07-25 Thread Colossus

Hi,

In my app I have the following:

g_signal_connect ((gpointer) AddFile_button, clicked,
G_CALLBACK (on_add_files_activate),
dummy);

I have noticed that if the function on_add_files_activate is 
declared with only one parameter, gpointer data , I never receive the 
word dummy. Instead if  the same function is declared with two parameters:


void on_add_files_activate ( GtkWidget *useless , gpointer data);
I can successfull print the value dummy pointed by data.

Could gtk developers explain this strange behaviour please ?
--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/

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


Re: strangeness of g_signal_connect

2005-07-25 Thread David Necas (Yeti)
On Mon, Jul 25, 2005 at 09:18:57AM -0700, Colossus wrote:
 g_signal_connect ((gpointer) AddFile_button, clicked,
 G_CALLBACK (on_add_files_activate),
 dummy);
 
 I have noticed that if the function on_add_files_activate is 
 declared with only one parameter, gpointer data , I never receive the 
 word dummy. Instead if  the same function is declared with two parameters:
 
 void on_add_files_activate ( GtkWidget *useless , gpointer data);
 I can successfull print the value dummy pointed by data.
 
 Could gtk developers explain this strange behaviour please ?

There's nothing strange about this behaviour.

The first argument of signal handlers is alwasy the object that
emitted the signal, user_data is the last.  If you want
user_data as the first argument, use g_signal_connect_swapped().
Please read the Gtk+ tutorial.

The fact C functions may be called with more arguments than
declared (though it's still error in ANSI C if you do that
without typecast) is just a side-effect of C calling
convention.

Yeti


--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: strangeness of g_signal_connect

2005-07-25 Thread Annamalai Gurusami
Colossus [EMAIL PROTECTED] writes:

 In my app I have the following:

 g_signal_connect ((gpointer) AddFile_button, clicked,
  G_CALLBACK (on_add_files_activate),
  dummy);

I normally write the above call like this:

g_signal_connect( G_OBJECT(AddFile_button), clicked,
  G_CALLBACK(on_add_files_activate), dummy);

Are both correct?  Which is the preferred way to do it?

 I have noticed that if the function on_add_files_activate is
 declared with only one parameter, gpointer data , I never receive
 the word dummy. Instead if the same function is declared with two
 parameters:

 void on_add_files_activate ( GtkWidget *useless , gpointer data);
 I can successfull print the value dummy pointed by data.

 Could gtk developers explain this strange behaviour please ?

The actual parameters of the callback function is determined by the
event and the widget handling the event.  Here you are handling the
clicked event for a GtkButton.  And for this event, the prototype of
the callback handler is

void user_function(GtkButton *button,  gpointer user_data);

http://developer.gnome.org/doc/API/2.0/gtk/GtkButton.html#GtkButton-clicked

You can use it or not, but you cannot change their order or add more
arguments.  Maybe others can add more information on this.

Rgds,
anna

-- 

Open Movie: Not only will the project be realized with Open
Source/Free Software, but also the resulting movie will be published
under an open public license. This makes it an exciting premiere as
first ever Open Movie project!  [ http://orange.blender.org ]
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: strangeness of g_signal_connect

2005-07-25 Thread Colossus

Annamalai Gurusami wrote:


g_signal_connect( G_OBJECT(AddFile_button), clicked,
  G_CALLBACK(on_add_files_activate), dummy);

The actual parameters of the callback function is determined by the
event and the widget handling the event.  Here you are handling the
clicked event for a GtkButton.  And for this event, the prototype of
the callback handler is


I just tried to replace gpointer with G_OBJECT but nothing to do, the 
value dummy is never received by the function. I must use two 
parameters and get rid of the first one to receive the value dummy.

--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/

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


Re: strangeness of g_signal_connect

2005-07-25 Thread Annamalai Gurusami
Colossus [EMAIL PROTECTED] writes:

 Annamalai Gurusami wrote:

 g_signal_connect( G_OBJECT(AddFile_button), clicked,
   G_CALLBACK(on_add_files_activate), dummy);
 The actual parameters of the callback function is determined by the
 event and the widget handling the event.  Here you are handling the
 clicked event for a GtkButton.  And for this event, the prototype of
 the callback handler is

 I just tried to replace gpointer with G_OBJECT but nothing to do, the
 value dummy is never received by the function. I must use two
 parameters and get rid of the first one to receive the value dummy.

You took two *separate* comments, joined it together, and now
complaining that my suggestion didn't work!!  Funny!  :-D

What I was suggesting is that

g_signal_connect( G_OBJECT(AddFile_button), clicked,
  G_CALLBACK(on_add_files_activate), dummy);

is better than

g_signal_connect( (gpointer)AddFile_button, clicked,
  G_CALLBACK(on_add_files_activate), dummy);

because G_OBJECT does some type checking.  This has nothing to do with
the semantics of callback functions.

Rgds,
anna

-- 

Open Movie: Not only will the project be realized with Open
Source/Free Software, but also the resulting movie will be published
under an open public license. This makes it an exciting premiere as
first ever Open Movie project!  [ http://orange.blender.org ]
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


im-xim.la does not export GTK+ IM module API

2005-07-25 Thread Jirka Pirko

hi

i got following error when compiling gtk - i tried almost everything but 
error still occurs:


Cannot load module 
/home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules/input/im-xim.la: 
/home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules/input/.libs/im-xim.so: 
undefined symbol: XmbResetIC
/home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules/input/im-xim.la 
does not export GTK+ IM module API: 
/home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules/input/.libs/im-xim.so: 
undefined symbol: XmbResetIC

make[3]: *** [gtk.immodules] Error 1
make[3]: Leaving directory 
`/home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules/input'

make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory 
`/home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules'

make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8'
make: *** [all] Error 2

thanks for any advice

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


[GObject] Error in unref

2005-07-25 Thread Uzytkownik
I've this check function:

#include woc-pager-test.h
#include woc-pager-parser.c

#define TEST(name, cau) g_print(#name ...\t%s\n, cau ? OK : Fail)

void woc_pager_parser_test() {
WocPagerParser *parser = NULL;

TEST(Check GType, WOC_PAGER_PARSER_TYPE);
TEST(Init, parser = g_object_new(WOC_PAGER_PARSER_TYPE, NULL));
g_print(%p\n, parser-scanner);
g_object_unref(parser);
}

It's print address, but after it's error of memory.
Init/fini functions:
static void class_init(gpointer g_class, gpointer class_data) {
GObjectClass *gclass = G_OBJECT_CLASS(g_class);
gclass-finalize = finalize;
}

static void init(GTypeInstance *instance, gpointer g_class) {
WocPagerParser *self = WOC_PAGER_PARSER(instance);

self-scanner = g_scanner_new(NULL);
}

static void finalize(GObject *object) {
WocPagerParser *self = WOC_PAGER_PARSER(object);
g_print(1);
g_scanner_destroy(self-scanner);
g_print(2);
}

And TypeInfo:
static const GTypeInfo info = {
sizeof(WocPagerParserClass),

NULL,
NULL,

class_init,
NULL,
NULL,

sizeof(WocPagerParser),
0,
init,

NULL
};



What do I do wrong? finalize isn't calling

Regards.
-- 
Linux user: #376500 (patrz http://counter.li.org/)
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: [GObject] Error in unref

2005-07-25 Thread Tristan Van Berkom

Uzytkownik wrote:
[...]


It's print address, but after it's error of memory.


What do you mean by error of memory ?


What do I do wrong? finalize isn't calling


What does WocPagerParser derive from ?

If there is GtkObject in the heirarchy, then gtk_object_sink()
needs to be called (or gtk_object_destroy).

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


Re: [GObject] Error in unref

2005-07-25 Thread Tim Müller
On Monday 25 July 2005 10:14, Uzytkownik wrote:

 #define TEST(name, cau) g_print(#name ...\t%s\n, cau ? OK : Fail)

 TEST(Init, parser = g_object_new(WOC_PAGER_PARSER_TYPE, NULL));
  g_print(%p\n, parser-scanner);
  g_object_unref(parser);
...
 It's print address, but after it's error of memory.
   ...
 What do I do wrong? finalize isn't calling

You've shot yourself in the foot with that macro. Here's a hint - try this:

  g_print (%s\n, parser-scanner);

and then think about why that prints OK and what exactly your macro expands 
to ... :-P

Cheers
 -Tim

PS: it should work as expected if you put brackets around the cau in the macro 
definition

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


calling gtk_menu_popup from a button's clicked signal

2005-07-25 Thread Hubert Sokołowski

Hi!

I have a GtkMenu which I want to popup when a user clicks a button.
my function that is called when user clicks the button looks like this

void
on_zamowienia_button_print_clicked (GtkButton   *button,
gpointer user_data)
{
...
}

How do I get the GdkEventButton here so I can pass the time and button
values to gtk_menu_popup ?

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


Re: calling gtk_menu_popup from a button's clicked signal

2005-07-25 Thread Hubert Sokołowski

ok, button-press-event on the button did the job :)
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: calling gtk_menu_popup from a button's clicked signal

2005-07-25 Thread Tristan Van Berkom

Hubert Sokołowski wrote:

Hi!

I have a GtkMenu which I want to popup when a user clicks a button.
my function that is called when user clicks the button looks like this

void
on_zamowienia_button_print_clicked (GtkButton   *button,
gpointer user_data)
{
...
}

How do I get the GdkEventButton here so I can pass the time and button
values to gtk_menu_popup ?


You cant,
 usualy you would use button-press-event for that.

I suppose generating the arguments for gtk_menu_popup() is no big deal
but why would you want to use a GtkButton to create a context menu ?

Cheers,
 -Tristan

Note that You can't is an overstatement, you probably /could/ get
ahold of the button-release-event emmission which is being handled
by GtkButtonClass (hence the emmission of clicked) but that would
just be an API abuse :)

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


Window Visibility Signal

2005-07-25 Thread Kevin DeKorte
What Signal is issued when a window becomes visible or invisible.

Say I have a window and other window covers it up, is there signal that is 
emitted or if a window is uncovered?

Thanks,

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

Re: Window Visibility Signal

2005-07-25 Thread Tristan Van Berkom

Kevin DeKorte wrote:

What Signal is issued when a window becomes visible or invisible.

Say I have a window and other window covers it up, is there signal that is 
emitted or if a window is uncovered?


You'll recieve expose-event whenever X needs to redraw a widget,
I think that in cases where the window is actualy presented
(like with `gtk_window_present()') you'll recieve focus-in-event
on the toplevel.

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


Re: Window Visibility Signal

2005-07-25 Thread Kevin DeKorte
On Monday 25 July 2005 12:22 pm, Tristan Van Berkom wrote:
 Kevin DeKorte wrote:
  What Signal is issued when a window becomes visible or invisible.
 
  Say I have a window and other window covers it up, is there signal that
  is emitted or if a window is uncovered?

 You'll recieve expose-event whenever X needs to redraw a widget,
 I think that in cases where the window is actualy presented
 (like with `gtk_window_present()') you'll recieve focus-in-event
 on the toplevel.


Tristan,

Expose is no problem, but what about when it is hid? basically I want 
to know 
when the window is hid, so I don't draw to it.

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

Re: [GObject] Error in unref

2005-07-25 Thread Uzytkownik
Dnia 25-07-2005, pon o godzinie 15:21 +0100, Tim Müller napisał(a):
 On Monday 25 July 2005 10:14, Uzytkownik wrote:
 
  #define TEST(name, cau) g_print(#name ...\t%s\n, cau ? OK : Fail)
 
  TEST(Init, parser = g_object_new(WOC_PAGER_PARSER_TYPE, NULL));
   g_print(%p\n, parser-scanner);
   g_object_unref(parser);
 ...
  It's print address, but after it's error of memory.
...
  What do I do wrong? finalize isn't calling
 
 You've shot yourself in the foot with that macro. Here's a hint - try this:
 
   g_print (%s\n, parser-scanner);
 
 and then think about why that prints OK and what exactly your macro expands 
 to ... :-P
 

I'm stupid :) - I didn't remember Be careful with macros
This is what is wrong :)
Now all it's OK.

 Cheers
  -Tim
 
 PS: it should work as expected if you put brackets around the cau in the 
 macro 
 definition

I forgot it.

Thank you very much.

Best regards.


-- 
W�ochy i Pary� - przewodniki turystyczne do wyboru. Tylko z lipcowym numerem 
miesi�cznika Auto+. 
http://www.a-plus.pl
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: calling gtk_menu_popup from a button's clicked signal

2005-07-25 Thread Greg Breland
On Mon, 2005-07-25 at 11:53, Tristan Van Berkom wrote:

 I suppose generating the arguments for gtk_menu_popup() is no big deal
 but why would you want to use a GtkButton to create a context menu ?


First, I'm 100% with you on this issue.  The product I support does this
and it confuses the users 100% of the time.  However, I can't say I
could offer a better option where I have seen this interface used.  I
blame it on how terrible combo boxes are on all platforms.

The places I've seen it used are when the user is entering very generic
data.  The dialog allows the user to  save the data or to cancel.  If
the user wishes to save, the program has to know where/how to save the
data.

For example, our product helps users keep track of customers and what
they've done for these customers.  When our user's phone rings, they
instantly hit F6 which is an activity dialog that lets them pick the
customer and enter in free form notes.  The user is only given the
option to save or cancel.  When the user clicks save they get a
context menu where they can pick what to do with the data.  There are
about ~13 options on the menu.  Here are a couple of examples:

1) Save as Note
2) Save as Completed Phone Call
3) Save as Completed Phone Call with Followup
4) Etc.

Until the user has been using that screen for a few days, it confuses
the mess out of them.  There are only maybe 5 places that technique is
used in the product thank goodness.  Having a required combo box where
the user chooses the type of record to create would slow the user down
or so the thinking went by the developer.  The only other option would
have been to make the combo change save the form, but that would have
been even worse.

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


Re: Window Visibility Signal

2005-07-25 Thread Zeeshan Ali
Hello,

 Expose is no problem, but what about when it is hid? basically I want 
 to know
 when the window is hid, so I don't draw to it.

   If you only want to check if a widget is visible or not at a
particular time, you'll need to check for the 'visible' property of
the widget. Moreover, 'expose' signal is called for both the cases
(show and hide). If you choose to go the 'expose' way then connect
your handler using g_signal_connect_after().

-- 
Regards,

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


Re: calling gtk_menu_popup from a button's clicked signal

2005-07-25 Thread Tristan Van Berkom

Greg Breland wrote:
[...]

For example, our product helps users keep track of customers and what
they've done for these customers.  When our user's phone rings, they
instantly hit F6 which is an activity dialog that lets them pick the
customer and enter in free form notes.  The user is only given the
option to save or cancel.  When the user clicks save they get a
context menu where they can pick what to do with the data.  There are
about ~13 options on the menu.  Here are a couple of examples:

1) Save as Note
2) Save as Completed Phone Call
3) Save as Completed Phone Call with Followup
4) Etc.

Until the user has been using that screen for a few days, it confuses
the mess out of them.  There are only maybe 5 places that technique is
used in the product thank goodness.  Having a required combo box where
the user chooses the type of record to create would slow the user down
or so the thinking went by the developer.  The only other option would
have been to make the combo change save the form, but that would have
been even worse.


Maybe you could have a GtkTreeView + GtkListStore in a scrolled window
on the same page with Save / Cancel, just make sure that the
Save button is insensitive untill the selection in the list store
is made.

Just a thought.

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


Re: calling gtk_menu_popup from a button's clicked signal

2005-07-25 Thread Greg Breland
This is the best suggestion I've ever heard as a replacement for the
horrible button menu hack.  Maybe this will keep the parent poster from
adding this hack to yet another piece of software.  

The only downside I could see is if the list is very long.  I think for
short lists, say 20 then the treelist vs the context menu works about
the same.  More than that and the context menu is better because of
scree real estate issues.  However after a certain point the treelist
would work better because long context lists are unusable.

On Mon, 2005-07-25 at 14:51, Tristan Van Berkom wrote:
 Maybe you could have a GtkTreeView + GtkListStore in a scrolled window
 on the same page with Save / Cancel, just make sure that the
 Save button is insensitive untill the selection in the list store
 is made.


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


Re: Doubt about free or dont free

2005-07-25 Thread Chris Anderson
 I wish the API docs would be added a line for _every_ get- or set-
 function, which explicitly notes whether and how reference counts of
 associated objects are changed by that function.

I second that motion! Actually, I wish it would be a standard for all
GNU-style open source projects. I think it is left out when it might
be redundant somehow, but I think the redundancy would be worth it for
increased clarity.

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


Re: Window Visibility Signal

2005-07-25 Thread Kevin DeKorte
On Monday 25 July 2005 12:38 pm, Zeeshan Ali wrote:
 Hello,

  Expose is no problem, but what about when it is hid? basically I
  want to know when the window is hid, so I don't draw to it.

If you only want to check if a widget is visible or not at a
 particular time, you'll need to check for the 'visible' property of
 the widget. Moreover, 'expose' signal is called for both the cases
 (show and hide). If you choose to go the 'expose' way then connect
 your handler using g_signal_connect_after().

Nice tip, but unfortunately the expose event does not signal when the object 
is covered up. Only when revealed. I even hooked event and event-after 
and nothing was emitted when I covered up the window. Only events were 
triggered when I moved the mouse into the window and out of it and clicks.

The code is doing the following...

Runs an external process in a thread and what I want is that when the 
window 
is covered up, I want to pause the external process (I can do this via a 
pipe). When the window is revealed I want the external process to continue 
on. Which I then can send it another signal via the pipe. So the code is not 
a loop while it is paused. So I can't check at a regular interval to wake it 
up.

I was hoping I could get signals to tell me when the window was revealed or 
not so that I could pause for example when a screen saver is kicked off. Or 
someone switches to another window because something more important came up.

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

Re: Doubt about free or dont free

2005-07-25 Thread Steve Feehan
On Sat, Jul 23, 2005 at 06:29:17PM +0200, Gus Koppel wrote:

 
 I wish the API docs would be added a line for _every_ get- or set-
 function, which explicitly notes whether and how reference counts of
 associated objects are changed by that function.

Take a look at the following wiki page. If your suggestion isn't
already present, then add it.

http://live.gnome.org/IdealDeveloperDocumentation

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


Re: Window Visibility Signal

2005-07-25 Thread Zeeshan Ali
Hello,

 Nice tip, but unfortunately the expose event does not signal when the object
 is covered up. Only when revealed. I even hooked event and event-after
 and nothing was emitted when I covered up the window. Only events were
 triggered when I moved the mouse into the window and out of it and clicks.

Try visibility-notify-event and try all the other (likely)
signals of GtkWidget documented in the gtk+ reference manual please if
this doens't work either.

Regards,

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


Re: Window Visibility Signal

2005-07-25 Thread David Necas (Yeti)
On Mon, Jul 25, 2005 at 01:57:02PM -0600, Kevin DeKorte wrote:
 
 Nice tip, but unfortunately the expose event does not signal when the object 
 is covered up. Only when revealed. I even hooked event and event-after 
 and nothing was emitted when I covered up the window. Only events were 
 triggered when I moved the mouse into the window and out of it and clicks.

I'm not following this thread closely, so I'm sorry if
I missed something, but have you tried visibility-notify-event
signal?  See attached example.

Yeti


--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


===
#include gtk/gtk.h

static gboolean
visibility(GtkWidget *widget,
   GdkEventVisibility *event)
{
static const gchar *visibility_names[] = {
Fully visible, Partially obscured, Fully obscured,
};

g_printerr(%s (%p) visibility state: %s\n,
   g_type_name(G_TYPE_FROM_INSTANCE(widget)), widget,
   visibility_names[event-state]);
return FALSE;
}

int
main(int argc, char *argv[])
{
GtkWidget *window;

gtk_init(argc, argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_add_events(window, GDK_VISIBILITY_NOTIFY_MASK);
g_signal_connect(window, destroy, G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(window, visibility-notify-event,
 G_CALLBACK(visibility), NULL);
gtk_window_set_default_size(GTK_WINDOW(window), 320, 240);
gtk_widget_show_all(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


Re: Window Visibility Signal

2005-07-25 Thread Tristan Van Berkom

Kevin DeKorte wrote:
[...]
Nice tip, but unfortunately the expose event does not signal when the object 
is covered up. Only when revealed. I even hooked event and event-after 
and nothing was emitted when I covered up the window. Only events were 
triggered when I moved the mouse into the window and out of it and clicks.


I found what your looking for :)

http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-visibility-notify-event
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html#GdkEventVisibility
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html#GdkVisibilityState

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


Re: im-xim.la does not export GTK+ IM module API

2005-07-25 Thread David Necas (Yeti)
On Mon, Jul 25, 2005 at 02:52:38PM +0200, Jirka Pirko wrote:
 i got following error when compiling gtk - i tried almost everything but 
 error still occurs:
 
 Cannot load module 
 /home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules/input/im-xim.la: 
 /home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules/input/.libs/im-xim.so:
  
 undefined symbol: XmbResetIC
 /home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules/input/im-xim.la 
 does not export GTK+ IM module API: 
 /home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules/input/.libs/im-xim.so:
  
 undefined symbol: XmbResetIC
 make[3]: *** [gtk.immodules] Error 1
 make[3]: Leaving directory 
 `/home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules/input'
 make[2]: *** [all-recursive] Error 1
 make[2]: Leaving directory 
 `/home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8/modules'
 make[1]: *** [all-recursive] Error 1
 make[1]: Leaving directory `/home/peyrak/src/newshot2/kdrive/gtk/gtk+-2.6.8'
 make: *** [all] Error 2
 
 thanks for any advice

XmbResetIC is normally defined in libX11.  What xlib you are
trying to link with?  I see KDrive in your directory paths,
maybe your xlib is minimalistic (read: incomplete) too...
Try to simply disable the XIM module:

make IM_XIM_MODULE=

Yeti


--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Is it possible to use int in labels?

2005-07-25 Thread Søren Juul
I got it working with this:
int number = 12;
char count[128]; 
sprintf( count, %i, number );

thanks for all the help

2005/7/20, Søren Juul [EMAIL PROTECTED]:
 
 Is it possible to use a int in labels? or is it only chars?
 
 Søren J

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


Re: Window Visibility Signal

2005-07-25 Thread Kevin DeKorte
On Monday 25 July 2005 02:11 pm, David Necas (Yeti) wrote:
 On Mon, Jul 25, 2005 at 01:57:02PM -0600, Kevin DeKorte wrote:
  Nice tip, but unfortunately the expose event does not signal when the
  object is covered up. Only when revealed. I even hooked event and
  event-after and nothing was emitted when I covered up the window. Only
  events were triggered when I moved the mouse into the window and out of
  it and clicks.

 I'm not following this thread closely, so I'm sorry if
 I missed something, but have you tried visibility-notify-event
 signal?  See attached example.


Ah! sample code is good... had been trying the visibility-notify-event, but it 
didn't work then I saw the add_events call and I went ... doh! Added that 
and it works almost how I want it, is there another event I should be looking 
for as well? Switching desktops and minimizing does not seem to pop the 
event, but this is pretty close. Covering up the window does work..

Kevin


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

Re: Doubt about free or dont free

2005-07-25 Thread Stefan Kost
Gus Koppel wrote:
While the case of returned const gchar *s is rather simple, the real
problem to me is that the API docs are quite less explicit when it comes
to more complex objects than just string constants.

For instance, whether and how reference counts of objects related to
treeviews are changed by what GTK+ functions dealing with them remains
undocumented.

For instance: whether gtk_tree_view_set_model() changes the reference
counts of either the newly set or the replaced GtkTreeModel remains as
unclear as whether gtk_tree_view_get_selection() increases the reference
count of the selection object or not.

If I remember right the first function changes reference counts while
the 2nd one doesn't but I may be wrong on this. Frequent explicit checks
on object reference counts after many GTK+ functions are my only way to
make sure about this while developping.

I wish the API docs would be added a line for _every_ get- or set-
function, which explicitly notes whether and how reference counts of
associated objects are changed by that function.
  
IMHO especially the Gtk docs lack a lot here. For many methods one has
to look into the sources to find out wheter to unref or free. Problem is
that that docs don't use G_CONST_RETURN. Some examples:
gtk_*_get_model()
gtk_combo_box_get_popup_accessible()
gtk_widget_get_accessible()   (this one is 100% undocumented)

Filed as http://bugzilla.gnome.org/show_bug.cgi?id=311536
Please add others you find. 

Similiar problem applies to methods like

gtk_tree_model_get()

These functions should realy document wheter the ref object references returned 
in their out-params or not (they dont).

Stefan


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