Commit 6cf98ba5 authored by Jonh Wendell's avatar Jonh Wendell Committed by Jonh Wendell S. Santana
Browse files

Make avahi optional by adding an option to configure script:

2008-11-11  Jonh Wendell <jwendell@gnome.org>

	* lots of files: Make avahi optional by adding an option to
	configure script: --disable-avahi. It's enabled by default.
	Closes #557740.

svn path=/trunk/; revision=506
parent b8d46c33
2008-11-11 Jonh Wendell <jwendell@gnome.org>
* lots of files: Make avahi optional by adding an option to
configure script: --disable-avahi. It's enabled by default.
Closes #557740.
2008-10-20 Jonh Wendell <jwendell@gnome.org>
* configure.ac: bump to 2.25.1
......
......@@ -42,6 +42,23 @@ GTK_VNC_REQUIRED=0.3.7
AVAHI_REQUIRED=0.6.22
PANEL_REQUIRED_VERSION=2.0.0
# Check for avahi
AC_ARG_ENABLE(avahi,
AC_HELP_STRING([--disable-avahi],
[Do not use avahi for auto-discover machines [default=yes]]),
enable_avahi=no,
enable_avahi=yes)
if test "x$enable_avahi" = "xyes" ; then
PKG_CHECK_MODULES(AVAHI,\
avahi-ui >= $AVAHI_REQUIRED\
avahi-gobject >= $AVAHI_REQUIRED)
AC_SUBST(AVAHI_CFLAGS)
AC_SUBST(AVAHI_LIBS)
AC_DEFINE([VINAGRE_ENABLE_AVAHI],[1],[We want avahi support])
fi
AM_CONDITIONAL(AVAHI, test "x$enable_avahi" = "xyes")
PKG_CHECK_MODULES(VINAGRE, \
glib-2.0 >= $GLIB_REQUIRED \
gio-2.0 >= $GLIB_REQUIRED \
......@@ -50,9 +67,7 @@ PKG_CHECK_MODULES(VINAGRE, \
gconf-2.0 >= $GCONF_REQUIRED \
gthread-2.0 >= $GTHREAD_REQUIRED \
gnome-keyring-1 \
gtk-vnc-1.0 >= $GTK_VNC_REQUIRED \
avahi-ui >= $AVAHI_REQUIRED \
avahi-gobject >= $AVAHI_REQUIRED)
gtk-vnc-1.0 >= $GTK_VNC_REQUIRED)
AC_SUBST(VINAGRE_CFLAGS)
AC_SUBST(VINAGRE_LIBS)
......@@ -107,4 +122,6 @@ Configure summary:
Compiler ...................: ${CC}
Compiler Flags .............: ${CFLAGS}
Avahi enabled ..............: ${enable_avahi}
"
......@@ -15,6 +15,7 @@ INCLUDES = \
-DVINAGRE_DATADIR=\""$(datadir)/vinagre"\" \
-DPACKAGE_LOCALE_DIR=\""$(datadir)/locale"\" \
$(VINAGRE_CFLAGS) \
$(AVAHI_CFLAGS) \
$(NULL)
bin_PROGRAMS = vinagre
......@@ -33,15 +34,19 @@ vinagre_SOURCES = \
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 \
vinagre-prefs.h vinagre-prefs.c \
bacon-message-connection.h bacon-message-connection.c \
vinagre-app.h vinagre-app.c \
vinagre-bacon.h vinagre-bacon.c \
$(NULL)
if AVAHI
vinagre_SOURCES += vinagre-mdns.h vinagre-mdns.c
endif
vinagre_LDADD = \
$(VINAGRE_LIBS) \
$(AVAHI_LIBS) \
$(GTKVNC_LIBS) \
view/libview.la \
$(NULL)
......@@ -70,6 +75,7 @@ libexec_PROGRAMS = vinagre-applet
vinagre_applet_CFLAGS = \
$(APPLET_CFLAGS) \
$(AVAHI_CFLAGS) \
$(NULL)
vinagre_applet_SOURCES = \
......@@ -78,12 +84,16 @@ vinagre_applet_SOURCES = \
vinagre-connection.h vinagre-connection.c \
vinagre-utils.h vinagre-utils.c \
vinagre-enums.h vinagre-enums.c \
vinagre-mdns.h vinagre-mdns.c \
$(NULL)
if AVAHI
vinagre_applet_SOURCES += vinagre-mdns.h vinagre-mdns.c
endif
vinagre_applet_LDADD = \
$(APPLET_LIBS) \
$(VINAGRE_LIBS) \
$(AVAHI_LIBS) \
$(NULL)
......
......@@ -23,12 +23,15 @@
#include <gtk/gtk.h>
#include <panel-applet.h>
#include "vinagre-bookmarks.h"
#include "vinagre-mdns.h"
#include "vinagre-utils.h"
#include "vinagre-connection.h"
#include "vinagre-commands.h"
#include <config.h>
#ifdef VINAGRE_ENABLE_AVAHI
#include "vinagre-mdns.h"
#endif
static void
menu_position (GtkMenu *menu,
gint *x,
......@@ -173,8 +176,10 @@ click_cb (GtkWidget *applet,
all = vinagre_bookmarks_get_all (vinagre_bookmarks_get_default ());
fill_menu (all, menu);
#ifdef VINAGRE_ENABLE_AVAHI
all = vinagre_mdns_get_all (vinagre_mdns_get_default ());
fill_menu (all, menu);
#endif
gtk_widget_show_all (menu);
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, (GtkMenuPositionFunc) menu_position, applet,
......@@ -205,13 +210,16 @@ vinagre_applet_fill (PanelApplet *applet,
{
GtkWidget *image, *button;
gchar *tmp;
VinagreMdns *mdns;
static const BonoboUIVerb menu_verbs[] = {
BONOBO_UI_VERB ("VinagreHelp", help_cb),
BONOBO_UI_VERB ("VinagreAbout", about_cb),
BONOBO_UI_VERB_END
};
#ifdef VINAGRE_ENABLE_AVAHI
VinagreMdns *mdns;
#endif
if (strcmp (iid, "OAFIID:GNOME_VinagreApplet") != 0)
return FALSE;
......@@ -238,7 +246,9 @@ vinagre_applet_fill (PanelApplet *applet,
gtk_container_add (GTK_CONTAINER (applet), image);
gtk_widget_show_all (GTK_WIDGET (applet));
#ifdef VINAGRE_ENABLE_AVAHI
mdns = vinagre_mdns_get_default ();
#endif
return TRUE;
}
......
......@@ -18,13 +18,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <avahi-ui/avahi-ui.h>
#include <string.h>
#ifdef VINAGRE_ENABLE_AVAHI
#include <avahi-ui/avahi-ui.h>
#endif
#include "vinagre-connect.h"
#include "vinagre-utils.h"
#include "vinagre-bookmarks.h"
......@@ -174,6 +181,7 @@ save_history (GtkWidget *combo) {
}
}
#ifdef VINAGRE_ENABLE_AVAHI
static void
vinagre_connect_find_button_cb (GtkButton *button,
VinagreConnectDialog *dialog)
......@@ -208,6 +216,7 @@ vinagre_connect_find_button_cb (GtkButton *button,
gtk_widget_destroy (d);
}
#endif
VinagreConnection *vinagre_connect (VinagreWindow *window)
{
......@@ -227,10 +236,15 @@ VinagreConnection *vinagre_connect (VinagreWindow *window)
setup_combo (dialog.host_entry);
#ifdef VINAGRE_ENABLE_AVAHI
g_signal_connect (dialog.find_button,
"clicked",
G_CALLBACK (vinagre_connect_find_button_cb),
&dialog);
#else
gtk_widget_hide (dialog.find_button);
gtk_widget_set_no_show_all (dialog.find_button, TRUE);
#endif
gtk_widget_show_all (dialog.dialog);
result = gtk_dialog_run (GTK_DIALOG (dialog.dialog));
......
......@@ -26,9 +26,12 @@
#include "vinagre-fav.h"
#include "vinagre-utils.h"
#include "vinagre-bookmarks.h"
#include "vinagre-mdns.h"
#include "vinagre-window-private.h"
#include "gossip-cell-renderer-expander.h"
#ifdef VINAGRE_ENABLE_AVAHI
#include "vinagre-mdns.h"
#endif
#define VINAGRE_FAV_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), VINAGRE_TYPE_FAV, VinagreFavPrivate))
......@@ -724,10 +727,12 @@ vinagre_fav_init (VinagreFav *fav)
"changed",
G_CALLBACK (vinagre_fav_update_list),
fav);
#ifdef VINAGRE_ENABLE_AVAHI
g_signal_connect_swapped (vinagre_mdns_get_default (),
"changed",
G_CALLBACK (vinagre_fav_update_list),
fav);
#endif
}
GtkWidget *
......@@ -797,7 +802,7 @@ vinagre_fav_update_list (VinagreFav *fav)
gtk_tree_view_expand_row (GTK_TREE_VIEW (fav->priv->tree), path, FALSE);
gtk_tree_path_free (path);
/* avahi */
#ifdef VINAGRE_ENABLE_AVAHI
list = vinagre_mdns_get_all (vinagre_mdns_get_default ());
if (!list)
return FALSE;
......@@ -841,6 +846,7 @@ vinagre_fav_update_list (VinagreFav *fav)
path = gtk_tree_path_new_from_string ("1");
gtk_tree_view_expand_row (GTK_TREE_VIEW (fav->priv->tree), path, FALSE);
gtk_tree_path_free (path);
#endif
return FALSE;
}
......
......@@ -33,10 +33,13 @@
#include "vinagre-app.h"
#include "vinagre-utils.h"
#include "vinagre-prefs.h"
#include "vinagre-mdns.h"
#include "vinagre-bacon.h"
#include <vncdisplay.h>
#ifdef VINAGRE_ENABLE_AVAHI
#include "vinagre-mdns.h"
#endif
/* command line */
static gchar **files = NULL;
static gchar **remaining_args = NULL;
......@@ -169,8 +172,10 @@ int main (int argc, char **argv) {
gtk_main ();
g_object_unref (vinagre_bookmarks_get_default ());
g_object_unref (vinagre_mdns_get_default ());
g_object_unref (vinagre_prefs_get_default ());
#ifdef VINAGRE_ENABLE_AVAHI
g_object_unref (vinagre_mdns_get_default ());
#endif
return 0;
}
......
......@@ -36,10 +36,12 @@
#include "vinagre-utils.h"
#include "vinagre-bookmarks.h"
#include "vinagre-ui.h"
#include "vinagre-mdns.h"
#include "vinagre-window-private.h"
#ifdef VINAGRE_ENABLE_AVAHI
#include "vinagre-mdns.h"
#endif
#define VINAGRE_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object),\
VINAGRE_TYPE_WINDOW, \
VinagreWindowPrivate))
......@@ -565,7 +567,10 @@ vinagre_window_update_bookmarks_list_menu (VinagreWindow *window)
{
VinagreWindowPrivate *p = window->priv;
GList *actions, *l;
GSList *favs, *mdnss;
GSList *favs;
#ifdef VINAGRE_ENABLE_AVAHI
GSList *mdnss;
#endif
gint n, m, i;
guint id;
......@@ -586,9 +591,14 @@ vinagre_window_update_bookmarks_list_menu (VinagreWindow *window)
g_list_free (actions);
favs = vinagre_bookmarks_get_all (vinagre_bookmarks_get_default ());
mdnss = vinagre_mdns_get_all (vinagre_mdns_get_default ());
n = g_slist_length (favs);
#ifdef VINAGRE_ENABLE_AVAHI
mdnss = vinagre_mdns_get_all (vinagre_mdns_get_default ());
m = g_slist_length (mdnss);
#else
m = 0;
#endif
i = 0;
id = (n > 0||m > 0) ? gtk_ui_manager_new_merge_id (p->manager) : 0;
......@@ -641,7 +651,7 @@ vinagre_window_update_bookmarks_list_menu (VinagreWindow *window)
i++;
}
/* avahi */
#ifdef VINAGRE_ENABLE_AVAHI
i = 0;
while (mdnss)
{
......@@ -690,6 +700,7 @@ vinagre_window_update_bookmarks_list_menu (VinagreWindow *window)
mdnss = mdnss->next;
i++;
}
#endif
p->bookmarks_list_menu_ui_id = id;
}
......@@ -1017,11 +1028,12 @@ vinagre_window_init (VinagreWindow *window)
"changed",
G_CALLBACK (vinagre_window_update_bookmarks_list_menu),
window);
#ifdef VINAGRE_ENABLE_AVAHI
g_signal_connect_swapped (vinagre_mdns_get_default (),
"changed",
G_CALLBACK (vinagre_window_update_bookmarks_list_menu),
window);
#endif
vinagre_window_init_clipboard (window);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment