summaryrefslogtreecommitdiffstats
path: root/src/virt-viewer.c
Commit message (Collapse)AuthorAgeFilesLines
* Bring back libvirt-glib dependencyFabiano Fidêncio2016-02-251-2/+2
| | | | | | | | | | | | | | | libvirt-glib dependency was dropped in commit 296f91c in favor to maintain the full glib event loop integration into virt-viewer tree. This decision was taken because libvirt-glib was not mature enough at that time, which is not the case nowadays. The libvirt-glib version chosen as dependency (0.1.8) is the first release that includes the fixes for the glib event loop integration that were backported to virt-viewer last year. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
* Port to GtkApplication API'sEduardo Lima (Etrunko)2016-02-181-26/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of this patch consists in code being shuffled around to fit the expected flow while using the new APIs. I tried my best to make this patch the less intrusive as possible. Main changes are: - Updated build requirements * glib version 2.38 * gtk+ version 3.10 * gio - VirtViewerApp is now a subclass of GtkApplication. Some mainloop calls were replaced: * gtk_main() -> g_application_run() * gtk_quit() -> g_application_quit() - Unified command line option handling. The logic has moved from the main functions and split in common options, and specific ones for each application. With this, the main functions were highly simplified, and now basically responsible for instantiating the App object and running the main loop. - All Window objects must be associated with the Application. With this, there is no need to emit our own 'window-added'/'window- removed' signals, as those will be emited by GtkApplication whenever gtk_application_add_window() and gtk_application_remove_window() are called. Also, 'window-removed' was not being used anywhere. Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
* Remove useless {get,set}_property functionsEduardo Lima (Etrunko)2015-11-041-22/+0
| | | | Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
* Move declaration to the beginning of the fileEduardo Lima (Etrunko)2015-11-041-2/+1
| | | | Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
* Stop polling after reconnecting to libvirtdChristophe Fergeau2015-10-201-0/+18
| | | | | | | | | | | | | | | | | When the connection to libvirtd is lost, virt-viewer starts polling for libvirtd to come back. The polling mechanism is also used when connecting to very old libvirtd which don't support virConnectDomainEventDeregisterAny(). Currently, once we could reconnect to libvirtd, virt-viewer will keep polling, thus behaving as if the libvirtd connection does not support virConnectDomainEventDeregisterAny(). This commit makes sure we stop polling once the new libvirtd connection is established. This has the side-effect of preventing https://bugzilla.redhat.com/show_bug.cgi?id=1271519 from occurring with recent libvirt as it's caused by some race occurring when using the polling code.
* virt-viewer: set keepAlive on libvirt connectionPavel Hrdina2015-07-091-0/+4
| | | | | | | Setting the keepAlive on libvirt connection is needed in order to receive the CloseCallback event. Resolves: rhbz#1164052
* Don't wait for reconnect when user cancels authJonathon Jongsma2015-06-191-1/+1
| | | | | | | | | | | When starting virt-viewer with the --reconnect switch to a guest that has a password, if the user cancels the authentication dialog (e.g. pressing 'Esc'), the window will display "Waiting for guest domain to restart". Obviously, the domain will never restart because it's already running. After this fix, the application will simply exit when the user cancels authentication, even if the --reconnect switch is used.
* virt-viewer: Set toolbar buttons not sensitive when neededLukas Venhoda2015-04-221-0/+1
| | | | | | | | | | | | | | File->Screenshot, File->Preferences, View->Zoom and Send keys are now sensitive only while quest is connected. Changed behaviour of zoom: Previously, zoom could be set while quest wasn't connected. The zoom would then be set on connection. There was no indication of current zoom level while not connected to guest. Now, the menu is not sensitive while not connected to guest. Zoom can now be only modified while connected to guest, or from the command line.
* virt-viewer: Make update_display() more readableFabiano Fidêncio2015-03-271-5/+3
|
* virt-viewer: Do not wait for a guest that will never show upFabiano Fidêncio2015-03-271-1/+1
| | | | | | | | | All the situations where virt_viewer_update_display() can fail are those when we won't be able to connect regardless of what changes on the remote host. So, propagate the error instead of waiting for the guest to start. Related: rhbz#1085216
* virt-viewer: Avoid simple_message_dialog() when errors can be propagatedFabiano Fidêncio2015-03-271-10/+6
| | | | | | | | | | Remove all the dialogs used to report errors on extract_connect_info() and just propagate the errors we got from it. The only exception is virt_viewer_domain_event(), that is a callback that doesn't have GError as argument. In this specific case, we show the error dialog instead of propagating it. Related: rhbz#1085216
* virt-viewer-app: create_session() should return a booleanFabiano Fidêncio2015-03-271-1/+1
| | | | | | | By convention functions that take GError parameters should return FALSE (or NULL) or error. Related: rhbz#1085216
* virt-viewer-app: Add a GError arg to create_session()Fabiano Fidêncio2015-03-271-1/+1
| | | | | | | | | | | This is part of a small re-factoring that will have all connection errors, when we won't be able to connect regardless of what changes on the remote host, being treated by virt_viewer_app_initial_connect(), avoiding weird behaviors as we have nowadays (like more than one error dialog being shown or having the virt-viewer waiting forever for a guest that will never show up). Related: rhbz#1085216
* virt-viewer: Add a GError arg to update_display()Fabiano Fidêncio2015-03-271-4/+4
| | | | | | | | | | | This is part of a small re-factoring that will have all connection errors, when we won't be able to connect regardless of what changes on the remote host, being treated by virt_viewer_app_initial_connect(), avoiding weird behaviors as we have nowadays (like more than one error dialog being shown or having the virt-viewer waiting forever for a guest that will never show up). Related: rhbz#1085216
* virt-viewer: Add a GError arg to extract_connect_info()Fabiano Fidêncio2015-03-271-2/+19
| | | | | | | | | | | This is part of a small re-factoring that will have all connection errors, when we won't be able to connect regardless of what changes on the remote host, being treated by virt_viewer_app_initial_connect(), avoiding weird behaviors as we have nowadays (like more than one error dialog being shown or having the virt-viewer waiting forever for a guest that will never show up). Related: rhbz#1085216
* Do not use comments that are not in EnglishFabiano Fidêncio2015-03-261-1/+1
|
* virt-viewer: Clean up if no vm was chosenPavel Grunt2015-03-241-1/+1
| | | | | | | | It is safe to clean up when running virt-viewer without specifying vm name if no vm was chosen. It brings back behavior before 88f6341. The 'if (dom == NULL && err != NULL)' part was affected by commits 824c4b9, 1eaaf8c, 15c7d17 so the check for 'err' is not needed anymore.
* Report errors in one placePavel Grunt2015-03-231-17/+4
| | | | | | Since the error is propagated to the main, report the error there. To make it work GError VIRT_VIEWER_ERROR_FAILED is set for all failing states and it is reported using virt_viewer_app_simple_message_dialog().
* Exit normally when canceling dialogPavel Grunt2015-03-231-20/+28
| | | | | | | | | This applies for: libvirt authentication dialog (e.g. virt-viewer --attach guest) 'recent connection' dialog (e.g. remote-viewer) 'vm choose' dialog when connecting without specifying the vm name This is done by using a new GError VIRT_VIEWER_ERROR_CANCELLED.
* virt-viewer: Bring back debug log about nonexistent guestPavel Grunt2015-03-231-0/+2
| | | | | | | | Although commit 88f6341 allowed to use virt-viewer with a wrong guest name, the user is informed about the nonexistent guest only by a dialog showing the list of running machines or informing about the connection error. Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1201177
* Take --direct into consideration when checking if a guest is reachableFabiano Fidêncio2015-03-121-6/+8
| | | | | | | | | | When connecting to a remote host (using qemu+ssh://...) that has a virtual machine listening to "127.0.0.1", virt_viewer_is_reachable() must take --direct into account, otherwise it can end up connecting to a local virtual machine listening to "0.0.0.0" instead of returning that the guest is not reachable. Resolves: rhbz#1085216
* Avoid 'Dereference of a null pointer'Fabiano Fidêncio2015-03-111-1/+1
| | | | Caught by Covscan.
* virt-viewer: set transient parent for connection's error dialogFabiano Fidêncio2015-01-081-1/+3
| | | | | Commit c3d24f8b sets transient parent for the most part of the GtkDialogs, but seems like this one was forgotten.
* virt-viewer: Don't connect to localhost displays with qemu+tcp://Christophe Fergeau2015-01-061-0/+57
| | | | | | | | | | | When connecting to a remote libvirt instance, a VM may only be listening on localhost for SPICE/VNC connections. In such a situation, virt-viewer then tries to connect to localhost, which is not correct as this 'localhost' referred to the remote libvirt host it connected to. This commit adds a couple of tests on the libvirt URI used and the <graphics> listen address to error out in this situation. Resolves: rhbz#1108523
* Set a transient parent for GtkDialogsPavel Grunt2014-12-191-3/+12
| | | | | Silence the Gtk 3.14 message: "GtkDialog mapped without a transient parent. This is discouraged."
* Do not show twice error dialog when no VM are foundMarc-André Lureau2014-12-011-1/+0
| | | | | When running virt-viewer without argument, and no VM are found, you get two error dialogs. Only one is enough.
* virt-viewer: allow connection to unix socket only serverMarc-André Lureau2014-11-251-7/+8
| | | | | Even when the server doesn't provide a display connection address, virt-viewer is able to connect to guest with libvirt attach.
* Report error in dialogMarc-André Lureau2014-11-251-3/+11
| | | | Use a UI dialog to inform of connection error.
* Simplify virt_viewer_initial_connect()Marc-André Lureau2014-11-251-6/+6
| | | | | | | - do not overwrite err if ->initial_connect() sets it - remove need for waitvm if the display server isn't yet started (note: this function might be untested, I am not sure relying on libvirt events is enough)
* Simplify virt_viewer_initial_connect()Marc-André Lureau2014-11-251-10/+3
| | | | | | - remove need for waitvm if the display server isn't yet started (note: this function might be untested, I am not sure relying on libvirt events is enough)
* Simplify virt_viewer_initial_connect()Marc-André Lureau2014-11-251-21/+21
| | | | | | | | Some refactoring to make the code easier to read, mostly code movement/reindenting and introduction of a "wait" label which has the same purpose as "done". This also adds a "goto wait" within an if block, but this does not change the initial code flow, just makes it more explicit.
* Remove VIRT_VIEWER_VM_CHOOSE_DIALOG_CANCELLEDMarc-André Lureau2014-11-251-4/+2
| | | | | | This error type isn't really an error, it is used to skip error report code. The functions can simply return FALSE on failure, without GError set, to indicate that program should quit normally.
* Limit HAVE_SOCKETPAIR to directly concerned codeMarc-André Lureau2014-11-251-3/+6
|
* Move libvirt reconnect polling to VirtViewerMarc-André Lureau2014-11-251-4/+37
| | | | | This is libvirt specific, no need to share it in the VirtViewerApp base class.
* Replace priv->withEvents usage for priv->domain_eventFabiano Fidêncio2014-11-201-9/+4
| | | | Once we have priv->domain_event, we don't need priv->withEvents anymore
* Prefer to use virConnectDomainEventRegisterAny()Fabiano Fidêncio2014-11-201-7/+13
| | | | | The usage of virConnectDomainEventRegister() is no longer recommended according to the libvirt's documentation.
* Set freed priv->dom to NULL in _dispose()Fabiano Fidêncio2014-11-201-1/+3
| | | | Avoid a possible use/free after the object has been freed.
* Make sure conn exists before use itFabiano Fidêncio2014-11-201-7/+9
| | | | | | Although all the used functions have a explicit check for a valid virConnPtr, let's be safe and only use priv->conn when its value is non-NULL.
* Don't use virGetLastErrorMessage()Christophe Fergeau2014-10-311-1/+2
| | | | This was introduced in libvirt 1.0.6 but we only require libvirt 0.10.0
* Avoid use of non-literal string with g_debugDaniel P. Berrange2014-10-271-1/+1
|
* Remove useless 'if (...)' before free()Daniel P. Berrange2014-10-271-3/+1
| | | | | The 'free()' function accepts NULL, so you should not check for NULL before calling it.
* Prefill the username in the authentication dialogFabiano Fidêncio2014-10-101-0/+4
| | | | | Lets prefill the username entry using the user name of the current user.
* Show VM chooser dialog when starting virt-viewer with no argPavel Grunt2014-10-101-8/+67
| | | | | | When user starts virt-viewer without specifying VM domain name or with a wrong name a list of running machines is shown and user may choose one of them.
* Prefer virDomainOpenGraphicsFD for --attachJán Tomko2014-10-011-1/+14
| | | | | | | | | | | | | | | The virDomainOpenGraphics API cannot label the socket we pass to it. Prefer virDomainOpenGraphicsFD (if building with libvirt 1.2.8 or later) which creates the socket for us and works with SELinux too. Fall back to the old API if the new one is unsupported (i.e. the libvirtd on the host is older than the libvirt version virt-viewer was compiled against). Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1141228 Signed-off-by: Ján Tomko <jtomko@redhat.com>
* Improve authentication error messagesFabiano Fidêncio2014-09-261-2/+35
| | | | | | | Adding a better error message to our default error message, based on the libvirt error. Also, the libvirt error is shown as debug. https://bugzilla.redhat.com/show_bug.cgi?id=1142742
* Simplify virt_viewer_auth_libvirt_credentials() return value logicFabiano Fidêncio2014-09-261-4/+4
| | | | | | | | | | As the function should return < 0 in error cases, let's explicitly return/set the return value to -1 in error cases. Otherwise, the function will return 0. This patch also fixes a regression introduced by (a5ce2ed3). https://bugzilla.redhat.com/show_bug.cgi?id=1142742
* Do not fail when the auth dialog is cancelledFabiano Fidêncio2014-09-231-7/+12
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1145460
* VirtViewer: Fix memory leaksJonathon Jongsma2014-09-111-0/+4
| | | | Don't leak priv->uri or priv->domkey from VirtViewer class
* Add a dialog showing details of the current guestJonathon Jongsma2014-08-071-1/+1
| | | | | | This allows the user to obtain the GUID and vm name of the currently-connected guest. Obviously, this only works with spice. In the future, it will allow them to set guest-specific configuration options (using a GUID as a key)
* util: get rid of ARRAY_CARDINALITYMarc-André Lureau2014-06-101-1/+1
|