]> git.meshlink.io Git - catta/blobdiff - avahi-ui/avahi-ui.c
avahi-ui: gtk3 fix
[catta] / avahi-ui / avahi-ui.c
index bd2b3cc1a9fe460049dc77dbf4a0b8f550803e5c..92d765aa1a8b40f426771d094b5d1e0834a63d08 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /***
   This file is part of avahi.
 
@@ -30,7 +28,6 @@
 #include <net/if.h>
 
 #include <gtk/gtk.h>
-#include <glib/gi18n.h>
 
 #include <avahi-glib/glib-watch.h>
 #include <avahi-client/client.h>
@@ -131,16 +128,16 @@ static void aui_service_dialog_get_property(GObject *object, guint prop_id, GVal
 static int get_default_response(GtkDialog *dlg) {
     gint ret = GTK_RESPONSE_NONE;
 
-    if (GTK_WINDOW(dlg)->default_widget)
+    if (gtk_window_get_default_widget(GTK_WINDOW(dlg)))
         /* Use the response of the default widget, if possible */
-        ret = gtk_dialog_get_response_for_widget(dlg, GTK_WINDOW(dlg)->default_widget);
+        ret = gtk_dialog_get_response_for_widget(dlg, gtk_window_get_default_widget(GTK_WINDOW(dlg)));
 
     if (ret == GTK_RESPONSE_NONE) {
         /* Fall back to finding the first positive response */
         GList *children, *t;
         gint bad = GTK_RESPONSE_NONE;
 
-        t = children = gtk_container_get_children(GTK_CONTAINER(dlg->action_area));
+        t = children = gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_action_area(dlg)));
 
         while (t) {
             GtkWidget *child = t->data;
@@ -230,13 +227,13 @@ static void aui_service_dialog_class_init(AuiServiceDialogClass *klass) {
     g_object_class_install_property(
             object_class,
             PROP_RESOLVE_SERVICE,
-            g_param_spec_boolean("resolve_service", _("Resolve service"), _("Resolve service"),
+            g_param_spec_boolean("resolve_service", _("Resolve Service"), _("Resolve the selected service automatically before returning"),
                                  TRUE,
                                  G_PARAM_READABLE | G_PARAM_WRITABLE));
     g_object_class_install_property(
             object_class,
             PROP_RESOLVE_HOST_NAME,
-            g_param_spec_boolean("resolve_host_name", _("Resolve service host name"), _("Resolve service host name"),
+            g_param_spec_boolean("resolve_host_name", _("Resolve Service Host Name"), _("Resolve the host name of the selected service automatically before returning"),
                                  TRUE,
                                  G_PARAM_READABLE | G_PARAM_WRITABLE));
     g_object_class_install_property(
@@ -257,11 +254,13 @@ GtkWidget *aui_service_dialog_new_valist(
     const gchar *button_text;
     gint dr;
 
-    GtkWidget *w = GTK_WIDGET(g_object_new(
+    GtkWidget *w = (GtkWidget*)g_object_new(
                                       AUI_TYPE_SERVICE_DIALOG,
+#if !GTK_CHECK_VERSION (2,21,8)
                                       "has-separator", FALSE,
+#endif
                                       "title", title,
-                                      NULL));
+                                      NULL);
 
     if (parent)
         gtk_window_set_transient_for(GTK_WINDOW(w), parent);
@@ -890,8 +889,8 @@ static void response_callback(GtkDialog *dialog, gint response, gpointer user_da
 
         gtk_widget_set_sensitive(GTK_WIDGET(dialog), FALSE);
         cursor = gdk_cursor_new(GDK_WATCH);
-        gdk_window_set_cursor(GTK_WIDGET(dialog)->window, cursor);
-        gdk_cursor_unref(cursor);
+        gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(dialog)), cursor);
+        g_object_unref(G_OBJECT(cursor));
 
         if (!(d->priv->resolver = avahi_service_resolver_new(
                       d->priv->client, interface, protocol, name, type, d->priv->domain,
@@ -988,11 +987,13 @@ static void domain_button_clicked(GtkButton *button G_GNUC_UNUSED, gpointer user
     p->domain_dialog = gtk_dialog_new();
     gtk_container_set_border_width(GTK_CONTAINER(p->domain_dialog), 5);
     gtk_window_set_title(GTK_WINDOW(p->domain_dialog), _("Change domain"));
+#if !GTK_CHECK_VERSION(2,21,8)
     gtk_dialog_set_has_separator(GTK_DIALOG(p->domain_dialog), FALSE);
+#endif
 
     vbox = gtk_vbox_new(FALSE, 8);
     gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(p->domain_dialog)->vbox), vbox, TRUE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(p->domain_dialog))), vbox, TRUE, TRUE, 0);
 
     p->domain_entry = gtk_entry_new();
     gtk_entry_set_max_length(GTK_ENTRY(p->domain_entry), AVAHI_DOMAIN_NAME_MAX);
@@ -1114,7 +1115,7 @@ static void aui_service_dialog_init(AuiServiceDialog *d) {
 
     vbox = gtk_vbox_new(FALSE, 8);
     gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), vbox, TRUE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(d))), vbox, TRUE, TRUE, 0);
 
     p->domain_label = gtk_label_new(_("Initializing..."));
     gtk_label_set_ellipsize(GTK_LABEL(p->domain_label), TRUE);
@@ -1165,8 +1166,8 @@ static void aui_service_dialog_init(AuiServiceDialog *d) {
     p->domain_button = gtk_button_new_with_mnemonic(_("_Domain..."));
     gtk_button_set_image(GTK_BUTTON(p->domain_button), gtk_image_new_from_stock(GTK_STOCK_NETWORK, GTK_ICON_SIZE_BUTTON));
     g_signal_connect(p->domain_button, "clicked", G_CALLBACK(domain_button_clicked), d);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), p->domain_button, FALSE, TRUE, 0);
-    gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(GTK_DIALOG(d)->action_area), p->domain_button, TRUE);
+    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(d))), p->domain_button, FALSE, TRUE, 0);
+    gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(gtk_dialog_get_action_area(GTK_DIALOG(d))), p->domain_button, TRUE);
     gtk_widget_show(p->domain_button);
 
     gtk_dialog_set_default_response(GTK_DIALOG(d), GTK_RESPONSE_ACCEPT);