Commit 81a4e7ee authored by Jonh Wendell S. Santana's avatar Jonh Wendell S. Santana
Browse files

Merge from unstable branch

svn path=/trunk/; revision=286
parent 7a56cb7b
2008-04-09 Jonh Wendell <jwendell@gnome.org>
Show avahi-found hosts in side panel and bookmark menu. Closes #512918.
* configure.ac:
- Bump avahi dependency to 0.6.22
- Bump gtk-vnc dependency to 0.3.5
- Avahi dependency is mandatory now
- Also depends on avahi-gobject
* src/vinagre-mdns.[ch]: New files, mdns class
* vinagre-window.[ch],
* vinagre-fav.c: Make use of new mdns class
2008-04-03 Jonh Wendell <jwendell@gnome.org>
* src/vinagre-commands.c: Show an error message if running composited
window and try to enable scaling. Compiz doesn't work well with OpenGL
applications yet.
2008-04-03 Jonh Wendell <jwendell@gnome.org>
* src/vinagre-tab.[ch],
* src/vinagre-window.[ch]: Better handles menus sensitivity.
* src/vinagre-bookmarks.c,
* src/vinagre-commands.c:
- Don't crash when adding a bookmark after the connection is closed. (LP: #205303).
- Ignore NULL hosts in bookmarks file.
2008-04-03 Jonh Wendell <jwendell@gnome.org>
* src/vinagre-tab.c:
Changed properties types from pointer to object;
Use new gtk-vnc API vnc_display_force_grab() in fullscreen handling.
2008-03-29 Jonh Wendell <jwendell@gnome.org>
* src/vinagre-utils.[ch],
* src/vinagre-main.c: Use the new debug stuff from gtk-vnc
2008-03-24 Jonh Wendell <jwendell@gnome.org>
- Make VinagreBookmarks a GObject.
- Modify the side panel interface.
2008-03-19 Jonh Wendell <jwendell@gnome.org>
Make VinagreConnection a GObject.
2008-03-14 Jonh Wendell <jwendell@gnome.org>
Initial support for scaling. Closes #476942.
* configure.ac: Bump gtk-vnc version to 0.3.4
* README: Brief explanation on how to enable scaling
* src/vinagre-tab.c,
* src/vinagre-commands.h,
* src/vinagre-window.c,
* src/vinagre-tab.h,
* src/vinagre-ui.h,
* src/vinagre-window-private.h,
* src/vinagre-commands.c,
* data/vinagre-ui.xml: Implement scaling
2008-03-12 Jonh Wendell <jwendell@gnome.org>
* configure.ac: post-release bump to 2.23.1 (#512925)
......
......@@ -38,7 +38,8 @@ GTK_REQUIRED=2.12.0
LIBGLADE_REQUIRED=2.6.0
GCONF_REQUIRED=2.16.0
GTHREAD_REQUIRED=2.0.0
GTK_VNC_REQUIRED=0.3.3
GTK_VNC_REQUIRED=0.3.5
AVAHI_REQUIRED=0.6.22
PKG_CHECK_MODULES(VINAGRE, \
glib-2.0 >= $GLIB_REQUIRED \
......@@ -48,7 +49,9 @@ PKG_CHECK_MODULES(VINAGRE, \
gconf-2.0 >= $GCONF_REQUIRED \
gthread-2.0 >= $GTHREAD_REQUIRED \
gnome-keyring-1 \
gtk-vnc-1.0 >= $GTK_VNC_REQUIRED)
gtk-vnc-1.0 >= $GTK_VNC_REQUIRED \
avahi-ui >= $AVAHI_REQUIRED \
avahi-gobject >= $AVAHI_REQUIRED)
AC_SUBST(VINAGRE_CFLAGS)
AC_SUBST(VINAGRE_LIBS)
......@@ -60,31 +63,17 @@ AC_PATH_PROG(GCONFTOOL, gconftool-2)
AM_GCONF_SOURCE_2
#*******************************************************************************
# Check for Avahi
#*******************************************************************************
AVAHI_REQUIRED=0.6.18
AC_ARG_ENABLE(avahi,
AS_HELP_STRING([--enable-avahi],[Enable use of avahi]),
[case "${enableval}" in
yes) VINAGRE_ENABLE_AVAHI=yes ;;
no) VINAGRE_ENABLE_AVAHI=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-avahi) ;;
esac],
[VINAGRE_ENABLE_AVAHI=no])
AVAHI_CFLAGS=
AVAHI_LIBS=
if test "x$VINAGRE_ENABLE_AVAHI" = "xyes" ; then
PKG_CHECK_MODULES(AVAHI,
[avahi-ui >= $AVAHI_REQUIRED])
AVAHI_CFLAGS="$AVAHI_CFLAGS -DVINAGRE_HAVE_AVAHI"
dnl define a MAINT-like variable REBUILD which is set
dnl if Perl, so autogenerated sources can be rebuilt
AC_PATH_PROGS(PERL, perl5 perl)
AC_ARG_ENABLE(rebuilds, [ --disable-rebuilds disable all source autogeneration rules],,enable_rebuilds=yes)
REBUILD=\#
if test "x$enable_rebuilds" = "xyes" && \
test -n "$PERL" && \
$PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
REBUILD=
fi
AC_SUBST(AVAHI_CFLAGS)
AC_SUBST(AVAHI_LIBS)
AM_CONDITIONAL(VINAGRE_AVAHI, [test "x$VINAGRE_ENABLE_AVAHI" = "xyes"])
AC_SUBST(REBUILD)
#*******************************************************************************
......@@ -109,6 +98,4 @@ Configure summary:
Compiler ...................: ${CC}
Compiler Flags .............: ${CFLAGS}
Avahi support ..............: ${VINAGRE_ENABLE_AVAHI}
"
......@@ -2,7 +2,7 @@
* vinagre-ui.xml
* This file is part of vinagre
*
* Copyright (C) 2007 - Jonh Wendell <wendell@bani.com.br>
* Copyright (C) 2007,2008 - Jonh Wendell <wendell@bani.com.br>
*
* 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
......@@ -38,9 +38,10 @@
<menu name="ViewMenu" action="View">
<menuitem name="ViewToolbarMenu" action="ViewToolbar"/>
<menuitem name="ViewStatusbarMenu" action="ViewStatusbar"/>
<menuitem name="ViewBookmarksMenu" action="ViewBookmarks"/>
<menuitem name="ViewSidePanelMenu" action="ViewSidePanel"/>
<separator/>
<menuitem name="ViewFullScreenMenu" action="ViewFullScreen"/>
<menuitem name="ViewScalingMenu" action="ViewScaling"/>
</menu>
<menu name="BookmarksMenu" action="Bookmarks">
......@@ -50,6 +51,8 @@
<menuitem name="BookmarksDelMenu" action="BookmarksDel"/>
<separator/>
<placeholder name="BookmarksList"/>
<separator/>
<placeholder name="AvahiList"/>
</menu>
<menu name="HelpMenu" action="Help">
......
NULL =
INCLUDES = \
-DBINDIR=\"$(bindir)\" \
-DDATADIR=\"$(datadir)\" \
......@@ -7,7 +9,7 @@ INCLUDES = \
-DVINAGRE_DATADIR=\""$(datadir)/vinagre"\" \
-DPACKAGE_LOCALE_DIR=\""$(datadir)/locale"\" \
$(VINAGRE_CFLAGS) \
$(AVAHI_CFLAGS)
$(NULL)
bin_PROGRAMS = vinagre
......@@ -23,10 +25,54 @@ vinagre_SOURCES = \
vinagre-tab.c vinagre-tab.h \
vinagre-utils.c vinagre-utils.h \
vinagre-window.c vinagre-window.h \
vinagre-ui.h vinagre-window-private.h
vinagre-ui.h vinagre-window-private.h \
vinagre-enums.h vinagre-enums.c \
gossip-cell-renderer-expander.c gossip-cell-renderer-expander.h \
vinagre-mdns.h vinagre-mdns.c \
$(NULL)
vinagre_LDADD = \
$(VINAGRE_LIBS) \
$(GTKVNC_LIBS) \
$(AVAHI_LIBS)
$(NULL)
vinagre_enum_headers = \
$(top_srcdir)/src/vinagre-connection.h \
$(NULL)
vinagre-enums.c: @REBUILD@ $(vinagre_enum_headers)
glib-mkenums --fhead "#include <glib-object.h>\n" \
--fhead "#include \"vinagre-enums.h\"\n\n" \
--fprod "\n/* enumerations from \"@filename@\" */" \
--fprod "\n#include \"@filename@\"\n" \
--vhead "static const G@Type@Value _@enum_name@_values[] = {" \
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n};\n\n" \
--vtail "GType\n@enum_name@_get_type (void)\n{\n" \
--vtail " static GType type = 0;\n\n" \
--vtail " if (!type)\n" \
--vtail " type = g_@type@_register_static (\"@EnumName@\", _@enum_name@_values);\n\n" \
--vtail " return type;\n}\n\n" \
$(vinagre_enum_headers) > $@
vinagre-enums.h: @REBUILD@ $(vinagre_enum_headers)
glib-mkenums --fhead "#ifndef __VINAGRE_ENUMS_H__\n" \
--fhead "#define __VINAGRE_ENUMS_H__ 1\n\n" \
--fhead "G_BEGIN_DECLS\n\n" \
--ftail "G_END_DECLS\n\n" \
--ftail "#endif /* __VINAGRE_ENUMS_H__ */\n" \
--fprod "\n/* --- @filename@ --- */" \
--eprod "#define VINAGRE_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n" \
--eprod "GType @enum_name@_get_type (void);\n" \
$(vinagre_enum_headers) > $@
BUILT_SOURCES = \
vinagre-enums.c \
vinagre-enums.h \
$(NULL)
DISTCLEANFILES = \
$(BUILT_SOURCES) \
$(NULL)
$(vinagre_OBJECTS): $(BUILT_SOURCES)
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2006 Kristian Rietveld <kris@babi-pangang.org>
*
* 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.
*/
/* To do:
* - should probably cancel animation if model changes
* - need to handle case where node-in-animation is removed
* - it only handles a single animation at a time; but I guess users
* aren't fast enough to trigger two or more animations at once anyway :P
* (could guard for this by just cancelling the "old" animation, and
* start the new one).
*/
#include "config.h"
#include <gtk/gtktreeview.h>
#include "gossip-cell-renderer-expander.h"
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_CELL_RENDERER_EXPANDER, GossipCellRendererExpanderPriv))
static void gossip_cell_renderer_expander_init (GossipCellRendererExpander *expander);
static void gossip_cell_renderer_expander_class_init (GossipCellRendererExpanderClass *klass);
static void gossip_cell_renderer_expander_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec);
static void gossip_cell_renderer_expander_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec);
static void gossip_cell_renderer_expander_finalize (GObject *object);
static void gossip_cell_renderer_expander_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
gint *width,
gint *height);
static void gossip_cell_renderer_expander_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
GtkCellRendererState flags);
static gboolean gossip_cell_renderer_expander_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GtkCellRendererState flags);
/* Properties */
enum {
PROP_0,
PROP_EXPANDER_STYLE,
PROP_EXPANDER_SIZE,
PROP_ACTIVATABLE
};
typedef struct _GossipCellRendererExpanderPriv GossipCellRendererExpanderPriv;
struct _GossipCellRendererExpanderPriv {
GtkExpanderStyle expander_style;
gint expander_size;
GtkTreeView *animation_view;
GtkTreeRowReference *animation_node;
GtkExpanderStyle animation_style;
guint animation_timeout;
GdkRectangle animation_area;
guint activatable : 1;
guint animation_expanding : 1;
};
G_DEFINE_TYPE (GossipCellRendererExpander, gossip_cell_renderer_expander, GTK_TYPE_CELL_RENDERER)
static void
gossip_cell_renderer_expander_init (GossipCellRendererExpander *expander)
{
GossipCellRendererExpanderPriv *priv;
priv = GET_PRIV (expander);
priv->expander_style = GTK_EXPANDER_COLLAPSED;
priv->expander_size = 12;
priv->activatable = TRUE;
priv->animation_node = NULL;
GTK_CELL_RENDERER (expander)->xpad = 2;
GTK_CELL_RENDERER (expander)->ypad = 2;
GTK_CELL_RENDERER (expander)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
}
static void
gossip_cell_renderer_expander_class_init (GossipCellRendererExpanderClass *klass)
{
GObjectClass *object_class;
GtkCellRendererClass *cell_class;
object_class = G_OBJECT_CLASS (klass);
cell_class = GTK_CELL_RENDERER_CLASS (klass);
object_class->finalize = gossip_cell_renderer_expander_finalize;
object_class->get_property = gossip_cell_renderer_expander_get_property;
object_class->set_property = gossip_cell_renderer_expander_set_property;
cell_class->get_size = gossip_cell_renderer_expander_get_size;
cell_class->render = gossip_cell_renderer_expander_render;
cell_class->activate = gossip_cell_renderer_expander_activate;
g_object_class_install_property (object_class,
PROP_EXPANDER_STYLE,
g_param_spec_enum ("expander-style",
"Expander Style",
"Style to use when painting the expander",
GTK_TYPE_EXPANDER_STYLE,
GTK_EXPANDER_COLLAPSED,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_EXPANDER_SIZE,
g_param_spec_int ("expander-size",
"Expander Size",
"The size of the expander",
0,
G_MAXINT,
12,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_ACTIVATABLE,
g_param_spec_boolean ("activatable",
"Activatable",
"The expander can be activated",
TRUE,
G_PARAM_READWRITE));
g_type_class_add_private (object_class, sizeof (GossipCellRendererExpanderPriv));
}
static void
gossip_cell_renderer_expander_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec)
{
GossipCellRendererExpander *expander;
GossipCellRendererExpanderPriv *priv;
expander = GOSSIP_CELL_RENDERER_EXPANDER (object);
priv = GET_PRIV (expander);
switch (param_id) {
case PROP_EXPANDER_STYLE:
g_value_set_enum (value, priv->expander_style);
break;
case PROP_EXPANDER_SIZE:
g_value_set_int (value, priv->expander_size);
break;
case PROP_ACTIVATABLE:
g_value_set_boolean (value, priv->activatable);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
static void
gossip_cell_renderer_expander_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec)
{
GossipCellRendererExpander *expander;
GossipCellRendererExpanderPriv *priv;
expander = GOSSIP_CELL_RENDERER_EXPANDER (object);
priv = GET_PRIV (expander);
switch (param_id) {
case PROP_EXPANDER_STYLE:
priv->expander_style = g_value_get_enum (value);
break;
case PROP_EXPANDER_SIZE:
priv->expander_size = g_value_get_int (value);
break;
case PROP_ACTIVATABLE:
priv->activatable = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
static void
gossip_cell_renderer_expander_finalize (GObject *object)
{
GossipCellRendererExpanderPriv *priv;
priv = GET_PRIV (object);
if (priv->animation_timeout) {
g_source_remove (priv->animation_timeout);
priv->animation_timeout = 0;
}
if (priv->animation_node) {
gtk_tree_row_reference_free (priv->animation_node);
}
(* G_OBJECT_CLASS (gossip_cell_renderer_expander_parent_class)->finalize) (object);
}
GtkCellRenderer *
gossip_cell_renderer_expander_new (void)
{
return g_object_new (GOSSIP_TYPE_CELL_RENDERER_EXPANDER, NULL);
}
static void
gossip_cell_renderer_expander_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
gint *width,
gint *height)
{
GossipCellRendererExpander *expander;
GossipCellRendererExpanderPriv *priv;
expander = (GossipCellRendererExpander*) cell;
priv = GET_PRIV (expander);
if (cell_area) {
if (x_offset) {
*x_offset = cell->xalign * (cell_area->width - (priv->expander_size + (2 * cell->xpad)));
*x_offset = MAX (*x_offset, 0);
}
if (y_offset) {
*y_offset = cell->yalign * (cell_area->height - (priv->expander_size + (2 * cell->ypad)));
*y_offset = MAX (*y_offset, 0);
}
} else {
if (x_offset)
*x_offset = 0;
if (y_offset)
*y_offset = 0;
}
if (width)
*width = cell->xpad * 2 + priv->expander_size;
if (height)
*height = cell->ypad * 2 + priv->expander_size;
}
static void
gossip_cell_renderer_expander_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
GtkCellRendererState flags)
{
GossipCellRendererExpander *expander;
GossipCellRendererExpanderPriv *priv;
GtkExpanderStyle expander_style;
gint x_offset, y_offset;
expander = (GossipCellRendererExpander*) cell;
priv = GET_PRIV (expander);
if (priv->animation_node) {
GtkTreePath *path;
GdkRectangle rect;
/* Not sure if I like this ... */
path = gtk_tree_row_reference_get_path (priv->animation_node);
gtk_tree_view_get_background_area (priv->animation_view, path,
NULL, &rect);
gtk_tree_path_free (path);
if (background_area->y == rect.y)
expander_style = priv->animation_style;
else
expander_style = priv->expander_style;
} else
expander_style = priv->expander_style;
gossip_cell_renderer_expander_get_size (cell, widget, cell_area,
&x_offset, &y_offset,
NULL, NULL);
gtk_paint_expander (widget->style,
window,
GTK_STATE_NORMAL,
expose_area,
widget,
"treeview",
cell_area->x + x_offset + cell->xpad + priv->expander_size / 2,
cell_area->y + y_offset + cell->ypad + priv->expander_size / 2,
expander_style);
}
static void
invalidate_node (GtkTreeView *tree_view,
GtkTreePath *path)
{
GdkWindow *bin_window;
GdkRectangle rect;
bin_window = gtk_tree_view_get_bin_window (tree_view);
gtk_tree_view_get_background_area (tree_view, path, NULL, &rect);
rect.x = 0;
rect.width = GTK_WIDGET (tree_view)->allocation.width;
gdk_window_invalidate_rect (bin_window, &rect, TRUE);
}
static gboolean
do_animation (GossipCellRendererExpander *expander)
{
GossipCellRendererExpanderPriv *priv;
GtkTreePath *path;
gboolean done = FALSE;
priv = GET_PRIV (expander);
if (priv->animation_expanding) {
if (priv->animation_style == GTK_EXPANDER_SEMI_COLLAPSED)
priv->animation_style = GTK_EXPANDER_SEMI_EXPANDED;
else if (priv->animation_style == GTK_EXPANDER_SEMI_EXPANDED) {
priv->animation_style = GTK_EXPANDER_EXPANDED;
done = TRUE;
}
} else {
if (priv->animation_style == GTK_EXPANDER_SEMI_EXPANDED)
priv->animation_style = GTK_EXPANDER_SEMI_COLLAPSED;
else if (priv->animation_style == GTK_EXPANDER_SEMI_COLLAPSED) {
priv->animation_style = GTK_EXPANDER_COLLAPSED;
done = TRUE;
}
}
path = gtk_tree_row_reference_get_path (priv->animation_node);
invalidate_node (priv->animation_view, path);
gtk_tree_path_free (path);
if (done) {
gtk_tree_row_reference_free (priv->animation_node);
priv->animation_node = NULL;
priv->animation_timeout = 0;
}
return !done;
}
static gboolean
animation_timeout (gpointer data)