From: Lennart Poettering Date: Fri, 3 Jun 2005 19:02:12 +0000 (+0000) Subject: * improve avahi-discover GUI X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=259ef1fd00e7e415dfb11bf26747355e5cd851f7;p=catta * improve avahi-discover GUI * if a new interface becomes available, reissue all queries git-svn-id: file:///home/lennart/svn/public/avahi/trunk@94 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-core/browse.c b/avahi-core/browse.c index c959831..45e8bce 100644 --- a/avahi-core/browse.c +++ b/avahi-core/browse.c @@ -41,7 +41,7 @@ struct AvahiRecordBrowser { AvahiRecordBrowserCallback callback; gpointer userdata; - AVAHI_LLIST_FIELDS(AvahiRecordBrowser, resolver); + AVAHI_LLIST_FIELDS(AvahiRecordBrowser, browser); AVAHI_LLIST_FIELDS(AvahiRecordBrowser, by_key); }; @@ -128,7 +128,7 @@ AvahiRecordBrowser *avahi_record_browser_new(AvahiServer *server, gint interface avahi_elapse_time(&tv, b->sec_delay*1000, 0); b->time_event = avahi_time_event_queue_add(server->time_event_queue, &tv, elapse, b); - AVAHI_LLIST_PREPEND(AvahiRecordBrowser, resolver, server->record_browsers, b); + AVAHI_LLIST_PREPEND(AvahiRecordBrowser, browser, server->record_browsers, b); /* Add the new entry to the record_browser hash table */ t = g_hash_table_lookup(server->record_browser_hashtable, key); @@ -159,7 +159,7 @@ void avahi_record_browser_destroy(AvahiRecordBrowser *b) { g_assert(b); - AVAHI_LLIST_REMOVE(AvahiRecordBrowser, resolver, b->server->record_browsers, b); + AVAHI_LLIST_REMOVE(AvahiRecordBrowser, browser, b->server->record_browsers, b); t = g_hash_table_lookup(b->server->record_browser_hashtable, b->key); AVAHI_LLIST_REMOVE(AvahiRecordBrowser, by_key, t, b); @@ -182,7 +182,7 @@ void avahi_browser_cleanup(AvahiServer *server) { g_assert(server); for (b = server->record_browsers; b; b = n) { - n = b->resolver_next; + n = b->browser_next; if (b->dead) avahi_record_browser_destroy(b); @@ -213,3 +213,14 @@ gboolean avahi_is_subscribed(AvahiServer *server, AvahiInterface *i, AvahiKey *k return FALSE; } + +void avahi_browser_new_interface(AvahiServer*s, AvahiInterface *i) { + AvahiRecordBrowser *b; + + g_assert(s); + g_assert(i); + + for (b = s->record_browsers; b; b = b->browser_next) + if (avahi_interface_match(i, b->interface, b->protocol)) + avahi_interface_post_query(i, b->key, FALSE); +} diff --git a/avahi-core/browse.h b/avahi-core/browse.h index f993d3e..ac33c51 100644 --- a/avahi-core/browse.h +++ b/avahi-core/browse.h @@ -34,4 +34,6 @@ gboolean avahi_is_subscribed(AvahiServer *s, AvahiInterface *i, AvahiKey *k); void avahi_record_browser_destroy(AvahiRecordBrowser *b); +void avahi_browser_new_interface(AvahiServer*s, AvahiInterface *i); + #endif diff --git a/avahi-core/iface.c b/avahi-core/iface.c index 8686fb5..d890e22 100644 --- a/avahi-core/iface.c +++ b/avahi-core/iface.c @@ -244,6 +244,7 @@ static void check_interface_relevant(AvahiInterfaceMonitor *m, AvahiInterface *i i->announcing = TRUE; avahi_announce_interface(m->server, i); + avahi_browser_new_interface(m->server, i); } else if (!b && i->announcing) { g_message("Interface %s.%i no longer relevant", i->hardware->name, i->protocol); diff --git a/avahi-discover/avahi-discover.glade b/avahi-discover/avahi-discover.glade index 9465036..852f2ee 100644 --- a/avahi-discover/avahi-discover.glade +++ b/avahi-discover/avahi-discover.glade @@ -41,7 +41,7 @@ True True False - True + False True diff --git a/avahi-discover/main.c b/avahi-discover/main.c index 557806e..de15a44 100644 --- a/avahi-discover/main.c +++ b/avahi-discover/main.c @@ -244,6 +244,7 @@ gboolean main_window_on_delete_event(GtkWidget *widget, GdkEvent *event, gpointe int main(int argc, char *argv[]) { GladeXML *xml; AvahiServerConfig config; + GtkTreeViewColumn *c; gtk_init(&argc, &argv); glade_init(); @@ -261,6 +262,10 @@ int main(int argc, char *argv[]) { gtk_tree_view_set_model(tree_view, GTK_TREE_MODEL(tree_store)); gtk_tree_view_insert_column_with_attributes(tree_view, -1, "Name", gtk_cell_renderer_text_new(), "text", 0, NULL); gtk_tree_view_insert_column_with_attributes(tree_view, -1, "Interface", gtk_cell_renderer_text_new(), "text", 1, NULL); + + gtk_tree_view_column_set_resizable(c = gtk_tree_view_get_column(tree_view, 0), TRUE); + gtk_tree_view_column_set_sizing(c, GTK_TREE_VIEW_COLUMN_GROW_ONLY); + gtk_tree_view_column_set_expand(c, TRUE); service_type_hash_table = g_hash_table_new((GHashFunc) avahi_domain_hash, (GEqualFunc) avahi_domain_equal);