Re: [virt-tools-list] [PATCH 1/2] session: Only create a hashtable if apply_monitor_geometry class exists

2015-10-21 Thread Eduardo Lima (Etrunko)
ACK

Although I think you could add a description for this patch in the
message a memory leak on error path.

On 10/21/2015 11:23 AM, Fabiano Fidêncio wrote:
> Related: rhbz#1267184
> ---
>  src/virt-viewer-session.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
> index 2699f41..92ffd3f 100644
> --- a/src/virt-viewer-session.c
> +++ b/src/virt-viewer-session.c
> @@ -405,13 +405,15 @@ 
> virt_viewer_session_on_monitor_geometry_changed(VirtViewerSession* self,
>  VirtViewerSessionClass *klass;
>  gboolean all_fullscreen = TRUE;
>  /* GHashTable */
> -GHashTable *monitors = g_hash_table_new_full(g_direct_hash, 
> g_direct_equal, NULL, g_free);
> +GHashTable *monitors;
>  GList *l;
>  
>  klass = VIRT_VIEWER_SESSION_GET_CLASS(self);
>  if (!klass->apply_monitor_geometry)
>  return;
>  
> +monitors = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, 
> g_free);
> +
>  for (l = self->priv->displays; l; l = l->next) {
>  VirtViewerDisplay *d = VIRT_VIEWER_DISPLAY(l->data);
>  guint nth = 0;
> 


-- 
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


[virt-tools-list] [PATCH 1/5] Call intltoolize after autoreconf

2015-10-29 Thread Eduardo Lima (Etrunko)
After a calling 'git clean -d -x -f' I got this error:

ln: failed to create symbolic link ‘m4/intltool.m4’: No such file or directory
cp: cannot create regular file ‘m4/intltool.m4’: No such file or directory
intltoolize: cannot copy '/usr/share/aclocal/intltool.m4' to 'm4/intltool.m4'

With this patch, the error is gone.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 autogen.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/autogen.sh b/autogen.sh
index b8d3c4d..a688ad4 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -27,8 +27,8 @@ fi
  # exists at all times :-(
 touch ChangeLog AUTHORS
 
-intltoolize --force
 autoreconf -vfi
+intltoolize --force
 
 cd $THEDIR
 
-- 
2.4.3

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

[virt-tools-list] Some cosmetic fixes

2015-10-29 Thread Eduardo Lima (Etrunko)
While working on adding support to GtkApplication for virt-viewer and
remote-viewer, I fixed some small things. I figured it was time to
flush them to avoid those to pile up.

Regards, Eduardo

-- 
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


[virt-tools-list] [PATCH 5/5] Remove useless {get, set}_property functions

2015-10-29 Thread Eduardo Lima (Etrunko)
Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/virt-viewer.c | 22 --
 1 file changed, 22 deletions(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index dd8dbba..10f624d 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -74,26 +74,6 @@ static void virt_viewer_dispose (GObject *object);
 static int virt_viewer_connect(VirtViewerApp *app, GError **error);
 
 static void
-virt_viewer_get_property (GObject *object, guint property_id,
-  GValue *value G_GNUC_UNUSED, GParamSpec *pspec)
-{
-switch (property_id) {
-default:
-G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-}
-
-static void
-virt_viewer_set_property (GObject *object, guint property_id,
-  const GValue *value G_GNUC_UNUSED, GParamSpec *pspec)
-{
-switch (property_id) {
-default:
-G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-}
-
-static void
 virt_viewer_class_init (VirtViewerClass *klass)
 {
 GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -101,8 +81,6 @@ virt_viewer_class_init (VirtViewerClass *klass)
 
 g_type_class_add_private (klass, sizeof (VirtViewerPrivate));
 
-object_class->get_property = virt_viewer_get_property;
-object_class->set_property = virt_viewer_set_property;
 object_class->dispose = virt_viewer_dispose;
 
 app_class->initial_connect = virt_viewer_initial_connect;
-- 
2.4.3

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


[virt-tools-list] [PATCH 2/5] Fix MAINTAINERCLEANFILES variable

2015-10-29 Thread Eduardo Lima (Etrunko)
Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 man/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/Makefile.am b/man/Makefile.am
index 6ee3116..39b6019 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -10,7 +10,7 @@ EXTRA_DIST =  \
virt-viewer.pod \
$(NULL)
 
-MAINTAINERCLEANFILES = $(man_MANS)
+MAINTAINERCLEANFILES = $(dist_man_MANS)
 
 %.1: %.pod
$(AM_V_GEN)pod2man -c "Virtualization Support" $< > $@
-- 
2.4.3

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


[virt-tools-list] [PATCH 4/5] Move declaration to the beginning of the file

2015-10-29 Thread Eduardo Lima (Etrunko)
Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/virt-viewer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index ca264c8..dd8dbba 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -71,6 +71,7 @@ static gboolean virt_viewer_open_connection(VirtViewerApp 
*self, int *fd);
 static void virt_viewer_deactivated(VirtViewerApp *self, gboolean 
connect_error);
 static gboolean virt_viewer_start(VirtViewerApp *self, GError **error);
 static void virt_viewer_dispose (GObject *object);
+static int virt_viewer_connect(VirtViewerApp *app, GError **error);
 
 static void
 virt_viewer_get_property (GObject *object, guint property_id,
@@ -723,8 +724,6 @@ choose_vm(GtkWindow *main_window,
 return dom;
 }
 
-static int virt_viewer_connect(VirtViewerApp *app, GError **error);
-
 static gboolean
 virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
 {
-- 
2.4.3

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


Re: [virt-tools-list] [PATCH 2/2] Fix spice includes

2015-11-11 Thread Eduardo Lima (Etrunko)
On 11/11/2015 05:11 AM, Pavel Grunt wrote:
> Hi Eduardo,
> 
> these warnings were introduced after spice-gtk v0.30 release, virt-viewer
> currently depends on spice-gtk v0.29.35. You can make the code conditional or
> wait for the spice-gtk v0.31 release.
> 

Alright, I guess it is better to wait then.

Regards. Eduardo.

-- 
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


[virt-tools-list] [PATCH 1/2] Remove unused 'window-removed' signal

2015-11-10 Thread Eduardo Lima (Etrunko)
Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/virt-viewer-app.c | 14 --
 src/virt-viewer-app.h |  1 -
 2 files changed, 15 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 653b30c..b14b509 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -176,7 +176,6 @@ enum {
 
 enum {
 SIGNAL_WINDOW_ADDED,
-SIGNAL_WINDOW_REMOVED,
 SIGNAL_LAST,
 };
 
@@ -1046,8 +1045,6 @@ static void 
virt_viewer_app_remove_nth_window(VirtViewerApp *self,
 g_debug("Remove window %d %p", nth, win);
 self->priv->windows = g_list_remove(self->priv->windows, win);
 
-g_signal_emit(self, signals[SIGNAL_WINDOW_REMOVED], 0, win);
-
 g_object_unref(win);
 }
 
@@ -2003,17 +2000,6 @@ virt_viewer_app_class_init (VirtViewerAppClass *klass)
  G_TYPE_NONE,
  1,
  G_TYPE_OBJECT);
-
-signals[SIGNAL_WINDOW_REMOVED] =
-g_signal_new("window-removed",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VirtViewerAppClass, window_removed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1,
- G_TYPE_OBJECT);
 }
 
 void
diff --git a/src/virt-viewer-app.h b/src/virt-viewer-app.h
index bbbc9b4..7aa315d 100644
--- a/src/virt-viewer-app.h
+++ b/src/virt-viewer-app.h
@@ -48,7 +48,6 @@ typedef struct {
 
 /* signals */
 void (*window_added) (VirtViewerApp *self, VirtViewerWindow *window);
-void (*window_removed) (VirtViewerApp *self, VirtViewerWindow *window);
 
 /*< private >*/
 gboolean (*start) (VirtViewerApp *self, GError **error);
-- 
2.5.0

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


[virt-tools-list] [PATCH virt-viewer 0/2] More cleanups

2015-11-10 Thread Eduardo Lima (Etrunko)
Here are a couple more clean-up patches I had on my staging area that
I think could be merged as they are independent of any feature. Please
take a look.

Regards, Eduardo

Eduardo Lima (Etrunko) (2):
  Remove unused 'window-removed' signal
  Fix spice includes

 src/remote-viewer-main.c|  2 +-
 src/virt-viewer-app.c   | 14 --
 src/virt-viewer-app.h   |  1 -
 src/virt-viewer-display-spice.c |  2 +-
 src/virt-viewer-display-spice.h |  3 +--
 src/virt-viewer-main.c  |  2 +-
 src/virt-viewer-session-spice.c |  5 +
 src/virt-viewer-session-spice.h |  3 +--
 8 files changed, 6 insertions(+), 26 deletions(-)

-- 
2.5.0

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


[virt-tools-list] [PATCH 2/2] Fix spice includes

2015-11-10 Thread Eduardo Lima (Etrunko)
Recent spice commit requires that only spice-client.h or
spice-client-gtk.h should be included directly. As a result,
compilation is now throwing warnings like:

warning: #warning "Only  can be included directly" [-Wcpp]
warning: #warning "Only  can be included directly" [-Wcpp]

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/remote-viewer-main.c| 2 +-
 src/virt-viewer-display-spice.c | 2 +-
 src/virt-viewer-display-spice.h | 3 +--
 src/virt-viewer-main.c  | 2 +-
 src/virt-viewer-session-spice.c | 5 +
 src/virt-viewer-session-spice.h | 3 +--
 6 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/src/remote-viewer-main.c b/src/remote-viewer-main.c
index 81cf736..6ac2523 100644
--- a/src/remote-viewer-main.c
+++ b/src/remote-viewer-main.c
@@ -34,7 +34,7 @@
 #include 
 #endif
 #ifdef HAVE_SPICE_GTK
-#include 
+#include 
 #endif
 #ifdef HAVE_OVIRT
 #include 
diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index c3dbd75..ffe4e09 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -25,7 +25,7 @@
 #include 
 
 #include 
-#include 
+#include 
 
 #include 
 
diff --git a/src/virt-viewer-display-spice.h b/src/virt-viewer-display-spice.h
index 3c30270..598a1b7 100644
--- a/src/virt-viewer-display-spice.h
+++ b/src/virt-viewer-display-spice.h
@@ -25,8 +25,7 @@
 #define _VIRT_VIEWER_DISPLAY_SPICE_H
 
 #include 
-#include 
-#include 
+#include 
 
 #include "virt-viewer-display.h"
 #include "virt-viewer-session-spice.h"
diff --git a/src/virt-viewer-main.c b/src/virt-viewer-main.c
index 505b472..9b9807a 100644
--- a/src/virt-viewer-main.c
+++ b/src/virt-viewer-main.c
@@ -29,7 +29,7 @@
 #include 
 #endif
 #ifdef HAVE_SPICE_GTK
-#include 
+#include 
 #endif
 #include "virt-viewer.h"
 
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index b9cae5e..68afb0a 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -24,12 +24,9 @@
 
 #include 
 
-#include 
 #include 
 
-#include 
-#include 
-#include 
+#include 
 
 #include 
 #include "virt-viewer-file.h"
diff --git a/src/virt-viewer-session-spice.h b/src/virt-viewer-session-spice.h
index 95bdcdf..aa1f7e8 100644
--- a/src/virt-viewer-session-spice.h
+++ b/src/virt-viewer-session-spice.h
@@ -25,8 +25,7 @@
 #define _VIRT_VIEWER_SESSION_SPICE_H
 
 #include 
-#include 
-#include 
+#include 
 
 #include "virt-viewer-session.h"
 
-- 
2.5.0

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


Re: [virt-tools-list] Some cosmetic fixes

2015-11-03 Thread Eduardo Lima (Etrunko)
On 02/11/15 04:26, Fabiano Fidêncio wrote:
> Hey,
> 
> On Thu, Oct 29, 2015 at 9:40 PM, Eduardo Lima (Etrunko)
> <etru...@redhat.com> wrote:
>> While working on adding support to GtkApplication for virt-viewer and
>> remote-viewer, I fixed some small things. I figured it was time to
>> flush them to avoid those to pile up.
> 
> The patch series seems good apart from the first patch and a question
> raised in the 3rd one.
> Also, I know it's not a rule here, but would be nice if you could add
> a prefix to the commit shortlog.

Ok, since it was my first submission, I was not aware of this. I will do
it from now on.

Thanks, Eduardo


-- 
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 1/5] Call intltoolize after autoreconf

2015-11-03 Thread Eduardo Lima (Etrunko)
On 02/11/15 04:08, Fabiano Fidêncio wrote:
> Hey!
> 
> On Thu, Oct 29, 2015 at 9:40 PM, Eduardo Lima (Etrunko)
> <etru...@redhat.com> wrote:
>> After a calling 'git clean -d -x -f' I got this error:
>>
>> ln: failed to create symbolic link ‘m4/intltool.m4’: No such file or 
>> directory
>> cp: cannot create regular file ‘m4/intltool.m4’: No such file or directory
>> intltoolize: cannot copy '/usr/share/aclocal/intltool.m4' to 'm4/intltool.m4'
> 
> I've never seen this error before and I am not able to reproduce it here.
>


Have you tried the git clean command? It removes the m4/ directory
altogether. and intltoolize requires that m4/ directory to be present.
This is what you get when you run autoreconf before it.

>>
>> With this patch, the error is gone.
> 
> This patch introduces this warning:
> aclocal: warning: couldn't open directory 'm4': No such file or directory
> 

This warning is generated by autoreconf and is harmless, it will create
that directory anyway.


-- 
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 3/5] Update gitignore

2015-11-03 Thread Eduardo Lima (Etrunko)
On 02/11/15 08:36, Christophe Fergeau wrote:
> On Thu, Oct 29, 2015 at 06:40:38PM -0200, Eduardo Lima (Etrunko) wrote:
>> Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
>> ---
>>  Makefile.am | 5 +
>>  git.mk  | 2 +-
>>  m4/.gitignore   | 0
>>  src/Makefile.am | 8 
>>  4 files changed, 14 insertions(+), 1 deletion(-)
>>  delete mode 100644 m4/.gitignore
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index d0e9ab4..9646119 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -48,6 +48,11 @@ MAINTAINERCLEANFILES =\
>>  $(srcdir)/m4/lt~obsolete.m4 \
>>  $(NULL)
>>  
>> +GITIGNOREFILES =\
>> +AUTHORS \
> 
> This one should be in xxxCLEANFILES (MAINTAINER maybe?)
> 
>> +build-aux/test-driver   \
> 
> Not sure about this one, but I suspect it belongs to
> MAINTAINERCLEANFILES as well as the other build-aux/ files are listed in
> it.
> 

Yes, you can find those in the final Makefile, but test-driver is the
only one missing. Maybe a bug in automake?

>> +$(NULL)
>> +
>>  dist-hook: gen-ChangeLog gen-AUTHORS
>>  
>>  # Generate the ChangeLog file (with all entries since the switch to git)
>> diff --git a/git.mk b/git.mk
>> index 0b26b23..277e6e3 100644
>> --- a/git.mk
>> +++ b/git.mk
>> @@ -123,7 +123,7 @@ $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
>>  $(gsettings__enum_file) \
>>  ; do echo /$$x; done; \
>>  fi; \
>> -if test -f $(srcdir)/po/Makefile.in.in; then \
>> +if test -f $(top_srcdir)/po/Makefile.in.in; then \
> 
> Same interrogation as Fidencio here. Are you updating git.mk from
> 'upstream', or was it changed for a different reason?
> 

git.mk assumes that the po/ directory is located under src/, not in the
root directory, as it happens for virt-viewer. I ended up getting the
whole lot of untracked files under po/ after running 'make distcheck',
can you try it and see if it happens for you too?

>>  for x in \
>>  po/Makefile.in.in \
>>  po/Makefile.in \
>> diff --git a/m4/.gitignore b/m4/.gitignore
>> deleted file mode 100644
>> index e69de29..000
>> diff --git a/src/Makefile.am b/src/Makefile.am
>> index 1ebc24e..5ce08bc 100644
>> --- a/src/Makefile.am
>> +++ b/src/Makefile.am
>> @@ -218,4 +218,12 @@ debug_helper_LDFLAGS = $(GLIB2_LIBS) 
>> -Wl,--subsystem,windows
>>  debug_helper_CFLAGS = $(GLIB2_CFLAGS)
>>  endif
>>  
>> +GITIGNOREFILES =\
>> +view/.deps  \
>> +view/.dirstamp  \
>> +view/.libs  \
>> +view/*.lo   \
>> +view/*.o\
>> +$(NULL)
> 
> This hunk does not look correct, the whole point of git.mk is to avoid
> listing these explicitly. What happens here is that git.mk does not know
> it should recurse in view/ (I don't know if it's supposed to guess or
> not). One way around it was to add a Makefile.am in view/ only
> containing -include $(top_srcdir)/git.mk (+ the associated changes in
> configure.ac and src/Makefile.am). I don't know if there's a better way
> of handling this.
> 

Yes, I did not want to create an empty Makefile inside of view/ because
recursing takes a lot of time and adds up to build times. I also find it
strange that you need to run make first in order to generate the
.gitignore files, but I guess this is how it was designed to work in
first place.

In the end, I can live with either approach, just want to know which
should be.

-- 
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 v2 0/6] [virt-viewer] Some cosmetic fixes

2015-11-05 Thread Eduardo Lima (Etrunko)
Daniel,

On 11/05/2015 12:27 PM, Daniel P. Berrange wrote:
> On Wed, Nov 04, 2015 at 12:32:41PM -0200, Eduardo Lima (Etrunko) wrote:
>> Resend of my cleanup series, please take a look. In this new version,
>> I have found what was causing the errors running autogen.sh and updated
>> git.mk from upstream.
> 
> This series broke the build on older RHEL because the m4/ directory
> no longer exists in a clean checkout. The solution is to mkdir -p m4
> in autogen.sh.
> 
> It also fails 'make syntax-check' on all platforms - please ensure
> 'make sytnax-check' passes before pushing any code to git master.
> 
> I've pushed changes to fix both these build problems.
> 
> Regards,
> Daniel
> 

Thank you for the fixes. I was not aware of syntax-check, so I guess it
would be interesting to submit the git.mk changes to upstream author.

http://github.com/behdad/git.mk

Regards, Eduardo.

-- 
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 3/5] Update gitignore

2015-11-04 Thread Eduardo Lima (Etrunko)
On 11/03/2015 10:57 AM, Christophe Fergeau wrote:
> Hey,
> 
> On Tue, Nov 03, 2015 at 09:38:24AM -0200, Eduardo Lima (Etrunko) wrote:
>>
>> Yes, you can find those in the final Makefile, but test-driver is the
>> only one missing. Maybe a bug in automake?
> 
> Makefile.am has a MAINTAINERCLEANFILES variable with all these build-aux
> files listed except for test-driver, the bug would be there. Now that I
> experimented a bit more with this, all these build-aux files are covered
> by one of:
> 
>  MAINTAINERCLEANFILES = \
> +   $(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \
> +   $(GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN) \
> +   $(GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL)  \
> (sorry dunno which one ;)
>

Ah right, I have missed the declaration of files under build-aux/ above,
I will take a look on those variables to check which one should be used.

>>>
>>> Same interrogation as Fidencio here. Are you updating git.mk from
>>> 'upstream', or was it changed for a different reason?
>>>
>>
>> git.mk assumes that the po/ directory is located under src/, not in the
>> root directory, as it happens for virt-viewer. I ended up getting the
>> whole lot of untracked files under po/ after running 'make distcheck',
>> can you try it and see if it happens for you too?
> 
> I haven't been able to reproduce this.
>

I wonder if there is some package missing in my system that is causing
this kind of differences between my environment and both of yours.


> 
> Actually, updating git.mk to the latest version seems to fix this
> particular issue with no changes on virt-viewer side
> https://github.com/behdad/git.mk
> 


Ok, so I guess I will start by updating that file.


Regards, Eduardo.

-- 
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


[virt-tools-list] [PATCH 4/6] Update MAINTAINERCLEANFILES variables

2015-11-04 Thread Eduardo Lima (Etrunko)
Makefile.am: Use helper variables from git.mk
man/Makefile.am: This should be $(dist_man_MANS) instead of $(man_MANS)

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 Makefile.am | 18 +++---
 man/Makefile.am |  2 +-
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index d0e9ab4..769fa21 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,23 +29,11 @@ DISTCLEAN_FILES =   \
$(NULL)
 
 MAINTAINERCLEANFILES = \
+   $(srcdir)/AUTHORS   \
$(srcdir)/INSTALL   \
-   $(srcdir)/aclocal.m4\
-   $(srcdir)/autoscan.log  \
-   $(srcdir)/config.h.in   \
-   $(srcdir)/build-aux/compile \
-   $(srcdir)/build-aux/config.guess\
-   $(srcdir)/build-aux/config.sub  \
-   $(srcdir)/build-aux/depcomp \
-   $(srcdir)/build-aux/install-sh  \
-   $(srcdir)/build-aux/ltmain.sh   \
-   $(srcdir)/build-aux/missing \
+   $(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL)  \
+   $(GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL)\
$(srcdir)/m4/intltool.m4\
-   $(srcdir)/m4/libtool.m4 \
-   $(srcdir)/m4/ltoptions.m4   \
-   $(srcdir)/m4/ltsugar.m4 \
-   $(srcdir)/m4/ltversion.m4   \
-   $(srcdir)/m4/lt~obsolete.m4 \
$(NULL)
 
 dist-hook: gen-ChangeLog gen-AUTHORS
diff --git a/man/Makefile.am b/man/Makefile.am
index 6ee3116..39b6019 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -10,7 +10,7 @@ EXTRA_DIST =  \
virt-viewer.pod \
$(NULL)
 
-MAINTAINERCLEANFILES = $(man_MANS)
+MAINTAINERCLEANFILES = $(dist_man_MANS)
 
 %.1: %.pod
$(AM_V_GEN)pod2man -c "Virtualization Support" $< > $@
-- 
2.4.3

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


[virt-tools-list] [PATCH 3/6] Update git.mk from latest upstream version

2015-11-04 Thread Eduardo Lima (Etrunko)
Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 git.mk | 221 -
 1 file changed, 178 insertions(+), 43 deletions(-)

diff --git a/git.mk b/git.mk
index 0b26b23..bd39ae1 100644
--- a/git.mk
+++ b/git.mk
@@ -1,14 +1,19 @@
-# git.mk
+# git.mk, a small Makefile to autogenerate .gitignore files
+# for autotools-based projects.
 #
-# Copyright (C) 2009, Red Hat, Inc.
-# Copyright (C) 2010,2011 Behdad Esfahbod
+# Copyright 2009, Red Hat, Inc.
+# Copyright 2010,2011,2012,2013 Behdad Esfahbod
 # Written by Behdad Esfahbod
 #
 # Copying and distribution of this file, with or without modification,
 # is permitted in any medium without royalty provided the copyright
 # notice and this notice are preserved.
 #
-# The canonical source for this file is https://github.com/behdad/git.mk.
+# The latest version of this file can be downloaded from:
+GIT_MK_URL = https://raw.githubusercontent.com/behdad/git.mk/master/git.mk
+#
+# Bugs, etc, should be reported upstream at:
+#   https://github.com/behdad/git.mk
 #
 # To use in your project, import this file in your git repo's toplevel,
 # then do "make -f git.mk".  This modifies all Makefile.am files in
@@ -42,8 +47,15 @@
 # build dir.
 #
 # This file knows how to handle autoconf, automake, libtool, gtk-doc,
-# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu.
+# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu, appdata,
+# appstream.
+#
+# This makefile provides the following targets:
 #
+# - all: "make all" will build all gitignore files.
+# - gitignore: makes all gitignore files in the current dir and subdirs.
+# - .gitignore: make gitignore file for the current dir.
+# - gitignore-recurse: makes all gitignore files in the subdirs.
 #
 # KNOWN ISSUES:
 #
@@ -55,14 +67,74 @@
 #   example.
 #
 
+
+
+###
+# Variables user modules may want to add to toplevel MAINTAINERCLEANFILES:
+###
+
+#
+# Most autotools-using modules should be fine including this variable in their
+# toplevel MAINTAINERCLEANFILES:
+GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL = \
+   $(srcdir)/aclocal.m4 \
+   $(srcdir)/autoscan.log \
+   $(srcdir)/configure.scan \
+   `AUX_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 
'AC_CONFIG_AUX_DIR:$$1' ./configure.ac); \
+test "x$$AUX_DIR" = "x$(srcdir)/" && AUX_DIR=$(srcdir); \
+for x in \
+   ar-lib \
+   compile \
+   config.guess \
+   config.sub \
+   depcomp \
+   install-sh \
+   ltmain.sh \
+   missing \
+   mkinstalldirs \
+   test-driver \
+   ylwrap \
+; do echo "$$AUX_DIR/$$x"; done` \
+   `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_HEADERS:$$1' 
./configure.ac | \
+   head -n 1 | while read f; do echo "$(srcdir)/$$f.in"; done`
+#
+# All modules should also be fine including the following variable, which
+# removes automake-generated Makefile.in files:
+GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN = \
+   `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_FILES:$$1' 
./configure.ac | \
+   while read f; do \
+ case $$f in Makefile|*/Makefile) \
+   test -f "$(srcdir)/$$f.am" && echo "$(srcdir)/$$f.in";; esac; \
+   done`
+#
+# Modules that use libtool and use  AC_CONFIG_MACRO_DIR() may also include 
this,
+# though it's harmless to include regardless.
+GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL = \
+   `MACRO_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 
'AC_CONFIG_MACRO_DIR:$$1' ./configure.ac); \
+if test "x$$MACRO_DIR" != "x$(srcdir)/"; then \
+   for x in \
+   libtool.m4 \
+   ltoptions.m4 \
+   ltsugar.m4 \
+   ltversion.m4 \
+   lt~obsolete.m4 \
+   ; do echo "$$MACRO_DIR/$$x"; done; \
+fi`
+
+
+
+###
+# Default rule is to install ourselves in all Makefile.am files:
+###
+
 git-all: git-mk-install
 
 git-mk-install:
-   @echo Installing git makefile
+   @echo "Installing git makefile"
@any_failed=; \
find "`test -z "$(top_srcdir)" && echo . || echo 
"$(top_srcdir)"`" -name Makefile.am | while read x; do \
if grep 'include .*/git.mk' $$x >/dev/null; then \
-   echo $$x already includes git.mk; \
+   

[virt-tools-list] [PATCH 5/6] Move declaration to the beginning of the file

2015-11-04 Thread Eduardo Lima (Etrunko)
Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/virt-viewer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index ca264c8..dd8dbba 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -71,6 +71,7 @@ static gboolean virt_viewer_open_connection(VirtViewerApp 
*self, int *fd);
 static void virt_viewer_deactivated(VirtViewerApp *self, gboolean 
connect_error);
 static gboolean virt_viewer_start(VirtViewerApp *self, GError **error);
 static void virt_viewer_dispose (GObject *object);
+static int virt_viewer_connect(VirtViewerApp *app, GError **error);
 
 static void
 virt_viewer_get_property (GObject *object, guint property_id,
@@ -723,8 +724,6 @@ choose_vm(GtkWindow *main_window,
 return dom;
 }
 
-static int virt_viewer_connect(VirtViewerApp *app, GError **error);
-
 static gboolean
 virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
 {
-- 
2.4.3

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


[virt-tools-list] [PATCH 2/6] Call intltoolize after autoreconf

2015-11-04 Thread Eduardo Lima (Etrunko)
After removing m4/.gitignore file in previous patch, I started getting
the following error when running autogen.sh.

ln: failed to create symbolic link ‘m4/intltool.m4’: No such file or directory
cp: cannot create regular file ‘m4/intltool.m4’: No such file or directory
intltoolize: cannot copy '/usr/share/aclocal/intltool.m4' to 'm4/intltool.m4'

The problem is that intltoolize requires te m4/ directory to be present,
and this directory is actually created by running autoreconf, so it
should be called before intltoolize.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 autogen.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/autogen.sh b/autogen.sh
index b8d3c4d..a688ad4 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -27,8 +27,8 @@ fi
  # exists at all times :-(
 touch ChangeLog AUTHORS
 
-intltoolize --force
 autoreconf -vfi
+intltoolize --force
 
 cd $THEDIR
 
-- 
2.4.3

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

Re: [virt-tools-list] [PATCH 1/5] Call intltoolize after autoreconf

2015-11-04 Thread Eduardo Lima (Etrunko)
On 04/11/15 11:39, Fabiano Fidêncio wrote:
> On Tue, Nov 3, 2015 at 3:20 PM, Fabiano Fidêncio <fiden...@redhat.com> wrote:
>> On Tue, Nov 3, 2015 at 12:14 PM, Eduardo Lima (Etrunko)
>> <etru...@redhat.com> wrote:
>>> On 02/11/15 04:08, Fabiano Fidêncio wrote:
>>>> Hey!
>>>>
>>>> On Thu, Oct 29, 2015 at 9:40 PM, Eduardo Lima (Etrunko)
>>>> <etru...@redhat.com> wrote:
>>>>> After a calling 'git clean -d -x -f' I got this error:
>>>>>
>>>>> ln: failed to create symbolic link ‘m4/intltool.m4’: No such file or 
>>>>> directory
>>>>> cp: cannot create regular file ‘m4/intltool.m4’: No such file or directory
>>>>> intltoolize: cannot copy '/usr/share/aclocal/intltool.m4' to 
>>>>> 'm4/intltool.m4'
>>>>
>>>> I've never seen this error before and I am not able to reproduce it here.
>>>>
>>>
>>>
>>> Have you tried the git clean command? It removes the m4/ directory
>>> altogether. and intltoolize requires that m4/ directory to be present.
>>> This is what you get when you run autoreconf before it.
>>
>> This is what I got running git master: http://fpaste.org/286429/65603541/
>> As I said, I am not able to reproduce it at all.
> 
> Hmm. git clean -d -x -f doesn't remove m4 folder (which only contains
> an empty .gitignore file inside).

Yay, so I am not crazy after all. That .gitignore file is being tracked
by git. I'll be uploading a new version of the patchset soon.

Thanks, Eduardo.

-- 
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

[virt-tools-list] [PATCH v2 0/6] [virt-viewer] Some cosmetic fixes

2015-11-04 Thread Eduardo Lima (Etrunko)
Resend of my cleanup series, please take a look. In this new version,
I have found what was causing the errors running autogen.sh and updated
git.mk from upstream.

Eduardo Lima (Etrunko) (6):
  Remove m4/.gitignore file
  Call intltoolize after autoreconf
  Update git.mk from latest upstream version
  Update MAINTAINERCLEANFILES variables
  Move declaration to the beginning of the file
  Remove useless {get,set}_property functions

 Makefile.am   |  18 +
 autogen.sh|   2 +-
 git.mk| 221 +++---
 m4/.gitignore |   0
 man/Makefile.am   |   2 +-
 src/virt-viewer.c |  25 +-
 6 files changed, 184 insertions(+), 84 deletions(-)
 delete mode 100644 m4/.gitignore

-- 
2.4.3

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


[virt-tools-list] [PATCH 1/6] Remove m4/.gitignore file

2015-11-04 Thread Eduardo Lima (Etrunko)
All .gitignore files are handled by git.mk and should not be part of the
repository.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 m4/.gitignore | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 m4/.gitignore

diff --git a/m4/.gitignore b/m4/.gitignore
deleted file mode 100644
index e69de29..000
-- 
2.4.3

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


[virt-tools-list] [PATCH 4/4] Port to GtkApplicationWindow API's

2015-11-27 Thread Eduardo Lima (Etrunko)
As a follow up to the previous patch, this has lots of code shuffled
around to make it work with the new flow. Also, there is no need to have
a GtkWindow in virt-viewer.xml file anymore.

Because of that, you may get the following warning message:

Gtk-CRITICAL **: gtk_window_add_accel_group: assertion 'GTK_IS_WINDOW (window)' 
failed

This happens because GtkAccelGroup is defined in virt-viewer.xml, but
no GtkWindow to be associated with it anymore. The warning is harmless,
and can be ignored. This should go away by the moment we start using
GMenuModel for the menus instead of GtkMenuBar, in a following patch.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/virt-viewer-app.c|   1 -
 src/virt-viewer-window.c |  57 ---
 src/virt-viewer.xml  | 416 +++
 3 files changed, 234 insertions(+), 240 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index adabb27..cc8364c 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -931,7 +931,6 @@ virt_viewer_app_window_new(VirtViewerApp *self, gint nth)
 app_window_try_fullscreen(self, window, nth);
 
 w = virt_viewer_window_get_window(window);
-gtk_application_add_window(GTK_APPLICATION(self), w);
 g_signal_connect(w, "hide", G_CALLBACK(viewer_window_visible_cb), self);
 g_signal_connect(w, "show", G_CALLBACK(viewer_window_visible_cb), self);
 g_signal_connect(w, "focus-in-event", 
G_CALLBACK(viewer_window_focus_in_cb), self);
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 3a958f0..6b2a66e 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -219,11 +219,40 @@ rebuild_combo_menu(GObject*gobject G_GNUC_UNUSED,
 static void
 virt_viewer_window_constructed(GObject *object)
 {
-VirtViewerWindowPrivate *priv = VIRT_VIEWER_WINDOW(object)->priv;
+VirtViewerWindow *self = VIRT_VIEWER_WINDOW(object);
+VirtViewerWindowPrivate *priv = self->priv;
+GtkWidget *vbox;
+GdkColor color;
+GSList *accels;
 
 if (G_OBJECT_CLASS(virt_viewer_window_parent_class)->constructed)
 G_OBJECT_CLASS(virt_viewer_window_parent_class)->constructed(object);
 
+priv->window = gtk_application_window_new(GTK_APPLICATION(priv->app));
+g_signal_connect(priv->window, "delete-event",
+ G_CALLBACK(virt_viewer_window_delete), self);
+gtk_window_add_accel_group(GTK_WINDOW(priv->window), priv->accel_group);
+
+vbox = GTK_WIDGET(gtk_builder_get_object(priv->builder, "viewer-box"));
+gtk_container_add(GTK_CONTAINER(priv->window), vbox);
+virt_viewer_window_toolbar_setup(self);
+
+gtk_box_pack_end(GTK_BOX(vbox), priv->layout, TRUE, TRUE, 0);
+gdk_color_parse("black", );
+gtk_widget_modify_bg(priv->layout, GTK_STATE_NORMAL, );
+virt_viewer_window_update_title(self);
+gtk_window_set_resizable(GTK_WINDOW(priv->window), TRUE);
+gtk_window_set_has_resize_grip(GTK_WINDOW(priv->window), FALSE);
+priv->accel_enabled = TRUE;
+
+accels = gtk_accel_groups_from_object(G_OBJECT(priv->window));
+for ( ; accels ; accels = accels->next) {
+priv->accel_list = g_slist_append(priv->accel_list, accels->data);
+g_object_ref(G_OBJECT(accels->data));
+}
+
+priv->zoomlevel = NORMAL_ZOOM_LEVEL;
+
 g_signal_connect(priv->app, "notify::enable-accel",
  G_CALLBACK(rebuild_combo_menu), object);
 rebuild_combo_menu(NULL, NULL, object);
@@ -293,9 +322,6 @@ static void
 virt_viewer_window_init (VirtViewerWindow *self)
 {
 VirtViewerWindowPrivate *priv;
-GtkWidget *vbox;
-GdkColor color;
-GSList *accels;
 
 self->priv = GET_PRIVATE(self);
 priv = self->priv;
@@ -330,29 +356,6 @@ virt_viewer_window_init (VirtViewerWindow *self)
  "can-activate-accel", G_CALLBACK(can_activate_cb), self);
 g_signal_connect(gtk_builder_get_object(priv->builder, 
"menu-view-zoom-out"),
  "can-activate-accel", G_CALLBACK(can_activate_cb), self);
-
-vbox = GTK_WIDGET(gtk_builder_get_object(priv->builder, "viewer-box"));
-virt_viewer_window_toolbar_setup(self);
-
-gtk_box_pack_end(GTK_BOX(vbox), priv->layout, TRUE, TRUE, 0);
-gdk_color_parse("black", );
-gtk_widget_modify_bg(priv->layout, GTK_STATE_NORMAL, );
-
-priv->window = GTK_WIDGET(gtk_builder_get_object(priv->builder, "viewer"));
-gtk_window_add_accel_group(GTK_WINDOW(priv->window), priv->accel_group);
-
-virt_viewer_window_update_title(self);
-gtk_window_set_resizable(GTK_WINDOW(priv->window), TRUE);
-gtk_window_set_has_resize_grip(GTK_WINDOW(priv->window), FALSE);
-priv->accel_enabled = TRUE;
-
-accels = gtk_ac

[virt-tools-list] [PATCH 3/4] Port to GtkApplication API's

2015-11-27 Thread Eduardo Lima (Etrunko)
Most of this patch consists in code being shuffled around to fit the
expected flow while using the new APIs. I tried my best to make this
patch the less intrusive as possible. Main changes are:

- VirtViewerApp is now a subclass of GtkApplication

  Also, some mainloop calls were replaced, as follows:
   * gtk_main() -> g_application_run()
   * gtk_quit() -> g_application_quit()

- Unified command line option handling:
  The logic has moved from the main functions and split in three, the
  common options, and specific ones for each application. With this, the
  main functions were highly simplified, and now basically responsible
  for instantiating the App object and running the main loop.

- All Window objects must be associated with the Application, and with
  this, there is no need to emit our own 'window-added' signal, it will
  be done by GtkApplication by the time gtk_application_add_window() is
  called. The 'window-removed' signal has also been removed, as it was
  not being used anyway.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/remote-viewer-main.c | 122 +-
 src/remote-viewer.c  | 137 ++---
 src/remote-viewer.h  |   3 +-
 src/virt-viewer-app.c| 221 ++-
 src/virt-viewer-app.h|  12 ++-
 src/virt-viewer-main.c   | 102 +-
 src/virt-viewer.c| 105 +-
 src/virt-viewer.h|   8 +-
 8 files changed, 346 insertions(+), 364 deletions(-)

diff --git a/src/remote-viewer-main.c b/src/remote-viewer-main.c
index 81cf736..0329d16 100644
--- a/src/remote-viewer-main.c
+++ b/src/remote-viewer-main.c
@@ -30,32 +30,11 @@
 #include 
 #endif
 
-#ifdef HAVE_GTK_VNC
-#include 
-#endif
-#ifdef HAVE_SPICE_GTK
-#include 
-#endif
-#ifdef HAVE_OVIRT
-#include 
-#endif
-
 #include "remote-viewer.h"
 #include "virt-viewer-app.h"
 #include "virt-viewer-session.h"
 
 static void
-remote_viewer_version(void)
-{
-g_print(_("remote-viewer version %s"), VERSION BUILDID);
-#ifdef REMOTE_VIEWER_OS_ID
-g_print(" (OS ID: %s)", REMOTE_VIEWER_OS_ID);
-#endif
-g_print("\n");
-exit(EXIT_SUCCESS);
-}
-
-static void
 recent_add(gchar *uri, const gchar *mime_type)
 {
 GtkRecentManager *recent;
@@ -87,118 +66,23 @@ static void connected(VirtViewerSession *session,
 int
 main(int argc, char **argv)
 {
-GOptionContext *context;
-GError *error = NULL;
 int ret = 1;
-gchar **args = NULL;
-gchar *uri = NULL;
-char *title = NULL;
 RemoteViewer *viewer = NULL;
-#ifdef HAVE_SPICE_GTK
-gboolean controller = FALSE;
-#endif
 VirtViewerApp *app;
-const GOptionEntry options [] = {
-{ "version", 'V', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-  remote_viewer_version, N_("Display version information"), NULL },
-{ "title", 't', 0, G_OPTION_ARG_STRING, ,
-  N_("Set window title"), NULL },
-#ifdef HAVE_SPICE_GTK
-{ "spice-controller", '\0', 0, G_OPTION_ARG_NONE, ,
-  N_("Open connection using Spice controller communication"), NULL },
-#endif
-{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, ,
-  NULL, "URI|VV-FILE" },
-{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
-};
-GOptionGroup *app_options = NULL;
 
 virt_viewer_util_init(_("Remote Viewer"));
 
-/* Setup command line options */
-context = g_option_context_new (NULL);
-g_option_context_set_summary(context, _("Remote viewer client"));
-app_options = virt_viewer_app_get_option_group();
-g_option_group_add_entries (app_options, options);
-g_option_context_set_main_group (context, app_options);
-g_option_context_add_group (context, gtk_get_option_group (TRUE));
-#ifdef HAVE_GTK_VNC
-g_option_context_add_group (context, vnc_display_get_option_group ());
-#endif
-#ifdef HAVE_SPICE_GTK
-g_option_context_add_group (context, spice_get_option_group ());
-#endif
-#ifdef HAVE_OVIRT
-g_option_context_add_group (context, ovirt_get_option_group ());
-#endif
-g_option_context_parse (context, , , );
-if (error) {
-char *base_name;
-base_name = g_path_get_basename(argv[0]);
-g_printerr(_("%s\nRun '%s --help' to see a full list of available 
command line options\n"),
-   error->message, base_name);
-g_free(base_name);
-goto cleanup;
-}
-
-g_option_context_free(context);
-
-#ifdef HAVE_SPICE_GTK
-if (controller) {
-if (args) {
-g_printerr(_("Error: extra arguments given while using Spice 
controller\n"));
-goto cleanup;
-}
-} else
-#endif
-if (args) {
-if (g_strv_length(args) > 1) {
-g_printerr(_("Er

[virt-tools-list] [PATCH 1/4] Drop support to gtk2

2015-11-27 Thread Eduardo Lima (Etrunko)
From: Fabiano Fidêncio 

The 3.0 release was the last one that still supports GTK2. For the
Windows builds the support to GTK2 was dropped in the previous release.
Let's do the same for the entire project now.
---
 configure.ac  | 39 +++
 src/view/autoDrawer.c | 10 -
 src/view/ovBox.c  | 45 --
 src/virt-gtk-compat.h | 12 --
 src/virt-viewer-display.c | 96 ---
 src/virt-viewer-window.c  | 10 -
 virt-viewer.spec.in   | 23 
 7 files changed, 5 insertions(+), 230 deletions(-)

diff --git a/configure.ac b/configure.ac
index cf75f0e..54d39c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,9 +15,7 @@ AM_SILENT_RULES([yes])
 GLIB2_REQUIRED=2.22.0
 LIBXML2_REQUIRED="2.6.0"
 LIBVIRT_REQUIRED="0.10.0"
-GTK2_REQUIRED="2.18.0"
 GTK3_REQUIRED="3.0"
-GTK_VNC1_REQUIRED="0.3.8"
 GTK_VNC2_REQUIRED="0.4.0"
 SPICE_GTK_REQUIRED="0.29.35"
 SPICE_PROTOCOL_REQUIRED="0.12.7"
@@ -26,9 +24,7 @@ GOVIRT_REQUIRED="0.3.2"
 AC_SUBST([GLIB2_REQUIRED])
 AC_SUBST([LIBXML2_REQUIRED])
 AC_SUBST([LIBVIRT_REQUIRED])
-AC_SUBST([GTK2_REQUIRED])
 AC_SUBST([GTK3_REQUIRED])
-AC_SUBST([GTK_VNC1_REQUIRED])
 AC_SUBST([GTK_VNC2_REQUIRED])
 AC_SUBST([SPICE_GTK_REQUIRED])
 AC_SUBST([SPICE_PROTOCOL_REQUIRED])
@@ -121,36 +117,15 @@ AC_CHECK_LIB([virt],
  [AC_DEFINE([HAVE_VIR_DOMAIN_OPEN_GRAPHICS_FD], 1, [Have 
virDomainOpenGraphicsFD?])])
 LIBS=$old_LIBS
 
-AC_MSG_CHECKING([which gtk+ version to compile against])
-AC_ARG_WITH([gtk],
-  [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against 
(default: 3.0)])],
-  [case "$with_gtk" in
- 2.0|3.0) ;;
- *) AC_MSG_ERROR([invalid gtk version specified]) ;;
-   esac],
-  [with_gtk=3.0])
-AC_MSG_RESULT([$with_gtk])
-
-case "$with_gtk" in
-  2.0) GTK_API_VERSION=2.0
-   GTK_REQUIRED=$GTK2_REQUIRED
-   GTK_VNC_REQUIRED=$GTK_VNC1_REQUIRED
-   GTK_VNC_API_VERSION=1.0
-   SPICE_GTK_API_VERSION=2.0
-   ;;
-  3.0) GTK_API_VERSION=3.0
-   GTK_REQUIRED=$GTK3_REQUIRED
-   GTK_VNC_REQUIRED=$GTK_VNC2_REQUIRED
-   GTK_VNC_API_VERSION=2.0
-   SPICE_GTK_API_VERSION=3.0
-   ;;
-esac
+GTK_API_VERSION=3.0
+GTK_REQUIRED=$GTK3_REQUIRED
+GTK_VNC_REQUIRED=$GTK_VNC2_REQUIRED
+GTK_VNC_API_VERSION=2.0
+SPICE_GTK_API_VERSION=3.0
 
 AC_SUBST([GTK_API_VERSION])
 AC_SUBST([GTK_REQUIRED])
 AC_SUBST([GTK_VNC_API_VERSION])
-AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
-AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
 
 PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
 
@@ -275,10 +250,6 @@ AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Configuration summary])
 AC_MSG_NOTICE([=])
 AC_MSG_NOTICE([])
-AC_MSG_NOTICE([ Features:])
-AC_MSG_NOTICE([])
-AC_MSG_NOTICE([  Gtk: $with_gtk])
-AC_MSG_NOTICE([])
 AC_MSG_NOTICE([ Libraries:])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([   GLIB2: $GLIB2_CFLAGS $GLIB2_LIBS])
diff --git a/src/view/autoDrawer.c b/src/view/autoDrawer.c
index cbf92de..2ae106c 100644
--- a/src/view/autoDrawer.c
+++ b/src/view/autoDrawer.c
@@ -218,7 +218,6 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
if (gtk_widget_get_window(priv->evBox)) {
   int x;
   int y;
-#if GTK_CHECK_VERSION(3, 0, 0)
   GdkDevice *dev;
   GdkDeviceManager *devmgr;
 
@@ -227,9 +226,6 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
 
   gdk_window_get_device_position(gtk_widget_get_window(priv->evBox),
  dev, , , NULL);
-#else
-  gtk_widget_get_pointer(priv->evBox, , );
-#endif
 
   gtk_widget_get_allocation(priv->evBox, );
   g_assert(gtk_container_get_border_width(   GTK_CONTAINER(priv->evBox))
@@ -262,16 +258,10 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
if (!priv->inputUngrabbed) {
   GtkWidget *grabbed = NULL;
 
-#if GTK_CHECK_VERSION(3, 0, 0)
   if (gtk_window_has_group (window)) {
 GtkWindowGroup *group = gtk_window_get_group (window);
 grabbed = gtk_window_group_get_current_grab (group);
   }
-#else
-  if (window->group && window->group->grabs) {
-grabbed = GTK_WIDGET(window->group->grabs->data);
-  }
-#endif
   if (!grabbed) {
  grabbed = gtk_grab_get_current();
   }
diff --git a/src/view/ovBox.c b/src/view/ovBox.c
index 185b0b7..fa56fd5 100644
--- a/src/view/ovBox.c
+++ b/src/view/ovBox.c
@@ -76,13 +76,6 @@
 
 #include "ovBox.h"
 
-#if ! GTK_CHECK_VERSION(3, 0, 0)
-#define gtk_widget_set_realized(widget, val)\
-  GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED)
-#define gtk_widget_get_realized(widget)\
-  GTK_WIDGET_REALIZED(widget)
-#endif
-
 struct _ViewOvBoxPrivate
 {
GdkWindow *underWin;
@@ -338,22 +331,12 @@ static void
 ViewOvBoxSetBackground(ViewOvBox *that) // IN
 {
GtkWidget *widget = GTK_WIDGET(that);
-
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *stylecontext;
 
stylecontext = 

[virt-tools-list] [PATCH 2/4] Move variable declaration to the top of the function

2015-11-27 Thread Eduardo Lima (Etrunko)
Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/remote-viewer.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 8e4754f..3f530a3 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -617,10 +617,13 @@ spice_ctrl_listen_async_cb(GObject *object,
 static gboolean
 remote_viewer_activate(VirtViewerApp *app, GError **error)
 {
-g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
-RemoteViewer *self = REMOTE_VIEWER(app);
+RemoteViewer *self;
 gboolean ret = FALSE;
 
+g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
+
+self = REMOTE_VIEWER(app);
+
 if (self->priv->controller) {
 SpiceSession *session = remote_viewer_get_spice_session(self);
 ret = spice_session_connect(session);
-- 
2.5.0

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


[virt-tools-list] [PATCH virt-viewer 0/4] Port virt-viewer to GtkApplication APIs

2015-11-27 Thread Eduardo Lima (Etrunko)
The subject says it all, and you will find more details in each commit
message. Unfortunately I was not able to test some options on
remote-viewer, especially spice-controller and ovirt. I will be really
glad if someone can help with those.

Also, the work has been pushed to the gapplication branch in my github
repository, in case you are interested in trying it easier, without the
need to apply the patches on your tree.

http://github.com/etrunko/virt-viewer

Regards, Eduardo.

Eduardo Lima (Etrunko) (3):
  Move variable declaration to the top of the function
  Port to GtkApplication API's
  Port to GtkApplicationWindow API's

Fabiano Fidêncio (1):
  Drop support to gtk2

 configure.ac  |  39 +
 src/remote-viewer-main.c  | 122 +-
 src/remote-viewer.c   | 144 
 src/remote-viewer.h   |   3 +-
 src/view/autoDrawer.c |  10 --
 src/view/ovBox.c  |  45 -
 src/virt-gtk-compat.h |  12 --
 src/virt-viewer-app.c | 220 +++-
 src/virt-viewer-app.h |  12 +-
 src/virt-viewer-display.c |  96 ---
 src/virt-viewer-main.c| 102 +---
 src/virt-viewer-window.c  |  67 
 src/virt-viewer.c | 105 +---
 src/virt-viewer.h |   8 +-
 src/virt-viewer.xml   | 416 +++---
 virt-viewer.spec.in   |  23 ---
 16 files changed, 589 insertions(+), 835 deletions(-)

-- 
2.5.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 3/4] Port to GtkApplication API's

2015-12-07 Thread Eduardo Lima (Etrunko)
On 12/07/2015 10:43 AM, Eduardo Lima (Etrunko) wrote:
> On 12/02/2015 11:25 PM, Jim Fehlig wrote:
>> On 12/02/2015 04:15 AM, Daniel P. Berrange wrote:
>>> Yep, we need to agree which min platform we're targetting. It is nice
>>> to see RHEL7 rebasing GTK, as that makes life easier. We should not
>>> only consider RHEL though. It would be desirable if someone can provide
>>> a list of GTK versions in current SLES,
>>
>> SLES11: glib 2.22, gtk 2.18.9
>> SLES12: glib 2.38, gtk 3.10.9
>>
> 
> Hi Jim,
> 
> I am trying to build with those deps, but it seems to require earlier
> version of atk too, can you tell what is the version in SLES12?
> 

For ATK, I followed the requirements in gtk configure.ac file, which is
2.7.5. and managed to build everything locally.

I tried copying the code from Glib to the virt-viewer compat, but it
proved not to be possible. So we will need to wait for SLES to upgrade
to 2.40.

Even so, I have a small cleanup patch that can be applied and
modifications to this v1. I will post them to the ML and come back to it
when the time is appropriate.

Regards, Eduardo.

-- 
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 3/4] Port to GtkApplication API's

2015-12-03 Thread Eduardo Lima (Etrunko)
On 11/30/2015 07:29 PM, Jonathon Jongsma wrote:

>> - All Window objects must be associated with the Application, and with
>>   this, there is no need to emit our own 'window-added' signal, it will
>>   be done by GtkApplication by the time gtk_application_add_window() is
>>   called. The 'window-removed' signal has also been removed, as it was
>>   not being used anyway.
> 
> The 'window-removed' signal was not being used, but I suspect that the main
> reason it was removed was that it conflicts with a signal of the same name 
> from
> GtkApplication. Perhaps useful to note that here.

Yes, I will add it to the message.

> 
>> diff --git a/src/remote-viewer.c b/src/remote-viewer.c
>> index 3f530a3..7a1e870 100644
>> --- a/src/remote-viewer.c
>> +++ b/src/remote-viewer.c
>> @@ -36,11 +36,9 @@
>>  
>>  #ifdef HAVE_SPICE_GTK
>>  #include 
>> -#endif
>> -
>> -#ifdef HAVE_SPICE_GTK
>>  #include "virt-viewer-session-spice.h"
>>  #endif
>> +
> 
> 
> This hunk is fine, but not strictly necessary for porting to GtkApplication.
> Consider moving it to a separate cleanup patch?
> 

Noted, I can add it to a cleanup patch together with the next one.

>> @@ -195,10 +199,14 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>>  
>>  object_class->get_property = remote_viewer_get_property;
>>  object_class->set_property = remote_viewer_set_property;
>> +object_class->dispose = remote_viewer_dispose;
>>  
>>  app_class->start = remote_viewer_start;
>>  app_class->deactivated = remote_viewer_deactivated;
>> -object_class->dispose = remote_viewer_dispose;
> 
> This move could also possibly be moved to a cleanup patch, I suppose. Not sure
> it's worth it though...

I will add it together with previous hunk.

>>  #ifdef HAVE_SPICE_GTK
>>  app_class->activate = remote_viewer_activate;
>>  app_class->window_added = remote_viewer_window_added;
>> @@ -210,7 +218,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>>  "Spice controller",
>> 
>>  SPICE_CTRL_TYPE_CONTROLLER,
>>  G_PARAM_READWRITE |
>> -   
>>  G_PARAM_CONSTRUCT_ONLY |
>> 
>>  G_PARAM_STATIC_STRINGS));
>>  g_object_class_install_property(object_class,
>>  PROP_CTRL_FOREIGN_MENU,
>> @@ -219,7 +226,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>>  "Spice foreign 
>> menu",
>> 
>>  SPICE_CTRL_TYPE_FOREIGN_MENU,
>>  G_PARAM_READWRITE |
>> -   
>>  G_PARAM_CONSTRUCT_ONLY |
>> 
>>  G_PARAM_STATIC_STRINGS));
>>  #endif
>>  g_object_class_install_property(object_class,
>> @@ -229,7 +235,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>>   "Open recent
>> dialog",
>>   FALSE,
>>   G_PARAM_READWRITE |
>> -
>>  G_PARAM_CONSTRUCT_ONLY |
>>  
>>  G_PARAM_STATIC_STRINGS));
>>  }
> 
> 
> I understand why these properties are no longer construct-only, however I 
> wonder
> if we want to add a warning if we try to set these properties after starting 
> the
> application. We can now technically change these properties after 
> construction,
> but we only use these values within remote_viewer_start(). So any property
> changes that are made after calling remote_viewer_start() will not have any
> effect. Do we care?

I think it is fine the way it is, there is a restriction in set property
that only allows those properties being set for the first time.

>>  
>> @@ -240,11 +245,11 @@ remote_viewer_init(RemoteViewer *self)
>>  }
>>  
>>  RemoteViewer *
>> -remote_viewer_new(const gchar *uri)
>> +remote_viewer_new(void)
>>  {
>>  return g_object_new(REMOTE_VIEWER_TYPE,
>> -"guri", uri,
>> -"open-recent-dialog", uri == NULL,
>> +"application-id", "org.fedorahosted.remote-viewer",
> 
> should we use "org.spice-space.remote-viewer" instead? or "org.virt
> -manager.remote-viewer" (since virt-manager.org is where the releases are
> hosted)?
> 

Ok, simple to change, I was wondering which one to use, and ended up
with this one because of where the repository is hosted. I tend to like
"org.virt-manager" prefix rather than "org.spice-space", but I'm okay
with any of those.

>>  
>> +static const gchar*

Re: [virt-tools-list] [PATCH 3/4] Port to GtkApplication API's

2015-12-03 Thread Eduardo Lima (Etrunko)
On 12/02/2015 09:21 AM, Christophe Fergeau wrote:
> On Mon, Nov 30, 2015 at 03:29:37PM -0600, Jonathon Jongsma wrote:
>>> +app_class->add_main_options = remote_viewer_add_main_options;
>>> +app_class->handle_options = remote_viewer_handle_options;
>>> +app_class->version_string = remote_viewer_version_string;
>>> +
>>>  #ifdef HAVE_SPICE_GTK
>>>  app_class->activate = remote_viewer_activate;
>>>  app_class->window_added = remote_viewer_window_added;
>>> @@ -210,7 +218,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>>>  "Spice controller",
>>> 
>>>  SPICE_CTRL_TYPE_CONTROLLER,
>>>  G_PARAM_READWRITE |
>>> -   
>>>  G_PARAM_CONSTRUCT_ONLY |
>>> 
>>>  G_PARAM_STATIC_STRINGS));
>>>  g_object_class_install_property(object_class,
>>>  PROP_CTRL_FOREIGN_MENU,
>>> @@ -219,7 +226,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>>>  "Spice foreign 
>>> menu",
>>> 
>>>  SPICE_CTRL_TYPE_FOREIGN_MENU,
>>>  G_PARAM_READWRITE |
>>> -   
>>>  G_PARAM_CONSTRUCT_ONLY |
>>> 
>>>  G_PARAM_STATIC_STRINGS));
>>>  #endif
>>>  g_object_class_install_property(object_class,
>>> @@ -229,7 +235,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>>>   "Open recent
>>> dialog",
>>>   FALSE,
>>>   G_PARAM_READWRITE 
>>> |
>>> -
>>>  G_PARAM_CONSTRUCT_ONLY |
>>>  
>>>  G_PARAM_STATIC_STRINGS));
>>>  }
>>
>>
>> I understand why these properties are no longer construct-only, however I 
>> wonder
>> if we want to add a warning if we try to set these properties after starting 
>> the
>> application. We can now technically change these properties after 
>> construction,
>> but we only use these values within remote_viewer_start(). So any property
>> changes that are made after calling remote_viewer_start() will not have any
>> effect. Do we care?
> 
> I think these properties could be either removed or made read-only as we
> now set them from inside the class if I'm not mistaken.

Good idea. I will take a look at it.

>>
>>
>> Right now you have a virtual function the base class (handle_local_options())
>> that does some work and then calls a different virtual function
>> (handle_options()) that is implemented in each subclass (but not in the 
>> parent
>> class). I think it might be cleaner to just get rid of the separate
>> handle_options() vfunc and implement handle_local_options() in each of the
>> subclasses. Then it could chain up and call the parent vfunc to do the common
>> work in the parent class. 
> 
> Agreed, these vfunc could hopefully be improved.

As I answered in my previous email, I had a bit different flow in my
mind, but I can rework the logic to use the existing vfuncs.

> 
>>
>> But a bigger issue is that I think that handle_local_options() is not really 
>> the
>> function we're generally expected to use here. handle_local_options() is 
>> passed
>> a GVariantDict of options, which means that you have to inspect and handle 
>> them
>> all manually rather than letting the GOptionContext stuff do the work for 
>> you.
> 
> My understanding is that this is optional. If GOptionEntry::arg_data is
> NULL, then the argument will appear in the GVariantDict. If it's not
> NULL, then the GOptionEntry::arg_data will be used.
> 
>> That means that if we want to add or remove options, we update the list of
>> GOptionEntry objects and also update the handle_local_options function to 
>> handle
>> that new option. This adds maintenance burden and makes it more likely 
>> they'll
>> get out of sync.
> 
> Kind of. If you add a new option, you would add whatever variable you
> need to set in your GOptionEntry, then you'd have to do something with
> this variable in your code. That code would now go in
> handle_local_options() rather than in an arbitary place. If you want to
> avoid having to look at the GVariantDict to get the option value, you
> can.
> 
>> If we instead handled the command_line() vfunc, we could take
>> advantage of GOptionContext parsing instead of manually inspecting the
>> GVariantDict. See 
>> https://git.gnome.org/browse/glib/tree/gio/tests/gapplication-example-cmdline3.c
>>  for an example of using 

Re: [virt-tools-list] [PATCH 3/4] Port to GtkApplication API's

2015-12-03 Thread Eduardo Lima (Etrunko)
On 12/02/2015 09:09 AM, Christophe Fergeau wrote:
> Hey,
> 
> On Fri, Nov 27, 2015 at 05:24:00PM -0200, Eduardo Lima (Etrunko) wrote:
>> Most of this patch consists in code being shuffled around to fit the
>> expected flow while using the new APIs. I tried my best to make this
>> patch the less intrusive as possible. Main changes are:
>>
>> - VirtViewerApp is now a subclass of GtkApplication
>>
>>   Also, some mainloop calls were replaced, as follows:
>>* gtk_main() -> g_application_run()
>>* gtk_quit() -> g_application_quit()
>>
>> - Unified command line option handling:
>>   The logic has moved from the main functions and split in three, the
>>   common options, and specific ones for each application. With this, the
>>   main functions were highly simplified, and now basically responsible
>>   for instantiating the App object and running the main loop.
>>
>> - All Window objects must be associated with the Application, and with
>>   this, there is no need to emit our own 'window-added' signal, it will
>>   be done by GtkApplication by the time gtk_application_add_window() is
>>   called. The 'window-removed' signal has also been removed, as it was
>>   not being used anyway.
> 
> GApplication was added in glib 2.28, but some of the API you are using (
> g_application_add_option_group ) was added as recently as glib 2.40.
> configure.ac needs to be updated to reflect this, or some alternatives
> need to be considered if the glib 2.40 is too new (el7.0 had a too old
> glib, el7.1 is fine, fedora 21 and newer are fine too).

Ok, I will update configure.ac too

> 
> If you start remote-viewer once, and then launch a second instance to
> connect to the same URL, then the first instance stays alive rather than
> dying. Similarly, attempting to connect to an IP/port where no SPICE
> instance is listening shows an error message, but does not exit
> remote-viewer nor show the URI selection dialog.
> 

Thanks for the use case, I will test it here.

>> @@ -195,10 +199,14 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>>  
>>  object_class->get_property = remote_viewer_get_property;
>>  object_class->set_property = remote_viewer_set_property;
>> +object_class->dispose = remote_viewer_dispose;
>>  
>>  app_class->start = remote_viewer_start;
>>  app_class->deactivated = remote_viewer_deactivated;
>> -object_class->dispose = remote_viewer_dispose;
>> +app_class->add_main_options = remote_viewer_add_main_options;
> 
> Do we really need this add_main_options vfunc? Could this be done in
> (eg) constructed instead?

I think it could be done with constructed, yes. I just need to check the
possibility.

>> +static gint
>> +remote_viewer_handle_options(VirtViewerApp *app, GVariantDict *options)
>> +{
>> +gint ret = -1;
>> +gchar *title = NULL;
>> +gchar **args = NULL;
>> +gboolean controller = FALSE;
>> +
>> +if (g_variant_dict_lookup(options, G_OPTION_REMAINING, "^as", )) {
>> +if (args && (g_strv_length(args) != 1)) {
>> +g_printerr(_("Error: can't handle multiple URIs\n"));
>> +ret = 0;
>> +goto end;
>> +}
>> +
>> +g_object_set(app, "guri", args[0], NULL);
>> +}
>> +
>> +g_variant_dict_lookup(options, OPT_TITLE, "s", );
> 
> I believe this could be "", which would allow you to avoid the g_free
> in end: (I know you told me on IRC this did not work as expected, but I
> tested it and it works locally, so there is potentially more digging to
> do).

Ok, I will double check it.

> 
>> +
>> +#ifdef HAVE_SPICE_GTK
>> +if (g_variant_dict_lookup(options, OPT_CONTROLLER, "b", )) {
>> +if (args) {
>> +g_printerr(_("Error: extra arguments given while using Spice 
>> controller\n\n"));
>> +ret = 0;
>> +goto end;
>> +} else {
>> +RemoteViewer *self = REMOTE_VIEWER(app);
>> +SpiceCtrlController *ctrl = spice_ctrl_controller_new();
>> +SpiceCtrlForeignMenu *menu = spice_ctrl_foreign_menu_new();
>> +
>> +g_object_set(self, "guest-name", "defined by Spice controller",
>> +   "controller", ctrl,
>> +   "foreign-menu", menu,
>> +   NULL);
>> +
>> +g_signal_connect(menu, "noti

Re: [virt-tools-list] [PATCH 4/4] Port to GtkApplicationWindow API's

2015-12-03 Thread Eduardo Lima (Etrunko)
On 12/01/2015 03:17 PM, Jonathon Jongsma wrote:
> Hmm, I don't quite understand most of these changes. 
> 
> Why are you removing the window from the xml file instead of just changing the
> 'class' attribute to GtkApplicationWindow? (Of course, we can't set the
> 'application' property of the window inside of the builder file, so we still
> have to set that by continuing to call gtk_application_add_window() or setting
> the GtkWindow::application property on the retrieved window object). 

GtkBuilder will not accept GtkApplicationWindow, so I think it is
supposed to be manually created.

> 
> Also, I don't quite understand why the code had to be moved from _init to
> _constructed. Can you expand on that?
> 

Sure, the problem is that in _init we still don't have the 'app' pointer
properly set, while on _constructed it is.

-- 
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 3/4] Port to GtkApplication API's

2015-12-07 Thread Eduardo Lima (Etrunko)
On 12/02/2015 11:25 PM, Jim Fehlig wrote:
> On 12/02/2015 04:15 AM, Daniel P. Berrange wrote:
>> Yep, we need to agree which min platform we're targetting. It is nice
>> to see RHEL7 rebasing GTK, as that makes life easier. We should not
>> only consider RHEL though. It would be desirable if someone can provide
>> a list of GTK versions in current SLES,
> 
> SLES11: glib 2.22, gtk 2.18.9
> SLES12: glib 2.38, gtk 3.10.9
> 

Hi Jim,

I am trying to build with those deps, but it seems to require earlier
version of atk too, can you tell what is the version in SLES12?

Thank you, Eduardo

-- 
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


[virt-tools-list] [PATCH 2/7] Minor code cleanups

2015-12-11 Thread Eduardo Lima (Etrunko)
- Reuse #ifdef HAVE_SPICE_GTK block for include.
- Move declaration of vfunc together with others of the same class.
- Move variable declaration to the top of the function.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/remote-viewer.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 8e4754f..e712d61 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -36,11 +36,9 @@
 
 #ifdef HAVE_SPICE_GTK
 #include 
-#endif
-
-#ifdef HAVE_SPICE_GTK
 #include "virt-viewer-session-spice.h"
 #endif
+
 #include "virt-viewer-app.h"
 #include "virt-viewer-auth.h"
 #include "virt-viewer-file.h"
@@ -195,10 +193,10 @@ remote_viewer_class_init (RemoteViewerClass *klass)
 
 object_class->get_property = remote_viewer_get_property;
 object_class->set_property = remote_viewer_set_property;
+object_class->dispose = remote_viewer_dispose;
 
 app_class->start = remote_viewer_start;
 app_class->deactivated = remote_viewer_deactivated;
-object_class->dispose = remote_viewer_dispose;
 #ifdef HAVE_SPICE_GTK
 app_class->activate = remote_viewer_activate;
 app_class->window_added = remote_viewer_window_added;
@@ -617,10 +615,13 @@ spice_ctrl_listen_async_cb(GObject *object,
 static gboolean
 remote_viewer_activate(VirtViewerApp *app, GError **error)
 {
-g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
-RemoteViewer *self = REMOTE_VIEWER(app);
+RemoteViewer *self;
 gboolean ret = FALSE;
 
+g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
+
+self = REMOTE_VIEWER(app);
+
 if (self->priv->controller) {
 SpiceSession *session = remote_viewer_get_spice_session(self);
 ret = spice_session_connect(session);
-- 
2.5.0

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


[virt-tools-list] [PATCH 5/7] Backport GVariantDict code from glib 2.40

2015-12-11 Thread Eduardo Lima (Etrunko)
Same case as last GApplication patch, but kept split for easier understanding.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/virt-glib-compat.c | 204 +
 src/virt-glib-compat.h |  32 
 2 files changed, 236 insertions(+)

diff --git a/src/virt-glib-compat.c b/src/virt-glib-compat.c
index 4748993..a61a3a6 100644
--- a/src/virt-glib-compat.c
+++ b/src/virt-glib-compat.c
@@ -399,4 +399,208 @@ g_application_real_local_command_line (GApplication   
*application,
 
   return TRUE;
 }
+
+struct stack_dict
+{
+  GHashTable *values;
+  gsize magic;
+};
+
+G_STATIC_ASSERT (sizeof (struct stack_dict) <= sizeof (GVariantDict));
+
+struct heap_dict
+{
+  struct stack_dict dict;
+  gint ref_count;
+  gsize magic;
+};
+
+#define GVSD(d) ((struct stack_dict *) (d))
+#define GVHD(d) ((struct heap_dict *) (d))
+#define GVSD_MAGIC  ((gsize) 2579507750u)
+#define GVHD_MAGIC  ((gsize) 2450270775u)
+#define is_valid_dict(d)(d != NULL && \
+ GVSD(d)->magic == GVSD_MAGIC)
+#define is_valid_heap_dict(d)   (GVHD(d)->magic == GVHD_MAGIC)
+
+GVariantDict *
+g_variant_dict_new (GVariant *from_asv)
+{
+  GVariantDict *dict;
+
+  dict = g_slice_alloc (sizeof (struct heap_dict));
+  g_variant_dict_init (dict, from_asv);
+  GVHD(dict)->magic = GVHD_MAGIC;
+  GVHD(dict)->ref_count = 1;
+
+  return dict;
+}
+
+void
+g_variant_dict_init (GVariantDict *dict,
+ GVariant *from_asv)
+{
+  GVariantIter iter;
+  gchar *key;
+  GVariant *value;
+
+  GVSD(dict)->values = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, 
(GDestroyNotify) g_variant_unref);
+  GVSD(dict)->magic = GVSD_MAGIC;
+
+  if (from_asv)
+{
+  g_variant_iter_init (, from_asv);
+  while (g_variant_iter_next (, "{sv}", , ))
+g_hash_table_insert (GVSD(dict)->values, key, value);
+}
+}
+
+gboolean
+g_variant_dict_lookup (GVariantDict *dict,
+   const gchar  *key,
+   const gchar  *format_string,
+   ...)
+{
+  GVariant *value;
+  va_list ap;
+
+  g_return_val_if_fail (is_valid_dict (dict), FALSE);
+  g_return_val_if_fail (key != NULL, FALSE);
+  g_return_val_if_fail (format_string != NULL, FALSE);
+
+  value = g_hash_table_lookup (GVSD(dict)->values, key);
+
+  if (value == NULL || !g_variant_check_format_string (value, format_string, 
FALSE))
+return FALSE;
+
+  va_start (ap, format_string);
+  g_variant_get_va (value, format_string, NULL, );
+  va_end (ap);
+
+  return TRUE;
+}
+
+GVariant *
+g_variant_dict_lookup_value (GVariantDict   *dict,
+ const gchar*key,
+ const GVariantType *expected_type)
+{
+  GVariant *result;
+
+  g_return_val_if_fail (is_valid_dict (dict), NULL);
+  g_return_val_if_fail (key != NULL, NULL);
+
+  result = g_hash_table_lookup (GVSD(dict)->values, key);
+
+  if (result && (!expected_type || g_variant_is_of_type (result, 
expected_type)))
+return g_variant_ref (result);
+
+  return NULL;
+}
+
+gboolean
+g_variant_dict_contains (GVariantDict *dict,
+ const gchar  *key)
+{
+  g_return_val_if_fail (is_valid_dict (dict), FALSE);
+  g_return_val_if_fail (key != NULL, FALSE);
+
+  return g_hash_table_contains (GVSD(dict)->values, key);
+}
+
+void
+g_variant_dict_insert (GVariantDict *dict,
+   const gchar  *key,
+   const gchar  *format_string,
+   ...)
+{
+  va_list ap;
+
+  g_return_if_fail (is_valid_dict (dict));
+  g_return_if_fail (key != NULL);
+  g_return_if_fail (format_string != NULL);
+
+  va_start (ap, format_string);
+  g_variant_dict_insert_value (dict, key, g_variant_new_va (format_string, 
NULL, ));
+  va_end (ap);
+}
+
+void
+g_variant_dict_insert_value (GVariantDict *dict,
+ const gchar  *key,
+ GVariant *value)
+{
+  g_return_if_fail (is_valid_dict (dict));
+  g_return_if_fail (key != NULL);
+  g_return_if_fail (value != NULL);
+
+  g_hash_table_insert (GVSD(dict)->values, g_strdup (key), g_variant_ref_sink 
(value));
+}
+
+gboolean
+g_variant_dict_remove (GVariantDict *dict,
+   const gchar  *key)
+{
+  g_return_val_if_fail (is_valid_dict (dict), FALSE);
+  g_return_val_if_fail (key != NULL, FALSE);
+
+  return g_hash_table_remove (GVSD(dict)->values, key);
+}
+
+void
+g_variant_dict_clear (GVariantDict *dict)
+{
+  if (GVSD(dict)->magic == 0)
+/* all-zeros case */
+return;
+
+  g_return_if_fail (is_valid_dict (dict));
+
+  g_hash_table_unref (GVSD(dict)->values);
+  GVSD(dict)->values = NULL;
+
+  GVSD(dict)->magic = 0;
+}
+
+GVariant *
+g_variant_dict_end (GVariantDict *dict)
+{
+  GVariantBuilder builder;
+  GHashTableIter 

[virt-tools-list] [PATCH 6/7] Adapt glib code to build out of the tree

2015-12-11 Thread Eduardo Lima (Etrunko)
Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/virt-glib-compat.c | 97 +++---
 1 file changed, 68 insertions(+), 29 deletions(-)

diff --git a/src/virt-glib-compat.c b/src/virt-glib-compat.c
index a61a3a6..0118e45 100644
--- a/src/virt-glib-compat.c
+++ b/src/virt-glib-compat.c
@@ -34,6 +34,33 @@ GByteArray *g_byte_array_new_take (guint8 *data, gsize len)
 #endif
 
 #ifndef GLIB_VERSION_2_40
+#include 
+#include 
+
+typedef struct _GApplicationOptionsPrivate GApplicationOptionsPrivate;
+struct _GApplicationOptionsPrivate
+{
+  GApplicationFlags   flags;
+  GOptionGroup   *main_options;
+  GSList *option_groups;
+  GHashTable *packed_options;
+  gbooleanoptions_parsed;
+};
+
+static GApplicationOptionsPrivate *
+get_options_private(GApplication *application)
+{
+GApplicationOptionsPrivate *priv = 
g_object_get_data(G_OBJECT(application), "options_private");
+
+if (priv == NULL) {
+priv = g_new0(GApplicationOptionsPrivate, 1);
+priv->flags = g_application_get_flags(application);
+g_object_set_data_full(G_OBJECT(application), "options_private", priv, 
g_free);
+}
+
+return priv;
+}
+
 static void
 free_option_entry (gpointer data)
 {
@@ -68,8 +95,9 @@ g_application_pack_option_entries (GApplication *application,
 {
   GHashTableIter iter;
   gpointer item;
+  GApplicationOptionsPrivate *priv = get_options_private(application);
 
-  g_hash_table_iter_init (, application->priv->packed_options);
+  g_hash_table_iter_init (, priv->packed_options);
   while (g_hash_table_iter_next (, NULL, ))
 {
   GOptionEntry *entry = item;
@@ -134,6 +162,7 @@ g_application_parse_command_line (GApplication   
*application,
   gboolean become_service = FALSE;
   GVariantDict *dict = NULL;
   GOptionContext *context;
+  GApplicationOptionsPrivate *priv = get_options_private(application);
 
   /* Due to the memory management of GOptionGroup we can only parse
* options once.  That's because once you add a group to the
@@ -141,7 +170,7 @@ g_application_parse_command_line (GApplication   
*application,
* local_command_line() should never get invoked more than once
* anyway.  Add a sanity check just to be sure.
*/
-  g_return_val_if_fail (!application->priv->options_parsed, NULL);
+  g_return_val_if_fail (!priv->options_parsed, NULL);
 
   context = g_option_context_new (NULL);
 
@@ -153,40 +182,40 @@ g_application_parse_command_line (GApplication   
*application,
* We must also ignore --help in this case since some applications
* will try to handle this from the remote side.  See #737869.
*/
-  if (application->priv->main_options == NULL && (application->priv->flags & 
G_APPLICATION_HANDLES_COMMAND_LINE))
+  if (priv->main_options == NULL && (priv->flags & 
G_APPLICATION_HANDLES_COMMAND_LINE))
 {
   g_option_context_set_ignore_unknown_options (context, TRUE);
   g_option_context_set_help_enabled (context, FALSE);
 }
 
   /* Add the main option group, if it exists */
-  if (application->priv->main_options)
+  if (priv->main_options)
 {
   /* This consumes the main_options */
-  g_option_context_set_main_group (context, 
application->priv->main_options);
-  application->priv->main_options = NULL;
+  g_option_context_set_main_group (context, priv->main_options);
+  priv->main_options = NULL;
 }
 
   /* Add any other option groups if they exist.  Adding them to the
* context will consume them, so we free the list as we go...
*/
-  while (application->priv->option_groups)
+  while (priv->option_groups)
 {
-  g_option_context_add_group (context, 
application->priv->option_groups->data);
-  application->priv->option_groups = g_slist_delete_link 
(application->priv->option_groups,
-  
application->priv->option_groups);
+  g_option_context_add_group (context, priv->option_groups->data);
+  priv->option_groups = g_slist_delete_link (priv->option_groups,
+ priv->option_groups);
 }
 
   /* In the case that we are not explicitly marked as a service or a
* launcher then we want to add the "--gapplication-service" option to
* allow the process to be made into a service.
*/
-  if ((application->priv->flags & (G_APPLICATION_IS_SERVICE | 
G_APPLICATION_IS_LAUNCHER)) == 0)
+  if ((priv->flags & (G_APPLICATION_IS_SERVICE | G_APPLICATION_IS_LAUNCHER)) 
== 0)
 {
   GOptionGroup *option_group;
   GOptionEntry entries[] = {
 { "gapplication-service", '\0', 0, G_OPTION_ARG_NONE, _service,
-  N_("Enter GApplication service mode (use from D-Bus service files)&

[virt-tools-list] [PATCH 3/7] Port to GtkApplication API's

2015-12-11 Thread Eduardo Lima (Etrunko)
Most of this patch consists in code being shuffled around to fit the
expected flow while using the new APIs. I tried my best to make this
patch the less intrusive as possible. Main changes are:

- Update glib requirements to 2.40.0 and adds gio as build dependency.

- VirtViewerApp is now a subclass of GtkApplication.
  Some mainloop calls were replaced:
   * gtk_main() -> g_application_run()
   * gtk_quit() -> g_application_quit()

- Unified command line option handling.
  The logic has moved from the main functions and split in three, the
  common options, and specific ones for each application. With this, the
  main functions were highly simplified, and now basically responsible
  for instantiating the App object and running the main loop.

- All Window objects must be associated with the Application.
  With this, there is no need to emit our own 'window-added'/'window-
  removed' signals, as those will be emited by GtkApplication whenever
  gtk_application_add_window() and gtk_application_remove_window() are
  called. Also, 'window-removed' was not being used anywhere.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 configure.ac |   4 +-
 src/remote-viewer-main.c | 122 +-
 src/remote-viewer.c  | 152 +---
 src/remote-viewer.h  |   3 +-
 src/virt-viewer-app.c| 223 +++
 src/virt-viewer-app.h|  10 +--
 src/virt-viewer-main.c   | 102 +-
 src/virt-viewer.c| 117 -
 src/virt-viewer.h|   8 +-
 src/virt-viewer.xml  |   2 +-
 10 files changed, 355 insertions(+), 388 deletions(-)

diff --git a/configure.ac b/configure.ac
index 250a7fe..bd9524e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,7 +12,7 @@ AC_CANONICAL_HOST
 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
 AM_SILENT_RULES([yes])
 
-GLIB2_REQUIRED=2.22.0
+GLIB2_REQUIRED="2.40.0"
 LIBXML2_REQUIRED="2.6.0"
 LIBVIRT_REQUIRED="0.10.0"
 GTK3_REQUIRED="3.0"
@@ -93,7 +93,7 @@ PKG_PROG_PKG_CONFIG
 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
 AC_SUBST(GLIB_MKENUMS)
 
-PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQUIRED gthread-2.0 
gmodule-export-2.0)
+PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQUIRED gio-2.0 gthread-2.0 
gmodule-export-2.0)
 PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED)
 
 AC_ARG_WITH([libvirt],
diff --git a/src/remote-viewer-main.c b/src/remote-viewer-main.c
index 6ac2523..0329d16 100644
--- a/src/remote-viewer-main.c
+++ b/src/remote-viewer-main.c
@@ -30,32 +30,11 @@
 #include 
 #endif
 
-#ifdef HAVE_GTK_VNC
-#include 
-#endif
-#ifdef HAVE_SPICE_GTK
-#include 
-#endif
-#ifdef HAVE_OVIRT
-#include 
-#endif
-
 #include "remote-viewer.h"
 #include "virt-viewer-app.h"
 #include "virt-viewer-session.h"
 
 static void
-remote_viewer_version(void)
-{
-g_print(_("remote-viewer version %s"), VERSION BUILDID);
-#ifdef REMOTE_VIEWER_OS_ID
-g_print(" (OS ID: %s)", REMOTE_VIEWER_OS_ID);
-#endif
-g_print("\n");
-exit(EXIT_SUCCESS);
-}
-
-static void
 recent_add(gchar *uri, const gchar *mime_type)
 {
 GtkRecentManager *recent;
@@ -87,118 +66,23 @@ static void connected(VirtViewerSession *session,
 int
 main(int argc, char **argv)
 {
-GOptionContext *context;
-GError *error = NULL;
 int ret = 1;
-gchar **args = NULL;
-gchar *uri = NULL;
-char *title = NULL;
 RemoteViewer *viewer = NULL;
-#ifdef HAVE_SPICE_GTK
-gboolean controller = FALSE;
-#endif
 VirtViewerApp *app;
-const GOptionEntry options [] = {
-{ "version", 'V', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-  remote_viewer_version, N_("Display version information"), NULL },
-{ "title", 't', 0, G_OPTION_ARG_STRING, ,
-  N_("Set window title"), NULL },
-#ifdef HAVE_SPICE_GTK
-{ "spice-controller", '\0', 0, G_OPTION_ARG_NONE, ,
-  N_("Open connection using Spice controller communication"), NULL },
-#endif
-{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, ,
-  NULL, "URI|VV-FILE" },
-{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
-};
-GOptionGroup *app_options = NULL;
 
 virt_viewer_util_init(_("Remote Viewer"));
 
-/* Setup command line options */
-context = g_option_context_new (NULL);
-g_option_context_set_summary(context, _("Remote viewer client"));
-app_options = virt_viewer_app_get_option_group();
-g_option_group_add_entries (app_options, options);
-g_option_context_set_main_group (context, app_options);
-g_option_context_add_group (context, gtk_get_option_group (TRUE));
-#ifdef HAVE_GTK_VNC
-g_option_context_add_group (context, vnc_display_get

[virt-tools-list] [PATCH 4/7] Backport GApplication code from glib 2.40

2015-12-11 Thread Eduardo Lima (Etrunko)
Ideally, glib was required to be at least 2.40.0, but due to the fact
that SLES still uses 2.38, we need to backport the code that is
available only in glib version 2.40.0 onwards.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/virt-glib-compat.c | 368 +
 src/virt-glib-compat.h |  10 ++
 2 files changed, 378 insertions(+)

diff --git a/src/virt-glib-compat.c b/src/virt-glib-compat.c
index c15ff28..4748993 100644
--- a/src/virt-glib-compat.c
+++ b/src/virt-glib-compat.c
@@ -32,3 +32,371 @@ GByteArray *g_byte_array_new_take (guint8 *data, gsize len)
   return array;
 }
 #endif
+
+#ifndef GLIB_VERSION_2_40
+static void
+free_option_entry (gpointer data)
+{
+  GOptionEntry *entry = data;
+
+  switch (entry->arg)
+{
+case G_OPTION_ARG_STRING:
+case G_OPTION_ARG_FILENAME:
+  g_free (*(gchar **) entry->arg_data);
+  break;
+
+case G_OPTION_ARG_STRING_ARRAY:
+case G_OPTION_ARG_FILENAME_ARRAY:
+  g_strfreev (*(gchar ***) entry->arg_data);
+  break;
+
+default:
+  /* most things require no free... */
+  break;
+}
+
+  /* ...except for the space that we allocated for it ourselves */
+  g_free (entry->arg_data);
+
+  g_slice_free (GOptionEntry, entry);
+}
+
+static void
+g_application_pack_option_entries (GApplication *application,
+   GVariantDict *dict)
+{
+  GHashTableIter iter;
+  gpointer item;
+
+  g_hash_table_iter_init (, application->priv->packed_options);
+  while (g_hash_table_iter_next (, NULL, ))
+{
+  GOptionEntry *entry = item;
+  GVariant *value = NULL;
+
+  switch (entry->arg)
+{
+case G_OPTION_ARG_NONE:
+  if (*(gboolean *) entry->arg_data != 2)
+value = g_variant_new_boolean (*(gboolean *) entry->arg_data);
+  break;
+
+case G_OPTION_ARG_STRING:
+  if (*(gchar **) entry->arg_data)
+value = g_variant_new_string (*(gchar **) entry->arg_data);
+  break;
+
+case G_OPTION_ARG_INT:
+  if (*(gint32 *) entry->arg_data)
+value = g_variant_new_int32 (*(gint32 *) entry->arg_data);
+  break;
+
+case G_OPTION_ARG_FILENAME:
+  if (*(gchar **) entry->arg_data)
+value = g_variant_new_bytestring (*(gchar **) entry->arg_data);
+  break;
+
+case G_OPTION_ARG_STRING_ARRAY:
+  if (*(gchar ***) entry->arg_data)
+value = g_variant_new_strv (*(const gchar ***) entry->arg_data, 
-1);
+  break;
+
+case G_OPTION_ARG_FILENAME_ARRAY:
+  if (*(gchar ***) entry->arg_data)
+value = g_variant_new_bytestring_array (*(const gchar ***) 
entry->arg_data, -1);
+  break;
+
+case G_OPTION_ARG_DOUBLE:
+  if (*(gdouble *) entry->arg_data)
+value = g_variant_new_double (*(gdouble *) entry->arg_data);
+  break;
+
+case G_OPTION_ARG_INT64:
+  if (*(gint64 *) entry->arg_data)
+value = g_variant_new_int64 (*(gint64 *) entry->arg_data);
+  break;
+
+default:
+  g_assert_not_reached ();
+}
+
+  if (value)
+g_variant_dict_insert_value (dict, entry->long_name, value);
+}
+}
+
+static GVariantDict *
+g_application_parse_command_line (GApplication   *application,
+  gchar***arguments,
+  GError**error)
+{
+  gboolean become_service = FALSE;
+  GVariantDict *dict = NULL;
+  GOptionContext *context;
+
+  /* Due to the memory management of GOptionGroup we can only parse
+   * options once.  That's because once you add a group to the
+   * GOptionContext there is no way to get it back again.  This is fine:
+   * local_command_line() should never get invoked more than once
+   * anyway.  Add a sanity check just to be sure.
+   */
+  g_return_val_if_fail (!application->priv->options_parsed, NULL);
+
+  context = g_option_context_new (NULL);
+
+  /* If the application has not registered local options and it has
+   * G_APPLICATION_HANDLES_COMMAND_LINE then we have to assume that
+   * their primary instance commandline handler may want to deal with
+   * the arguments.  We must therefore ignore them.
+   *
+   * We must also ignore --help in this case since some applications
+   * will try to handle this from the remote side.  See #737869.
+   */
+  if (application->priv->main_options == NULL && (application->priv->flags & 
G_APPLICATION_HANDLES_COMMAND_LINE))
+{
+  g_option_context_set_ignore_unknown_options (context, TRUE);
+  g_option_context_set_help_enabled (context, FALSE);
+}
+
+  /* Add the main option group, if it exists */
+  if (application->priv->main_options)
+{
+  /* This consumes the main_options */
+  g_option

Re: [virt-tools-list] [PATCH 3/7] Port to GtkApplication API's

2015-12-16 Thread Eduardo Lima (Etrunko)
Hi Jonathon,

It seems I got a bit lost with the all comments on the previous series
and some of them became were not addressed. Once again, thanks for the
review. My comments follow inline. I am working on the new version of
this series.

On 12/14/2015 08:46 PM, Jonathon Jongsma wrote:
>> @@ -238,11 +275,11 @@ remote_viewer_init(RemoteViewer *self)
>>  }
>>  
>>  RemoteViewer *
>> -remote_viewer_new(const gchar *uri)
>> +remote_viewer_new(void)
>>  {
>>  return g_object_new(REMOTE_VIEWER_TYPE,
>> -"guri", uri,
>> -"open-recent-dialog", uri == NULL,
>> +"application-id", "org.fedorahosted.remote-viewer",
> 
> Still using org.fedorahosted. Does anybody else have an opinion on this? I 
> 

I think we could be using "virt-manager" instead of fedorahosted. But it
is simple enough to change it.


>> @@ -634,11 +651,12 @@ remote_viewer_activate(VirtViewerApp *app, GError
>> **error)
>>  }
>>  
>>  static void
>> -remote_viewer_window_added(VirtViewerApp *app,
>> -   VirtViewerWindow *win)
>> +remote_viewer_window_added(GtkApplication *app,
>> +   G_GNUC_UNUSED GtkWindow *win)
>>  {
>> -spice_menu_update(REMOTE_VIEWER(app), win);
>> -spice_foreign_menu_update(REMOTE_VIEWER(app), win);
>> +VirtViewerWindow *window =
>> virt_viewer_app_get_main_window(VIRT_VIEWER_APP(app));
>> +spice_menu_update(REMOTE_VIEWER(app), window);
>> +spice_foreign_menu_update(REMOTE_VIEWER(app), window);
> 
> 
> This seems wrong to me. When we add a new window to the appliation, I think we
> should be updating the menu, etc for the new window, rather than the main
> window. 

Yes, you are right, this function is updating the menu on the main
window only. I am thinking about adding the VirtViewerWindow pointer as
a data to the GtkWindow so we can access it here and keep the
menu_update functions unchanged.

> @@ -1185,6 +1203,76 @@ cleanup:
>>  return ret;
>>  }
>>  
>> +static gint
>> +remote_viewer_handle_local_options(GApplication *gapp, GVariantDict 
>> *options)
>> +{
>> +VirtViewerApp *app = VIRT_VIEWER_APP(gapp);
>> +gint ret = -1;
>> +gchar *title = NULL;
>> +gchar **args = NULL;
>> +gboolean controller = FALSE;
>> +
>> +if (g_variant_dict_contains(options, OPT_VERSION)) {
>> +g_print(_("%s version %s"), g_get_prgname(), VERSION BUILDID);
>> +#ifdef REMOTE_VIEWER_OS_ID
>> +g_print(" (OS ID: %s)", REMOTE_VIEWER_OS_ID);
>> +#endif
>> +g_print("\n");
>> +return 0;
>> +}
>> +
>> +if (g_variant_dict_lookup(options, G_OPTION_REMAINING, "^as", )) {
>> +if (args && (g_strv_length(args) != 1)) {
>> +g_printerr(_("Error: can't handle multiple URIs\n"));
>> +ret = 1;
>> +goto end;
>> +}
>> +
>> +g_object_set(app, "guri", args[0], NULL);
>> +}
>> +
>> +g_variant_dict_lookup(options, OPT_TITLE, "s", );
> 
> This didn't occur to me during the last review, but: why did you decide to 
> pass
> NULL for arg_data in the GOptionEntry array instead of continuing to set
> arg_data to a pointer to e.g. a string variable? Setting arg_data to NULL 
> there
> means that the argument value will be stuffed into a GVariantDict which you 
> can
> inspect in this vfunc. But that just seems like more work to me. If you had 
> left
> it the old way, you could just use the (already-populated) variable here 
> instead
> of needing to extract the value from the variant dict here. It also means that
> you wouldn't need to create string variables for each of the option names
> (OPT_TITLE, etc) since you wouldn't need to query the variant dict by name 
> here.
> 

Yes, this was intended. I tried to make use of the new functionalities
provided by glib as much as possible. Now, knowing that copying that
huge amount of compatibility code from glib is not desired, I will get
back to the original approach and keep the variables for handling the
options.

>> +
>> +#ifdef HAVE_SPICE_GTK
>> +if (g_variant_dict_lookup(options, OPT_CONTROLLER, "b", )) {
>> +if (args) {
>> +g_printerr(_("Error: extra arguments given while using Spice
>> controller\n\n"));
>> +ret = 1;
>> +goto end;
>> +} else {
>> +RemoteViewer *self = REMOTE_VIEWER(app);
>> +SpiceCtrlController *ctrl = spice_ctrl_controller_new();
>> +SpiceCtrlForeignMenu *menu = spice_ctrl_foreign_menu_new();
>> +
>> +g_object_set(self, "guest-name", "defined by Spice controller",
>> +   "controller", ctrl,
>> +   "foreign-menu", menu,
>> +   NULL);
>> +
>> +g_signal_connect(menu, "notify::title",
>> + G_CALLBACK(foreign_menu_title_changed),
>> + self);
>> +
>> +g_object_unref(ctrl);
>> + 

Re: [virt-tools-list] [PATCH 7/7] Make GApplication port compatible with older glib

2015-12-16 Thread Eduardo Lima (Etrunko)
On 12/14/2015 07:42 PM, Jonathon Jongsma wrote:
> On Fri, 2015-12-11 at 17:11 +, Daniel P. Berrange wrote:
>> On Fri, Dec 11, 2015 at 02:40:36PM -0200, Eduardo Lima (Etrunko) wrote:
>>> Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
>>> ---
>>>  configure.ac   |  2 +-
>>>  src/remote-viewer.c|  9 +
>>>  src/virt-glib-compat.c | 29 +
>>>  src/virt-viewer-app.c  | 15 +++
>>>  src/virt-viewer-app.h  |  8 
>>>  src/virt-viewer.c  |  9 +
>>>  6 files changed, 71 insertions(+), 1 deletion(-)
>>
>> [snip]
>>
>> You've added an awful lot of back compat code here to deal with
>> this. I can't help thinking a better approach is to just not
>> use the g_application_add_main_option_entries() method in the
>> first place instead of adding piles of copy+pasted code.
>>
>> Reading the description of that method does not make it sound
>> like it is a critical feature we absolutely need to have.
>>
>> [quote]
>> This function is new in GLib 2.40. Before then, the only real
>> choice was to send all of the commandline arguments (options
>> and all) to the primary instance for handling. GApplication
>> ignored them completely on the local side. Calling this function
>> "opts in" to the new behaviour, and in particular, means that
>> unrecognised options will be treated as errors.
>> [/quote]
>>
>>
>> IMHO we could just do as that suggested, and send the options
>> to the primary instance for handling instead of parsing them
>> locally. Or alternatively just carry on using the GOptionContext
>> for parsing CLI args locally, and only use GApplication for the
>> non-CLI arg handling parts
> 
> I thinkt hat I agree with Daniel that this seems like an awful lot of code to 
> be
> copying into virt-viewer. Since we are explicitly choosing not to be a 
> "unique"
> application, handle-local-options and command-line are both going to be 
> handled
> in the same process. So I think it would be simpler to just use command-line 
> and
> follow the approach demonstrated here:
> 

Yes, I do agree it is a lot of code copied, my target was to change the
behaviour introduced by the patch as little as possible, so in the
future, when we update the glib requirements once again, the cleanup
would be straightforward.

I am working on the new version of the patch which will change the
proposed approach to not make use of all functionality provided by glib,
like keeping using option parsing locally.

Regards, Eduardo

-- 
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


[virt-tools-list] [PATCH 1/7] Drop support to gtk2

2015-12-13 Thread Eduardo Lima (Etrunko)
From: Fabiano Fidêncio 

The 3.0 release was the last one that still supports GTK2. For the
Windows builds the support to GTK2 was dropped in the previous release.
Let's do the same for the entire project now.
---
 configure.ac  | 39 +++
 src/view/autoDrawer.c | 10 -
 src/view/ovBox.c  | 45 --
 src/virt-gtk-compat.h | 12 --
 src/virt-viewer-display.c | 96 ---
 src/virt-viewer-window.c  | 10 -
 virt-viewer.spec.in   | 23 
 7 files changed, 5 insertions(+), 230 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8aa80ca..250a7fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,9 +15,7 @@ AM_SILENT_RULES([yes])
 GLIB2_REQUIRED=2.22.0
 LIBXML2_REQUIRED="2.6.0"
 LIBVIRT_REQUIRED="0.10.0"
-GTK2_REQUIRED="2.18.0"
 GTK3_REQUIRED="3.0"
-GTK_VNC1_REQUIRED="0.3.8"
 GTK_VNC2_REQUIRED="0.4.0"
 SPICE_GTK_REQUIRED="0.30"
 SPICE_PROTOCOL_REQUIRED="0.12.7"
@@ -26,9 +24,7 @@ GOVIRT_REQUIRED="0.3.2"
 AC_SUBST([GLIB2_REQUIRED])
 AC_SUBST([LIBXML2_REQUIRED])
 AC_SUBST([LIBVIRT_REQUIRED])
-AC_SUBST([GTK2_REQUIRED])
 AC_SUBST([GTK3_REQUIRED])
-AC_SUBST([GTK_VNC1_REQUIRED])
 AC_SUBST([GTK_VNC2_REQUIRED])
 AC_SUBST([SPICE_GTK_REQUIRED])
 AC_SUBST([SPICE_PROTOCOL_REQUIRED])
@@ -121,36 +117,15 @@ AC_CHECK_LIB([virt],
  [AC_DEFINE([HAVE_VIR_DOMAIN_OPEN_GRAPHICS_FD], 1, [Have 
virDomainOpenGraphicsFD?])])
 LIBS=$old_LIBS
 
-AC_MSG_CHECKING([which gtk+ version to compile against])
-AC_ARG_WITH([gtk],
-  [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against 
(default: 3.0)])],
-  [case "$with_gtk" in
- 2.0|3.0) ;;
- *) AC_MSG_ERROR([invalid gtk version specified]) ;;
-   esac],
-  [with_gtk=3.0])
-AC_MSG_RESULT([$with_gtk])
-
-case "$with_gtk" in
-  2.0) GTK_API_VERSION=2.0
-   GTK_REQUIRED=$GTK2_REQUIRED
-   GTK_VNC_REQUIRED=$GTK_VNC1_REQUIRED
-   GTK_VNC_API_VERSION=1.0
-   SPICE_GTK_API_VERSION=2.0
-   ;;
-  3.0) GTK_API_VERSION=3.0
-   GTK_REQUIRED=$GTK3_REQUIRED
-   GTK_VNC_REQUIRED=$GTK_VNC2_REQUIRED
-   GTK_VNC_API_VERSION=2.0
-   SPICE_GTK_API_VERSION=3.0
-   ;;
-esac
+GTK_API_VERSION=3.0
+GTK_REQUIRED=$GTK3_REQUIRED
+GTK_VNC_REQUIRED=$GTK_VNC2_REQUIRED
+GTK_VNC_API_VERSION=2.0
+SPICE_GTK_API_VERSION=3.0
 
 AC_SUBST([GTK_API_VERSION])
 AC_SUBST([GTK_REQUIRED])
 AC_SUBST([GTK_VNC_API_VERSION])
-AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
-AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
 
 PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
 
@@ -275,10 +250,6 @@ AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Configuration summary])
 AC_MSG_NOTICE([=])
 AC_MSG_NOTICE([])
-AC_MSG_NOTICE([ Features:])
-AC_MSG_NOTICE([])
-AC_MSG_NOTICE([  Gtk: $with_gtk])
-AC_MSG_NOTICE([])
 AC_MSG_NOTICE([ Libraries:])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([   GLIB2: $GLIB2_CFLAGS $GLIB2_LIBS])
diff --git a/src/view/autoDrawer.c b/src/view/autoDrawer.c
index cbf92de..2ae106c 100644
--- a/src/view/autoDrawer.c
+++ b/src/view/autoDrawer.c
@@ -218,7 +218,6 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
if (gtk_widget_get_window(priv->evBox)) {
   int x;
   int y;
-#if GTK_CHECK_VERSION(3, 0, 0)
   GdkDevice *dev;
   GdkDeviceManager *devmgr;
 
@@ -227,9 +226,6 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
 
   gdk_window_get_device_position(gtk_widget_get_window(priv->evBox),
  dev, , , NULL);
-#else
-  gtk_widget_get_pointer(priv->evBox, , );
-#endif
 
   gtk_widget_get_allocation(priv->evBox, );
   g_assert(gtk_container_get_border_width(   GTK_CONTAINER(priv->evBox))
@@ -262,16 +258,10 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
if (!priv->inputUngrabbed) {
   GtkWidget *grabbed = NULL;
 
-#if GTK_CHECK_VERSION(3, 0, 0)
   if (gtk_window_has_group (window)) {
 GtkWindowGroup *group = gtk_window_get_group (window);
 grabbed = gtk_window_group_get_current_grab (group);
   }
-#else
-  if (window->group && window->group->grabs) {
-grabbed = GTK_WIDGET(window->group->grabs->data);
-  }
-#endif
   if (!grabbed) {
  grabbed = gtk_grab_get_current();
   }
diff --git a/src/view/ovBox.c b/src/view/ovBox.c
index 185b0b7..fa56fd5 100644
--- a/src/view/ovBox.c
+++ b/src/view/ovBox.c
@@ -76,13 +76,6 @@
 
 #include "ovBox.h"
 
-#if ! GTK_CHECK_VERSION(3, 0, 0)
-#define gtk_widget_set_realized(widget, val)\
-  GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED)
-#define gtk_widget_get_realized(widget)\
-  GTK_WIDGET_REALIZED(widget)
-#endif
-
 struct _ViewOvBoxPrivate
 {
GdkWindow *underWin;
@@ -338,22 +331,12 @@ static void
 ViewOvBoxSetBackground(ViewOvBox *that) // IN
 {
GtkWidget *widget = GTK_WIDGET(that);
-
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *stylecontext;
 
stylecontext = 

[virt-tools-list] [PATCH v2 0/7] Port to GtkApplication API's

2015-12-13 Thread Eduardo Lima (Etrunko)
In this second round, I addresed most of the concerns that were raised
in v1, especially keeping compatibility with glib 2.38. I tried to keep
patches as self-contained as possible, in either case of having this
functionatily fully or partially merged.

The first two patches seem to be ready for merge, and do not interfere
in the rest of the series.

The main patch is the third one, which does all the porting. I chose
to update glib requirement to 2.40 here and only downgrade it to 2.38
after I had all the compatibility layer working. This way I avoided
having a broken patch in the middle of the tree, which could cause
troubles in future git bisects.

The next two are the ones which backport functions only available in
glib 2.40 onwards, with no changes to the code. These are contained in
#ifndef GLIB_VERSION_2_40 blocks, also to maintain the code building.

Last couple are the adaptations of the glib code to build outside of the
tree and integrate with virt-viewer.

Eduardo Lima (Etrunko) (6):
  Minor code cleanups
  Port to GtkApplication API's
  Backport GApplication code from glib 2.40
  Backport GVariantDict code from glib 2.40
  Adapt glib code to build out of the tree
  Make GApplication port compatible with older glib

Fabiano Fidêncio (1):
  Drop support to gtk2

 configure.ac  |  43 +---
 src/remote-viewer-main.c  | 122 +
 src/remote-viewer.c   | 174 ++---
 src/remote-viewer.h   |   3 +-
 src/view/autoDrawer.c |  10 -
 src/view/ovBox.c  |  45 
 src/virt-glib-compat.c| 640 ++
 src/virt-glib-compat.h|  42 +++
 src/virt-gtk-compat.h |  12 -
 src/virt-viewer-app.c | 238 ++---
 src/virt-viewer-app.h |  18 +-
 src/virt-viewer-display.c |  96 ---
 src/virt-viewer-main.c| 102 +---
 src/virt-viewer-window.c  |  10 -
 src/virt-viewer.c | 126 +++--
 src/virt-viewer.h |   8 +-
 src/virt-viewer.xml   |   2 +-
 virt-viewer.spec.in   |  23 --
 18 files changed, 1090 insertions(+), 624 deletions(-)

-- 
2.5.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 0/4] Port virt-viewer to GtkApplication APIs

2015-11-30 Thread Eduardo Lima (Etrunko)
On 11/30/2015 05:44 PM, Jonathon Jongsma wrote:
> On Fri, 2015-11-27 at 17:23 -0200, Eduardo Lima (Etrunko) wrote:
>> The subject says it all, and you will find more details in each commit
>> message. Unfortunately I was not able to test some options on
>> remote-viewer, especially spice-controller and ovirt. I will be really
>> glad if someone can help with those.
>>
>> Also, the work has been pushed to the gapplication branch in my github
>> repository, in case you are interested in trying it easier, without the
>> need to apply the patches on your tree.
>>
>> http://github.com/etrunko/virt-viewer
>>
> 
> 
> FYI: I built your branch and when I run virt-viewer or remote-viewer, I get an
> empty window with the following warnings on the terminal:
> 
> 
> (virt-viewer:1605): Gtk-WARNING **: Attempting to add a widget with type 
> GtkVBox
> to a container of type GtkApplicationWindow, but the widget is already inside 
> a
> container of type GtkWindow, please remove the widget from its existing
> container first.
> 
> (virt-viewer:1605): Gtk-CRITICAL **: gtk_window_resize: assertion 'width > 0'
> failed
> 

This is because your installed virt-viewer.xml file is outdated. You'll
need to build and install the new one.

-- 
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] [virt-viewer 3/5] app: Set the resource base path

2016-06-14 Thread Eduardo Lima (Etrunko)

On 06/14/2016 06:40 PM, Fabiano Fidêncio wrote:
> GApplication's resource base path is based on the application-id, for
> instamce:

type (instance)

>  - virt-viewer's resource base path: /org/virt-manager/virt-viewer, as
>the virt-viewer's application id is: org.virt-manager.virt-viewer.
>  - remote-viewer's resource bash path: /org/virt-manager/remote-viewer
>as remote-viewer's application id is: org.virt-manager.remote-viewer
> 
> It's a issue because our resources have /org/virt-manager/virt-viewer
> and Gtk, when trying to automatically load ui files (as done for
> gtk/menu.ui, gtk/menus-appmenu.ui, gtk/menus-tradicional.ui and
> gtk/help-overlay.ui), searches for these files in the base path.
> 
> For solving this issue, we can basically set the resource path using

s/For solving/To solve

> g_application_set_resource_base_path() method. A check could be done and
> this method could be called only when running remote-viewer, but as it's
> a simple call, called only when the application starts I decided to go
> without the application-id's check.
> 
> g_application_set_resource_base_path() was introduced in GLib 2.42 and
> that's the reason I'm also bumping GLib dependency's version. Currently
> it makes impossible to build virt-viewer on SLES 12 SP1 as it still has
> GLib 2.38, so postponing this patch till SLES 12 SP2 release is
> desirable.
> 
> Signed-off-by: Fabiano Fidêncio 
> ---
>  configure.ac  | 4 ++--
>  src/virt-viewer-app.c | 2 ++
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 9426350..f7e537d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -13,8 +13,8 @@ m4_ifndef([AM_SILENT_RULES], 
> [m4_define([AM_SILENT_RULES],[])])
>  AM_SILENT_RULES([yes])
>  
>  # Keep these two definitions in agreement.
> -GLIB2_REQUIRED="2.38"
> -GLIB2_ENCODED_VERSION="GLIB_VERSION_2_38"
> +GLIB2_REQUIRED="2.42"
> +GLIB2_ENCODED_VERSION="GLIB_VERSION_2_42"
>  
>  # Keep these two definitions in agreement.
>  GTK_REQUIRED="3.10"
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 4c3a373..d9f46ab 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -1784,6 +1784,8 @@ virt_viewer_app_on_application_startup(GApplication 
> *app)
>  VirtViewerApp *self = VIRT_VIEWER_APP(app);
>  GError *error = NULL;
>  
> +g_application_set_resource_base_path(app, 
> "/org/virt-manager/virt-viewer");
> +
>  G_APPLICATION_CLASS(virt_viewer_app_parent_class)->startup(app);
>  
>  self->priv->resource = virt_viewer_get_resource();
> 

Other than that, patch is good. Does anyone know when the new SLES is due?

-- 
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 4/4] Fix missing field initializers

2016-06-22 Thread Eduardo Lima (Etrunko)
This is not actually necessary as of C99. You only need to initialize
any field of a structure to get all other fields initialized too.

On 06/22/2016 03:17 AM, Pavel Grunt wrote:
> ---
>  src/virt-viewer-display-spice.c | 2 +-
>  src/virt-viewer-display-vnc.c   | 2 +-
>  src/virt-viewer-window.c| 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
> index ee07507..a604230 100644
> --- a/src/virt-viewer-display-spice.c
> +++ b/src/virt-viewer-display-spice.c
> @@ -243,7 +243,7 @@ enable_accel_changed(VirtViewerApp *app,
>   GParamSpec *pspec G_GNUC_UNUSED,
>   VirtViewerDisplaySpice *self)
>  {
> -GtkAccelKey key = { 0 };
> +GtkAccelKey key = {0, 0, 0};
>  if (virt_viewer_app_get_enable_accel(app))
>  gtk_accel_map_lookup_entry("/view/release-cursor", 
> );
>  
> diff --git a/src/virt-viewer-display-vnc.c b/src/virt-viewer-display-vnc.c
> index 390c366..cb45c23 100644
> --- a/src/virt-viewer-display-vnc.c
> +++ b/src/virt-viewer-display-vnc.c
> @@ -190,7 +190,7 @@ enable_accel_changed(VirtViewerApp *app,
>   GParamSpec *pspec G_GNUC_UNUSED,
>   VncDisplay *vnc)
>  {
> -GtkAccelKey key = { 0 };
> +GtkAccelKey key = {0, 0, 0};
>  if (virt_viewer_app_get_enable_accel(app))
>  gtk_accel_map_lookup_entry("/view/release-cursor", 
> );
>  
> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> index 6bf0a2e..c828916 100644
> --- a/src/virt-viewer-window.c
> +++ b/src/virt-viewer-window.c
> @@ -1176,7 +1176,7 @@ virt_viewer_window_update_title(VirtViewerWindow *self)
>  
>  if (priv->grabbed) {
>  gchar *label;
> -GtkAccelKey key = { 0 };
> +GtkAccelKey key = {0, 0, 0};
>  
>  if (virt_viewer_app_get_enable_accel(priv->app))
>  gtk_accel_map_lookup_entry("/view/release-cursor", 
> );
> 


-- 
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] [virt-viewer 2/5] remote-viewer: Remove unneeded g_application_hold() call

2016-06-14 Thread Eduardo Lima (Etrunko)
On 06/14/2016 06:40 PM, Fabiano Fidêncio wrote:
> This call was added as hack during the GApplication's port, as the
> remote-viewer window was closed as soon as the connection happened.
> 
> This behaviour hapened because we didn't chain-up to the parent's
> window_added() method, which already calls g_application_hold()..
> 
> Signed-off-by: Fabiano Fidêncio 
> ---
>  src/virt-viewer-app.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index b99ed32..4c3a373 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -1825,8 +1825,6 @@ virt_viewer_app_on_application_startup(GApplication 
> *app)
>  g_application_quit(app);
>  return;
>  }
> -
> -g_application_hold(app);
>  }
>  
>  static gboolean
> 

Thanks for finding the real problem here. So, this one could be squashed
with previous one maybe?

-- 
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] [virt-viewer 0/5] Preparing the ground for UI changes

2016-06-16 Thread Eduardo Lima (Etrunko)
On 06/15/2016 07:20 PM, Jim Fehlig wrote:
> On 06/15/2016 06:42 AM, Pavel Grunt wrote:
>> Hi,
>>
>> On Tue, 2016-06-14 at 23:40 +0200, Fabiano Fidêncio wrote:
>>> These small series has as objective start "preparing the ground" for
>>> the work Sagar Huge has been done on re-design/re-write virt-viewer's
>>> UI in a way to have it looking as something from this decade. :-) [0]
>> I really like the new UI.
>>> There is still a lot of work to do on our (Sagar's and mine) side and
>>> once they are fixed he will send the patches and ask for comments and
>>> reviews. So far I'm keeping his patches rebased on top of current
>>> master on my personal gitlab[1] and you also can find his work on his
>>> personal's github[2].
>>>
>>> As I said, there's still a lot of work to do and we are trying to do it
>>> as soon as possible. Our target is to have it in for Fedora25 and maybe
>>> we will need a virt-viewer release before starting, actually, doing the
>>> UI changes (for those who want to stick to the old UI/not bump GLib/Gtk
>>> dependencies' versions).
>> F25 sounds like a reasonable goal
>>
>>> This small series of patch can also be found on another branch of my
>>> personal gitlab repo[3] and can be waiting there till we have SLES 12
>>> SP2 release, as the 3rd patch of this series will bump GLib dependency
>>> version, making impossible to build virt-viewer in a stock SLES 12 SP1.
> 
> That's a bummer, but...
> 
>> I don't think it is reasonable to wait for SLES to be released.
> 
> agree that upstream development shouldn't come to a halt due to an old version
> of glib in SLES12 SP1. For the record, here are glib versions in relevant SUSE
> distros
> 
> openSUSE 13.2 (becoming rather old openSUSE release): 2.42
> openSUSE Leap 42.1 (latest stable openSUSE release): 2.44
> openSUSE Tumbleweed (rolling openSUSE release): 2.48
> SLES12 SP1 (latest stable enterprise release): 2.38
> SLES12 SP2 (enterprise release scheduled for Oct 2016): 2.48
> 
>>  As you said a
>> release can be done before merging Sagar's and yours works upstream.
> 
> Ah, so there will be a release before these changes go in? And a release with
> the changes isn't planned until later in the year, e.g. October or later? If 
> so,
> the latest release will always work with the latest SUSE Linux Enterprise. 
> Only
> developers would be affected, but they should be using something newer anyhow.
> 

I think this is a good plan. Release first and then bump requirements
for the next one.

-- 
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] [virt-viewer 2/2] window: Replace autoDrawer with native Gtk widgets

2016-06-21 Thread Eduardo Lima (Etrunko)
On 06/21/2016 05:04 PM, Fabiano Fidêncio wrote:

> diff --git a/src/view/virt-viewer-timed-revealer.c 
> b/src/view/virt-viewer-timed-revealer.c
> new file mode 100644
> index 000..bba363c
> --- /dev/null
> +++ b/src/view/virt-viewer-timed-revealer.c
> @@ -0,0 +1,224 @@
> +/*
> + * 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
> + *
> + * Author: Cole Robinson 
> + * Author: Fabiano Fidêncio 
> + */
> +
> +#include 
> +
> +#include "virt-viewer-timed-revealer.h"
> +
> +G_DEFINE_TYPE (VirtViewerTimedRevealer, virt_viewer_timed_revealer, 
> G_TYPE_OBJECT)
> +
> +#define VIRT_VIEWER_TIMED_REVEALER_GET_PRIVATE(obj) \
> +(G_TYPE_INSTANCE_GET_PRIVATE ((obj), VIRT_VIEWER_TYPE_TIMED_REVEALER, 
> VirtViewerTimedRevealerPrivate))
> +
> +struct _VirtViewerTimedRevealerPrivate
> +{
> +gboolean fullscreen;
> +guint timeout_id;
> +
> +GtkWidget *revealer;
> +GtkWidget *evBox;
> +};
> +
> +static void
> +virt_viewer_timed_revealer_unregister_timeout(VirtViewerTimedRevealer *self)
> +{
> +VirtViewerTimedRevealerPrivate *priv;
> +
> +priv = self->priv;
> +

I can see you don't like using self->priv->, so maybe you could just
initialize priv with the declaration on the line above?

> +if (priv->timeout_id) {
> +g_source_remove(priv->timeout_id);
> +priv->timeout_id = 0;
> +}
> +}
> +
> +static gboolean
> +schedule_unreveal_timeout_cb(VirtViewerTimedRevealer *self)
> +{
> +VirtViewerTimedRevealerPrivate *priv;
> +
> +priv = self->priv;
> +

Here too.

> +gtk_revealer_set_reveal_child(GTK_REVEALER(priv->revealer), FALSE);
> +priv->timeout_id = 0;
> +
> +return FALSE;
> +}
> +
> +static void
> +virt_viewer_timed_revealer_schedule_unreveal_timeout(VirtViewerTimedRevealer 
> *self,
> + guint timeout)
> +{
> +VirtViewerTimedRevealerPrivate *priv;
> +
> +priv = self->priv;
> +

And here.

> +if (priv->timeout_id != 0)
> +return;
> +
> +priv->timeout_id = g_timeout_add(timeout,
> + 
> (GSourceFunc)schedule_unreveal_timeout_cb,
> + self);
> +}
> +
> +static gboolean
> +virt_viewer_timed_revealer_enter_leave_notify(GtkWidget *evBox G_GNUC_UNUSED,
> +  GdkEventCrossing *event 
> G_GNUC_UNUSED,

event is marked G_GNC_UNUSED, but it is used on the function in a couple
of places.

> +  VirtViewerTimedRevealer *self)
> +{
> +VirtViewerTimedRevealerPrivate *priv;
> +GdkDevice *device;
> +GtkAllocation allocation;
> +gint x, y;
> +gboolean entered;
> +
> +priv = self->priv;

Same about initializing.

> +
> +device = gdk_event_get_device((GdkEvent *)event);
> +
> +gdk_window_get_device_position(event->window, device, , , 0);
> +gtk_widget_get_allocation(priv->evBox, );
> +
> +entered = !!(x >= 0 && y >= 0 && x < allocation.width && y < 
> allocation.height);
> +
> +if (!priv->fullscreen)
> +return FALSE;
> +

You should test for fullscreen the first thing in the function.

> +/*
> + * Pointer exited the toolbar, and toolbar is revealed. Schedule
> + * a timeout to close it, if one isn't already scheduled.
> + */
> +if (!entered && 
> gtk_revealer_get_reveal_child(GTK_REVEALER(priv->revealer))) {
> +virt_viewer_timed_revealer_schedule_unreveal_timeout(self, 1000);
> +return FALSE;
> +}
> +
> +virt_viewer_timed_revealer_unregister_timeout(self);
> +if (entered && 
> !gtk_revealer_get_reveal_child(GTK_REVEALER(priv->revealer))) {
> +gtk_revealer_set_reveal_child(GTK_REVEALER(priv->revealer), TRUE);
> +}
> +
> +return FALSE;
> +}
> +
> +static void
> +virt_viewer_timed_revealer_init(VirtViewerTimedRevealer *self)
> +{
> +self->priv = VIRT_VIEWER_TIMED_REVEALER_GET_PRIVATE(self);
> +}
> +
> +static void
> +virt_viewer_timed_revealer_dispose(GObject *object)
> +{
> +VirtViewerTimedRevealer *self;
> +VirtViewerTimedRevealerPrivate *priv;
> +
> +self = 

Re: [virt-tools-list] [virt-viewer 2/2] window: Replace autoDrawer with native Gtk widgets

2016-06-21 Thread Eduardo Lima (Etrunko)
On 06/21/2016 05:50 PM, Fabiano Fidêncio wrote:
> On Tue, Jun 21, 2016 at 10:39 PM, Eduardo Lima (Etrunko)
> <etru...@redhat.com> wrote:
>> On 06/21/2016 05:04 PM, Fabiano Fidêncio wrote:
>>> GtkRevealer was intrudced in Gtk+ 3.10 and, combined with Gtk Overlay
>>> (intoduced in Gtk+ 3.2), can provide a more sustainably implementation
>>> of the AutoDrawer functionality.
>>>
>>> This approach is completely based on the approach taken by virt-manager:
>>> https://github.com/virt-manager/virt-manager/commit/dc05600324f6b9a82b68581fc0a9c145f9889ce9
>>>
>>> Resolves: https://bugs.freedesktop.org/show_bug.cgi?id=94495
>>>
>>> Signed-off-by: Fabiano Fidêncio <fiden...@redhat.com>
>>> ---
>>>  src/Makefile.am   |   8 +-
>>>  src/resources/ui/virt-viewer.ui   | 401 +++---
>>>  src/view/autoDrawer.c | 991 
>>> --
>>>  src/view/autoDrawer.h |  91 
>>>  src/view/drawer.c | 366 -
>>>  src/view/drawer.h |  83 ---
>>>  src/view/ovBox.c  | 946 
>>> 
>>>  src/view/ovBox.h  | 103 
>>>  src/view/virt-viewer-timed-revealer.c | 224 
>>>  src/view/virt-viewer-timed-revealer.h |  74 +++
>>>  src/virt-viewer-window.c  |  36 +-
>>>  11 files changed, 521 insertions(+), 2802 deletions(-)
>>
>> The joys of cleaning up code. I have some general questions before going
>> deep on the review.
>>
>> 1) Do you think the new files could go under src/ instead of src/view/
>> directory? Those seemed to be used only for the old widget.
> 
> Well, I personally don't have a strong opinion about where those files
> are placed. Just left there because the files used for the old widget
> were there.

Yeah, if you want my suggestion, get rid of that directory. :P

> 
>>
>> 2) Even better, it seems that timed-revealed has more boilerplate code
>> than code that really does something useful. Any specific reason why
>> those functions could not be part of virt-viewer-window.c ?
> 
> Just because I preferred to keep the implementation details as close
> as possible to the one used in virt-manager. The functions could be
> moved to the virt-viewer-window.c, but I, particularly, fail to see a
> good reason for doing this. Actually, IMHO, it seems more organized
> the way it's now than moving the functions to the virt-viewer-window.c
> file.

Okay, I just read the code, I like it the way it is. I have posted a few
comments about it.

-- 
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] [virt-viewer 2/2] window: Replace autoDrawer with native Gtk widgets

2016-06-21 Thread Eduardo Lima (Etrunko)
On 06/21/2016 05:04 PM, Fabiano Fidêncio wrote:
> GtkRevealer was intrudced in Gtk+ 3.10 and, combined with Gtk Overlay
> (intoduced in Gtk+ 3.2), can provide a more sustainably implementation
> of the AutoDrawer functionality.
> 
> This approach is completely based on the approach taken by virt-manager:
> https://github.com/virt-manager/virt-manager/commit/dc05600324f6b9a82b68581fc0a9c145f9889ce9
> 
> Resolves: https://bugs.freedesktop.org/show_bug.cgi?id=94495
> 
> Signed-off-by: Fabiano Fidêncio 
> ---
>  src/Makefile.am   |   8 +-
>  src/resources/ui/virt-viewer.ui   | 401 +++---
>  src/view/autoDrawer.c | 991 
> --
>  src/view/autoDrawer.h |  91 
>  src/view/drawer.c | 366 -
>  src/view/drawer.h |  83 ---
>  src/view/ovBox.c  | 946 
>  src/view/ovBox.h  | 103 
>  src/view/virt-viewer-timed-revealer.c | 224 
>  src/view/virt-viewer-timed-revealer.h |  74 +++
>  src/virt-viewer-window.c  |  36 +-
>  11 files changed, 521 insertions(+), 2802 deletions(-)

The joys of cleaning up code. I have some general questions before going
deep on the review.

1) Do you think the new files could go under src/ instead of src/view/
directory? Those seemed to be used only for the old widget.

2) Even better, it seems that timed-revealed has more boilerplate code
than code that really does something useful. Any specific reason why
those functions could not be part of virt-viewer-window.c ?

-- 
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] [virt-viewer 1/2] window, util: Fix resource path for icons

2016-06-21 Thread Eduardo Lima (Etrunko)
On 06/21/2016 05:04 PM, Fabiano Fidêncio wrote:
> Since commit 1f6f1a48 the resource path for icons has been broken.
> The reason is that when moving the .ui files to $(srcdir)/resources/ui,
> the define used for the resources was changed to reflect the new
> directory. However, this change wasn't needed by the icons and ended up
> with virt-viewer not displaying a few icons.
> 
> Let's fix the issue by adding a new define for the icon's resource path.
> 
> Signed-off-by: Fabiano Fidêncio 
> ---
>  src/virt-viewer-util.h   | 1 +
>  src/virt-viewer-window.c | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/virt-viewer-util.h b/src/virt-viewer-util.h
> index 14a477a..7b90052 100644
> --- a/src/virt-viewer-util.h
> +++ b/src/virt-viewer-util.h
> @@ -35,6 +35,7 @@ enum {
>  
>  #define VIRT_VIEWER_ERROR virt_viewer_error_quark ()
>  #define VIRT_VIEWER_RESOURCE_PREFIX "/org/virt-manager/virt-viewer/ui"
> +#define VIRT_VIEWER_RESOURCE_ICONS_PREFIX "/org/virt-manager/virt-viewer"
>  

I would prefer if you kept using VIRT_VIEWER_RESOUCE_PREFIX instead of
adding a new define. It could be "/org/virt-manager/virt-viewer" and
then you would adjust other occurrences accordingly (the only one i see
is in virt-viewer-util.c).

-- 
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] [virt-viewer v2] util: Fix resource path

2016-06-21 Thread Eduardo Lima (Etrunko)
On 06/21/2016 05:28 PM, Fabiano Fidêncio wrote:
> Since commit 1f6f1a48 the resource path for icons has been broken.
> The reason is that when moving the .ui files to $(srcdir)/resources/ui
> the define used for the resources was changed to reflect the new
> directory. However, this change wasn't needed by the icons and ended
> up with virt-viewer not displaying a few icons.
> 
> Let's fix it by setting back the define to the previous one and then
> tweak the virt_viewer_util_load_ui() to add "ui" to the resource path,
> for loading the ui files.
> ---
>  src/virt-viewer-util.c | 3 ++-
>  src/virt-viewer-util.h | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c
> index 9e52b87..7c95583 100644
> --- a/src/virt-viewer-util.c
> +++ b/src/virt-viewer-util.c
> @@ -50,8 +50,9 @@ virt_viewer_error_quark(void)
>  GtkBuilder *virt_viewer_util_load_ui(const char *name)
>  {
>  GtkBuilder *builder;
> -gchar *resource = g_strdup_printf("%s/%s",
> +    gchar *resource = g_strdup_printf("%s/%s/%s",

Minor:

"%s/ui/%s" ???

Acked-by: Eduardo Lima (Etrunko) <etru...@redhat.com>

-- 
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 4/4] Fix missing field initializers

2016-06-23 Thread Eduardo Lima (Etrunko)
On 06/22/2016 05:16 PM, Pavel Grunt wrote:
> On Wed, 2016-06-22 at 14:59 -0300, Eduardo Lima (Etrunko) wrote:
>> This is not actually necessary as of C99. You only need to initialize
>> any field of a structure to get all other fields initialized too.
> 
> yes, I was just annoyed by the warning..


Interesting, can you share what was exactly the warning message? Clang
as a modern compiler should be able to handle this case.


-- 
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


[virt-tools-list] [PATCH 1/2] Avoid creating ovirt foreign menu item manually

2016-06-23 Thread Eduardo Lima (Etrunko)
This patch is a preparation for a upcoming UI change that will present
the ISO list in a separate dialog, instead of a submenu.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/remote-viewer.c | 26 --
 src/resources/ui/virt-viewer.ui |  8 
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 71723cf..16c9d22 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -737,30 +737,28 @@ ovirt_foreign_menu_update(GtkApplication *gtkapp, 
GtkWindow *gtkwin, G_GNUC_UNUS
 RemoteViewer *app = REMOTE_VIEWER(gtkapp);
 VirtViewerWindow *win = g_object_get_data(G_OBJECT(gtkwin), 
"virt-viewer-window");
 GtkWidget *menu = g_object_get_data(G_OBJECT(win), "foreign-menu");
-GtkWidget *submenu;
-GtkMenuShell *shell = 
GTK_MENU_SHELL(gtk_builder_get_object(virt_viewer_window_get_builder(win), 
"top-menu"));
+GtkWidget *submenu = 
ovirt_foreign_menu_get_gtk_menu(app->priv->ovirt_foreign_menu);
 
 if (app->priv->ovirt_foreign_menu == NULL) {
 /* nothing to do */
 return;
 }
-if (menu == NULL) {
-menu = gtk_menu_item_new_with_label(_("_Change CD"));
-gtk_menu_item_set_use_underline(GTK_MENU_ITEM(menu), TRUE);
-gtk_menu_shell_append(shell, menu);
-g_object_set_data_full(G_OBJECT(win), "foreign-menu",
-   g_object_ref(menu),
-   (GDestroyNotify)gtk_widget_destroy);
-}
 
-submenu = ovirt_foreign_menu_get_gtk_menu(app->priv->ovirt_foreign_menu);
-if (submenu != NULL) {
-gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
-} else {
+if (submenu == NULL) {
 /* No items to show, no point in showing the menu */
+if (menu != NULL)
+   gtk_widget_set_visible(menu, FALSE);
 g_object_set_data(G_OBJECT(win), "foreign-menu", NULL);
+return;
+}
+
+if (menu == NULL) {
+menu = 
GTK_WIDGET(gtk_builder_get_object(virt_viewer_window_get_builder(win), 
"menu-change-cd"));
+g_object_set_data(G_OBJECT(win), "foreign-menu", menu);
+gtk_widget_set_visible(menu, TRUE);
 }
 
+gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
 gtk_widget_show_all(menu);
 }
 
diff --git a/src/resources/ui/virt-viewer.ui b/src/resources/ui/virt-viewer.ui
index 830a451..219e0af 100644
--- a/src/resources/ui/virt-viewer.ui
+++ b/src/resources/ui/virt-viewer.ui
@@ -243,6 +243,14 @@
 
   
 
+
+  
+False
+False
+_Change CD
+True
+  
+
   
   
 False
-- 
2.5.5

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


[virt-tools-list] [PATCH 2/2] Avoid unecessary debug message if returning NULL

2016-06-23 Thread Eduardo Lima (Etrunko)
Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/ovirt-foreign-menu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
index 9b552eb..959804d 100644
--- a/src/ovirt-foreign-menu.c
+++ b/src/ovirt-foreign-menu.c
@@ -465,10 +465,10 @@ GtkWidget 
*ovirt_foreign_menu_get_gtk_menu(OvirtForeignMenu *foreign_menu)
 GList *it;
 char *current_iso;
 
-g_debug("Creating GtkMenu for foreign menu");
 if (foreign_menu->priv->iso_names == NULL) {
 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) {
-- 
2.5.5

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


Re: [virt-tools-list] [virt-viewer] mingw, spec: Bump msitools version

2016-06-23 Thread Eduardo Lima (Etrunko)
On 06/22/2016 07:59 AM, Fabiano Fidêncio wrote:
> Fedora 24 has GLib 2.48.0, which brings a new dependency: PCRE.
> The new dependency is already added to the wxi file (in msitools) and a
> new msitools build including the fix is already done [0].
> 
> Let's just bump the version in our spec file and make sure we will be
> using the msitools which includes the fix.
> 
> [0]: https://bodhi.fedoraproject.org/updates/FEDORA-2016-a7a2db6109
> ---
>  mingw-virt-viewer.spec.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mingw-virt-viewer.spec.in b/mingw-virt-viewer.spec.in
> index 3109f5f..06f1992 100644
> --- a/mingw-virt-viewer.spec.in
> +++ b/mingw-virt-viewer.spec.in
> @@ -65,7 +65,7 @@ BuildRequires:  icoutils
>  BuildRequires:  dos2unix
>  BuildRequires:  hicolor-icon-theme
>  BuildRequires:  hwdata
> -BuildRequires:  msitools >= 0.95-4
> +BuildRequires:  msitools >= 0.95-5
>  
>  BuildArch:  noarch
>  
> 
Acked-by: Eduardo Lima (Etrunko) <etru...@redhat.com>


-- 
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


[virt-tools-list] [PATCH v2] Avoid creating ovirt foreign menu item manually

2016-06-23 Thread Eduardo Lima (Etrunko)
This patch is a preparation for a upcoming UI change that will present
the ISO list in a separate dialog, instead of a submenu.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/remote-viewer.c | 23 +++
 src/resources/ui/virt-viewer.ui |  8 
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 71723cf..6d29bf2 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -738,29 +738,28 @@ ovirt_foreign_menu_update(GtkApplication *gtkapp, 
GtkWindow *gtkwin, G_GNUC_UNUS
 VirtViewerWindow *win = g_object_get_data(G_OBJECT(gtkwin), 
"virt-viewer-window");
 GtkWidget *menu = g_object_get_data(G_OBJECT(win), "foreign-menu");
 GtkWidget *submenu;
-GtkMenuShell *shell = 
GTK_MENU_SHELL(gtk_builder_get_object(virt_viewer_window_get_builder(win), 
"top-menu"));
 
 if (app->priv->ovirt_foreign_menu == NULL) {
 /* nothing to do */
 return;
 }
-if (menu == NULL) {
-menu = gtk_menu_item_new_with_label(_("_Change CD"));
-gtk_menu_item_set_use_underline(GTK_MENU_ITEM(menu), TRUE);
-gtk_menu_shell_append(shell, menu);
-g_object_set_data_full(G_OBJECT(win), "foreign-menu",
-   g_object_ref(menu),
-   (GDestroyNotify)gtk_widget_destroy);
-}
 
 submenu = ovirt_foreign_menu_get_gtk_menu(app->priv->ovirt_foreign_menu);
-if (submenu != NULL) {
-gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
-} else {
+if (submenu == NULL) {
 /* No items to show, no point in showing the menu */
+if (menu != NULL)
+   gtk_widget_set_visible(menu, FALSE);
 g_object_set_data(G_OBJECT(win), "foreign-menu", NULL);
+return;
+}
+
+if (menu == NULL) {
+menu = 
GTK_WIDGET(gtk_builder_get_object(virt_viewer_window_get_builder(win), 
"menu-change-cd"));
+g_object_set_data(G_OBJECT(win), "foreign-menu", menu);
+gtk_widget_set_visible(menu, TRUE);
 }
 
+gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
 gtk_widget_show_all(menu);
 }
 
diff --git a/src/resources/ui/virt-viewer.ui b/src/resources/ui/virt-viewer.ui
index 830a451..219e0af 100644
--- a/src/resources/ui/virt-viewer.ui
+++ b/src/resources/ui/virt-viewer.ui
@@ -243,6 +243,14 @@
 
   
 
+
+  
+False
+False
+_Change CD
+True
+  
+
   
   
 False
-- 
2.5.5

___
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 4/4] Fix missing field initializers

2016-06-23 Thread Eduardo Lima (Etrunko)
On 06/23/2016 10:26 AM, Pavel Grunt wrote:
> On Thu, 2016-06-23 at 10:15 -0300, Eduardo Lima (Etrunko) wrote:
>> On 06/22/2016 05:16 PM, Pavel Grunt wrote:
>>> On Wed, 2016-06-22 at 14:59 -0300, Eduardo Lima (Etrunko) wrote:
>>>> This is not actually necessary as of C99. You only need to initialize
>>>> any field of a structure to get all other fields initialized too.
>>>
>>> yes, I was just annoyed by the warning..
>>
>>
>> Interesting, can you share what was exactly the warning message? Clang
>> as a modern compiler should be able to handle this case.
>>
> 
> virt-viewer-window.c:1164:31: warning: missing field 'accel_mods' initializer
>   [-Wmissing-field-initializers]
> GtkAccelKey key = { 0 };
> 
> maybe it is needed to pass something like "--std=c99" to the compiler
> 

I suspect it is because accel_mods is a enum (GdkModifierType) and the
compiler would not know a default value for that one.


-- 
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


[virt-tools-list] [PATCH virt-viewer v2 0/2] Changes to ovirt-foreign menu

2016-06-23 Thread Eduardo Lima (Etrunko)
In this version:
 - Rebase to latest master
 - Better commit messages
 - Additional debug message if returning NULL in patch 2

Eduardo Lima (Etrunko) (2):
  Get ovirt foreign menu item from UI file
  Use more accurate debug messages for foreign menu

 src/ovirt-foreign-menu.c|  3 ++-
 src/remote-viewer.c | 23 +++
 src/resources/ui/virt-viewer.ui |  8 
 3 files changed, 21 insertions(+), 13 deletions(-)

-- 
2.5.5

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


[virt-tools-list] [PATCH virt-viewer v2 2/2] Use more accurate debug messages for foreign menu

2016-06-23 Thread Eduardo Lima (Etrunko)
Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/ovirt-foreign-menu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
index 9b552eb..2d286fb 100644
--- a/src/ovirt-foreign-menu.c
+++ b/src/ovirt-foreign-menu.c
@@ -465,10 +465,11 @@ GtkWidget 
*ovirt_foreign_menu_get_gtk_menu(OvirtForeignMenu *foreign_menu)
 GList *it;
 char *current_iso;
 
-g_debug("Creating GtkMenu for foreign menu");
 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) {
-- 
2.5.5

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


[virt-tools-list] [PATCH virt-viewer v2 1/2] Get ovirt foreign menu item from UI file

2016-06-23 Thread Eduardo Lima (Etrunko)
Currently the menu item is created manually, while this patch changes it to be
retrieved from the UI file, and decides if it needs to be shown or hidden if the
ISO list is received from ovirt.

This a preparation for a upcoming UI change that will present the ISO list in a
separate dialog, instead of a submenu.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/remote-viewer.c | 23 +++
 src/resources/ui/virt-viewer.ui |  8 
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 71723cf..6d29bf2 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -738,29 +738,28 @@ ovirt_foreign_menu_update(GtkApplication *gtkapp, 
GtkWindow *gtkwin, G_GNUC_UNUS
 VirtViewerWindow *win = g_object_get_data(G_OBJECT(gtkwin), 
"virt-viewer-window");
 GtkWidget *menu = g_object_get_data(G_OBJECT(win), "foreign-menu");
 GtkWidget *submenu;
-GtkMenuShell *shell = 
GTK_MENU_SHELL(gtk_builder_get_object(virt_viewer_window_get_builder(win), 
"top-menu"));
 
 if (app->priv->ovirt_foreign_menu == NULL) {
 /* nothing to do */
 return;
 }
-if (menu == NULL) {
-menu = gtk_menu_item_new_with_label(_("_Change CD"));
-gtk_menu_item_set_use_underline(GTK_MENU_ITEM(menu), TRUE);
-gtk_menu_shell_append(shell, menu);
-g_object_set_data_full(G_OBJECT(win), "foreign-menu",
-   g_object_ref(menu),
-   (GDestroyNotify)gtk_widget_destroy);
-}
 
 submenu = ovirt_foreign_menu_get_gtk_menu(app->priv->ovirt_foreign_menu);
-if (submenu != NULL) {
-gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
-} else {
+if (submenu == NULL) {
 /* No items to show, no point in showing the menu */
+if (menu != NULL)
+   gtk_widget_set_visible(menu, FALSE);
 g_object_set_data(G_OBJECT(win), "foreign-menu", NULL);
+return;
+}
+
+if (menu == NULL) {
+menu = 
GTK_WIDGET(gtk_builder_get_object(virt_viewer_window_get_builder(win), 
"menu-change-cd"));
+g_object_set_data(G_OBJECT(win), "foreign-menu", menu);
+gtk_widget_set_visible(menu, TRUE);
 }
 
+gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
 gtk_widget_show_all(menu);
 }
 
diff --git a/src/resources/ui/virt-viewer.ui b/src/resources/ui/virt-viewer.ui
index 5f767d1..6e3c5ad 100644
--- a/src/resources/ui/virt-viewer.ui
+++ b/src/resources/ui/virt-viewer.ui
@@ -247,6 +247,14 @@
 
   
 
+
+  
+False
+False
+_Change 
CD
+True
+  
+
   
   
 False
-- 
2.5.5

___
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 v2 0/2] Changes to ovirt-foreign menu

2016-06-24 Thread Eduardo Lima (Etrunko)
On 06/24/2016 04:16 AM, Christophe Fergeau wrote:
> Hey,
> 
> On Fri, Jun 24, 2016 at 02:44:07AM +0200, Fabiano Fidêncio wrote:
>> On Thu, Jun 23, 2016 at 7:15 PM, Eduardo Lima (Etrunko)
>> <etru...@redhat.com> wrote:
>>> In this version:
>>>  - Rebase to latest master
>>>  - Better commit messages
>>>  - Additional debug message if returning NULL in patch 2
>>>
>>> Eduardo Lima (Etrunko) (2):
>>>   Get ovirt foreign menu item from UI file
>>>   Use more accurate debug messages for foreign menu
>>>
>>>  src/ovirt-foreign-menu.c|  3 ++-
>>>  src/remote-viewer.c | 23 +++
>>>  src/resources/ui/virt-viewer.ui |  8 
>>>  3 files changed, 21 insertions(+), 13 deletions(-)
>>>
>>> --
>>> 2.5.5
>>>
>>> ___
>>> virt-tools-list mailing list
>>> virt-tools-list@redhat.com
>>> https://www.redhat.com/mailman/listinfo/virt-tools-list
>>
>> Both patches look good.
>> Acked-by: Fabiano Fidêncio <fiden...@redhat.com>
>>
>> Please, wait till Christophe's Ack before pushing, as he did the first
>> round of review.
> 
> Same for me,
> 
> Acked-by: Christophe Fergeau <cferg...@redhat.com>
> 


Thanks, pushed

-- 
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 2/2] Avoid unecessary debug message if returning NULL

2016-06-23 Thread Eduardo Lima (Etrunko)
On 06/23/2016 01:36 PM, Christophe Fergeau wrote:
> On Thu, Jun 23, 2016 at 10:13:25AM -0300, Eduardo Lima (Etrunko) wrote:
>> Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
>> ---
>>  src/ovirt-foreign-menu.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
>> index 9b552eb..959804d 100644
>> --- a/src/ovirt-foreign-menu.c
>> +++ b/src/ovirt-foreign-menu.c
>> @@ -465,10 +465,10 @@ GtkWidget 
>> *ovirt_foreign_menu_get_gtk_menu(OvirtForeignMenu *foreign_menu)
>>  GList *it;
>>  char *current_iso;
>>  
>> -g_debug("Creating GtkMenu for foreign menu");
>>  if (foreign_menu->priv->iso_names == NULL) {
>>  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) {
> 
> Fine with me. Actually it might be more useful to have a log when the
> Change CD menu does not show up because the iso name list is empty
> rather than having a log when something is going to be shown. So maybe
> add an additional g_debug() when NULL is returned?

Sure, does not hurt.

-- 
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 v2] Avoid creating ovirt foreign menu item manually

2016-06-23 Thread Eduardo Lima (Etrunko)
On 06/23/2016 01:35 PM, Christophe Fergeau wrote:
> This looks fine to me, however I'd rephrase the shortlog (or add to the
> long log) that we get the Change CD menu from the UI file rather than
> manually creating it. Before looking at the commit, I was not sure what
> this was about.

Okay fixed.

> 
> Christophe
> 
> On Thu, Jun 23, 2016 at 11:23:11AM -0300, Eduardo Lima (Etrunko) wrote:
>> This patch is a preparation for a upcoming UI change that will present
>> the ISO list in a separate dialog, instead of a submenu.
>>
>> Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
>> ---
>>  src/remote-viewer.c | 23 +++
>>  src/resources/ui/virt-viewer.ui |  8 
>>  2 files changed, 19 insertions(+), 12 deletions(-)
>>
>> diff --git a/src/remote-viewer.c b/src/remote-viewer.c
>> index 71723cf..6d29bf2 100644
>> --- a/src/remote-viewer.c
>> +++ b/src/remote-viewer.c
>> @@ -738,29 +738,28 @@ ovirt_foreign_menu_update(GtkApplication *gtkapp, 
>> GtkWindow *gtkwin, G_GNUC_UNUS
>>  VirtViewerWindow *win = g_object_get_data(G_OBJECT(gtkwin), 
>> "virt-viewer-window");
>>  GtkWidget *menu = g_object_get_data(G_OBJECT(win), "foreign-menu");
>>  GtkWidget *submenu;
>> -GtkMenuShell *shell = 
>> GTK_MENU_SHELL(gtk_builder_get_object(virt_viewer_window_get_builder(win), 
>> "top-menu"));
>>  
>>  if (app->priv->ovirt_foreign_menu == NULL) {
>>  /* nothing to do */
>>  return;
>>  }
>> -if (menu == NULL) {
>> -menu = gtk_menu_item_new_with_label(_("_Change CD"));
>> -gtk_menu_item_set_use_underline(GTK_MENU_ITEM(menu), TRUE);
>> -gtk_menu_shell_append(shell, menu);
>> -g_object_set_data_full(G_OBJECT(win), "foreign-menu",
>> -   g_object_ref(menu),
>> -   (GDestroyNotify)gtk_widget_destroy);
>> -}
>>  
>>  submenu = 
>> ovirt_foreign_menu_get_gtk_menu(app->priv->ovirt_foreign_menu);
>> -if (submenu != NULL) {
>> -gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
>> -} else {
>> +if (submenu == NULL) {
>>  /* No items to show, no point in showing the menu */
>> +if (menu != NULL)
>> +   gtk_widget_set_visible(menu, FALSE);
>>  g_object_set_data(G_OBJECT(win), "foreign-menu", NULL);
>> +return;
>> +}
>> +
>> +if (menu == NULL) {
>> +menu = 
>> GTK_WIDGET(gtk_builder_get_object(virt_viewer_window_get_builder(win), 
>> "menu-change-cd"));
>> +g_object_set_data(G_OBJECT(win), "foreign-menu", menu);
>> +gtk_widget_set_visible(menu, TRUE);
>>  }
>>  
>> +gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
>>  gtk_widget_show_all(menu);
>>  }
>>  
>> diff --git a/src/resources/ui/virt-viewer.ui 
>> b/src/resources/ui/virt-viewer.ui
>> index 830a451..219e0af 100644
>> --- a/src/resources/ui/virt-viewer.ui
>> +++ b/src/resources/ui/virt-viewer.ui
>> @@ -243,6 +243,14 @@
>>  
>>
>>  
>> +
>> +  
>> +False
>> +False
>> +_Change 
>> CD
>> +True
>> +  
>> +
>>
>>
>>  False
>> -- 
>> 2.5.5
>>
>> ___
>> virt-tools-list mailing list
>> virt-tools-list@redhat.com
>> https://www.redhat.com/mailman/listinfo/virt-tools-list


-- 
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


[virt-tools-list] [PATCH] Get rid of deprecated functions to customize widget colors

2016-06-27 Thread Eduardo Lima (Etrunko)
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=94276

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---

As a result of commit cc455b7f916110d7cfae6b7af753349e070c9494, setting
custom color for background does not work anymore on my Fedora 23
system. The status label still rendered with white color, but with the
background with default theme color (usually light grey), it has become
hard to read the text from the label.

I talked to Fabiano who told me that everything was working as expected
with his recently upgraded Fedora 24 system. While trying to track and
fix the issue, I noticed that it will only happen if the notebook tabs
are hidden. If tabs are shown, the background color will be properly
set.

I tracked down to Gtk+ some changes to GtkNotebook in recently released
version 3.20, which fixed the rendering of the custom background color,
with tabs hidden, but those could not be easily backported. Even though
it is a change of behavior in virt-viewer, I think it is really a minor
issue, and I decided to not spent too much time on this, so I put a
check for Gtk+ version to decide whether or not set the custom colors.

Some screenshots to illustrate:

Gtk+ > 3.20:
  http://imgur.com/gpuMukA

Gtk+ < 3.20:

  without this patch.: http://imgur.com/RdirSoX
  with this patch: http://imgur.com/9LJNeNI

---
 src/virt-viewer-notebook.c | 25 ++---
 src/virt-viewer-window.c   | 10 --
 2 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/src/virt-viewer-notebook.c b/src/virt-viewer-notebook.c
index 420c914..f02779c 100644
--- a/src/virt-viewer-notebook.c
+++ b/src/virt-viewer-notebook.c
@@ -71,25 +71,28 @@ static void
 virt_viewer_notebook_init (VirtViewerNotebook *self)
 {
 VirtViewerNotebookPrivate *priv;
-GdkRGBA color;
 
 self->priv = GET_PRIVATE(self);
 priv = self->priv;
 
-priv->status = gtk_label_new("");
+/* Check for Gtk+ 3.20 to set the custom colors, because with older 
versions
+ * it the background color will not be set correctly, so we will end up 
with
+ * the default theme color for background (usually light grey), while the
+ * foreground text color is white.
+ */
+if (gtk_check_version(3,20,0) == NULL) {
+GtkStyleContext *style = 
gtk_widget_get_style_context(GTK_WIDGET(self));
+GtkCssProvider *css = gtk_css_provider_new();
+gtk_css_provider_load_from_data(css, "* { background-color: black; 
color: white; }", -1, NULL);
+gtk_style_context_add_provider(style, GTK_STYLE_PROVIDER(css), 
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+}
+
 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(self), FALSE);
 gtk_notebook_set_show_border(GTK_NOTEBOOK(self), FALSE);
+
+priv->status = gtk_label_new("");
 gtk_widget_show_all(priv->status);
 gtk_notebook_append_page(GTK_NOTEBOOK(self), priv->status, NULL);
-gdk_rgba_parse(, "white");
-/* FIXME:
- * This method has been deprecated in 3.16.
- * For more details on how to deal with this in the future, please, see:
- * 
https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-override-color
- * For the bug report about this deprecated function, please, see:
- * https://bugs.freedesktop.org/show_bug.cgi?id=94276
- */
-gtk_widget_override_color(priv->status, GTK_STATE_FLAG_NORMAL, );
 }
 
 void
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 1ebb423..c59fff5 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -297,7 +297,6 @@ virt_viewer_window_init (VirtViewerWindow *self)
 {
 VirtViewerWindowPrivate *priv;
 GtkWidget *vbox;
-GdkRGBA color;
 GSList *accels;
 
 self->priv = GET_PRIVATE(self);
@@ -340,15 +339,6 @@ virt_viewer_window_init (VirtViewerWindow *self)
 virt_viewer_window_toolbar_setup(self);
 
 gtk_box_pack_end(GTK_BOX(vbox), GTK_WIDGET(priv->notebook), TRUE, TRUE, 0);
-gdk_rgba_parse(, "black");
-/* FIXME:
- * This method has been deprecated in 3.16.
- * For more details on how to deal with this in the future, please, see:
- * 
https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-override-background-color
- * For the bug report about this deprecated function, please, see:
- * https://bugs.freedesktop.org/show_bug.cgi?id=94276
- */
-gtk_widget_override_background_color(GTK_WIDGET(priv->notebook), 
GTK_STATE_FLAG_NORMAL, );
 
 priv->window = GTK_WIDGET(gtk_builder_get_object(priv->builder, "viewer"));
 gtk_window_add_accel_group(GTK_WINDOW(priv->window), priv->accel_group);
-- 
2.5.5

___
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/2] display: Remove zoom property

2016-02-05 Thread Eduardo Lima (Etrunko)
I guess this change answers the question I asked in the previous email. :)

Acked-by: Eduardo Lima (Etrunko) <etru...@redhat.com>

On 02/05/2016 01:27 PM, Pavel Grunt wrote:
> It is possible to get the same info from the "zoom-level" property.
> virt_viewer_display_get_zoom() now returns TRUE if zoom level != 100
> ---
>  src/virt-viewer-display.c | 26 ++
>  1 file changed, 2 insertions(+), 24 deletions(-)
> 
> diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
> index a289b6f..bac0c7c 100644
> --- a/src/virt-viewer-display.c
> +++ b/src/virt-viewer-display.c
> @@ -43,7 +43,6 @@ struct _VirtViewerDisplayPrivate
>  guint desktopWidth;
>  guint desktopHeight;
>  guint zoom_level;
> -gboolean zoom;
>  gint nth_display; /* Monitor number inside the guest */
>  gint monitor; /* Monitor number on the client */
>  guint show_hint;
> @@ -130,14 +129,6 @@ virt_viewer_display_class_init(VirtViewerDisplayClass 
> *class)
>   G_PARAM_READWRITE));
>  
>  g_object_class_install_property(object_class,
> -PROP_ZOOM,
> -g_param_spec_boolean("zoom",
> - "Zoom",
> - "Zoom",
> - TRUE,
> - G_PARAM_READWRITE));
> -
> -g_object_class_install_property(object_class,
>  PROP_ZOOM_LEVEL,
>  g_param_spec_int("zoom-level",
>   "Zoom",
> @@ -277,7 +268,6 @@ virt_viewer_display_init(VirtViewerDisplay *display)
>  display->priv->desktopWidth = MIN_DISPLAY_WIDTH;
>  display->priv->desktopHeight = MIN_DISPLAY_HEIGHT;
>  display->priv->zoom_level = NORMAL_ZOOM_LEVEL;
> -display->priv->zoom = TRUE;
>  #if !GTK_CHECK_VERSION(3, 0, 0)
>  display->priv->dirty = TRUE;
>  display->priv->size_request_once = FALSE;
> @@ -388,7 +378,7 @@ void 
> virt_viewer_display_get_preferred_size(VirtViewerDisplay *self,
>  requisition->width = border_width * 2;
>  requisition->height = border_width * 2;
>  
> -if (priv->zoom) {
> +if (virt_viewer_display_get_zoom(display)) {
>  requisition->width += round(priv->desktopWidth * priv->zoom_level / 
> (double) NORMAL_ZOOM_LEVEL);
>  requisition->height += round(priv->desktopHeight * priv->zoom_level 
> / (double) NORMAL_ZOOM_LEVEL);
>  } else {
> @@ -627,21 +617,9 @@ guint 
> virt_viewer_display_get_zoom_level(VirtViewerDisplay *display)
>  return priv->zoom_level;
>  }
>  
> -
> -void virt_viewer_display_set_zoom(VirtViewerDisplay *display,
> -  gboolean zoom)
> -{
> -VirtViewerDisplayPrivate *priv = display->priv;
> -
> -priv->zoom = zoom;
> -virt_viewer_display_queue_resize(display);
> -}
> -
> -
>  gboolean virt_viewer_display_get_zoom(VirtViewerDisplay *display)
>  {
> -VirtViewerDisplayPrivate *priv = display->priv;
> -return priv->zoom;
> +return virt_viewer_display_get_zoom_level(display) != NORMAL_ZOOM_LEVEL;
>  }
>  
>  
> 


-- 
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 1/2] display: Use common code to get preferred size

2016-02-05 Thread Eduardo Lima (Etrunko)
On 02/05/2016 01:27 PM, Pavel Grunt wrote:
> ---
>  src/virt-viewer-display.c | 52 
> ---
>  1 file changed, 31 insertions(+), 21 deletions(-)
> 
> diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
> index 654cada..a289b6f 100644
> --- a/src/virt-viewer-display.c
> +++ b/src/virt-viewer-display.c
> @@ -448,24 +448,39 @@ virt_viewer_display_make_resizable(VirtViewerDisplay 
> *self)
>  
>  #else
>  
> +static void 
> virt_viewer_display_get_preferred_dimension_from_desktop(VirtViewerDisplay 
> *display,
> + const 
> int minimal_size,
> + const 
> int desktop_dim,
> + int 
> *minimal_dim,
> + int 
> *preferred_dim)
> +{
> +int border_width = 
> gtk_container_get_border_width(GTK_CONTAINER(display));
> +
> +if (virt_viewer_display_get_zoom(display)) {
> +guint zoom_level = virt_viewer_display_get_zoom_level(display);

The functions you removed access these fields directly? Any reason for
not doing it?

Acked-by: Eduardo Lima (Etrunko) <etru...@redhat.com>

> +*preferred_dim = round(desktop_dim * zoom_level / (double) 
> NORMAL_ZOOM_LEVEL);
> +*minimal_dim = round(minimal_size * zoom_level / (double) 
> NORMAL_ZOOM_LEVEL);
> +} else {
> +*preferred_dim = desktop_dim;
> +*minimal_dim = minimal_size;
> +}
> +*preferred_dim += 2 * border_width;
> +*minimal_dim += 2 * border_width;
> +}
> +
> +
>  static void virt_viewer_display_get_preferred_width(GtkWidget *widget,
>  int *minwidth,
>  int *defwidth)
>  {
>  VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(widget);
>  VirtViewerDisplayPrivate *priv = display->priv;
> -int border_width = gtk_container_get_border_width(GTK_CONTAINER(widget));
> -
>  
> -if (priv->zoom) {
> -*defwidth = round(priv->desktopWidth * priv->zoom_level / (double) 
> NORMAL_ZOOM_LEVEL);
> -*minwidth = round(MIN_DISPLAY_WIDTH * priv->zoom_level / (double) 
> NORMAL_ZOOM_LEVEL);
> -} else {
> -*defwidth = priv->desktopWidth;
> -*minwidth = MIN_DISPLAY_WIDTH;
> -}
> -*defwidth += 2 * border_width;
> -*minwidth += 2 * border_width;
> +virt_viewer_display_get_preferred_dimension_from_desktop(display,
> + 
> MIN_DISPLAY_WIDTH,
> + 
> priv->desktopWidth,
> + minwidth,
> + defwidth);
>  }
>  
>  
> @@ -475,17 +490,12 @@ static void 
> virt_viewer_display_get_preferred_height(GtkWidget *widget,
>  {
>  VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(widget);
>  VirtViewerDisplayPrivate *priv = display->priv;
> -int border_height = 
> gtk_container_get_border_width(GTK_CONTAINER(widget));
>  
> -if (priv->zoom) {
> -*defheight = round(priv->desktopHeight * priv->zoom_level / (double) 
> NORMAL_ZOOM_LEVEL);
> -*minheight = round(MIN_DISPLAY_HEIGHT * priv->zoom_level / (double) 
> NORMAL_ZOOM_LEVEL);
> -} else {
> -*defheight = priv->desktopHeight;
> -*minheight = MIN_DISPLAY_HEIGHT;
> -}
> -*defheight += 2 * border_height;
> -*minheight += 2 * border_height;
> +virt_viewer_display_get_preferred_dimension_from_desktop(display,
> + 
> MIN_DISPLAY_HEIGHT,
> + 
> priv->desktopHeight,
> + minheight,
> + defheight);
>  }
>  #endif
>  
> 


-- 
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


[virt-tools-list] [PATCH v3 3/5] Port to GtkApplication API's

2016-02-12 Thread Eduardo Lima (Etrunko)
Most of this patch consists in code being shuffled around to fit the
expected flow while using the new APIs. I tried my best to make this
patch the less intrusive as possible. Main changes are:

- Updated build requirements
   * glib version 2.38
   * gtk+ version 3.10
   * gio

- VirtViewerApp is now a subclass of GtkApplication.
  Some mainloop calls were replaced:
   * gtk_main() -> g_application_run()
   * gtk_quit() -> g_application_quit()

- Unified command line option handling.
  The logic has moved from the main functions and split in common
  options, and specific ones for each application. With this, the main
  functions were highly simplified, and now basically responsible for
  instantiating the App object and running the main loop.

- All Window objects must be associated with the Application.
  With this, there is no need to emit our own 'window-added'/'window-
  removed' signals, as those will be emited by GtkApplication whenever
  gtk_application_add_window() and gtk_application_remove_window() are
  called. Also, 'window-removed' was not being used anywhere.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 configure.ac |   6 +-
 src/remote-viewer-main.c | 163 +
 src/remote-viewer.c  | 207 +++
 src/remote-viewer.h  |   4 +-
 src/virt-viewer-app.c| 144 -
 src/virt-viewer-app.h|  11 +--
 src/virt-viewer-main.c   | 104 ++--
 src/virt-viewer-util.h   |   1 +
 src/virt-viewer-window.c |   4 +-
 src/virt-viewer.c| 137 +--
 src/virt-viewer.h|   9 +--
 src/virt-viewer.xml  |   2 +-
 12 files changed, 394 insertions(+), 398 deletions(-)

diff --git a/configure.ac b/configure.ac
index 250a7fe..e09d0cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,10 +12,10 @@ AC_CANONICAL_HOST
 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
 AM_SILENT_RULES([yes])
 
-GLIB2_REQUIRED=2.22.0
+GLIB2_REQUIRED="2.38.0"
 LIBXML2_REQUIRED="2.6.0"
 LIBVIRT_REQUIRED="0.10.0"
-GTK3_REQUIRED="3.0"
+GTK3_REQUIRED="3.10"
 GTK_VNC2_REQUIRED="0.4.0"
 SPICE_GTK_REQUIRED="0.30"
 SPICE_PROTOCOL_REQUIRED="0.12.7"
@@ -93,7 +93,7 @@ PKG_PROG_PKG_CONFIG
 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
 AC_SUBST(GLIB_MKENUMS)
 
-PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQUIRED gthread-2.0 
gmodule-export-2.0)
+PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQUIRED gio-2.0 gthread-2.0 
gmodule-export-2.0)
 PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED)
 
 AC_ARG_WITH([libvirt],
diff --git a/src/remote-viewer-main.c b/src/remote-viewer-main.c
index 81cf736..b0932c5 100644
--- a/src/remote-viewer-main.c
+++ b/src/remote-viewer-main.c
@@ -22,184 +22,29 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-#ifdef G_OS_WIN32
-#include 
-#include 
-#endif
-
-#ifdef HAVE_GTK_VNC
-#include 
-#endif
-#ifdef HAVE_SPICE_GTK
-#include 
-#endif
-#ifdef HAVE_OVIRT
-#include 
-#endif
 
 #include "remote-viewer.h"
-#include "virt-viewer-app.h"
-#include "virt-viewer-session.h"
-
-static void
-remote_viewer_version(void)
-{
-g_print(_("remote-viewer version %s"), VERSION BUILDID);
-#ifdef REMOTE_VIEWER_OS_ID
-g_print(" (OS ID: %s)", REMOTE_VIEWER_OS_ID);
-#endif
-g_print("\n");
-exit(EXIT_SUCCESS);
-}
-
-static void
-recent_add(gchar *uri, const gchar *mime_type)
-{
-GtkRecentManager *recent;
-GtkRecentData meta = {
-.app_name = (char*)"remote-viewer",
-.app_exec = (char*)"remote-viewer %u",
-.mime_type= (char*)mime_type,
-};
-
-if (uri == NULL)
-return;
-
-recent = gtk_recent_manager_get_default();
-meta.display_name = uri;
-if (!gtk_recent_manager_add_full(recent, uri, ))
-g_warning("Recent item couldn't be added");
-}
-
-static void connected(VirtViewerSession *session,
-  VirtViewerApp *self G_GNUC_UNUSED)
-{
-gchar *uri = virt_viewer_session_get_uri(session);
-const gchar *mime = virt_viewer_session_mime_type(session);
-
-recent_add(uri, mime);
-g_free(uri);
-}
 
 int
 main(int argc, char **argv)
 {
-GOptionContext *context;
-GError *error = NULL;
 int ret = 1;
-gchar **args = NULL;
-gchar *uri = NULL;
-char *title = NULL;
 RemoteViewer *viewer = NULL;
-#ifdef HAVE_SPICE_GTK
-gboolean controller = FALSE;
-#endif
-VirtViewerApp *app;
-const GOptionEntry options [] = {
-{ "version", 'V', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-  remote_viewer_version, N_("Display version information"), NULL },
-{ "title", 't', 0, G_OPTION_ARG_ST

[virt-tools-list] [PATCH v3 5/5] Drop old compatibility code

2016-02-12 Thread Eduardo Lima (Etrunko)
With glib requirements now being 2.38, these functions do not make sense anymore

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/virt-glib-compat.c | 15 ---
 src/virt-glib-compat.h | 27 ---
 2 files changed, 42 deletions(-)

diff --git a/src/virt-glib-compat.c b/src/virt-glib-compat.c
index c15ff28..04d5c8c 100644
--- a/src/virt-glib-compat.c
+++ b/src/virt-glib-compat.c
@@ -17,18 +17,3 @@
 
 #include "virt-glib-compat.h"
 
-#if !GLIB_CHECK_VERSION(2,32,0)
-GByteArray *g_byte_array_new_take (guint8 *data, gsize len)
-{
-  GByteArray *array;
-
-  array = g_byte_array_new ();
-  g_assert (array->data == NULL);
-  g_assert (array->len == 0);
-
-  array->data = data;
-  array->len = len;
-
-  return array;
-}
-#endif
diff --git a/src/virt-glib-compat.h b/src/virt-glib-compat.h
index 1242289..23345a0 100644
--- a/src/virt-glib-compat.h
+++ b/src/virt-glib-compat.h
@@ -51,33 +51,6 @@ G_BEGIN_DECLS
   } G_STMT_END
 #endif
 
-#if !GLIB_CHECK_VERSION(2,28,0)
-#define g_clear_object(object_ptr) \
-  G_STMT_START { \
-/* Only one access, please */\
-gpointer *_p = (gpointer) (object_ptr);  \
-gpointer _o; \
- \
-do   \
-  _o = g_atomic_pointer_get (_p);\
-while G_UNLIKELY (!g_atomic_pointer_compare_and_exchange (_p, _o, NULL));\
- \
-if (_o)  \
-  g_object_unref (_o);   \
-  } G_STMT_END
-#endif
-
-#if !GLIB_CHECK_VERSION(2,32,0)
-GByteArray *g_byte_array_new_take (guint8 *data, gsize len);
-
-#define G_SOURCE_CONTINUE   TRUE
-#define G_SOURCE_REMOVE FALSE
-#endif
-
-#if GLIB_CHECK_VERSION(2,31,0)
-#define g_mutex_new() g_new0(GMutex, 1)
-#endif
-
 G_END_DECLS
 
 #endif // _VIRT_GLIB_COMPAT_H
-- 
2.5.0

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


[virt-tools-list] [PATCH v3 2/5] Minor code cleanups

2016-02-12 Thread Eduardo Lima (Etrunko)
- Reuse #ifdef HAVE_SPICE_GTK block for include.
- Move declaration of vfunc together with others of the same class.
- Move variable declaration to the top of the function.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/remote-viewer.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 8e4754f..e712d61 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -36,11 +36,9 @@
 
 #ifdef HAVE_SPICE_GTK
 #include 
-#endif
-
-#ifdef HAVE_SPICE_GTK
 #include "virt-viewer-session-spice.h"
 #endif
+
 #include "virt-viewer-app.h"
 #include "virt-viewer-auth.h"
 #include "virt-viewer-file.h"
@@ -195,10 +193,10 @@ remote_viewer_class_init (RemoteViewerClass *klass)
 
 object_class->get_property = remote_viewer_get_property;
 object_class->set_property = remote_viewer_set_property;
+object_class->dispose = remote_viewer_dispose;
 
 app_class->start = remote_viewer_start;
 app_class->deactivated = remote_viewer_deactivated;
-object_class->dispose = remote_viewer_dispose;
 #ifdef HAVE_SPICE_GTK
 app_class->activate = remote_viewer_activate;
 app_class->window_added = remote_viewer_window_added;
@@ -617,10 +615,13 @@ spice_ctrl_listen_async_cb(GObject *object,
 static gboolean
 remote_viewer_activate(VirtViewerApp *app, GError **error)
 {
-g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
-RemoteViewer *self = REMOTE_VIEWER(app);
+RemoteViewer *self;
 gboolean ret = FALSE;
 
+g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
+
+self = REMOTE_VIEWER(app);
+
 if (self->priv->controller) {
 SpiceSession *session = remote_viewer_get_spice_session(self);
 ret = spice_session_connect(session);
-- 
2.5.0

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


[virt-tools-list] [PATCH v3 4/5] remote-viewer: Remove unused properties

2016-02-12 Thread Eduardo Lima (Etrunko)
The reason for using properties to access those members was to ensure
that they would only be set during the creation of the object. Now that
we removed that restriction, we set private members directly.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/remote-viewer.c | 101 +++-
 1 file changed, 4 insertions(+), 97 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 0e15d2f..1c3cd84 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -67,15 +67,6 @@ 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 {
-PROP_0,
-#ifdef HAVE_SPICE_GTK
-PROP_CONTROLLER,
-PROP_CTRL_FOREIGN_MENU,
-#endif
-PROP_OPEN_RECENT_DIALOG
-};
-
 #ifdef HAVE_OVIRT
 static OvirtVm * choose_vm(GtkWindow *main_window,
char **vm_name,
@@ -122,56 +113,6 @@ remote_viewer_dispose (GObject *object)
 }
 
 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_SPICE_GTK
-case PROP_CONTROLLER:
-g_value_set_object(value, priv->controller);
-break;
-case PROP_CTRL_FOREIGN_MENU:
-g_value_set_object(value, priv->ctrl_foreign_menu);
-break;
-#endif
-case PROP_OPEN_RECENT_DIALOG:
-g_value_set_boolean(value, priv->open_recent_dialog);
-break;
-default:
-G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-}
-
-static void
-remote_viewer_set_property (GObject *object, guint property_id,
-const GValue *value, GParamSpec *pspec)
-{
-RemoteViewer *self = REMOTE_VIEWER(object);
-RemoteViewerPrivate *priv = self->priv;
-
-switch (property_id) {
-#ifdef HAVE_SPICE_GTK
-case PROP_CONTROLLER:
-g_return_if_fail(priv->controller == NULL);
-priv->controller = g_value_dup_object(value);
-break;
-case PROP_CTRL_FOREIGN_MENU:
-g_return_if_fail(priv->ctrl_foreign_menu == NULL);
-priv->ctrl_foreign_menu = g_value_dup_object(value);
-break;
-#endif
-case PROP_OPEN_RECENT_DIALOG:
-priv->open_recent_dialog = g_value_get_boolean(value);
-break;
-default:
-G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-}
-
-static void
 remote_viewer_deactivated(VirtViewerApp *app, gboolean connect_error)
 {
 RemoteViewer *self = REMOTE_VIEWER(app);
@@ -271,20 +212,14 @@ remote_viewer_local_command_line (GApplication   *gapp,
 GOTO_END;
 } 
 
-SpiceCtrlController *ctrl = spice_ctrl_controller_new();
-SpiceCtrlForeignMenu *menu = spice_ctrl_foreign_menu_new();
+self->priv->controller = spice_ctrl_controller_new();
+self->priv->ctrl_foreign_menu = spice_ctrl_foreign_menu_new();
 
-g_object_set(self, "guest-name", "defined by Spice controller",
-   "controller", ctrl,
-   "foreign-menu", menu,
-   NULL);
+g_object_set(self, "guest-name", "defined by Spice controller", NULL);
 
-g_signal_connect(menu, "notify::title",
+g_signal_connect(self->priv->ctrl_foreign_menu, "notify::title",
  G_CALLBACK(foreign_menu_title_changed),
  self);
-
-g_object_unref(ctrl);
-g_object_unref(menu);
 }
 #endif
 
@@ -311,8 +246,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
 
 g_type_class_add_private (klass, sizeof (RemoteViewerPrivate));
 
-object_class->get_property = remote_viewer_get_property;
-object_class->set_property = remote_viewer_set_property;
 object_class->dispose = remote_viewer_dispose;
 
 g_app_class->local_command_line = remote_viewer_local_command_line;
@@ -322,36 +255,10 @@ remote_viewer_class_init (RemoteViewerClass *klass)
 app_class->add_option_entries = remote_viewer_add_option_entries;
 #ifdef HAVE_SPICE_GTK
 app_class->activate = remote_viewer_activate;
-
 gtk_app_class->window_added = remote_viewer_window_added;
-
-g_object_class_install_property(object_class,
-PROP_CONTROLLER,
-g_param_spec_object("controller",
-"Controller",
-"

[virt-tools-list] [PATCH v3 1/5] Drop support to gtk2

2016-02-12 Thread Eduardo Lima (Etrunko)
From: Fabiano Fidêncio 

The 3.0 release was the last one that still supports GTK2. For the
Windows builds the support to GTK2 was dropped in the previous release.
Let's do the same for the entire project now.
---
 configure.ac  | 39 +++
 src/view/autoDrawer.c | 10 -
 src/view/ovBox.c  | 45 --
 src/virt-gtk-compat.h | 12 --
 src/virt-viewer-display.c | 96 +--
 src/virt-viewer-window.c  | 10 -
 virt-viewer.spec.in   | 23 
 7 files changed, 6 insertions(+), 229 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8aa80ca..250a7fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,9 +15,7 @@ AM_SILENT_RULES([yes])
 GLIB2_REQUIRED=2.22.0
 LIBXML2_REQUIRED="2.6.0"
 LIBVIRT_REQUIRED="0.10.0"
-GTK2_REQUIRED="2.18.0"
 GTK3_REQUIRED="3.0"
-GTK_VNC1_REQUIRED="0.3.8"
 GTK_VNC2_REQUIRED="0.4.0"
 SPICE_GTK_REQUIRED="0.30"
 SPICE_PROTOCOL_REQUIRED="0.12.7"
@@ -26,9 +24,7 @@ GOVIRT_REQUIRED="0.3.2"
 AC_SUBST([GLIB2_REQUIRED])
 AC_SUBST([LIBXML2_REQUIRED])
 AC_SUBST([LIBVIRT_REQUIRED])
-AC_SUBST([GTK2_REQUIRED])
 AC_SUBST([GTK3_REQUIRED])
-AC_SUBST([GTK_VNC1_REQUIRED])
 AC_SUBST([GTK_VNC2_REQUIRED])
 AC_SUBST([SPICE_GTK_REQUIRED])
 AC_SUBST([SPICE_PROTOCOL_REQUIRED])
@@ -121,36 +117,15 @@ AC_CHECK_LIB([virt],
  [AC_DEFINE([HAVE_VIR_DOMAIN_OPEN_GRAPHICS_FD], 1, [Have 
virDomainOpenGraphicsFD?])])
 LIBS=$old_LIBS
 
-AC_MSG_CHECKING([which gtk+ version to compile against])
-AC_ARG_WITH([gtk],
-  [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against 
(default: 3.0)])],
-  [case "$with_gtk" in
- 2.0|3.0) ;;
- *) AC_MSG_ERROR([invalid gtk version specified]) ;;
-   esac],
-  [with_gtk=3.0])
-AC_MSG_RESULT([$with_gtk])
-
-case "$with_gtk" in
-  2.0) GTK_API_VERSION=2.0
-   GTK_REQUIRED=$GTK2_REQUIRED
-   GTK_VNC_REQUIRED=$GTK_VNC1_REQUIRED
-   GTK_VNC_API_VERSION=1.0
-   SPICE_GTK_API_VERSION=2.0
-   ;;
-  3.0) GTK_API_VERSION=3.0
-   GTK_REQUIRED=$GTK3_REQUIRED
-   GTK_VNC_REQUIRED=$GTK_VNC2_REQUIRED
-   GTK_VNC_API_VERSION=2.0
-   SPICE_GTK_API_VERSION=3.0
-   ;;
-esac
+GTK_API_VERSION=3.0
+GTK_REQUIRED=$GTK3_REQUIRED
+GTK_VNC_REQUIRED=$GTK_VNC2_REQUIRED
+GTK_VNC_API_VERSION=2.0
+SPICE_GTK_API_VERSION=3.0
 
 AC_SUBST([GTK_API_VERSION])
 AC_SUBST([GTK_REQUIRED])
 AC_SUBST([GTK_VNC_API_VERSION])
-AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
-AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
 
 PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
 
@@ -275,10 +250,6 @@ AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Configuration summary])
 AC_MSG_NOTICE([=])
 AC_MSG_NOTICE([])
-AC_MSG_NOTICE([ Features:])
-AC_MSG_NOTICE([])
-AC_MSG_NOTICE([  Gtk: $with_gtk])
-AC_MSG_NOTICE([])
 AC_MSG_NOTICE([ Libraries:])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([   GLIB2: $GLIB2_CFLAGS $GLIB2_LIBS])
diff --git a/src/view/autoDrawer.c b/src/view/autoDrawer.c
index cbf92de..2ae106c 100644
--- a/src/view/autoDrawer.c
+++ b/src/view/autoDrawer.c
@@ -218,7 +218,6 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
if (gtk_widget_get_window(priv->evBox)) {
   int x;
   int y;
-#if GTK_CHECK_VERSION(3, 0, 0)
   GdkDevice *dev;
   GdkDeviceManager *devmgr;
 
@@ -227,9 +226,6 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
 
   gdk_window_get_device_position(gtk_widget_get_window(priv->evBox),
  dev, , , NULL);
-#else
-  gtk_widget_get_pointer(priv->evBox, , );
-#endif
 
   gtk_widget_get_allocation(priv->evBox, );
   g_assert(gtk_container_get_border_width(   GTK_CONTAINER(priv->evBox))
@@ -262,16 +258,10 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
if (!priv->inputUngrabbed) {
   GtkWidget *grabbed = NULL;
 
-#if GTK_CHECK_VERSION(3, 0, 0)
   if (gtk_window_has_group (window)) {
 GtkWindowGroup *group = gtk_window_get_group (window);
 grabbed = gtk_window_group_get_current_grab (group);
   }
-#else
-  if (window->group && window->group->grabs) {
-grabbed = GTK_WIDGET(window->group->grabs->data);
-  }
-#endif
   if (!grabbed) {
  grabbed = gtk_grab_get_current();
   }
diff --git a/src/view/ovBox.c b/src/view/ovBox.c
index 185b0b7..fa56fd5 100644
--- a/src/view/ovBox.c
+++ b/src/view/ovBox.c
@@ -76,13 +76,6 @@
 
 #include "ovBox.h"
 
-#if ! GTK_CHECK_VERSION(3, 0, 0)
-#define gtk_widget_set_realized(widget, val)\
-  GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED)
-#define gtk_widget_get_realized(widget)\
-  GTK_WIDGET_REALIZED(widget)
-#endif
-
 struct _ViewOvBoxPrivate
 {
GdkWindow *underWin;
@@ -338,22 +331,12 @@ static void
 ViewOvBoxSetBackground(ViewOvBox *that) // IN
 {
GtkWidget *widget = GTK_WIDGET(that);
-
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *stylecontext;
 
stylecontext = 

[virt-tools-list] [PATCH virt-viewer v3 0/5] Port to GtkApplication API's

2016-02-12 Thread Eduardo Lima (Etrunko)
This is the reworked series which should be compatible with glib version 2.38
onwards. Option handling is still done with GOption API's but follows the same
ideas proposed on previous versions of the patch.

Again, the two first patches are kind of independent from the rest of the
series, and it would be good to have those pushed, avoiding the maintenance
burden outside of the tree.

Eduardo Lima (Etrunko) (4):
  Minor code cleanups
  Port to GtkApplication API's
  remote-viewer: Remove unused properties
  Drop old compatibility code

Fabiano Fidêncio (1):
  Drop support to gtk2

 configure.ac  |  45 ++--
 src/remote-viewer-main.c  | 163 +-
 src/remote-viewer.c   | 287 +++---
 src/remote-viewer.h   |   4 +-
 src/view/autoDrawer.c |  10 --
 src/view/ovBox.c  |  45 
 src/virt-glib-compat.c|  15 ---
 src/virt-glib-compat.h|  27 -
 src/virt-gtk-compat.h |  12 --
 src/virt-viewer-app.c | 144 ++-
 src/virt-viewer-app.h |  11 +-
 src/virt-viewer-display.c |  96 +---
 src/virt-viewer-main.c| 104 +
 src/virt-viewer-util.h|   1 +
 src/virt-viewer-window.c  |  14 +--
 src/virt-viewer.c | 137 +-
 src/virt-viewer.h |   9 +-
 src/virt-viewer.xml   |   2 +-
 virt-viewer.spec.in   |  23 
 19 files changed, 394 insertions(+), 755 deletions(-)

-- 
2.5.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 v3 3/5] Port to GtkApplication API's

2016-02-12 Thread Eduardo Lima (Etrunko)
Running remote-viewer will throw some warnings:

(remote-viewer:546): Gtk-CRITICAL **: gtk_application_get_app_menu:
assertion 'GTK_IS_APPLICATION (application)' failed

(remote-viewer:546): Gtk-CRITICAL **: gtk_application_get_menubar:
assertion 'GTK_IS_APPLICATION (application)' failed

This does not happen with virt-viewer. I attached the gdb backtrace to
this mail.

On 02/12/2016 09:35 AM, Eduardo Lima (Etrunko) wrote:
[snip]

> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 653b30c..5b0e720 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -1868,25 +1867,81 @@ virt_viewer_app_constructed(GObject *object)
>  gtk_accel_map_add_entry("/view/zoom-out", GDK_minus, 
> GDK_CONTROL_MASK);
>  gtk_accel_map_add_entry("/view/zoom-in", GDK_plus, 
> GDK_CONTROL_MASK);
>  gtk_accel_map_add_entry("/send/secure-attention", GDK_End, 
> GDK_CONTROL_MASK | GDK_MOD1_MASK);
> +
> +if (!virt_viewer_app_start(self, )) {
> +if (error && !g_error_matches(error, VIRT_VIEWER_ERROR, 
> VIRT_VIEWER_ERROR_CANCELLED)) {
> +virt_viewer_app_simple_message_dialog(self, error->message);
> +}
> +
> +g_clear_error();
> +g_application_quit(app);
> +}
> +
> +g_application_hold(app);

Again, this call to _hold() is only necessary for remote-viewer,
otherwise the application will quit the mainloop before showing the main
window. This is not necessary for virt-viewer, and I tried to track the
reason, without success. Maybe someone can help here.

> +}
> +
> +static gboolean
> +virt_viewer_app_local_command_line (GApplication   *gapp,
> +gchar***args,
> +int*status)
> +{
> +VirtViewerApp *self = VIRT_VIEWER_APP(gapp);
> +gboolean ret = FALSE;
> +gint argc = g_strv_length(*args);
> +GError *error = NULL;
> +GOptionContext *context = g_option_context_new(NULL);
> +GOptionGroup *group = g_option_group_new("virt-viewer", NULL, NULL, 
> NULL, NULL);
> +
> +g_option_context_set_main_group(context, group);
> +VIRT_VIEWER_APP_GET_CLASS(self)->add_option_entries(self, context, 
> group);
> +
> +g_option_context_add_group(context, gtk_get_option_group(TRUE));
> +
> +#ifdef HAVE_GTK_VNC
> +g_option_context_add_group(context, vnc_display_get_option_group());
> +#endif
> +
> +#ifdef HAVE_SPICE_GTK
> +g_option_context_add_group(context, spice_get_option_group());
> +#endif
> +
> +if (!g_option_context_parse(context, , args, ))
> +{
> +if (error && !g_error_matches(error, VIRT_VIEWER_ERROR, 
> VIRT_VIEWER_VERSION)) {
> +g_printerr(_("%s\n"), error->message);
> +*status = 1;
> +}
> +
> +g_error_free(error);
> +ret = TRUE;
> +}
> +
> +g_option_context_free(context);
> +return ret;
>  }
>  
>  static void
>  virt_viewer_app_class_init (VirtViewerAppClass *klass)
>  {
>  GObjectClass *object_class = G_OBJECT_CLASS (klass);
> +GApplicationClass *g_app_class = G_APPLICATION_CLASS(klass);
>  
>  g_type_class_add_private (klass, sizeof (VirtViewerAppPrivate));
>  
> -object_class->constructed = virt_viewer_app_constructed;
>  object_class->get_property = virt_viewer_app_get_property;
>  object_class->set_property = virt_viewer_app_set_property;
>  object_class->dispose = virt_viewer_app_dispose;
>  
> +g_app_class->local_command_line = virt_viewer_app_local_command_line;
> +g_app_class->startup = virt_viewer_app_startup;
> +g_app_class->command_line = NULL; /* inhibit GApplication default 
> handler */
> +

In this case we set the handler to NULL to avoid some warnings that will
be thrown by the default handler. We could have defined a function which
did nothing, as all command line options were already handled in
local_command_line().


-- 
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etru...@redhat.com

Breakpoint 1, gtk_application_get_app_menu (application=0x0) at 
gtkapplication.c:1102
warning: Source file is more recent than executable.
1102
Missing separate debuginfos, use: dnf debuginfo-install 
bzip2-libs-1.0.6-19.fc23.x86_64 libgcc-5.3.1-2.fc23.x86_64
(gdb) bt
#0 gtk_application_get_app_menu (application=0x0) at gtkapplication.c:1102
#1 0x76c0e751 in gtk_application_window_update_shell_shows_app_menu 
(window=0x6d6270, settings=) at gtkapplicationwindow.c:319
#2 0x76c0e8e3 in gtk_application_window_real_realize (widget=0x6d6270) 
at gtkapplicationwindow.c:752
#3 0x74480ad4 in _g_closure_invoke_va (closure=closure@

Re: [virt-tools-list] [PATCH v3 3/5] Port to GtkApplication API's

2016-02-12 Thread Eduardo Lima (Etrunko)
On 02/12/2016 10:09 AM, Eduardo Lima (Etrunko) wrote:
> Running remote-viewer will throw some warnings:
> 
> (remote-viewer:546): Gtk-CRITICAL **: gtk_application_get_app_menu:
> assertion 'GTK_IS_APPLICATION (application)' failed
> 
> (remote-viewer:546): Gtk-CRITICAL **: gtk_application_get_menubar:
> assertion 'GTK_IS_APPLICATION (application)' failed
> 
> This does not happen with virt-viewer. I attached the gdb backtrace to
> this mail.
> 

Fidencio just pointed out that these warnings won't happen with recent
versions of glib/gtk as for instance the ones shipped with fedora, and I
can confirm it. Also, I have some minor additions to this patch that I
just added:

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 1c3cd84..93aa590 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -754,7 +754,7 @@ authenticate_cb(RestProxy *proxy, G_GNUC_UNUSED
RestProxyAuth *auth,
 }

 static void
-ovirt_foreign_menu_update(GtkApplication *gtkapp, GtkWindow *gtkwin,
gpointer data)
+ovirt_foreign_menu_update(GtkApplication *gtkapp, GtkWindow *gtkwin,
G_GNUC_UNUSED gpointer data)
 {
 RemoteViewer *app = REMOTE_VIEWER(gtkapp);
 VirtViewerWindow *win = g_object_get_data(G_OBJECT(gtkwin),
"virt-viewer-window");
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 5b0e720..fca483a 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1892,6 +1892,7 @@ virt_viewer_app_local_command_line (GApplication
 *gapp,
 GOptionContext *context = g_option_context_new(NULL);
 GOptionGroup *group = g_option_group_new("virt-viewer", NULL, NULL,
NULL, NULL);

+*status = 0;
 g_option_context_set_main_group(context, group);
 VIRT_VIEWER_APP_GET_CLASS(self)->add_option_entries(self, context,
group);


-- 
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 v3 3/5] Port to GtkApplication API's

2016-02-12 Thread Eduardo Lima (Etrunko)
On 02/12/2016 03:26 PM, Eduardo Lima (Etrunko) wrote:
> On 02/12/2016 10:09 AM, Eduardo Lima (Etrunko) wrote:
>> Running remote-viewer will throw some warnings:
>>
>> (remote-viewer:546): Gtk-CRITICAL **: gtk_application_get_app_menu:
>> assertion 'GTK_IS_APPLICATION (application)' failed
>>
>> (remote-viewer:546): Gtk-CRITICAL **: gtk_application_get_menubar:
>> assertion 'GTK_IS_APPLICATION (application)' failed
>>
>> This does not happen with virt-viewer. I attached the gdb backtrace to
>> this mail.
>>
> 
> Fidencio just pointed out that these warnings won't happen with recent
> versions of glib/gtk as for instance the ones shipped with fedora, and I
> can confirm it. Also, I have some minor additions to this patch that I
> just added:

Following up, I tracked down to this gtk+ commit which makes the
warnings disappear. In this case I think they can be ignored.

commit 1bb880af36d4dfbda743a6fa3c68815963549a49
Author: Matthias Clasen <mcla...@redhat.com>
Date:   Sat Jun 7 14:04:57 2014 -0400

GtkApplicationWindow: Avoid a crash

In several places, we were not correctly dealing with the
possibility of application not being set.

diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c
index bf037ff..aba45a7 100644
--- a/gtk/gtkapplicationwindow.c
+++ b/gtk/gtkapplicationwindow.c
@@ -298,9 +298,10 @@ gtk_application_window_update_shell_shows_app_menu
(GtkApplicationWindow *window
   /* the shell does not show it, so make sure we show it */
   if (g_menu_model_get_n_items (G_MENU_MODEL
(window->priv->app_menu_section)) == 0)
 {
-  GMenuModel *app_menu;
+  GMenuModel *app_menu = NULL;

-  app_menu = gtk_application_get_app_menu
(gtk_window_get_application (GTK_WINDOW (window)));
+  if (gtk_window_get_application (GTK_WINDOW (window)) != NULL)
+app_menu = gtk_application_get_app_menu
(gtk_window_get_application (GTK_WINDOW (window)));

   if (app_menu != NULL)
 {
@@ -347,9 +348,10 @@ gtk_application_window_update_shell_shows_menubar
(GtkApplicationWindow *window,
   /* the shell does not show it, so make sure we show it */
   if (g_menu_model_get_n_items (G_MENU_MODEL
(window->priv->menubar_section)) == 0)
 {
-  GMenuModel *menubar;
+  GMenuModel *menubar = NULL;

-  menubar = gtk_application_get_menubar
(gtk_window_get_application (GTK_WINDOW (window)));
+  if (gtk_window_get_application (GTK_WINDOW (window)) != NULL)
+menubar = gtk_application_get_menubar
(gtk_window_get_application (GTK_WINDOW (window)));

   if (menubar != NULL)
 g_menu_append_section (window->priv->menubar_section, NULL,
menubar);



-- 
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 v2 3/3] display: Set value of desktop width and height property directly

2016-02-03 Thread Eduardo Lima (Etrunko)
On 02/03/2016 06:11 AM, Pavel Grunt wrote:
> Avoid calling gtk_widget_queue_resize() and emiting
> the "display-desktop-resize" signal.
> The only user of the properties is virt_viewer_display_spice_set_desktop()
> which will call the function and emit the signal after setting both
> "desktop-width" and "desktop-height" properties.

It just occurred to me if this will have any impact with VNC display.
Have you tested this path?

> ---
>  src/virt-viewer-display.c | 8 ++--
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
> index 4bfa29b..654cada 100644
> --- a/src/virt-viewer-display.c
> +++ b/src/virt-viewer-display.c
> @@ -301,14 +301,10 @@ virt_viewer_display_set_property(GObject *object,
>  
>  switch (prop_id) {
>  case PROP_DESKTOP_WIDTH:
> -virt_viewer_display_set_desktop_size(display,
> - g_value_get_int(value),
> - priv->desktopHeight);
> +priv->desktopWidth = g_value_get_int(value);
>  break;
>  case PROP_DESKTOP_HEIGHT:
> -virt_viewer_display_set_desktop_size(display,
> - priv->desktopWidth,
> - g_value_get_int(value));
> +priv->desktopHeight = g_value_get_int(value);
>      break;
>  case PROP_NTH_DISPLAY:
>  priv->nth_display = g_value_get_int(value);
> 

Acked-by: Eduardo Lima (Etrunko) <etru...@redhat.com>

-- 
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 v2 2/3] display: Return early and remove a block

2016-02-03 Thread Eduardo Lima (Etrunko)
On 02/03/2016 06:08 AM, Pavel Grunt wrote:
> ---
>  src/virt-viewer-display.c | 39 ++-
>  1 file changed, 18 insertions(+), 21 deletions(-)
> 
> diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
> index 72ec56a..4bfa29b 100644
> --- a/src/virt-viewer-display.c
> +++ b/src/virt-viewer-display.c
> @@ -511,37 +511,34 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
>  g_debug("Allocated %dx%d", allocation->width, allocation->height);
>  gtk_widget_set_allocation(widget, allocation);
>  
> -if (priv->desktopWidth == 0 ||
> -priv->desktopHeight == 0)
> +if (priv->desktopWidth == 0 || priv->desktopHeight == 0 ||
> +child == NULL || !gtk_widget_get_visible(child))
>  #if !GTK_CHECK_VERSION(3, 0, 0)
>  goto end;
>  #else
>  return;
>  #endif
> +border_width = gtk_container_get_border_width(GTK_CONTAINER(display));
>  
> -desktopAspect = (double)priv->desktopWidth / (double)priv->desktopHeight;
> +width  = MAX(1, allocation->width - 2 * border_width);
> +height = MAX(1, allocation->height - 2 * border_width);
>  
> -if (child && gtk_widget_get_visible(child)) {
> -border_width = 
> gtk_container_get_border_width(GTK_CONTAINER(display));
> -
> -width  = MAX(1, allocation->width - 2 * border_width);
> -height = MAX(1, allocation->height - 2 * border_width);
> -actualAspect = (double)width / (double)height;
> +desktopAspect = (double) priv->desktopWidth / (double) 
> priv->desktopHeight;
> +actualAspect = (double) width / (double) height;
>  
> -if (actualAspect > desktopAspect) {
> -child_allocation.width = round(height * desktopAspect);
> -child_allocation.height = height;
> -} else {
> -child_allocation.width = width;
> -child_allocation.height = round(width / desktopAspect);
> -}
> +if (actualAspect > desktopAspect) {
> +child_allocation.width = round(height * desktopAspect);
> +child_allocation.height = height;
> +} else {
> +child_allocation.width = width;
> +child_allocation.height = round(width / desktopAspect);
> +}
>  
> -child_allocation.x = 0.5 * (width - child_allocation.width) + 
> allocation->x + border_width;
> -child_allocation.y = 0.5 * (height - child_allocation.height) + 
> allocation->y + border_width;
> +child_allocation.x = 0.5 * (width - child_allocation.width) + 
> allocation->x + border_width;
> +child_allocation.y = 0.5 * (height - child_allocation.height) + 
> allocation->y + border_width;
>  
> -g_debug("Child allocate %dx%d", child_allocation.width, 
> child_allocation.height);
> -    gtk_widget_size_allocate(child, _allocation);
> -}
> +g_debug("Child allocate %dx%d", child_allocation.width, 
> child_allocation.height);
> +gtk_widget_size_allocate(child, _allocation);
>  
>  #if !GTK_CHECK_VERSION(3, 0, 0)
>  end:
> 

Acked-by: Eduardo Lima (Etrunko) <etru...@redhat.com>


-- 
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] display: Set value of desktop width and height property directly

2016-02-02 Thread Eduardo Lima (Etrunko)
On 01/27/2016 03:33 PM, Pavel Grunt wrote:
> Avoid calling gtk_widget_queue_resize() and emitting
> the "display-desktop-resize" signal.

Just curious about why this change is necessary? I mean, isn't this
signal necessary somewhere else? I see it is handled in VirtViewerWindow.

If so, please provide some more details in the commit message.

> ---
>  src/virt-viewer-display.c | 8 ++--
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
> index d1b088e..af1fe01 100644
> --- a/src/virt-viewer-display.c
> +++ b/src/virt-viewer-display.c
> @@ -301,14 +301,10 @@ virt_viewer_display_set_property(GObject *object,
>  
>  switch (prop_id) {
>  case PROP_DESKTOP_WIDTH:
> -virt_viewer_display_set_desktop_size(display,
> - g_value_get_int(value),
> - priv->desktopHeight);
> +priv->desktopWidth = g_value_get_int(value);
>  break;
>  case PROP_DESKTOP_HEIGHT:
> -virt_viewer_display_set_desktop_size(display,
> - priv->desktopWidth,
> - g_value_get_int(value));
> +priv->desktopHeight = g_value_get_int(value);
>  break;
>  case PROP_NTH_DISPLAY:
>  priv->nth_display = g_value_get_int(value);
> 


-- 
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 2/2] display: Move variable definitions to block where are used

2016-02-02 Thread Eduardo Lima (Etrunko)
On 01/27/2016 03:03 PM, Pavel Grunt wrote:
> ---
>  src/virt-viewer-display.c | 18 +++---
>  1 file changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
> index 72ec56a..d1b088e 100644
> --- a/src/virt-viewer-display.c
> +++ b/src/virt-viewer-display.c
> @@ -501,11 +501,6 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
>  GtkBin *bin = GTK_BIN(widget);
>  VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(widget);
>  VirtViewerDisplayPrivate *priv = display->priv;
> -GtkAllocation child_allocation;
> -gint width, height;
> -gint border_width;
> -double desktopAspect;
> -double actualAspect;
>  GtkWidget *child = gtk_bin_get_child(bin);
>  
>  g_debug("Allocated %dx%d", allocation->width, allocation->height);
> @@ -519,14 +514,15 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
>  return;
>  #endif
>  
> -desktopAspect = (double)priv->desktopWidth / (double)priv->desktopHeight;
> -
>  if (child && gtk_widget_get_visible(child)) {
> -border_width = 
> gtk_container_get_border_width(GTK_CONTAINER(display));
> +GtkAllocation child_allocation;
> +gint border_width = 
> gtk_container_get_border_width(GTK_CONTAINER(display));
> +
> +gint width  = MAX(1, allocation->width - 2 * border_width);
> +gint height = MAX(1, allocation->height - 2 * border_width);
>  
> -width  = MAX(1, allocation->width - 2 * border_width);
> -height = MAX(1, allocation->height - 2 * border_width);
> -actualAspect = (double)width / (double)height;
> +double desktopAspect = (double) priv->desktopWidth / (double) 
> priv->desktopHeight;
> +double actualAspect = (double) width / (double) height;
>  
>  if (actualAspect > desktopAspect) {
>  child_allocation.width = round(height * desktopAspect);
> 


Looks good, but what do you think about removing this huge if block and
maybe merging this "child" check together with the one on the beginning
of the function, something like:

 if (priv->desktopWidth == 0 ||
 priv->desktopHeight == 0 ||
 !child || !gtk_widget_get_visible(child))



-- 
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 1/2] display: Remove unnecessary VIRT_VIEWER_DISPLAY cast

2016-02-02 Thread Eduardo Lima (Etrunko)
On 01/27/2016 03:03 PM, Pavel Grunt wrote:
> ---
>  src/virt-viewer-display.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
> index a16181f..72ec56a 100644
> --- a/src/virt-viewer-display.c
> +++ b/src/virt-viewer-display.c
> @@ -545,7 +545,7 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
>  
>  #if !GTK_CHECK_VERSION(3, 0, 0)
>  end:
> -virt_viewer_display_make_resizable(VIRT_VIEWER_DISPLAY(widget));
> +virt_viewer_display_make_resizable(display);
>  #endif
>  }
>  
> @@ -819,7 +819,7 @@ void 
> virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay* self,
>  
>  g_return_if_fail(preferred != NULL);
>  
> -if (!virt_viewer_display_get_enabled(VIRT_VIEWER_DISPLAY(self))) {
> +if (!virt_viewer_display_get_enabled(self)) {
>  preferred->width = 0;
>  preferred->height = 0;
>  preferred->x = 0;
> @@ -832,10 +832,10 @@ void 
> virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay* self,
>  topx = MAX(topx, 0);
>  topy = MAX(topy, 0);
>  
> -if (virt_viewer_display_get_fullscreen(VIRT_VIEWER_DISPLAY(self))) {
> +if (virt_viewer_display_get_fullscreen(self)) {
>  GdkRectangle physical_monitor;
>  GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(self));
> -int n = virt_viewer_display_get_monitor(VIRT_VIEWER_DISPLAY(self));
> +int n = virt_viewer_display_get_monitor(self);
>  if (n == -1)
>  n = gdk_screen_get_monitor_at_window(screen,
>   
> gtk_widget_get_window(GTK_WIDGET(self)));
> @@ -850,8 +850,8 @@ void 
> virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay* self,
>  preferred->y = topy;
>  }
>  
> -if (virt_viewer_display_get_zoom(VIRT_VIEWER_DISPLAY(self))) {
> -guint zoom = 
> virt_viewer_display_get_zoom_level(VIRT_VIEWER_DISPLAY(self));
> +if (virt_viewer_display_get_zoom(self)) {
> +guint zoom = virt_viewer_display_get_zoom_level(self);
>  
>  preferred->width = round(preferred->width * NORMAL_ZOOM_LEVEL / 
> (double) zoom);
>  preferred->height = round(preferred->height * NORMAL_ZOOM_LEVEL / 
> (double) zoom);
> 

Acked-by: Eduardo Lima (Etrunko) <etru...@redhat.com>

-- 
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


[virt-tools-list] [PATCH] Don't open the default display while parsing command line

2016-02-26 Thread Eduardo Lima (Etrunko)
Since commit a9ce19f it has not been possible to check app version from
a tty without X session running. The issue is that gtk_get_option_group
function opens the default display if passed TRUE as argument.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/virt-viewer-app.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index d31acd3..3fa80a5 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1920,7 +1920,7 @@ virt_viewer_app_local_command_line (GApplication   *gapp,
 g_option_context_set_main_group(context, group);
 VIRT_VIEWER_APP_GET_CLASS(self)->add_option_entries(self, context, group);
 
-g_option_context_add_group(context, gtk_get_option_group(TRUE));
+g_option_context_add_group(context, gtk_get_option_group(FALSE));
 
 #ifdef HAVE_GTK_VNC
 g_option_context_add_group(context, vnc_display_get_option_group());
-- 
2.5.0

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


Re: [virt-tools-list] [virt-viewer 1/3] Bring back libvirt-glib dependency

2016-02-25 Thread Eduardo Lima (Etrunko)
On 02/25/2016 06:11 PM, Fabiano Fidêncio wrote:
> On Thu, Feb 25, 2016 at 3:04 PM, Eduardo Lima (Etrunko)
> <etru...@redhat.com> wrote:
>> On 02/23/2016 11:32 AM, Fabiano Fidêncio wrote:
>>> libvirt-glib dependency was dropped in commit 296f91c in favor to
>>> maintain the full glib event loop integration into virt-viewer tree.
>>> This decision was taken because libvirt-glib was not mature enough at
>>> that time, which is not the case nowadays.
>>>
>>> The libvirt-glib version chosen as dependency (0.1.8) is the first
>>> release that includes the fixes for the glib event loop integration that
>>> were backported to virt-viewer last year.
>>> ---
>>>  configure.ac  |   5 +-
>>>  mingw-virt-viewer.spec.in |   2 +
>>>  src/Makefile.am   |   4 +-
>>>  src/virt-viewer-events.c  | 459 
>>> --
>>>  src/virt-viewer-events.h  |  37 
>>>  src/virt-viewer.c |   4 +-
>>>  virt-viewer.spec.in   |   1 +
>>>  7 files changed, 11 insertions(+), 501 deletions(-)
>>>  delete mode 100644 src/virt-viewer-events.c
>>>  delete mode 100644 src/virt-viewer-events.h
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index 286c7f5..0eecb00 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -22,6 +22,7 @@ GTK_ENCODED_VERSION="GDK_VERSION_3_10"
>>>
>>>  LIBXML2_REQUIRED="2.6.0"
>>>  LIBVIRT_REQUIRED="0.10.0"
>>> +LIBVIRT_GLIB_REQUIRED="0.1.8"
>>>  GTK_VNC_REQUIRED="0.4.0"
>>>  SPICE_GTK_REQUIRED="0.30"
>>>  SPICE_PROTOCOL_REQUIRED="0.12.7"
>>> @@ -30,6 +31,7 @@ GOVIRT_REQUIRED="0.3.2"
>>>  AC_SUBST([GLIB2_REQUIRED])
>>>  AC_SUBST([LIBXML2_REQUIRED])
>>>  AC_SUBST([LIBVIRT_REQUIRED])
>>> +AC_SUBST([LIBVIRT_GLIB_REQUIRED])
>>>  AC_SUBST([GTK_REQUIRED])
>>>  AC_SUBST([GTK_VNC_REQUIRED])
>>>  AC_SUBST([SPICE_GTK_REQUIRED])
>>> @@ -116,6 +118,7 @@ AS_IF([test "x$with_libvirt" != "xno" && test 
>>> "x$with_libvirt" != "xyes"],
>>>
>>>  AS_IF([test "x$with_libvirt" = "xyes"],
>>>    [PKG_CHECK_MODULES(LIBVIRT, [libvirt >= $LIBVIRT_REQUIRED])]
>>> +  [PKG_CHECK_MODULES(LIBVIRT_GLIB, [libvirt-glib-1.0 >= 
>>> $LIBVIRT_GLIB_REQUIRED])]
>>
>> Maybe you could join the two checks into one, like:
>>
>> [PKG_CHECK_MODULES(LIBVIRT, [libvirt >= $LIBVIRT_REQUIRED
>> libvirt-glib-1.0 >= $LIBVIRT_GLIB_REQUIRED])]
>>
>> This would remove the need of LIBVIRT_GLIB_{CFLAGS,LIBS} in Makefile.am
>> files all around the code.
> 
> So, you ACK the patches with this change?
> http://paste.fedoraproject.org/329474/56434363/
> 

Oh yes, much simpler :)


Acked-by: Eduardo Lima (Etrunko) <etru...@redhat.com>



-- 
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] [virt-viewer 1/2] util: slightly reorganize _load_ui()

2016-02-25 Thread Eduardo Lima (Etrunko)
On 02/25/2016 04:21 AM, Fabiano Fidêncio wrote:
> The function was a bit hard to read and, mainly, hard to expand in a
> readable way when adding one more directory to try to load the ui file
> from.
> 
> Signed-off-by: Fabiano Fidêncio 
> ---
>  src/virt-viewer-util.c | 60 
> ++
>  1 file changed, 36 insertions(+), 24 deletions(-)
> 
> diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c
> index 76b61a1..6fe6c04 100644
> --- a/src/virt-viewer-util.c
> +++ b/src/virt-viewer-util.c
> @@ -47,6 +47,40 @@ virt_viewer_error_quark(void)
>return g_quark_from_static_string ("virt-viewer-error-quark");
>  }
>  
> +static gboolean
> +virt_viewer_util_try_to_load_ui_from_system_data_dirs(GtkBuilder *builder, 
> const gchar *name, GError **error)
> +{
> +const gchar * const * dirs = g_get_system_data_dirs();
> +g_return_val_if_fail(dirs != NULL, FALSE);
> +gboolean success = FALSE;
> +
> +while (dirs[0] != NULL && !success) {
> +gchar *path = g_build_filename(dirs[0], PACKAGE, "ui", name, NULL);
> +success = (gtk_builder_add_from_file(builder, path, error) != 0);
> +g_free(path);
> +
> +dirs++;
> +}
> +
> +return success;
> +}
> +
> +static gboolean
> +virt_viewer_util_try_to_load_ui_from_non_system_data_dirs(GtkBuilder 
> *builder, const gchar *name, GError **error)
> +{
> +gchar *path = g_build_filename(PACKAGE_DATADIR, "ui", name, NULL);
> +gboolean success = (gtk_builder_add_from_file(builder, path, error) != 
> 0);
> +
> +if (*error != NULL) {
> +if (!((*error)->domain == G_FILE_ERROR && (*error)->code == 
> G_FILE_ERROR_NOENT))
> +g_warning("Failed to add ui file '%s': %s", path, 
> (*error)->message);
> +g_clear_error(error);
> +}
> +g_free(path);
> +
> +return success;
> +}
> +
>  GtkBuilder *virt_viewer_util_load_ui(const char *name)
>  {
>  struct stat sb;
> @@ -57,31 +91,9 @@ GtkBuilder *virt_viewer_util_load_ui(const char *name)
>  if (stat(name, ) >= 0) {
>  gtk_builder_add_from_file(builder, name, );
>  } else {
> -gchar *path = g_build_filename(PACKAGE_DATADIR, "ui", name, NULL);
> -gboolean success = (gtk_builder_add_from_file(builder, path, ) 
> != 0);
> -if (error) {
> -if (!(error->domain == G_FILE_ERROR && error->code == 
> G_FILE_ERROR_NOENT))
> -g_warning("Failed to add ui file '%s': %s", path, 
> error->message);
> -g_clear_error();
> -}
> -g_free(path);
> -
> -if (!success) {
> -const gchar * const * dirs = g_get_system_data_dirs();
> -g_return_val_if_fail(dirs != NULL, NULL);
> -
> -while (dirs[0] != NULL) {
> -path = g_build_filename(dirs[0], PACKAGE, "ui", name, NULL);
> -if (gtk_builder_add_from_file(builder, path, NULL) != 0) {
> -g_free(path);
> -break;
> -}
> -g_free(path);
> -dirs++;
> -}
> -if (dirs[0] == NULL)
> +if 
> (!virt_viewer_util_try_to_load_ui_from_non_system_data_dirs(builder, name, 
> ))
> +if 
> (!virt_viewer_util_try_to_load_ui_from_system_data_dirs(builder, name, 
> ))

Is there any reason for using nested if's and not logical and?

if (!virt_viewer_util_try_to_load_ui_from_non_system_data_dirs(builder,
name, ) &&
!virt_viewer_util_try_to_load_ui_from_system_data_dirs(builder,
name, ))

>  goto failed;
> -}
>  }
>  
>  if (error) {
> 


-- 
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] [virt-viewer 0/2] Allow loading in-tree ui files

2016-02-25 Thread Eduardo Lima (Etrunko)
On 02/25/2016 04:20 AM, Fabiano Fidêncio wrote:
> The goal of these two patches are the $(subject).
> The first one is just doing a small refactoring in the _load_ui() in the way
> that introducing a new path to load a file from wouldn't be too confusing.
> 
> As always, the most dificult part of writing a patch is naming new functions.
> So, suggestions for the new functions names are welcome.

What do you think about using "local" instead of "non_system"? Or maybe
"user"?

-- 
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] [virt-viewer] configure: Simplify libvirt/libvirt-glib handling

2016-02-25 Thread Eduardo Lima (Etrunko)
On 02/25/2016 06:24 PM, Fabiano Fidêncio wrote:
> Merge libvirt and libvirt-glib checking in PKG_CHECK_MODULES, then we
> don't nee the LIBVIRT_GLIB_{CFLAGS,LIBS} in Makefile.am
> 
> Signed-off-by: Fabiano Fidêncio <fiden...@redhat.com>
> ---
>  configure.ac| 5 ++---
>  src/Makefile.am | 2 --
>  2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 0eecb00..33362f9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -117,8 +117,7 @@ AS_IF([test "x$with_libvirt" != "xno" && test 
> "x$with_libvirt" != "xyes"],
>  [with_libvirt=yes], [with_libvirt=no])])
>  
>  AS_IF([test "x$with_libvirt" = "xyes"],
> -  [PKG_CHECK_MODULES(LIBVIRT, [libvirt >= $LIBVIRT_REQUIRED])]
> -  [PKG_CHECK_MODULES(LIBVIRT_GLIB, [libvirt-glib-1.0 >= 
> $LIBVIRT_GLIB_REQUIRED])]
> +  [PKG_CHECK_MODULES(LIBVIRT, [libvirt >= $LIBVIRT_REQUIRED] 
> [libvirt-glib-1.0 >= $LIBVIRT_GLIB_REQUIRED])]
>[AC_DEFINE([HAVE_LIBVIRT], 1, [Have libvirt?])]
>  )
>  AM_CONDITIONAL([HAVE_LIBVIRT], [test "x$with_libvirt" = "xyes"])
> @@ -270,7 +269,7 @@ AC_MSG_NOTICE([   SPICE_GTK: $SPICE_GTK_CFLAGS 
> $SPICE_GTK_LIBS])
>  AC_MSG_NOTICE([])
>  AC_MSG_NOTICE([ LIBXML2: $LIBXML2_CFLAGS $LIBXML2_LIBS])
>  AC_MSG_NOTICE([])
> -AC_MSG_NOTICE([ LIBVIRT: $LIBVIRT_CFLAGS $LIBVIRT_LIBS 
> $LIBVIRT_GLIB_CFLAGS $LIBVIRT_GLIB_LIBS])
> +AC_MSG_NOTICE([ LIBVIRT: $LIBVIRT_CFLAGS $LIBVIRT_LIBS])
>  AC_MSG_NOTICE([])
>  AC_MSG_NOTICE([   OVIRT: $OVIRT_CFLAGS $OVIRT_LIBS])
>  AC_MSG_NOTICE([])
> diff --git a/src/Makefile.am b/src/Makefile.am
> index b1fe667..f42a7bf 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -150,12 +150,10 @@ virt_viewer_SOURCES =   
> \
>  virt_viewer_LDFLAGS =\
>   $(COMMON_LIBS)  \
>   $(LIBVIRT_LIBS) \
> - $(LIBVIRT_GLIB_LIBS)\
>   $(NULL)
>  virt_viewer_CFLAGS =             \
>   $(COMMON_CFLAGS)\
>   $(LIBVIRT_CFLAGS)   \
> - $(LIBVIRT_GLIB_CFLAGS)  \
>   $(NULL)
>  virt_viewer_LDADD = \
>   libvirt-viewer.la \
> 
Acked-by: Eduardo Lima (Etrunko) <etru...@redhat.com>

-- 
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] [virt-viewer] about: Fix the program's name in the title

2016-02-29 Thread Eduardo Lima (Etrunko)
On 02/29/2016 03:47 AM, Fabiano Fidêncio wrote:
> Title currently says "About Glade". It's not a big deal because it's not
> actually shown anywhere, but just for correctness let's change it to
> "About Virt-Viewer".
> 
> Thanks Jonathon Jongsma for pointing this out.
> 
> Signed-off-by: Fabiano Fidêncio <fiden...@redhat.com>
> ---
>  src/virt-viewer-about.xml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/virt-viewer-about.xml b/src/virt-viewer-about.xml
> index 287c68d..28e38c8 100644
> --- a/src/virt-viewer-about.xml
> +++ b/src/virt-viewer-about.xml
> @@ -4,7 +4,7 @@
>
>  False
>  5
> -About Glade
> +About Virt-Viewer
>  False
>  True
>  center-on-parent
> 

Funny :)

Acked-by: Eduardo Lima (Etrunko) <etru...@redhat.com>

-- 
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] [virt-viewer] Use GResource for loading ui files

2016-02-29 Thread Eduardo Lima (Etrunko)
On 02/26/2016 07:38 PM, Fabiano Fidêncio wrote:
> Let's take advantage of GResource for loading ui files in a better and
> cleaner way than virt_viewer_util_load_ui() was doing.
> It also brings the benefit, at least for developers, of being able to
> test ui changes without having to "make install" virt-viewer.
> 

General question, does this mean that those XML files don't need to be
installed anymore? If so, you might also remove them from Makefile.

Otherwise patch looks good. I don't kwnow much about GResources, so it
might be interesting to listen from more experienced people.

Reviewed-by: Eduardo Lima (Etrunko) <etru...@redhat.com>

> Signed-off-by: Fabiano Fidêncio <fiden...@redhat.com>
> ---
>  src/Makefile.am   | 25 ++
>  src/virt-viewer-about.xml |  1 -
>  src/virt-viewer-app.c | 10 +
>  src/virt-viewer-util.c| 50 
> ++-
>  src/virt-viewer-window.c  | 20 +
>  src/virt-viewer.gresource.xml | 19 
>  6 files changed, 73 insertions(+), 52 deletions(-)
>  create mode 100644 src/virt-viewer.gresource.xml
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index f42a7bf..ce31f08 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -18,8 +18,10 @@ builderxml_DATA =  \
>  
>  EXTRA_DIST = \
>   $(builderxml_DATA)  \
> + $(resource_files)   \
>   virt-viewer-enums.c.etemplate   \
>   virt-viewer-enums.h.etemplate   \
> + virt-viewer.gresource.xml   \
>   $(NULL)
>  
>  ENUMS_FILES =\
> @@ -27,15 +29,32 @@ ENUMS_FILES = \
>   $(NULL)
>  
>  BUILT_SOURCES =  \
> + virt-viewer-resources.h \
> + virt-viewer-resources.c \
>   virt-viewer-enums.h \
>   virt-viewer-enums.c \
>   $(NULL)
>  
> -$(BUILT_SOURCES): %: %.etemplate $(ENUMS_FILES)
> - $(AM_V_GEN)$(GLIB_MKENUMS) --template $^ | \
> +resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) 
> --generate-dependencies $(srcdir)/virt-viewer.gresource.xml)
> +virt-viewer-resources.c: $(srcdir)/virt-viewer.gresource.xml 
> $(resource_files)
> + glib-compile-resources --target=$@ --sourcedir=$(srcdir) 
> --generate-source --c-name virt_viewer $(srcdir)/virt-viewer.gresource.xml
> +virt-viewer-resources.h: $(srcdir)/virt-viewer.gresource.xml 
> $(resource_files)
> + glib-compile-resources --target=$@ --sourcedir=$(srcdir) 
> --generate-header --c-name virt_viewer $(srcdir)/virt-viewer.gresource.xml
> +
> +virt-viewer-enums.h: %: virt-viewer-enums.h.etemplate $(ENUMS_FILES)
> +$(AM_V_GEN)$(GLIB_MKENUMS) --template $^ | \
> +sed -e 's/VIRT_TYPE_VIEWER/VIRT_VIEWER_TYPE/' \
> +-e 's,#include "$(srcdir)/,#include ",' > $@
> +
> +virt-viewer-enums.c: %: virt-viewer-enums.c.etemplate $(ENUMS_FILES)
> +$(AM_V_GEN)$(GLIB_MKENUMS) --template $^ | \
>  sed -e 's/VIRT_TYPE_VIEWER/VIRT_VIEWER_TYPE/' \
>  -e 's,#include "$(srcdir)/,#include ",' > $@
>  
> +CLEANFILES = \
> + $(BUILT_SOURCES)\
> + $(NULL)
> +
>  libvirt_viewer_la_SOURCES =  \
>   $(BUILT_SOURCES)\
>   virt-viewer-util.h  \
> @@ -185,8 +204,6 @@ if OS_WIN32
>  remote_viewer_LDFLAGS += -Wl,--subsystem,windows
>  endif
>  
> -AM_CPPFLAGS = -DPACKAGE_DATADIR=\""$(pkgdatadir)"\"
> -
>  VIRT_VIEWER_RES = virt-viewer.rc virt-viewer.manifest
>  ICONDIR = $(top_builddir)/icons
>  MANIFESTDIR = $(srcdir)
> diff --git a/src/virt-viewer-about.xml b/src/virt-viewer-about.xml
> index 16db3c2..287c68d 100644
> --- a/src/virt-viewer-about.xml
> +++ b/src/virt-viewer-about.xml
> @@ -36,7 +36,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  
> 02111-1307  USA
>  Marc-André Lureau
>  
>  The Fedora 
> Translation Team
> -virt-viewer
>   swapped="no"/>
>   swapped="no"/>
>  
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 3fa80a5..68fe533 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -52,6 +52,7 @@
>  #endif
>  
>  #include "virt-viewer-app.h"
> +#include "virt-viewer-resources.h"
>  #in

Re: [virt-tools-list] [PATCH v3 1/5] Drop support to gtk2

2016-02-15 Thread Eduardo Lima (Etrunko)
On 02/15/2016 11:48 AM, Fabiano Fidêncio wrote:

> 
> This patch got already ACKed in one of the previous iterations?
> If yes, I'll push it. If it's not the case, I cannot ACK my own patch
> though :-)
> 

I can ack it for you :P. But this one is already outdated due to Pavel's
recent changes in virt-viewer-display.c. I will post the updated version.


-- 
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 v3 2/5] Minor code cleanups

2016-02-15 Thread Eduardo Lima (Etrunko)
On 02/15/2016 11:51 AM, Fabiano Fidêncio wrote:
> 
> Acked-by: Fabiano Fidêncio 
> 
> Anyways. was this patch already ACKed in the previous iterations, no?
> 

It might have, but I don't have write permissions to the repositories,
so I can't push.

-- 
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 v3 3/5] Port to GtkApplication API's

2016-02-15 Thread Eduardo Lima (Etrunko)
On 02/15/2016 11:47 AM, Fabiano Fidêncio wrote:
[snip]

>>  
>>   cleanup:
>> -g_free(uri);
>> -if (viewer)
>> -g_object_unref(viewer);
>> -g_strfreev(args);
>> -g_clear_error();
>> -
>> +g_object_unref(viewer);
> 
> g_object_unref() shouldn't be called with a NULL argument. So, you'll
> need to re-add the check for the viewer before unref'ing the object.
> 

Fixed.

>> +}
>> +
>> +g_clear_error();
>> +g_application_quit(app);
> 
> 
> And then return here ... ?
> 

I don't think it is necessary, g_application_quit() will end the
execution of the program.

>> -g_free(uri);
>> -g_strfreev(args);
>> -g_free(help_msg);
>> -g_clear_error();
>> -
>> +g_object_unref(viewer);
> 
> As for remote-viewer, don't remove the check for the viewer before
> calling g_object_unref().
> 

Also fixed.

>> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
>> index 3a958f0..14549fd 100644
>> --- a/src/virt-viewer-window.c
>> +++ b/src/virt-viewer-window.c
>> @@ -346,8 +346,7 @@ virt_viewer_window_init (VirtViewerWindow *self)
>>  gtk_window_set_has_resize_grip(GTK_WINDOW(priv->window), FALSE);
>>  priv->accel_enabled = TRUE;
>>  
>> -accels = gtk_accel_groups_from_object(G_OBJECT(priv->window));
>> -for ( ; accels ; accels = accels->next) {
>> +for (accels = gtk_accel_groups_from_object(G_OBJECT(priv-
>>> window)); accels; accels = accels->next) {
> 
> This change is not related 
> 

Yes, I can merge it with previous cleanup patch.

> 
> 
> Didn't have any problem running on Windows and on Linux.
> 
> The code is in a way better shape than the previous versions. Just a
> small set of minor comments from me. Also, please, this whole series is
> breaking "make syntax-check" as pointed out in the #spice channel.
> +1 for having the code in with the fixes suggested.
> 
> Please, I also would like to have at least one more review from someone
> used with the client side (Daniel? Jonathon? Pavel?) before you can
> consider it as an ACK!

Sure, will post a new version with fixes to comments. Thanks for the review.

-- 
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 v3 5/5] Drop old compatibility code

2016-02-15 Thread Eduardo Lima (Etrunko)
On 02/15/2016 11:57 AM, Fabiano Fidêncio wrote:
> 
> NACK from me.
> There is no reason for keeping an empty virt-glib-compat.c file.
> virt-glib-compat.h also could be removed entirely as g_clear_pointer()
> was introduced in 2.34. So, please, remove both files from the tree.
> 
> Reviewed-by: Fabiano Fidêncio 
> 

Indeed, I did not check when g_clear_pointer was introduced. I will
remove the files then.

-- 
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

[virt-tools-list] [PATCH v4 2/5] Minor code cleanups

2016-02-15 Thread Eduardo Lima (Etrunko)
- Reuse #ifdef HAVE_SPICE_GTK block for include.
- Move declaration of vfunc together with others of the same class.
- Move variable declaration to the top of the function.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/remote-viewer.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 8e4754f..e712d61 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -36,11 +36,9 @@
 
 #ifdef HAVE_SPICE_GTK
 #include 
-#endif
-
-#ifdef HAVE_SPICE_GTK
 #include "virt-viewer-session-spice.h"
 #endif
+
 #include "virt-viewer-app.h"
 #include "virt-viewer-auth.h"
 #include "virt-viewer-file.h"
@@ -195,10 +193,10 @@ remote_viewer_class_init (RemoteViewerClass *klass)
 
 object_class->get_property = remote_viewer_get_property;
 object_class->set_property = remote_viewer_set_property;
+object_class->dispose = remote_viewer_dispose;
 
 app_class->start = remote_viewer_start;
 app_class->deactivated = remote_viewer_deactivated;
-object_class->dispose = remote_viewer_dispose;
 #ifdef HAVE_SPICE_GTK
 app_class->activate = remote_viewer_activate;
 app_class->window_added = remote_viewer_window_added;
@@ -617,10 +615,13 @@ spice_ctrl_listen_async_cb(GObject *object,
 static gboolean
 remote_viewer_activate(VirtViewerApp *app, GError **error)
 {
-g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
-RemoteViewer *self = REMOTE_VIEWER(app);
+RemoteViewer *self;
 gboolean ret = FALSE;
 
+g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
+
+self = REMOTE_VIEWER(app);
+
 if (self->priv->controller) {
 SpiceSession *session = remote_viewer_get_spice_session(self);
 ret = spice_session_connect(session);
-- 
2.5.0

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


[virt-tools-list] [PATCH v4 5/5] Drop old compatibility code

2016-02-15 Thread Eduardo Lima (Etrunko)
With glib requirements now being 2.38, these functions do not make sense 
anymore.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/Makefile.am |  2 -
 src/ovirt-foreign-menu.c|  1 -
 src/virt-glib-compat.c  | 34 -
 src/virt-glib-compat.h  | 83 -
 src/virt-viewer-events.c|  1 -
 src/virt-viewer-file.h  |  1 -
 src/virt-viewer-session-spice.c |  1 -
 7 files changed, 123 deletions(-)
 delete mode 100644 src/virt-glib-compat.c
 delete mode 100644 src/virt-glib-compat.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 1ebc24e..dbf2c4f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,8 +40,6 @@ $(BUILT_SOURCES): %: %.etemplate $(ENUMS_FILES)
 
 libvirt_viewer_la_SOURCES =\
$(BUILT_SOURCES)\
-   virt-glib-compat.h  \
-   virt-glib-compat.c  \
virt-gtk-compat.h   \
virt-viewer-util.h  \
virt-viewer-util.c  \
diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
index 9b6d3b8..9859439 100644
--- a/src/ovirt-foreign-menu.c
+++ b/src/ovirt-foreign-menu.c
@@ -28,7 +28,6 @@
 #include 
 
 #include "ovirt-foreign-menu.h"
-#include "virt-glib-compat.h"
 #include "virt-viewer-util.h"
 
 typedef enum {
diff --git a/src/virt-glib-compat.c b/src/virt-glib-compat.c
deleted file mode 100644
index c15ff28..000
--- a/src/virt-glib-compat.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   This library 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-#include 
-
-#include "virt-glib-compat.h"
-
-#if !GLIB_CHECK_VERSION(2,32,0)
-GByteArray *g_byte_array_new_take (guint8 *data, gsize len)
-{
-  GByteArray *array;
-
-  array = g_byte_array_new ();
-  g_assert (array->data == NULL);
-  g_assert (array->len == 0);
-
-  array->data = data;
-  array->len = len;
-
-  return array;
-}
-#endif
diff --git a/src/virt-glib-compat.h b/src/virt-glib-compat.h
deleted file mode 100644
index 1242289..000
--- a/src/virt-glib-compat.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Virt Viewer: A virtual machine console viewer
- *
- * Copyright (C) 2007-2009 Red Hat, Inc.
- * Copyright (C) 2009-2012 Daniel P. Berrange
- * Copyright (C) 2010 Marc-Andr?? Lureau
- *
- * 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
- *
- * Author: Daniel P. Berrange <berra...@redhat.com>
- */
-
-#include 
-
-#ifndef _VIRT_GLIB_COMPAT_H
-# define _VIRT_GLIB_COMPAT_H 1
-
-#include 
-
-G_BEGIN_DECLS
-
-#ifndef g_clear_pointer
-#define g_clear_pointer(pp, destroy) \
-  G_STMT_START {   
\
-G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer));   
\
-/* Only one access, please */  
\
-gpointer *_pp = (gpointer *) (pp); 
\
-gpointer _p;   
\
-/* This assignment is needed to avoid a gcc warning */ 
\
-GDestroyNotify _destroy = (GDestroyNotify) (destroy);  
\
-   
\
-(void) (0 ? (gpointer) *(pp) : 0); 
\
-do   

[virt-tools-list] [PATCH v4 1/5] Drop support to gtk2

2016-02-15 Thread Eduardo Lima (Etrunko)
From: Fabiano Fidêncio <fiden...@redhat.com>

The 3.0 release was the last one that still supports GTK2. For the
Windows builds the support to GTK2 was dropped in the previous release.
Let's do the same for the entire project now.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 configure.ac  | 39 +++
 src/view/autoDrawer.c | 10 -
 src/view/ovBox.c  | 45 --
 src/virt-gtk-compat.h | 12 --
 src/virt-viewer-display.c | 96 +--
 src/virt-viewer-window.c  | 10 -
 virt-viewer.spec.in   | 23 
 7 files changed, 6 insertions(+), 229 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8aa80ca..250a7fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,9 +15,7 @@ AM_SILENT_RULES([yes])
 GLIB2_REQUIRED=2.22.0
 LIBXML2_REQUIRED="2.6.0"
 LIBVIRT_REQUIRED="0.10.0"
-GTK2_REQUIRED="2.18.0"
 GTK3_REQUIRED="3.0"
-GTK_VNC1_REQUIRED="0.3.8"
 GTK_VNC2_REQUIRED="0.4.0"
 SPICE_GTK_REQUIRED="0.30"
 SPICE_PROTOCOL_REQUIRED="0.12.7"
@@ -26,9 +24,7 @@ GOVIRT_REQUIRED="0.3.2"
 AC_SUBST([GLIB2_REQUIRED])
 AC_SUBST([LIBXML2_REQUIRED])
 AC_SUBST([LIBVIRT_REQUIRED])
-AC_SUBST([GTK2_REQUIRED])
 AC_SUBST([GTK3_REQUIRED])
-AC_SUBST([GTK_VNC1_REQUIRED])
 AC_SUBST([GTK_VNC2_REQUIRED])
 AC_SUBST([SPICE_GTK_REQUIRED])
 AC_SUBST([SPICE_PROTOCOL_REQUIRED])
@@ -121,36 +117,15 @@ AC_CHECK_LIB([virt],
  [AC_DEFINE([HAVE_VIR_DOMAIN_OPEN_GRAPHICS_FD], 1, [Have 
virDomainOpenGraphicsFD?])])
 LIBS=$old_LIBS
 
-AC_MSG_CHECKING([which gtk+ version to compile against])
-AC_ARG_WITH([gtk],
-  [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against 
(default: 3.0)])],
-  [case "$with_gtk" in
- 2.0|3.0) ;;
- *) AC_MSG_ERROR([invalid gtk version specified]) ;;
-   esac],
-  [with_gtk=3.0])
-AC_MSG_RESULT([$with_gtk])
-
-case "$with_gtk" in
-  2.0) GTK_API_VERSION=2.0
-   GTK_REQUIRED=$GTK2_REQUIRED
-   GTK_VNC_REQUIRED=$GTK_VNC1_REQUIRED
-   GTK_VNC_API_VERSION=1.0
-   SPICE_GTK_API_VERSION=2.0
-   ;;
-  3.0) GTK_API_VERSION=3.0
-   GTK_REQUIRED=$GTK3_REQUIRED
-   GTK_VNC_REQUIRED=$GTK_VNC2_REQUIRED
-   GTK_VNC_API_VERSION=2.0
-   SPICE_GTK_API_VERSION=3.0
-   ;;
-esac
+GTK_API_VERSION=3.0
+GTK_REQUIRED=$GTK3_REQUIRED
+GTK_VNC_REQUIRED=$GTK_VNC2_REQUIRED
+GTK_VNC_API_VERSION=2.0
+SPICE_GTK_API_VERSION=3.0
 
 AC_SUBST([GTK_API_VERSION])
 AC_SUBST([GTK_REQUIRED])
 AC_SUBST([GTK_VNC_API_VERSION])
-AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
-AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
 
 PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
 
@@ -275,10 +250,6 @@ AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Configuration summary])
 AC_MSG_NOTICE([=])
 AC_MSG_NOTICE([])
-AC_MSG_NOTICE([ Features:])
-AC_MSG_NOTICE([])
-AC_MSG_NOTICE([  Gtk: $with_gtk])
-AC_MSG_NOTICE([])
 AC_MSG_NOTICE([ Libraries:])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([   GLIB2: $GLIB2_CFLAGS $GLIB2_LIBS])
diff --git a/src/view/autoDrawer.c b/src/view/autoDrawer.c
index cbf92de..2ae106c 100644
--- a/src/view/autoDrawer.c
+++ b/src/view/autoDrawer.c
@@ -218,7 +218,6 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
if (gtk_widget_get_window(priv->evBox)) {
   int x;
   int y;
-#if GTK_CHECK_VERSION(3, 0, 0)
   GdkDevice *dev;
   GdkDeviceManager *devmgr;
 
@@ -227,9 +226,6 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
 
   gdk_window_get_device_position(gtk_widget_get_window(priv->evBox),
  dev, , , NULL);
-#else
-  gtk_widget_get_pointer(priv->evBox, , );
-#endif
 
   gtk_widget_get_allocation(priv->evBox, );
   g_assert(gtk_container_get_border_width(   GTK_CONTAINER(priv->evBox))
@@ -262,16 +258,10 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
if (!priv->inputUngrabbed) {
   GtkWidget *grabbed = NULL;
 
-#if GTK_CHECK_VERSION(3, 0, 0)
   if (gtk_window_has_group (window)) {
 GtkWindowGroup *group = gtk_window_get_group (window);
 grabbed = gtk_window_group_get_current_grab (group);
   }
-#else
-  if (window->group && window->group->grabs) {
-grabbed = GTK_WIDGET(window->group->grabs->data);
-  }
-#endif
   if (!grabbed) {
  grabbed = gtk_grab_get_current();
   }
diff --git a/src/view/ovBox.c b/src/view/ovBox.c
index 185b0b7..fa56fd5 100644
--- a/src/view/ovBox.c
+++ b/src/view/ovBox.c
@@ -76,13 +76,6 @@
 
 #include "ovBox.h"
 
-#if ! GTK_CHECK_VERSION(3, 0, 0)
-#define gtk_widget_set_realized(widget, val)\
-  GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED)
-#define gtk_widget_get_realized(widget)\
-  GTK_WIDGET_REALIZED(widget)
-#e

[virt-tools-list] [PATCH v4 4/5] remote-viewer: Remove unused properties

2016-02-15 Thread Eduardo Lima (Etrunko)
The reason for using properties to access those members was to ensure
that they would only be set during the creation of the object. Now that
we removed that restriction, we set private members directly.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/remote-viewer.c | 101 +++-
 1 file changed, 4 insertions(+), 97 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 2703a24..aa99baa 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -67,15 +67,6 @@ 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 {
-PROP_0,
-#ifdef HAVE_SPICE_GTK
-PROP_CONTROLLER,
-PROP_CTRL_FOREIGN_MENU,
-#endif
-PROP_OPEN_RECENT_DIALOG
-};
-
 #ifdef HAVE_OVIRT
 static OvirtVm * choose_vm(GtkWindow *main_window,
char **vm_name,
@@ -122,56 +113,6 @@ remote_viewer_dispose (GObject *object)
 }
 
 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_SPICE_GTK
-case PROP_CONTROLLER:
-g_value_set_object(value, priv->controller);
-break;
-case PROP_CTRL_FOREIGN_MENU:
-g_value_set_object(value, priv->ctrl_foreign_menu);
-break;
-#endif
-case PROP_OPEN_RECENT_DIALOG:
-g_value_set_boolean(value, priv->open_recent_dialog);
-break;
-default:
-G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-}
-
-static void
-remote_viewer_set_property (GObject *object, guint property_id,
-const GValue *value, GParamSpec *pspec)
-{
-RemoteViewer *self = REMOTE_VIEWER(object);
-RemoteViewerPrivate *priv = self->priv;
-
-switch (property_id) {
-#ifdef HAVE_SPICE_GTK
-case PROP_CONTROLLER:
-g_return_if_fail(priv->controller == NULL);
-priv->controller = g_value_dup_object(value);
-break;
-case PROP_CTRL_FOREIGN_MENU:
-g_return_if_fail(priv->ctrl_foreign_menu == NULL);
-priv->ctrl_foreign_menu = g_value_dup_object(value);
-break;
-#endif
-case PROP_OPEN_RECENT_DIALOG:
-priv->open_recent_dialog = g_value_get_boolean(value);
-break;
-default:
-G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-}
-
-static void
 remote_viewer_deactivated(VirtViewerApp *app, gboolean connect_error)
 {
 RemoteViewer *self = REMOTE_VIEWER(app);
@@ -271,20 +212,14 @@ remote_viewer_local_command_line (GApplication   *gapp,
 GOTO_END;
 }
 
-SpiceCtrlController *ctrl = spice_ctrl_controller_new();
-SpiceCtrlForeignMenu *menu = spice_ctrl_foreign_menu_new();
+self->priv->controller = spice_ctrl_controller_new();
+self->priv->ctrl_foreign_menu = spice_ctrl_foreign_menu_new();
 
-g_object_set(self, "guest-name", "defined by Spice controller",
-   "controller", ctrl,
-   "foreign-menu", menu,
-   NULL);
+g_object_set(self, "guest-name", "defined by Spice controller", NULL);
 
-g_signal_connect(menu, "notify::title",
+g_signal_connect(self->priv->ctrl_foreign_menu, "notify::title",
  G_CALLBACK(foreign_menu_title_changed),
  self);
-
-g_object_unref(ctrl);
-g_object_unref(menu);
 }
 #endif
 
@@ -311,8 +246,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
 
 g_type_class_add_private (klass, sizeof (RemoteViewerPrivate));
 
-object_class->get_property = remote_viewer_get_property;
-object_class->set_property = remote_viewer_set_property;
 object_class->dispose = remote_viewer_dispose;
 
 g_app_class->local_command_line = remote_viewer_local_command_line;
@@ -322,36 +255,10 @@ remote_viewer_class_init (RemoteViewerClass *klass)
 app_class->add_option_entries = remote_viewer_add_option_entries;
 #ifdef HAVE_SPICE_GTK
 app_class->activate = remote_viewer_activate;
-
 gtk_app_class->window_added = remote_viewer_window_added;
-
-g_object_class_install_property(object_class,
-PROP_CONTROLLER,
-g_param_spec_object("controller",
-"Controller",
-"

[virt-tools-list] [PATCH v4 virt-viewer 0/5] Port to GtkApplication API's

2016-02-15 Thread Eduardo Lima (Etrunko)
In this version:

Rebased to latest master, fixed conflicts in virt-viewer-display.c.

Fix patch #3 according to review by Fabiano Fidencio.

Remove virt-glib-compat.[ch] files entirely from the tree. All functions
are now covered with new version requirements.

Eduardo Lima (Etrunko) (4):
  Minor code cleanups
  Port to GtkApplication API's
  remote-viewer: Remove unused properties
  Drop old compatibility code

Fabiano Fidêncio (1):
  Drop support to gtk2

 configure.ac|  45 ++-
 src/Makefile.am |   2 -
 src/ovirt-foreign-menu.c|   1 -
 src/remote-viewer-main.c| 167 +--
 src/remote-viewer.c | 287 +++-
 src/remote-viewer.h |   4 +-
 src/view/autoDrawer.c   |  10 --
 src/view/ovBox.c|  45 ---
 src/virt-glib-compat.c  |  34 -
 src/virt-glib-compat.h  |  83 
 src/virt-gtk-compat.h   |  12 --
 src/virt-viewer-app.c   | 145 
 src/virt-viewer-app.h   |  11 +-
 src/virt-viewer-display.c   |  96 +-
 src/virt-viewer-events.c|   1 -
 src/virt-viewer-file.h  |   1 -
 src/virt-viewer-main.c  | 108 +--
 src/virt-viewer-session-spice.c |   1 -
 src/virt-viewer-util.h  |   1 +
 src/virt-viewer-window.c|  14 +-
 src/virt-viewer.c   | 137 +++
 src/virt-viewer.h   |   9 +-
 src/virt-viewer.xml |   2 +-
 virt-viewer.spec.in |  23 
 24 files changed, 399 insertions(+), 840 deletions(-)
 delete mode 100644 src/virt-glib-compat.c
 delete mode 100644 src/virt-glib-compat.h

-- 
2.5.0

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

[virt-tools-list] [PATCH v4 3/5] Port to GtkApplication API's

2016-02-15 Thread Eduardo Lima (Etrunko)
Most of this patch consists in code being shuffled around to fit the
expected flow while using the new APIs. I tried my best to make this
patch the less intrusive as possible. Main changes are:

- Updated build requirements
   * glib version 2.38
   * gtk+ version 3.10
   * gio

- VirtViewerApp is now a subclass of GtkApplication.
  Some mainloop calls were replaced:
   * gtk_main() -> g_application_run()
   * gtk_quit() -> g_application_quit()

- Unified command line option handling.
  The logic has moved from the main functions and split in common
  options, and specific ones for each application. With this, the main
  functions were highly simplified, and now basically responsible for
  instantiating the App object and running the main loop.

- All Window objects must be associated with the Application.
  With this, there is no need to emit our own 'window-added'/'window-
  removed' signals, as those will be emited by GtkApplication whenever
  gtk_application_add_window() and gtk_application_remove_window() are
  called. Also, 'window-removed' was not being used anywhere.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 configure.ac |   6 +-
 src/remote-viewer-main.c | 167 ++
 src/remote-viewer.c  | 207 +++
 src/remote-viewer.h  |   4 +-
 src/virt-viewer-app.c| 145 -
 src/virt-viewer-app.h|  11 +--
 src/virt-viewer-main.c   | 108 ++---
 src/virt-viewer-util.h   |   1 +
 src/virt-viewer-window.c |   4 +-
 src/virt-viewer.c| 137 +--
 src/virt-viewer.h|   9 +--
 src/virt-viewer.xml  |   2 +-
 12 files changed, 399 insertions(+), 402 deletions(-)

diff --git a/configure.ac b/configure.ac
index 250a7fe..e09d0cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,10 +12,10 @@ AC_CANONICAL_HOST
 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
 AM_SILENT_RULES([yes])
 
-GLIB2_REQUIRED=2.22.0
+GLIB2_REQUIRED="2.38.0"
 LIBXML2_REQUIRED="2.6.0"
 LIBVIRT_REQUIRED="0.10.0"
-GTK3_REQUIRED="3.0"
+GTK3_REQUIRED="3.10"
 GTK_VNC2_REQUIRED="0.4.0"
 SPICE_GTK_REQUIRED="0.30"
 SPICE_PROTOCOL_REQUIRED="0.12.7"
@@ -93,7 +93,7 @@ PKG_PROG_PKG_CONFIG
 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
 AC_SUBST(GLIB_MKENUMS)
 
-PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQUIRED gthread-2.0 
gmodule-export-2.0)
+PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQUIRED gio-2.0 gthread-2.0 
gmodule-export-2.0)
 PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED)
 
 AC_ARG_WITH([libvirt],
diff --git a/src/remote-viewer-main.c b/src/remote-viewer-main.c
index 81cf736..b05f27b 100644
--- a/src/remote-viewer-main.c
+++ b/src/remote-viewer-main.c
@@ -22,184 +22,29 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-#ifdef G_OS_WIN32
-#include 
-#include 
-#endif
-
-#ifdef HAVE_GTK_VNC
-#include 
-#endif
-#ifdef HAVE_SPICE_GTK
-#include 
-#endif
-#ifdef HAVE_OVIRT
-#include 
-#endif
 
 #include "remote-viewer.h"
-#include "virt-viewer-app.h"
-#include "virt-viewer-session.h"
-
-static void
-remote_viewer_version(void)
-{
-g_print(_("remote-viewer version %s"), VERSION BUILDID);
-#ifdef REMOTE_VIEWER_OS_ID
-g_print(" (OS ID: %s)", REMOTE_VIEWER_OS_ID);
-#endif
-g_print("\n");
-exit(EXIT_SUCCESS);
-}
-
-static void
-recent_add(gchar *uri, const gchar *mime_type)
-{
-GtkRecentManager *recent;
-GtkRecentData meta = {
-.app_name = (char*)"remote-viewer",
-.app_exec = (char*)"remote-viewer %u",
-.mime_type= (char*)mime_type,
-};
-
-if (uri == NULL)
-return;
-
-recent = gtk_recent_manager_get_default();
-meta.display_name = uri;
-if (!gtk_recent_manager_add_full(recent, uri, ))
-g_warning("Recent item couldn't be added");
-}
-
-static void connected(VirtViewerSession *session,
-  VirtViewerApp *self G_GNUC_UNUSED)
-{
-gchar *uri = virt_viewer_session_get_uri(session);
-const gchar *mime = virt_viewer_session_mime_type(session);
-
-recent_add(uri, mime);
-g_free(uri);
-}
 
 int
 main(int argc, char **argv)
 {
-GOptionContext *context;
-GError *error = NULL;
 int ret = 1;
-gchar **args = NULL;
-gchar *uri = NULL;
-char *title = NULL;
 RemoteViewer *viewer = NULL;
-#ifdef HAVE_SPICE_GTK
-gboolean controller = FALSE;
-#endif
-VirtViewerApp *app;
-const GOptionEntry options [] = {
-{ "version", 'V', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-  remote_viewer_version, N_("Display version information"), NULL },
-{ "title", 't', 0, G_OPTION_ARG_ST

Re: [virt-tools-list] [PATCH v4 3/5] Port to GtkApplication API's

2016-02-15 Thread Eduardo Lima (Etrunko)
On 02/15/2016 12:31 PM, Eduardo Lima (Etrunko) wrote:
> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> index 3a958f0..14549fd 100644
> --- a/src/virt-viewer-window.c
> +++ b/src/virt-viewer-window.c
> @@ -346,8 +346,7 @@ virt_viewer_window_init (VirtViewerWindow *self)
>  gtk_window_set_has_resize_grip(GTK_WINDOW(priv->window), FALSE);
>  priv->accel_enabled = TRUE;
>  
> -accels = gtk_accel_groups_from_object(G_OBJECT(priv->window));
> -for ( ; accels ; accels = accels->next) {
> +for (accels = gtk_accel_groups_from_object(G_OBJECT(priv->window)); 
> accels; accels = accels->next) {
>  priv->accel_list = g_slist_append(priv->accel_list, accels->data);
>  g_object_ref(G_OBJECT(accels->data));
>  }

This slipped in again, I will wait for another round of review to remove
this change.

-- 
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


[virt-tools-list] [PATCH v5 3/3] Drop old compatibility code

2016-02-15 Thread Eduardo Lima (Etrunko)
With glib requirements now being 2.38, these functions do not make sense 
anymore.

Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
---
 src/Makefile.am |  2 -
 src/ovirt-foreign-menu.c|  1 -
 src/virt-glib-compat.c  | 34 -
 src/virt-glib-compat.h  | 83 -
 src/virt-viewer-events.c|  1 -
 src/virt-viewer-file.h  |  1 -
 src/virt-viewer-session-spice.c |  1 -
 7 files changed, 123 deletions(-)
 delete mode 100644 src/virt-glib-compat.c
 delete mode 100644 src/virt-glib-compat.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 42d30fd..a4a420b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,8 +40,6 @@ $(BUILT_SOURCES): %: %.etemplate $(ENUMS_FILES)
 
 libvirt_viewer_la_SOURCES =\
$(BUILT_SOURCES)\
-   virt-glib-compat.h  \
-   virt-glib-compat.c  \
virt-viewer-util.h  \
virt-viewer-util.c  \
virt-viewer-auth.h  \
diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
index 9b6d3b8..9859439 100644
--- a/src/ovirt-foreign-menu.c
+++ b/src/ovirt-foreign-menu.c
@@ -28,7 +28,6 @@
 #include 
 
 #include "ovirt-foreign-menu.h"
-#include "virt-glib-compat.h"
 #include "virt-viewer-util.h"
 
 typedef enum {
diff --git a/src/virt-glib-compat.c b/src/virt-glib-compat.c
deleted file mode 100644
index c15ff28..000
--- a/src/virt-glib-compat.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   This library 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-#include 
-
-#include "virt-glib-compat.h"
-
-#if !GLIB_CHECK_VERSION(2,32,0)
-GByteArray *g_byte_array_new_take (guint8 *data, gsize len)
-{
-  GByteArray *array;
-
-  array = g_byte_array_new ();
-  g_assert (array->data == NULL);
-  g_assert (array->len == 0);
-
-  array->data = data;
-  array->len = len;
-
-  return array;
-}
-#endif
diff --git a/src/virt-glib-compat.h b/src/virt-glib-compat.h
deleted file mode 100644
index 1242289..000
--- a/src/virt-glib-compat.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Virt Viewer: A virtual machine console viewer
- *
- * Copyright (C) 2007-2009 Red Hat, Inc.
- * Copyright (C) 2009-2012 Daniel P. Berrange
- * Copyright (C) 2010 Marc-Andr?? Lureau
- *
- * 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
- *
- * Author: Daniel P. Berrange <berra...@redhat.com>
- */
-
-#include 
-
-#ifndef _VIRT_GLIB_COMPAT_H
-# define _VIRT_GLIB_COMPAT_H 1
-
-#include 
-
-G_BEGIN_DECLS
-
-#ifndef g_clear_pointer
-#define g_clear_pointer(pp, destroy) \
-  G_STMT_START {   
\
-G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer));   
\
-/* Only one access, please */  
\
-gpointer *_pp = (gpointer *) (pp); 
\
-gpointer _p;   
\
-/* This assignment is needed to avoid a gcc warning */ 
\
-GDestroyNotify _destroy = (GDestroyNotify) (destroy);  
\
-   
\
-(void) (0 ? (gpointer) *(pp) : 0); 
\
-do   

  1   2   3   4   >