virt-viewer/virt-viewer-0.0.2-window-title.patch

75 lines
1.9 KiB
Diff
Raw Normal View History

changeset: 17:59fccec87973
user: "Daniel P. Berrange <berrange@redhat.com>"
date: Thu Nov 29 15:09:26 2007 -0500
summary: Use proper domain name in title bar, rather than VNC server title
diff -r 97f00b8df38a -r 59fccec87973 AUTHORS
--- a/AUTHORS Tue Aug 28 20:33:11 2007 -0400
+++ b/AUTHORS Thu Nov 29 15:09:26 2007 -0500
@@ -3,9 +3,11 @@
The Virt Viewer application is written by
- Daniel P. Berrange <berrange@redhat.com>
+ Daniel P. Berrange <berrange-at-redhat-dot-com>
With additional patches from:
+
+ Chris Lalancette <clalance-at-redhat-dot-com>
...send patches to get your name here...
diff -r 97f00b8df38a -r 59fccec87973 src/main.c
--- a/src/main.c Tue Aug 28 20:33:11 2007 -0400
+++ b/src/main.c Thu Nov 29 15:09:26 2007 -0500
@@ -42,6 +42,7 @@
#define DEBUG_LOG(s, ...) do {} while (0)
#endif
+static char *domname = NULL;
static int verbose = 0;
#define MAX_KEY_COMBO 3
struct keyComboDef {
@@ -66,10 +67,8 @@ static const struct keyComboDef keyCombo
{ { GDK_Print }, 1, "_PrintScreen"},
};
-
static void viewer_set_title(VncDisplay *vnc, GtkWidget *window, gboolean grabbed)
{
- const char *name;
char title[1024];
const char *subtitle;
@@ -78,9 +77,8 @@ static void viewer_set_title(VncDisplay
else
subtitle = "";
- name = vnc_display_get_name(VNC_DISPLAY(vnc));
snprintf(title, sizeof(title), "%s%s - Virt Viewer",
- subtitle, name);
+ subtitle, domname);
gtk_window_set_title(GTK_WINDOW(window), title);
}
@@ -708,6 +706,7 @@ int main(int argc, char **argv)
char *vncport = NULL;
char *transport = NULL;
char *user = NULL;
+ const char *tmpname = NULL;
int port = 0;
int fd = -1;
int direct = 0;
@@ -772,6 +771,10 @@ int main(int argc, char **argv)
if (!vncport)
usleep(300*1000);
} while (!vncport);
+ tmpname = virDomainGetName(dom);
+ if (tmpname != NULL) {
+ domname = strdup(tmpname);
+ }
virDomainFree(dom);
virConnectClose(conn);