Re: [virt-tools-list] [PATCH virt-viewer 3/5] iso-dialog: Use header bar for buttons
On 20/01/17 13:26, Fabiano FidĂȘncio wrote: > 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 :-) > I have some patches locally changing other dialogs to this new look, I will soon publish them on a separate branch so it can be tested easier. -- Eduardo de Barros Lima (Etrunko) Software Engineer - RedHat etru...@redhat.com ___ 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 3/5] iso-dialog: Use header bar for buttons
On Fri, Jan 20, 2017 at 4:21 PM, Christophe Fergeauwrote: > 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, >> -
Re: [virt-tools-list] [PATCH virt-viewer 3/5] iso-dialog: Use header bar for buttons
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); >