Re: [virt-tools-list] [PATCH virt-viewer 1/5] ovirt-foreign-menu: Add accessors for current iso and iso list

2017-01-20 Thread Christophe Fergeau

Acked-by: Christophe Fergeau 

On Thu, Jan 19, 2017 at 01:42:10PM -0200, Eduardo Lima (Etrunko) wrote:
> Also, to keep consistency around the codebase, changed the return value
> of ovirt_foreign_menu_get_current_iso_name() from char * to gchar *.
> 
> Signed-off-by: Eduardo Lima (Etrunko) 
> ---
>  src/ovirt-foreign-menu.c | 11 +--
>  src/ovirt-foreign-menu.h |  2 ++
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
> index 8a99665..ef3ddd9 100644
> --- a/src/ovirt-foreign-menu.c
> +++ b/src/ovirt-foreign-menu.c
> @@ -85,10 +85,10 @@ enum {
>  };
>  
>  
> -static char *
> +gchar *
>  ovirt_foreign_menu_get_current_iso_name(OvirtForeignMenu *foreign_menu)
>  {
> -char *name;
> +gchar *name;
>  
>  if (foreign_menu->priv->cdrom == NULL) {
>  return NULL;
> @@ -100,6 +100,13 @@ ovirt_foreign_menu_get_current_iso_name(OvirtForeignMenu 
> *foreign_menu)
>  }
>  
>  
> +GList*
> +ovirt_foreign_menu_get_iso_names(OvirtForeignMenu *foreign_menu)
> +{
> +return foreign_menu->priv->iso_names;
> +}
> +
> +
>  static void
>  ovirt_foreign_menu_get_property(GObject *object, guint property_id,
> GValue *value, GParamSpec *pspec)
> diff --git a/src/ovirt-foreign-menu.h b/src/ovirt-foreign-menu.h
> index a864a60..340201f 100644
> --- a/src/ovirt-foreign-menu.h
> +++ b/src/ovirt-foreign-menu.h
> @@ -88,6 +88,8 @@ gboolean 
> ovirt_foreign_menu_set_current_iso_name_finish(OvirtForeignMenu *foreig
>  
>  
>  GtkWidget *ovirt_foreign_menu_get_gtk_menu(OvirtForeignMenu *foreign_menu);
> +gchar *ovirt_foreign_menu_get_current_iso_name(OvirtForeignMenu *menu);
> +GList *ovirt_foreign_menu_get_iso_names(OvirtForeignMenu *menu);
>  
>  G_END_DECLS
>  
> -- 
> 2.9.3
> 
> ___
> virt-tools-list mailing list
> virt-tools-list@redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list


signature.asc
Description: PGP signature
___
virt-tools-list mailing list
virt-tools-list@redhat.com
https://www.redhat.com/mailman/listinfo/virt-tools-list

Re: [virt-tools-list] [PATCH virt-viewer 5/5] ovirt-foreign-menu: Remove GtkMenu related functions

2017-01-20 Thread Christophe Fergeau

Acked-by: Christophe Fergeau 

On Thu, Jan 19, 2017 at 01:42:14PM -0200, Eduardo Lima (Etrunko) wrote:
> With this commit, we finish cleaning up ovirt foreign menu code, which
> only deals with data, leaving the UI bits to be handled properly in the
> new ISO list dialog.
> 
> This patch also updates remote-viewer to reflect the change.
> 
> Signed-off-by: Eduardo Lima (Etrunko) 
> ---
>  src/ovirt-foreign-menu.c | 99 
> 
>  src/remote-viewer.c  | 87 +++---
>  2 files changed, 6 insertions(+), 180 deletions(-)
> 
> diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
> index ef3ddd9..2939ae5 100644
> --- a/src/ovirt-foreign-menu.c
> +++ b/src/ovirt-foreign-menu.c
> @@ -350,22 +350,6 @@ 
> ovirt_foreign_menu_fetch_iso_names_finish(OvirtForeignMenu *foreign_menu,
>  }
>  
>  
> -static void
> -ovirt_foreign_menu_activate_item_cb(GtkMenuItem *menuitem, gpointer 
> user_data);
> -
> -
> -static void
> -menu_item_set_active_no_signal(GtkMenuItem *menuitem,
> -   gboolean active,
> -   GCallback callback,
> -   gpointer user_data)
> -{
> -g_signal_handlers_block_by_func(menuitem, callback, user_data);
> -gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), active);
> -g_signal_handlers_unblock_by_func(menuitem, callback, user_data);
> -}
> -
> -
>  static void iso_name_set_cb(GObject *source_object,
>  GAsyncResult *result,
>  gpointer user_data)
> @@ -447,88 +431,6 @@ gboolean 
> ovirt_foreign_menu_set_current_iso_name_finish(OvirtForeignMenu *foreig
>  }
>  
>  
> -static void
> -ovirt_foreign_menu_iso_name_changed(GObject *source_object,
> -GAsyncResult *result,
> -gpointer user_data G_GNUC_UNUSED)
> -{
> -OvirtForeignMenu *foreign_menu = OVIRT_FOREIGN_MENU(source_object);
> -GError *error = NULL;
> -
> -if (!ovirt_foreign_menu_set_current_iso_name_finish(foreign_menu, 
> result, &error)) {
> -g_warning(error ? error->message : "Failed to change CD");
> -g_clear_error(&error);
> -return;
> -}
> -
> -g_object_notify(G_OBJECT(foreign_menu), "file");
> -}
> -
> -
> -static void
> -ovirt_foreign_menu_activate_item_cb(GtkMenuItem *menuitem, gpointer 
> user_data)
> -{
> -OvirtForeignMenu *foreign_menu;
> -const char *iso_name = NULL;
> -gboolean checked;
> -
> -checked = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem));
> -foreign_menu = OVIRT_FOREIGN_MENU(user_data);
> -g_return_if_fail(foreign_menu->priv->cdrom != NULL);
> -g_return_if_fail(foreign_menu->priv->next_iso_name == NULL);
> -
> -g_debug("'%s' clicked", gtk_menu_item_get_label(menuitem));
> -
> -/* We only want to move the check mark for the currently selected ISO
> - * when ovirt_cdrom_update_async() is successful, so for now we move
> - * the check mark back to where it was before
> - */
> -menu_item_set_active_no_signal(menuitem, !checked,
> -   
> (GCallback)ovirt_foreign_menu_activate_item_cb,
> -   foreign_menu);
> -
> -if (checked) {
> -iso_name = gtk_menu_item_get_label(menuitem);
> -}
> -ovirt_foreign_menu_set_current_iso_name_async(foreign_menu, iso_name, 
> NULL,
> -  
> ovirt_foreign_menu_iso_name_changed,
> -  menuitem);
> -}
> -
> -
> -GtkWidget *ovirt_foreign_menu_get_gtk_menu(OvirtForeignMenu *foreign_menu)
> -{
> -GtkWidget *gtk_menu;
> -GList *it;
> -char *current_iso;
> -
> -if (foreign_menu->priv->iso_names == NULL) {
> -g_debug("ISO list is empty, no menu to show");
> -return NULL;
> -}
> -g_debug("Creating GtkMenu for foreign menu");
> -current_iso = ovirt_foreign_menu_get_current_iso_name(foreign_menu);
> -gtk_menu = gtk_menu_new();
> -for (it = foreign_menu->priv->iso_names; it != NULL; it = it->next) {
> -GtkWidget *menuitem;
> -
> -menuitem = gtk_check_menu_item_new_with_label((char *)it->data);
> -if (g_strcmp0((char *)it->data, current_iso) == 0) {
> -g_warn_if_fail(g_strcmp0(current_iso, 
> foreign_menu->priv->current_iso_name) == 0);
> -gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
> -   TRUE);
> -}
> -g_signal_connect(menuitem, "activate",
> - G_CALLBACK(ovirt_foreign_menu_activate_item_cb),
> - foreign_menu);
> -gtk_menu_shell_append(GTK_MENU_SHELL(gtk_menu), menuitem);
> -}
> -g_free(current_iso);
> -
> -return gtk_menu;
> -}
> -
> -
>  static void ovirt_foreign_menu_set_f

Re: [virt-tools-list] [PATCH virt-viewer 3/5] iso-dialog: Use header bar for buttons

2017-01-20 Thread Fabiano Fidêncio
On Fri, Jan 20, 2017 at 4:21 PM, Christophe Fergeau  wrote:
> I haven't looked at this patch at all, as I don't know what the plan is
> for virt-viewer regarding gtk+ versions. It's easy to move last in the
> series though. Would be nice if someone more informed about that chimed
> in on this patch ;)

All big distros (including the enterprise ones) have a newer version.
So that's not a problem at all.

I just want to know Daniel's opinion on how it looks on his TWM testing VM :-)

>
> Christophe
>
> On Thu, Jan 19, 2017 at 01:42:12PM -0200, Eduardo Lima (Etrunko) wrote:
>> It seems to give more modern look to the dialog, but it requires Gtk+
>> 3.12, thus I will am keeping this commit separated.
>>
>> On the glade UI file, we get rid of the GtkAlignment object that was
>> used to put some space between the tree view and dialog buttons. The
>> "Select ISO" label is gone too.
>>
>> Signed-off-by: Eduardo Lima (Etrunko) 
>> ---
>>  configure.ac   |  4 +-
>>  src/remote-viewer-iso-list-dialog.c| 31 +--
>>  src/resources/ui/remote-viewer-iso-list.ui | 87 
>> +++---
>>  3 files changed, 60 insertions(+), 62 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index c611d70..ce71349 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -17,8 +17,8 @@ GLIB2_REQUIRED="2.38"
>>  GLIB2_ENCODED_VERSION="GLIB_VERSION_2_38"
>>
>>  # Keep these two definitions in agreement.
>> -GTK_REQUIRED="3.10"
>> -GTK_ENCODED_VERSION="GDK_VERSION_3_10"
>> +GTK_REQUIRED="3.12"
>> +GTK_ENCODED_VERSION="GDK_VERSION_3_12"
>>
>>  LIBXML2_REQUIRED="2.6.0"
>>  LIBVIRT_REQUIRED="0.10.0"
>> diff --git a/src/remote-viewer-iso-list-dialog.c 
>> b/src/remote-viewer-iso-list-dialog.c
>> index bf7c6c7..3751c9b 100644
>> --- a/src/remote-viewer-iso-list-dialog.c
>> +++ b/src/remote-viewer-iso-list-dialog.c
>> @@ -36,6 +36,7 @@ G_DEFINE_TYPE(RemoteViewerISOListDialog, 
>> remote_viewer_iso_list_dialog, GTK_TYPE
>>
>>  struct _RemoteViewerISOListDialogPrivate
>>  {
>> +GtkHeaderBar *header_bar;
>>  GtkListStore *list_store;
>>  GtkWidget *status;
>>  GtkWidget *spinner;
>> @@ -118,6 +119,19 @@ 
>> remote_viewer_iso_list_dialog_show_files(RemoteViewerISOListDialog *self)
>>  }
>>
>>  static void
>> +remote_viewer_iso_list_dialog_set_subtitle(RemoteViewerISOListDialog *self, 
>> const char *iso_name)
>> +{
>> +RemoteViewerISOListDialogPrivate *priv = self->priv;
>> +gchar *subtitle = NULL;
>> +
>> +if (iso_name && strlen(iso_name) != 0)
>> +subtitle = g_strdup_printf(_("Current: %s"), iso_name);
>> +
>> +gtk_header_bar_set_subtitle(priv->header_bar, subtitle);
>> +g_free(subtitle);
>> +}
>> +
>> +static void
>>  remote_viewer_iso_list_dialog_foreach(char *name, RemoteViewerISOListDialog 
>> *self)
>>  {
>>  RemoteViewerISOListDialogPrivate *priv = self->priv;
>> @@ -137,6 +151,7 @@ remote_viewer_iso_list_dialog_foreach(char *name, 
>> RemoteViewerISOListDialog *sel
>>  gtk_tree_view_set_cursor(GTK_TREE_VIEW(priv->tree_view), path, 
>> NULL, FALSE);
>>  gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(priv->tree_view), path, 
>> NULL, TRUE, 0.5, 0.5);
>>  gtk_tree_path_free(path);
>> +remote_viewer_iso_list_dialog_set_subtitle(self, current_iso);
>>  }
>>
>>  g_free(current_iso);
>> @@ -195,6 +210,7 @@ remote_viewer_iso_list_dialog_response(GtkDialog *dialog,
>>
>>  gtk_spinner_start(GTK_SPINNER(priv->spinner));
>>  gtk_label_set_markup(GTK_LABEL(priv->status), _("Loading..."));
>> +remote_viewer_iso_list_dialog_set_subtitle(self, NULL);
>>  gtk_stack_set_visible_child_full(GTK_STACK(priv->stack), "status",
>>   GTK_STACK_TRANSITION_TYPE_NONE);
>>  gtk_dialog_set_response_sensitive(GTK_DIALOG(self), GTK_RESPONSE_NONE, 
>> FALSE);
>> @@ -248,9 +264,13 @@ 
>> remote_viewer_iso_list_dialog_init(RemoteViewerISOListDialog *self)
>>  RemoteViewerISOListDialogPrivate *priv = self->priv = 
>> DIALOG_PRIVATE(self);
>>  GtkBuilder *builder = 
>> virt_viewer_util_load_ui("remote-viewer-iso-list.ui");
>>  GtkCellRendererToggle *cell_renderer;
>> +GtkWidget *button, *image;
>>
>>  gtk_builder_connect_signals(builder, self);
>>
>> +priv->header_bar = 
>> GTK_HEADER_BAR(gtk_dialog_get_header_bar(GTK_DIALOG(self)));
>> +gtk_header_bar_set_has_subtitle(priv->header_bar, TRUE);
>> +
>>  priv->status = GTK_WIDGET(gtk_builder_get_object(builder, "status"));
>>  priv->spinner = GTK_WIDGET(gtk_builder_get_object(builder, "spinner"));
>>  priv->stack = GTK_WIDGET(gtk_builder_get_object(builder, "stack"));
>> @@ -264,12 +284,11 @@ 
>> remote_viewer_iso_list_dialog_init(RemoteViewerISOListDialog *self)
>>
>>  g_object_unref(builder);
>>
>> -gtk_dialog_add_buttons(GTK_DIALOG(self),
>> -   _("Refresh"), GTK_RESPONSE_NONE,
>> -   _("Close"), GTK_RESPONSE_CLOSE,
>> - 

Re: [virt-tools-list] [PATCH virt-viewer 4/5] Run ISO dialog when 'Change CD' menu is activated

2017-01-20 Thread Christophe Fergeau
Looks good,

Acked-by: Christophe Fergeau 

On Thu, Jan 19, 2017 at 01:42:13PM -0200, Eduardo Lima (Etrunko) wrote:
> Also moves 'Change CD' menu item from the toplevel menu to a subitem
> under 'File' toplevel menu.
> 
> In order to avoid object interdependency, it is necessary to make the
> ovirt foreign-menu pointer from RemoteViewer, acessible via property, so
> it can be passed to the dialog as an opaque GObject.
> 
> Signed-off-by: Eduardo Lima (Etrunko) 
> ---
>  src/remote-viewer.c | 37 +
>  src/resources/ui/virt-viewer.ui | 19 ++-
>  src/virt-viewer-window.c| 37 +
>  3 files changed, 84 insertions(+), 9 deletions(-)
> 
> diff --git a/src/remote-viewer.c b/src/remote-viewer.c
> index c84a35b..29d7db1 100644
> --- a/src/remote-viewer.c
> +++ b/src/remote-viewer.c
> @@ -67,6 +67,13 @@ G_DEFINE_TYPE (RemoteViewer, remote_viewer, 
> VIRT_VIEWER_TYPE_APP)
>  #define GET_PRIVATE(o)   
>  \
>  (G_TYPE_INSTANCE_GET_PRIVATE ((o), REMOTE_VIEWER_TYPE, 
> RemoteViewerPrivate))
>  
> +enum RemoteViewerProperties {
> +PROP_0,
> +#ifdef HAVE_OVIRT
> +PROP_OVIRT_FOREIGN_MENU,
> +#endif
> +};
> +
>  #ifdef HAVE_OVIRT
>  static OvirtVm * choose_vm(GtkWindow *main_window,
> char **vm_name,
> @@ -214,6 +221,25 @@ end:
>  }
>  
>  static void
> +remote_viewer_get_property(GObject *object, guint property_id,
> +   GValue *value, GParamSpec *pspec)
> +{
> +RemoteViewer *self = REMOTE_VIEWER(object);
> +RemoteViewerPrivate *priv = self->priv;
> +
> +switch (property_id) {
> +#ifdef HAVE_OVIRT
> +case PROP_OVIRT_FOREIGN_MENU:
> +g_value_set_object(value, priv->ovirt_foreign_menu);
> +break;
> +#endif
> +
> +default:
> +G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
> +}
> +}
> +
> +static void
>  remote_viewer_class_init (RemoteViewerClass *klass)
>  {
>  GObjectClass *object_class = G_OBJECT_CLASS (klass);
> @@ -223,6 +249,7 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>  
>  g_type_class_add_private (klass, sizeof (RemoteViewerPrivate));
>  
> +object_class->get_property = remote_viewer_get_property;
>  object_class->dispose = remote_viewer_dispose;
>  
>  g_app_class->local_command_line = remote_viewer_local_command_line;
> @@ -236,6 +263,16 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>  #else
>  (void) gtk_app_class;
>  #endif
> +
> +#ifdef HAVE_OVIRT
> +g_object_class_install_property(object_class,
> +PROP_OVIRT_FOREIGN_MENU,
> +g_param_spec_object("ovirt-foreign-menu",
> +"oVirt Foreign Menu",
> +"Object which is 
> used as interface to oVirt",
> +
> OVIRT_TYPE_FOREIGN_MENU,
> +G_PARAM_READABLE | 
> G_PARAM_STATIC_STRINGS));
> +#endif
>  }
>  
>  static void
> diff --git a/src/resources/ui/virt-viewer.ui b/src/resources/ui/virt-viewer.ui
> index 6e3c5ad..e9609ec 100644
> --- a/src/resources/ui/virt-viewer.ui
> +++ b/src/resources/ui/virt-viewer.ui
> @@ -1,6 +1,7 @@
>  
> +
>  
> -  
> +  
>
>
>  False
> @@ -73,6 +74,14 @@
>
>  
>  
> +  
> +False
> + translatable="yes">_Change CD
> +True
> + handler="virt_viewer_window_menu_change_cd_activate" swapped="no"/>
> +  
> +
> +
>
>  True
>  False
> @@ -247,14 +256,6 @@
>  
>
>  
> -
> -  
> -False
> -False
> -_Change 
> CD
> -True
> -  
> -
>
>
>  False
> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> index 99fd102..8eda12e 100644
> --- a/src/virt-viewer-window.c
> +++ b/src/virt-viewer-window.c
> @@ -43,6 +43,8 @@
>  #include "virt-viewer-util.h"
>  #include "virt-viewer-timed-revealer.h"
>  
> +#include "remote-viewer-iso-list-dialog.h"
> +
>  #define ZOOM_STEP 10
>  
>  /* Signal handlers for main window (move in a VirtViewerMainWindow?) */
> @@ -62,6 +64,7 @@ void 
> virt_viewer_window_menu_file_smartcard_insert(GtkWidget *menu, VirtViewerWi
>  void virt_viewer_window_menu_file_smartcard_remove(GtkWidget *menu, 

Re: [virt-tools-list] [PATCH virt-viewer 3/5] iso-dialog: Use header bar for buttons

2017-01-20 Thread Christophe Fergeau
I haven't looked at this patch at all, as I don't know what the plan is
for virt-viewer regarding gtk+ versions. It's easy to move last in the
series though. Would be nice if someone more informed about that chimed
in on this patch ;)

Christophe

On Thu, Jan 19, 2017 at 01:42:12PM -0200, Eduardo Lima (Etrunko) wrote:
> It seems to give more modern look to the dialog, but it requires Gtk+
> 3.12, thus I will am keeping this commit separated.
> 
> On the glade UI file, we get rid of the GtkAlignment object that was
> used to put some space between the tree view and dialog buttons. The
> "Select ISO" label is gone too.
> 
> Signed-off-by: Eduardo Lima (Etrunko) 
> ---
>  configure.ac   |  4 +-
>  src/remote-viewer-iso-list-dialog.c| 31 +--
>  src/resources/ui/remote-viewer-iso-list.ui | 87 
> +++---
>  3 files changed, 60 insertions(+), 62 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index c611d70..ce71349 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -17,8 +17,8 @@ GLIB2_REQUIRED="2.38"
>  GLIB2_ENCODED_VERSION="GLIB_VERSION_2_38"
>  
>  # Keep these two definitions in agreement.
> -GTK_REQUIRED="3.10"
> -GTK_ENCODED_VERSION="GDK_VERSION_3_10"
> +GTK_REQUIRED="3.12"
> +GTK_ENCODED_VERSION="GDK_VERSION_3_12"
>  
>  LIBXML2_REQUIRED="2.6.0"
>  LIBVIRT_REQUIRED="0.10.0"
> diff --git a/src/remote-viewer-iso-list-dialog.c 
> b/src/remote-viewer-iso-list-dialog.c
> index bf7c6c7..3751c9b 100644
> --- a/src/remote-viewer-iso-list-dialog.c
> +++ b/src/remote-viewer-iso-list-dialog.c
> @@ -36,6 +36,7 @@ G_DEFINE_TYPE(RemoteViewerISOListDialog, 
> remote_viewer_iso_list_dialog, GTK_TYPE
>  
>  struct _RemoteViewerISOListDialogPrivate
>  {
> +GtkHeaderBar *header_bar;
>  GtkListStore *list_store;
>  GtkWidget *status;
>  GtkWidget *spinner;
> @@ -118,6 +119,19 @@ 
> remote_viewer_iso_list_dialog_show_files(RemoteViewerISOListDialog *self)
>  }
>  
>  static void
> +remote_viewer_iso_list_dialog_set_subtitle(RemoteViewerISOListDialog *self, 
> const char *iso_name)
> +{
> +RemoteViewerISOListDialogPrivate *priv = self->priv;
> +gchar *subtitle = NULL;
> +
> +if (iso_name && strlen(iso_name) != 0)
> +subtitle = g_strdup_printf(_("Current: %s"), iso_name);
> +
> +gtk_header_bar_set_subtitle(priv->header_bar, subtitle);
> +g_free(subtitle);
> +}
> +
> +static void
>  remote_viewer_iso_list_dialog_foreach(char *name, RemoteViewerISOListDialog 
> *self)
>  {
>  RemoteViewerISOListDialogPrivate *priv = self->priv;
> @@ -137,6 +151,7 @@ remote_viewer_iso_list_dialog_foreach(char *name, 
> RemoteViewerISOListDialog *sel
>  gtk_tree_view_set_cursor(GTK_TREE_VIEW(priv->tree_view), path, NULL, 
> FALSE);
>  gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(priv->tree_view), path, 
> NULL, TRUE, 0.5, 0.5);
>  gtk_tree_path_free(path);
> +remote_viewer_iso_list_dialog_set_subtitle(self, current_iso);
>  }
>  
>  g_free(current_iso);
> @@ -195,6 +210,7 @@ remote_viewer_iso_list_dialog_response(GtkDialog *dialog,
>  
>  gtk_spinner_start(GTK_SPINNER(priv->spinner));
>  gtk_label_set_markup(GTK_LABEL(priv->status), _("Loading..."));
> +remote_viewer_iso_list_dialog_set_subtitle(self, NULL);
>  gtk_stack_set_visible_child_full(GTK_STACK(priv->stack), "status",
>   GTK_STACK_TRANSITION_TYPE_NONE);
>  gtk_dialog_set_response_sensitive(GTK_DIALOG(self), GTK_RESPONSE_NONE, 
> FALSE);
> @@ -248,9 +264,13 @@ 
> remote_viewer_iso_list_dialog_init(RemoteViewerISOListDialog *self)
>  RemoteViewerISOListDialogPrivate *priv = self->priv = 
> DIALOG_PRIVATE(self);
>  GtkBuilder *builder = 
> virt_viewer_util_load_ui("remote-viewer-iso-list.ui");
>  GtkCellRendererToggle *cell_renderer;
> +GtkWidget *button, *image;
>  
>  gtk_builder_connect_signals(builder, self);
>  
> +priv->header_bar = 
> GTK_HEADER_BAR(gtk_dialog_get_header_bar(GTK_DIALOG(self)));
> +gtk_header_bar_set_has_subtitle(priv->header_bar, TRUE);
> +
>  priv->status = GTK_WIDGET(gtk_builder_get_object(builder, "status"));
>  priv->spinner = GTK_WIDGET(gtk_builder_get_object(builder, "spinner"));
>  priv->stack = GTK_WIDGET(gtk_builder_get_object(builder, "stack"));
> @@ -264,12 +284,11 @@ 
> remote_viewer_iso_list_dialog_init(RemoteViewerISOListDialog *self)
>  
>  g_object_unref(builder);
>  
> -gtk_dialog_add_buttons(GTK_DIALOG(self),
> -   _("Refresh"), GTK_RESPONSE_NONE,
> -   _("Close"), GTK_RESPONSE_CLOSE,
> -   NULL);
> +button = gtk_dialog_add_button(GTK_DIALOG(self), "", GTK_RESPONSE_NONE);
> +image = gtk_image_new_from_icon_name("view-refresh-symbolic", 
> GTK_ICON_SIZE_BUTTON);
> +gtk_button_set_image(GTK_BUTTON(button), image);
> +gtk_button_set_always_show_image(GTK_BUTTON(button), TRUE);
>  
> -gtk_dialog_

[virt-tools-list] [virt-manager PATCH] virtManager/addhardware: get supported disk bus types from libvirt

2017-01-20 Thread Pavel Hrdina
Libvirt provides domain capabilities where supported disk bus types are
listed.  Virt-manager should try to get those bus types.  The old code
remains as fallback if domain capabilities doesn't contain the disk
bus types.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1387218

Signed-off-by: Pavel Hrdina 
---
 virtManager/addhardware.py | 49 +-
 1 file changed, 31 insertions(+), 18 deletions(-)

diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index aab90957..e63ad3d0 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -690,25 +690,38 @@ class vmmAddHardware(vmmGObjectUI):
 
 @staticmethod
 def populate_disk_bus_combo(vm, devtype, model):
+# try to get supported disk bus types from domain capabilities
+domcaps = vm.get_domain_capabilities()
+disk_bus_types = None
+if "bus" in domcaps.devices.disk.enum_names():
+disk_bus_types = domcaps.devices.disk.get_enum("bus").get_values()
+
+# if there are no disk bus types in domain capabilities fallback to
+# old code
+if not disk_bus_types:
+disk_bus_types = []
+if vm.is_hvm():
+if not vm.get_xmlobj().os.is_q35():
+disk_bus_types.append("ide")
+disk_bus_types.append("sata")
+disk_bus_types.append("fdc")
+
+if not vm.stable_defaults():
+disk_bus_types.append("scsi")
+disk_bus_types.append("usb")
+
+if vm.get_hv_type() in ["qemu", "kvm", "test"]:
+disk_bus_types.append("sd")
+disk_bus_types.append("virtio")
+if "scsi" not in disk_bus_types:
+disk_bus_types.append("scsi")
+
+if vm.conn.is_xen() or vm.conn.is_test_conn():
+disk_bus_types.append("xen")
+
 rows = []
-if vm.is_hvm():
-if not vm.get_xmlobj().os.is_q35():
-rows.append(["ide", "IDE"])
-rows.append(["sata", "SATA"])
-rows.append(["fdc", _("Floppy")])
-
-if not vm.stable_defaults():
-rows.append(["scsi", "SCSI"])
-rows.append(["usb", "USB"])
-
-if vm.get_hv_type() in ["qemu", "kvm", "test"]:
-rows.append(["sd", "SD"])
-rows.append(["virtio", "VirtIO"])
-if not rows.count(["scsi", "SCSI"]):
-rows.append(["scsi", "SCSI"])
-
-if vm.conn.is_xen() or vm.conn.is_test_conn():
-rows.append(["xen", "Xen"])
+for bus in disk_bus_types:
+rows.append([bus, virtinst.VirtualDisk.pretty_disk_bus(bus)])
 
 model.clear()
 
-- 
2.11.0

___
virt-tools-list mailing list
virt-tools-list@redhat.com
https://www.redhat.com/mailman/listinfo/virt-tools-list


Re: [virt-tools-list] [PATCH virt-viewer 2/5] Introduce ISO List dialog

2017-01-20 Thread Christophe Fergeau
Can you expand a bit in the commit log about what this iso dialog is,
what is your goal for introducing it, .. ? Huge commit with shortlog
does not look good ;)

On Thu, Jan 19, 2017 at 01:42:11PM -0200, Eduardo Lima (Etrunko) wrote:
> Signed-off-by: Eduardo Lima (Etrunko) 
> ---
>  po/POTFILES.in |   2 +
>  src/Makefile.am|   3 +
>  src/remote-viewer-iso-list-dialog.c| 365 
> +
>  src/remote-viewer-iso-list-dialog.h|  58 +
>  src/resources/ui/remote-viewer-iso-list.ui | 158 +
>  src/resources/virt-viewer.gresource.xml|   1 +
>  6 files changed, 587 insertions(+)
>  create mode 100644 src/remote-viewer-iso-list-dialog.c
>  create mode 100644 src/remote-viewer-iso-list-dialog.h
>  create mode 100644 src/resources/ui/remote-viewer-iso-list.ui
> 
> diff --git a/po/POTFILES.in b/po/POTFILES.in
> index 69d9fef..371c242 100644
> --- a/po/POTFILES.in
> +++ b/po/POTFILES.in
> @@ -1,9 +1,11 @@
>  data/remote-viewer.appdata.xml.in
>  data/remote-viewer.desktop.in
>  data/virt-viewer-mime.xml.in
> +src/remote-viewer-iso-list-dialog.c
>  src/remote-viewer-main.c
>  src/remote-viewer.c
>  [type: gettext/glade] src/resources/ui/remote-viewer-connect.ui
> +[type: gettext/glade] src/resources/ui/remote-viewer-iso-list.ui
>  [type: gettext/glade] src/resources/ui/virt-viewer-about.ui
>  src/virt-viewer-app.c
>  src/virt-viewer-auth.c
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 272c4ff..9748277 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -13,6 +13,7 @@ noinst_DATA = \
>   resources/ui/virt-viewer-vm-connection.ui \
>   resources/ui/virt-viewer-preferences.ui \
>   resources/ui/remote-viewer-connect.ui \
> + resources/ui/remote-viewer-iso-list.ui \
>   resources/ui/virt-viewer-file-transfer-dialog.ui \
>   $(NULL)
>  
> @@ -97,6 +98,8 @@ if HAVE_OVIRT
>  libvirt_viewer_la_SOURCES += \
>   ovirt-foreign-menu.h \
>   ovirt-foreign-menu.c \
> + remote-viewer-iso-list-dialog.c \
> + remote-viewer-iso-list-dialog.h \
>   $(NULL)
>  endif
>  
> diff --git a/src/remote-viewer-iso-list-dialog.c 
> b/src/remote-viewer-iso-list-dialog.c
> new file mode 100644
> index 000..bf7c6c7
> --- /dev/null
> +++ b/src/remote-viewer-iso-list-dialog.c
> @@ -0,0 +1,365 @@
> +/*
> + * Virt Viewer: A virtual machine console viewer
> + *
> + * Copyright (C) 2016 Red Hat, Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> + */
> +
> +#include 
> +
> +#include 
> +
> +#include "remote-viewer-iso-list-dialog.h"
> +#include "virt-viewer-util.h"
> +#include "ovirt-foreign-menu.h"
> +
> +static void ovirt_foreign_menu_iso_name_changed(OvirtForeignMenu 
> *foreign_menu, GAsyncResult *result, RemoteViewerISOListDialog *self);
> +static void 
> remote_viewer_iso_list_dialog_show_error(RemoteViewerISOListDialog *self, 
> const gchar *message);
> +
> +G_DEFINE_TYPE(RemoteViewerISOListDialog, remote_viewer_iso_list_dialog, 
> GTK_TYPE_DIALOG)
> +
> +#define DIALOG_PRIVATE(o) \
> +(G_TYPE_INSTANCE_GET_PRIVATE((o), 
> REMOTE_VIEWER_TYPE_ISO_LIST_DIALOG, RemoteViewerISOListDialogPrivate))
> +
> +struct _RemoteViewerISOListDialogPrivate
> +{
> +GtkListStore *list_store;
> +GtkWidget *status;
> +GtkWidget *spinner;
> +GtkWidget *stack;
> +GtkWidget *tree_view;
> +OvirtForeignMenu *foreign_menu;
> +};
> +
> +enum RemoteViewerISOListDialogModel
> +{
> +ISO_IS_ACTIVE = 0,
> +ISO_NAME,
> +FONT_WEIGHT,
> +};
> +
> +enum RemoteViewerISOListDialogProperties {
> +PROP_0,
> +PROP_FOREIGN_MENU,
> +};
> +
> +
> +void remote_viewer_iso_list_dialog_toggled(GtkCellRendererToggle 
> *cell_renderer, gchar *path, gpointer user_data);
> +void remote_viewer_iso_list_dialog_row_activated(GtkTreeView *view, 
> GtkTreePath *path, GtkTreeViewColumn *col, gpointer user_data);
> +
> +static void
> +remote_viewer_iso_list_dialog_dispose(GObject *object)
> +{
> +RemoteViewerISOListDialog *self = REMOTE_VIEWER_ISO_LIST_DIALOG(object);
> +RemoteViewerISOListDialogPrivate *priv = self->priv;
> +
> +if (priv->foreign_menu) {
> +g_signal_handlers_disconnect_by_data(priv->foreign_menu, object);
> +g_clear_object(&priv->foreign_m

Re: [virt-tools-list] [PATCH virt-viewer v2 2/2] README: switch to Markdown syntax

2017-01-20 Thread Fabiano Fidêncio
On Thu, Jan 19, 2017 at 5:36 PM, Pavel Grunt  wrote:
> To render nicely on the project git page:
>  https://pagure.io/virt-viewer
> ---
>  README => README.md | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
>  rename README => README.md (92%)
>
> diff --git a/README b/README.md
> similarity index 92%
> rename from README
> rename to README.md
> index ea1c633..ceb01a9 100644
> --- a/README
> +++ b/README.md
> @@ -1,5 +1,4 @@
> -  Virt Viewer
> -  ===
> +# Virt Viewer
>
>  Virt Viewer provides a graphical viewer for the guest OS
>  display. At this time is supports guest OS using the VNC
> @@ -22,7 +21,7 @@ display of the SPICE protocol, which is available from:
>https://www.spice-space.org/download.html
>
>  Use of either SPICE-GTK or GTK-VNC can be disabled at time
> -of configure, with --without-gtk-vnc or --without-spice-gtk
> +of configure, with `--without-gtk-vnc` or `--without-spice-gtk`
>  respectively.
>
>  Virt Viewer uses libvirt to lookup information about the
> @@ -38,5 +37,3 @@ found on the Virt Manager website:
>  Feedback should be directed to the mailing list at
>
>http://www.redhat.com/mailman/listinfo/virt-tools-list
> -
> --- End
> --
> 2.11.0
>
> ___
> virt-tools-list mailing list
> virt-tools-list@redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list

Acked-by: Fabiano Fidêncio 

-- 
Fabiano Fidêncio

___
virt-tools-list mailing list
virt-tools-list@redhat.com
https://www.redhat.com/mailman/listinfo/virt-tools-list