Commit Graph

767 Commits

Author SHA1 Message Date
Pavel Grunt
c645a99267 Remove unnecessary parameter from virt_viewer_window_resize()
Since c3cbdef888 virt_viewer_window_resize
is always called with keep_win_size = FALSE.
2015-07-22 14:51:26 +02:00
Pavel Hrdina
08378ec4dc virt-viewer: set keepAlive on libvirt connection
Setting the keepAlive on libvirt connection is needed in order to
receive the CloseCallback event.

Resolves: rhbz#1164052
2015-07-09 02:45:12 +02:00
Jonathon Jongsma
ba5bf67288 Build an intermediate convenience library
Instead of building every single source file twice (once for
virt-viewer, and once for remote-viewer), just build them into a
temporary library and link the final executables against that.

The one possible drawback to this approach is that we now use the same
log domain for both executables: 'virt-viewer'. Previously, the
remote-viewer executable used 'remote-viewer' for its log domain.
2015-06-30 14:31:11 -05:00
Jonathon Jongsma
1716c1a7b9 Build: put one file on a line
For easier maintenance, put a single source file per-line in the
makefile
2015-06-30 14:31:11 -05:00
Jonathon Jongsma
bdd3b7af74 Remove spice-controller flags from virt-viewer build
Virt-viewer does not use spice-controller, only remote-viewer does. So
there's no need to ad SPICE_CONTROLLER_CFLAGS to the virt-viewer build.
2015-06-30 14:31:11 -05:00
Jonathon Jongsma
c33f37efe3 Don't wait for reconnect when user cancels auth
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.
2015-06-19 14:39:48 -05:00
Jonathon Jongsma
999bd67675 Automatically retry auth failures for VNC
There's no reason that we need to ask if the user wants to retry auth
failures for VNC sessions but not ask for spice sessions. If the user
doesn't want to retry, she can simply click 'cancel' when the auth
dialog pops up, just as they do with spice.
2015-06-19 14:39:48 -05:00
Jonathon Jongsma
592d8c6bb2 VNC session: emit session-cancelled signal
When the user cancells an authentication dialog (e.g. by pressing 'Esc',
emit the session-cancelled signal to be consistent with the spice
session implementation.
2015-06-19 14:39:48 -05:00
Jonathon Jongsma
be279c8388 Rename session-auth-failed to session-auth-unsupported
Now that VNC and Spice both return the same signal on normal
authentication failures ('session-auth-refused'), the
'session-auth-failed' signal is too confusingly similar. Rename it to
-unsupported to make it obvious that it's a different type of
(unrecoverable) error.
2015-06-19 14:39:48 -05:00
Jonathon Jongsma
271c51d8de Fix inconsistencies in session auth failures
The spice session implementation can retry authentication on its own,
whereas the vnc session needs to tear down the session and re-connect in
order to retry a failed authentication. This results in the following
inconsistent behavior:

VNC session:
 - emits a 'session-auth-failed' signal when the client does not support
   a particular authentication type (i.e.: a non-recoverable error)
Spice session:
- emits a 'session-auth-failed' signal when user enters an incorrect
  password, and immediately retries auth internally

VNC session:
 - emits a 'session-auth-refused' error when user enters an invalid
   password (i.e.: a recoverable error)
Spice Session:
- never emits a 'session-auth-refused' signal

Because of these differences, the VirtViewerApp code to handle authentication
failures is a bit confusing and difficult to maintain. To fix this issue, make
both the spice and VNC sessions emit the same signal when similar errors occur.
We use the new session API added in the last commit to determine whether the
session supports automatic retries so we know how to handle the signal.
2015-06-19 14:39:48 -05:00
Jonathon Jongsma
5c0ed8a99f Session: add vfunc to check auth retry capability
The spice session implementation can retry authentication on its own,
whereas the vnc session needs to tear down the session and re-connect in
order to retry a failed authentication. Add API to determine this so
that we can clean up some code related to authentication failures.
2015-06-19 14:39:48 -05:00
Jonathon Jongsma
bac799c6e9 Move SpiceSession setup to create_spice_session()
Most of the setup (connecting to signals, etc) for the SpiceSession was
done in create_spice_session(), but some was done afterwards in
virt_viewer_session_spice_new(). Consolidate all session configuration
in one place.

In addition to making it easier to maintain, create_spice_session() is
also called in virt_viewer_session_spice_close(). which results in a
spice session that is configured slightly differently than the first
session created in _new(). Consolidating everything in
create_spice_session() avoids that inconsistency.
2015-06-19 14:39:47 -05:00
Daniel P. Berrange
795d499a0f Add config.h include to remote-viewer-connect.c file 2015-06-19 09:37:23 +01:00
Lukas Venhoda
0fdfd6cbfc remote-viewer-connect: Address entry is now required
Connect button is now non-sensitive when address entry is empty.
Pressing enter will now also NOT connect, when address entry is empty.
2015-06-16 14:11:00 +02:00
Lukas Venhoda
78b1fa977a remote-viewer-connect: Fixed reselecting in recent chooser
Recent chooser didn't unselect on loosing focus.
Selecting recent connection, then modifying address in entry and
doubleclicking on the same recent connection caused remote-viewer to
connect to address in the entry,

Recent chooser now unselects on loosing focus, forcing to re-select when
doubleclicking the recent connection, which will now properly set the
address to connect to.
2015-06-16 14:11:00 +02:00
Lukas Venhoda
0571843d7f remote-viewer-connect: Changed hardcoded UI into XML
Hardcoded UI removed in favor of XML.
Added the new XML file for translation.
2015-06-16 14:11:00 +02:00
Lukas Venhoda
ce31441c73 remote-viewer-connect: Changed dialog into a window
Changed connect dialog from GtkDialog to a GtkWindow.
Added the necessary signals and buttons, to keep the
behaviour of a dialog. (ESC to close, ENTER to submit)
2015-06-16 14:10:53 +02:00
Lukas Venhoda
ee785d3352 remote-viewer-connect: Check if uri is NULL
URI should be NULL before passing it to remote_viewer_connect_dialog.
2015-06-16 14:10:03 +02:00
Lukas Venhoda
e7dcc5a497 remote-viewer-connect: Changed response to gboolean
remote_viewer_connect_dialog now returns TRUE and FALSE, instead of 0 and -1.

Added a doxygen style comment to document this in code also.
2015-06-16 14:10:03 +02:00
Lukas Venhoda
f4018a8dbe remote-viewer: Connect dialog moved to its own file
Connect dialog from remote-viewer is now in its own file.
Most other dialog also have their own files.
This will make changing the dialog into a window easier.

Renamed connect_dialog to remote_viewer_connect_dialog.
2015-06-16 14:10:03 +02:00
Christophe Fergeau
21c71767e3 Enable hotkeys after setting them in virt_viewer_app_set_hotkeys
Enabling hotkeys will trigger a rebuild of the 'send keys' menu
containing the new hotkeys. virt_viewer_app_set_hotkeys() was clearing
and then enabling the hotkeys before parsing the string containing the
new hotkeys. This was causing these hotkeys to be missing from the 'Send
keys' menu when they are set through the spice controller because the
'send keys' menu was rebuilt before the new hotkeys are set.

Resolves: rhbz#1055600
2015-06-15 11:08:40 +02:00
Daniel P. Berrange
f3642a33d7 Add missing config.h header file 2015-06-10 09:32:02 +01:00
Christophe Fergeau
8884608104 vv-file: Show 'newer-version-url' when version check fails
We currently display a generic error message when the current binary is
older than the minimum version specified in the vv file. The previous
commit added a 'newer-version-url' field to these .vv file. This commit
adds that URL to the error message if it's set.
2015-06-09 18:06:39 +02:00
Christophe Fergeau
a9967fd2f6 vv-file: Add 'newer-version-url' key to .vv files
If set, this URL will be displayed when one of the version checks
('version' of 'versions' key fail). This URL should contain explanations
about how to get an updated remote-viewer version.
2015-06-09 18:06:39 +02:00
Christophe Fergeau
c9a6a27061 test: Add test case for virt_viewer_compare_buildid 2015-06-09 18:06:39 +02:00
Christophe Fergeau
e2df5a739a util: Replace virt_viewer_compare_version with _compare_buildid
This allows us to do a more accurate version check if the .vv file
producer wants to allow builds newer than x.y-z because they contain an
important bug fix.
2015-06-09 18:06:39 +02:00
Christophe Fergeau
809d097cfd vv-file: Use "versions" in min version check
This tries to use the list of versions added to .vv files by the
previous commit. If remote-viewer was built with an os-id specified, and
if it's found in the 'versions' .vv file key, then the version
associated with it is used for version checks, otherwise the 'version'
field is used if present.
2015-06-09 18:06:39 +02:00
Christophe Fergeau
1856dbfa24 Show osid in remote-viewer --version 2015-06-09 18:06:39 +02:00
Christophe Fergeau
fd1052ad5d vv-file: Add VirtViewerFile::versions
Specifying a single minimal version in the .vv file is not enough as
the client version will be highly dependent on the OS it's running in.
Windows versioning is not the same as linux versioning, Fedora 21 and
Fedora 22 may have different release numbers for the same version,
and we may want to force a specific minimal release in case of a
critical bug fix.

This commit adds supports for a 'versions' field in .vv files where a
list of os-id:version couples can be stored.
2015-06-09 18:06:39 +02:00
Christophe Fergeau
f94a64d759 vv-file: Refactor virt_viewer_file_check_min_version
Reorganize the code a bit so that it's easier to extend it.
2015-06-09 18:06:39 +02:00
Christophe Fergeau
7a69a239e7 vv-file: Move version checking code in its own function
This moves the version checking code in a
virt_viewer_file_check_min_version helper so that it can be
reused/extended more easily.
2015-06-09 18:06:39 +02:00
Pavel Grunt
233c61eaea monitor-mapping: Do not allow to skip a display
Skipping a display does not have an effect because displays will be
reconfigured and shifted on the guest side anyway.

these monitor mappings are not valid:
 'monitor-mapping=1:2;3:1' - display #2 is not specified
 'monitor-mapping=4:2;2:1' - displays #1, #3 are not specified
 'monitor-mapping=3:3'     - displays #1, #2 are not specified
2015-06-04 10:58:09 +02:00
Fabiano Fidêncio
ad438e0b96 session-spice: Only update displays geometry if the agent is connected 2015-06-02 17:29:03 +02:00
Lukas Venhoda
596aea6912 virt-viewer: Fix choose VM dialog alt-tab in gnome2
Choose VM dialog was not visible in taskbar and alt-tab when running on
system with gnome2.

rhbz#1223285
2015-05-21 13:06:31 +02:00
Fabiano Fidêncio
921318e42f Revert "display-vnc: fix zoom-level set by command line"
This reverts commit 68148e1bd1.

The commit in question was causing a regression about a tiny window
being displayed when opening a vnc guest.
The issue only happens with the gtk2 version of virt-viewer.

rhbz#1170071 that was solved by the reverted commit is avoided by
the commit c45a30e909.

Resolves: rhbz#1201679
2015-05-21 13:06:31 +02:00
Pavel Grunt
61a1bc4dcb session-vnc: Set window for display to avoid gtk-vnc v0.3.8 crash
The VNC display widget of gtk-vnc v0.3.8 needs a window at the moment
it is initialized otherwise it would crash.

Resolves: rhbz#1196517
2015-05-21 13:06:31 +02:00
Lukas Venhoda
fc2add5827 virt-viewer-display-vnc: Set uuid when using VNC
Notify user, that VNC does not provide uuid.

Set uuid to string "VNC does not provide guid".
This is more informative then just plain "Unknown".
User will now know WHY the GUID is unknown, when using remote-viewer.
2015-05-21 13:06:30 +02:00
Lukas Venhoda
772698a8a6 virt-viewer-display-vnc: Set guest name when using VNC
If it's not already set, set guest name field in virt-viewer-app when using VNC.

Wait for VNC to be initialized (virt_viewer_display_vnc_initialized()).
In this callback get field guest name from app and check whether it
was already set before (FE from libvirt).
If not, set the guest name to name provided by VNC from
vnc_display_get_name().

This fill fix issue in remote-viewer: Guest name is Unknown when using VNC.
2015-05-21 13:06:30 +02:00
Michal Privoznik
35c5f7f745 Fix syntax-check
Commit c45a30e9 broke syntax-check:

trailing_blank
src/virt-viewer-window.c:1478:
maint.mk: found trailing blank(s)
maint.mk:700: recipe for target 'sc_trailing_blank' failed
make: *** [sc_trailing_blank] Error 1

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-04-29 10:29:52 +02:00
Pavel Grunt
4219a7ec69 virt-viewer-window: Set initial zoom only once
It is not needed to do it more times as it may cause unnecessary resize
events especially when leaving the fullscreen mode

related: rhbz#1206460
2015-04-22 15:20:05 +02:00
Pavel Grunt
41645a0eb5 virt-viewer-window: Make sure that minimum zoom level is lower than NORMAL_ZOOM_LEVEL
The minimum size of the desktop is 100x100 if the minimum window size
is greater than this, the zoom level is greater than NORMAL_ZOOM_LEVEL

related: rhbz#1206460
2015-04-22 15:20:05 +02:00
Lukas Venhoda
82d6280e5c virt-viewer: Set toolbar buttons not sensitive when needed
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.
2015-04-22 11:03:13 +02:00
Lukas Venhoda
2b7d8717f9 app/window: Set display menu not sensitive when needed
Displays menu must be sensitive only when at least one display is
enabled.
2015-04-22 10:46:02 +02:00
Fabiano Fidêncio
7a32e58f2d cosmetic: move the "break" to inside the {} block 2015-04-22 10:40:29 +02:00
Fabiano Fidêncio
64e7b604d3 spice-session: use the error message, when available, on _channel_destroy() 2015-04-22 10:40:29 +02:00
Fabiano Fidêncio
f3fe9ffe7b session-spice: Destroy the channel instead of emit a "session-disconnect" signal
Whenever we reach these branches, we will abort or have to create a new
spice session (from the dialog showed to the user). So, destroying the
channel on these situations seems sane enough.
It also avoids an error dialog to be popped out twice with (basically)
the same information.
2015-04-22 10:40:29 +02:00
Fabiano Fidêncio
98d892d811 session-spice: Do not use _UNUSED for used attributes
channel attribute is actually used for error treatment
2015-04-22 10:40:29 +02:00
Fabiano Fidêncio
70569de4d8 display: remove useless identation level 2015-04-22 10:40:29 +02:00
Jonathon Jongsma
f0c6bb27f4 SessionSpice: Protect against unreffing window twice
In theory, the dispose method can be called multiple times, so any
member variables that are unreffed should be set to NULL so that we
don't accidentally unref them multiple times.
2015-04-15 09:18:16 -05:00
Pavel Grunt
69a5077a8a virt-viewer-main: '--wait' should not be used without domain name
Commit a830275344 required the domain
name to be placed just after the '--wait' option. It broke the
command line api, because running 'virt-viewer $vm --wait' was considered
as the error.

This patch rather checks whether the domain name was specified.

Related: rhbz#1209398, rhbz#1211573
2015-04-14 18:22:01 +02:00