[virt-tools-list] [PATCH virt-viewer 4/6] Remove the "container" logic used by legacy browser plugin

Marc-André Lureau marcandre.lureau at gmail.com
Thu May 16 19:33:20 UTC 2013


From: Marc-André Lureau <marcandre.lureau at redhat.com>

---
 src/virt-viewer-app.c    | 43 ++++---------------------------------------
 src/virt-viewer-main.c   |  2 +-
 src/virt-viewer-window.c | 22 ----------------------
 src/virt-viewer.c        |  4 +---
 src/virt-viewer.h        |  3 +--
 5 files changed, 7 insertions(+), 67 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 62e3603..8bdbc59 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -106,7 +106,6 @@ static void virt_viewer_app_update_menu_displays(VirtViewerApp *self);
 struct _VirtViewerAppPrivate {
     VirtViewerWindow *main_window;
     GtkWidget *main_notebook;
-    GtkWidget *container;
     GHashTable *windows;
     gchar *clipboard;
 
@@ -152,7 +151,6 @@ G_DEFINE_ABSTRACT_TYPE(VirtViewerApp, virt_viewer_app, G_TYPE_OBJECT)
 enum {
     PROP_0,
     PROP_VERBOSE,
-    PROP_CONTAINER,
     PROP_SESSION,
     PROP_GUEST_NAME,
     PROP_GURI,
@@ -651,15 +649,12 @@ app_window_try_fullscreen(VirtViewerApp *self, VirtViewerWindow *win, gint nth)
 }
 
 static VirtViewerWindow*
-virt_viewer_app_window_new(VirtViewerApp *self, GtkWidget *container, gint nth)
+virt_viewer_app_window_new(VirtViewerApp *self, gint nth)
 {
     VirtViewerWindow* window;
     GtkWindow *w;
 
-    window = g_object_new(VIRT_VIEWER_TYPE_WINDOW,
-                          "app", self,
-                          "container", container,
-                          NULL);
+    window = g_object_new(VIRT_VIEWER_TYPE_WINDOW, "app", self, NULL);
     if (self->priv->main_window)
         virt_viewer_window_set_zoom_level(window, virt_viewer_window_get_zoom_level(self->priv->main_window));
     virt_viewer_app_set_nth_window(self, nth, window);
@@ -720,13 +715,8 @@ virt_viewer_app_display_added(VirtViewerSession *session G_GNUC_UNUSED,
     if (nth == 0) {
         window = priv->main_window;
     } else {
-        if (priv->container) {
-            g_warning("multi-head not yet supported within container");
-            return;
-        }
-
         g_return_if_fail(virt_viewer_app_get_nth_window(self, nth) == NULL);
-        window = virt_viewer_app_window_new(self, NULL, nth);
+        window = virt_viewer_app_window_new(self, nth);
     }
 
     virt_viewer_window_set_display(window, display);
@@ -1242,10 +1232,6 @@ virt_viewer_app_get_property (GObject *object, guint property_id,
         g_value_set_boolean(value, priv->verbose);
         break;
 
-    case PROP_CONTAINER:
-        g_value_set_object(value, priv->container);
-        break;
-
     case PROP_SESSION:
         g_value_set_object(value, priv->session);
         break;
@@ -1296,11 +1282,6 @@ virt_viewer_app_set_property (GObject *object, guint property_id,
         priv->verbose = g_value_get_boolean(value);
         break;
 
-    case PROP_CONTAINER:
-        g_return_if_fail(priv->container == NULL);
-        priv->container = g_value_dup_object(value);
-        break;
-
     case PROP_GUEST_NAME:
         g_free(priv->guest_name);
         priv->guest_name = g_value_dup_string(value);
@@ -1349,11 +1330,6 @@ virt_viewer_app_dispose (GObject *object)
         g_hash_table_unref(tmp);
     }
 
-    if (priv->container) {
-        g_object_unref(priv->container);
-        priv->container = NULL;
-    }
-
     if (priv->session) {
         g_object_unref(priv->session);
         priv->session = NULL;
@@ -1429,7 +1405,7 @@ virt_viewer_app_constructor (GType gtype,
     self = VIRT_VIEWER_APP(obj);
     priv = self->priv;
 
-    priv->main_window = virt_viewer_app_window_new(self, priv->container, 0);
+    priv->main_window = virt_viewer_app_window_new(self, 0);
     priv->main_notebook = GTK_WIDGET(virt_viewer_window_get_notebook(priv->main_window));
 
     gtk_accel_map_add_entry("<virt-viewer>/file/smartcard-insert", GDK_F8, GDK_SHIFT_MASK);
@@ -1469,17 +1445,6 @@ virt_viewer_app_class_init (VirtViewerAppClass *klass)
                                                          G_PARAM_STATIC_STRINGS));
 
     g_object_class_install_property(object_class,
-                                    PROP_CONTAINER,
-                                    g_param_spec_object("container",
-                                                        "Container",
-                                                        "Widget container",
-                                                        GTK_TYPE_WIDGET,
-                                                        G_PARAM_READABLE |
-                                                        G_PARAM_WRITABLE |
-                                                        G_PARAM_CONSTRUCT_ONLY |
-                                                        G_PARAM_STATIC_STRINGS));
-
-    g_object_class_install_property(object_class,
                                     PROP_SESSION,
                                     g_param_spec_object("session",
                                                         "Session",
diff --git a/src/virt-viewer-main.c b/src/virt-viewer-main.c
index fca4626..c93d948 100644
--- a/src/virt-viewer-main.c
+++ b/src/virt-viewer-main.c
@@ -129,7 +129,7 @@ int main(int argc, char **argv)
 
     virt_viewer_app_set_debug(debug);
 
-    viewer = virt_viewer_new(uri, args[0], zoom, direct, attach, waitvm, reconnect, verbose, NULL);
+    viewer = virt_viewer_new(uri, args[0], zoom, direct, attach, waitvm, reconnect, verbose);
     if (viewer == NULL)
         goto cleanup;
 
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 2d75e74..b00734c 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -75,13 +75,11 @@ enum {
     PROP_WINDOW,
     PROP_DISPLAY,
     PROP_SUBTITLE,
-    PROP_CONTAINER,
     PROP_APP,
 };
 
 struct _VirtViewerWindowPrivate {
     VirtViewerApp *app;
-    GtkContainer *container; /* if any, then there is no window */
 
     GtkBuilder *builder;
     GtkWidget *window;
@@ -128,10 +126,6 @@ virt_viewer_window_get_property (GObject *object, guint property_id,
         g_value_set_object(value, virt_viewer_window_get_display(self));
         break;
 
-    case PROP_CONTAINER:
-        g_value_set_object(value, priv->container);
-        break;
-
     case PROP_APP:
         g_value_set_object(value, priv->app);
         break;
@@ -154,11 +148,6 @@ virt_viewer_window_set_property (GObject *object, guint property_id,
         virt_viewer_window_update_title(VIRT_VIEWER_WINDOW(object));
         break;
 
-    case PROP_CONTAINER:
-        g_return_if_fail(priv->container == NULL);
-        priv->container = g_value_dup_object(value);
-        break;
-
     case PROP_APP:
         g_return_if_fail(priv->app == NULL);
         priv->app = g_value_get_object(value);
@@ -245,17 +234,6 @@ virt_viewer_window_class_init (VirtViewerWindowClass *klass)
                                                         G_PARAM_STATIC_STRINGS));
 
     g_object_class_install_property(object_class,
-                                    PROP_CONTAINER,
-                                    g_param_spec_object("container",
-                                                        "Container",
-                                                        "Container widget",
-                                                        VIRT_VIEWER_TYPE_DISPLAY,
-                                                        G_PARAM_READABLE |
-                                                        G_PARAM_WRITABLE |
-                                                        G_PARAM_CONSTRUCT_ONLY |
-                                                        G_PARAM_STATIC_STRINGS));
-
-    g_object_class_install_property(object_class,
                                     PROP_APP,
                                     g_param_spec_object("app",
                                                         "App",
diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 8d4ec62..898e1c0 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -733,15 +733,13 @@ virt_viewer_new(const char *uri,
                 gboolean attach,
                 gboolean waitvm,
                 gboolean reconnect,
-                gboolean verbose,
-                GtkWidget *container)
+                gboolean verbose)
 {
     VirtViewer *self;
     VirtViewerApp *app;
     VirtViewerPrivate *priv;
 
     self = g_object_new(VIRT_VIEWER_TYPE,
-                        "container", container,
                         "verbose", verbose,
                         "guest-name", name,
                         NULL);
diff --git a/src/virt-viewer.h b/src/virt-viewer.h
index d136ade..73d9170 100644
--- a/src/virt-viewer.h
+++ b/src/virt-viewer.h
@@ -56,8 +56,7 @@ virt_viewer_new(const char *uri,
                 gboolean attach,
                 gboolean waitvm,
                 gboolean reconnect,
-                gboolean verbose,
-                GtkWidget *container);
+                gboolean verbose);
 
 G_END_DECLS
 
-- 
1.8.3.rc1.49.g8d97506




More information about the virt-tools-list mailing list