GNOME Bugzilla – Bug 527736
starting cheese twice produces two cheese windows
Last modified: 2008-08-16 18:41:09 UTC
wrong. as most users just have one webcam, we just want to show that one once.
Daniel, When you set a bug as gnome-love, please provide detailed comments on how to achieve to fix the bug like files and functions to look at. All people is not as aware as you of the code of cheese :). thanks a lot.
You could use "unique" to do this easily. It would also allow users to script cheese to take pictures at recurring intervals, or something.
The actual version of cheese I work with (branch of the latest trunk, 2 weeks ago) doesn't open a second window. The problem is, the second window is segfaulting, probably because he can't access the webcam? Here comes the bt of gdb of the second cheese instance: (gdb) run -v Starting program: /usr/local/bin/cheese -v [Thread debugging using libthread_db enabled] [New Thread 0xb6755740 (LWP 15706)] [New Thread 0xb5e82b90 (LWP 15710)] [New Thread 0xb5681b90 (LWP 15711)] [New Thread 0xb54d5b90 (LWP 15712)] [New Thread 0xb4cd4b90 (LWP 15713)] Program received signal SIGSEGV, Segmentation fault.
+ Trace 202920
Thread 3051891600 (LWP 15710)
exactly ;)
still doesn't solve the issue I think :) this bug is closed, but shall we open another one? I'm just kidding =) I'm not that hot to get more bugzilla points than my age is (wouldn't be possible I think...) I will solve this bug as soon as I get some time, shouldn't be that hard and would be nice in 2.24 Can the bug be assigned to me? How? Can I get points for it? :D
the attachment in bug #522199 should solve this issue! http://bugzilla.gnome.org/attachment.cgi?id=116512&action=view
Created attachment 116730 [details] [review] solves the issue with dbus this solves the issue, its part of my integration work which provides a more powerfull dbus class! This is only a small part to solve the issue, the full dbus class will be in 2.26...
Seems ok to me, +1 to commit! I just have a couple of notes/suggestions: 1. What about setting urgent hint when a second instance is started? or just bring cheese window on top? 2. Why do you start cheese_dbus server there? there are a couple of initializations before that are not being freed if cheese quits (fileutile_new, gconf_new). What about moving it to cheese.c before goption parsing and pass the server to cheese_window adding an argument to cheese_window_init? 3. struct _CheeseDbus *server; shouldn't be just CheeseDbus *server; ?
Thanks for the review! point 1: Sounds good, but how? Any suggestions? I would need the window to do that and thats a problem because the window gets initialized after this part (look at point 2 of your suggestions ;) ) point 2: you're right...improved patch will follow point 3: you're right to ;)
Created attachment 116737 [details] [review] improved patch
felix: if you could fix point 1, its ok for me to commit! btw: there are a few warnings, which you should fix before committing: cheese-dbus.c:79: warning: pointer targets in passing argument 4 of ‘org_freedesktop_DBus_request_name’ differ in signedness cheese-dbus.c:90: warning: implicit declaration of function ‘exit’ cheese-dbus.c:90: warning: incompatible implicit declaration of built-in function ‘exit’ then: you probably should return false from the dbus object and do the cleanup and exit in cheese-window. you need to do at least the g_free (cheese_window); gtk_main_quit (); i think you should try something like: cheese_window->server = cheese_dbus_new (); if (!cheese_window->server) { exit, cleanup...} seems all for now ;)
I have no idea how point 1 can be fixed....can somebody help me with that? ideas? The warning in line 79 is tricky! I tried to remove it a long time but I did not manage to do so. I'll look at it again...
fixed warning in line 79! I did not understand what you ment with return false... I'm doing this stuff in cheese_dbus_init, and that one has no return type!
you would have to do that in cheese_dbus_new
Created attachment 116749 [details] [review] new patch with urgency hint this one should be fine... i worked with gtk_window_set_urgency_hint, you can fight whats better, urgency hint or bring to front...can be changed with one single line of code i think!
Ok, seems fine but.. urgency hint is never unset, so the taskbar starts blinking and never ends. Please fix it in the following way : in cheese-window.c (pseudo-diff :P): +static gboolean +cheese_window_focus_in_cb (GtkWidget *window, GdkEventFocus *event, gpointer data) +{ + if (gtk_window_get_urgency_hint (GTK_WINDOW (window))) { + gtk_window_set_urgency_hint (GTK_WINDOW (window), FALSE); + } + return FALSE; +} (somewhere in _create_window) + gtk_widget_add_events (cheese_window->window, GDK_FOCUS_CHANGE_MASK); (in _create_window too, near the other signal_connect-s) + g_signal_connect (cheese_window->window, "focus-in-event", + G_CALLBACK (cheese_window_focus_cb), NULL); It should to the trick. The patch also needs some reindenting but I can do it before to commit.
Created attachment 116753 [details] [review] should solve the issue with gtk_window_present we decided its better to use gtk_window_present and let the window manager do the rest!
Thanks Felix, reviewed and commited ;)