Bug 669130 [atk]Use emission hook for show/hide signal to add/remove GTK+ native a11y dialog to children of Mozilla application accessible. r=trev.saunders,roc
authorGinn Chen <ginn.chen@oracle.com>
Thu, 14 Jul 2011 09:58:32 +0800
changeset 72760 34b0b3bc6984
parent 72759 8644336b5d40
child 72761 62cb7ce43f42
push id20768
push userginn.chen@oracle.com
push dateThu, 14 Jul 2011 01:59:31 +0000
treeherdermozilla-central@34b0b3bc6984 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstrev
bugs669130
milestone8.0a1
first release with
nightly linux32
34b0b3bc6984 / 8.0a1 / 20110714030748 / files
nightly linux64
34b0b3bc6984 / 8.0a1 / 20110714030748 / files
nightly mac
34b0b3bc6984 / 8.0a1 / 20110714030748 / files
nightly win32
34b0b3bc6984 / 8.0a1 / 20110714030748 / files
nightly win64
34b0b3bc6984 / 8.0a1 / 20110714030748 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 669130 [atk]Use emission hook for show/hide signal to add/remove GTK+ native a11y dialog to children of Mozilla application accessible. r=trev.saunders,roc
accessible/src/atk/nsApplicationAccessibleWrap.cpp
widget/src/gtk2/Makefile.in
widget/src/gtk2/nsFilePicker.cpp
widget/src/gtk2/nsPrintDialogGTK.cpp
--- a/accessible/src/atk/nsApplicationAccessibleWrap.cpp
+++ b/accessible/src/atk/nsApplicationAccessibleWrap.cpp
@@ -50,17 +50,17 @@
 #include "nsAccessibilityService.h"
 #include "AtkSocketAccessible.h"
 
 #include <gtk/gtk.h>
 #include <atk/atk.h>
 
 typedef GType (* AtkGetTypeType) (void);
 GType g_atk_hyperlink_impl_type = G_TYPE_INVALID;
-static PRBool sATKChecked = PR_FALSE;
+static bool sATKChecked = false;
 static PRLibrary *sATKLib = nsnull;
 static const char sATKLibName[] = "libatk-1.0.so.0";
 static const char sATKHyperlinkImplGetTypeSymbol[] =
     "atk_hyperlink_impl_get_type";
 static const char sAccEnv [] = "GNOME_ACCESSIBILITY";
 static const char sSysPrefService [] =
     "@mozilla.org/system-preference-service;1";
 static const char sAccessibilityKey [] =
@@ -95,33 +95,37 @@ static guint add_listener (GSignalEmissi
                            const gchar *hook_data,
                            guint gail_listenerid = 0);
 static AtkKeyEventStruct *atk_key_event_from_gdk_event_key(GdkEventKey *key);
 static gboolean notify_hf(gpointer key, gpointer value, gpointer data);
 static void insert_hf(gpointer key, gpointer value, gpointer data);
 static gint mai_key_snooper(GtkWidget *the_widget, GdkEventKey *event,
                             gpointer func_data);
 
-static GHashTable *listener_list = NULL;
-static gint listener_idx = 1;
+static GHashTable* sListener_list = NULL;
+static gint sListener_idx = 1;
 
 #define MAI_TYPE_UTIL              (mai_util_get_type ())
 #define MAI_UTIL(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
                                     MAI_TYPE_UTIL, MaiUtil))
 #define MAI_UTIL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), \
                                     MAI_TYPE_UTIL, MaiUtilClass))
 #define MAI_IS_UTIL(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
                                     MAI_TYPE_UTIL))
 #define MAI_IS_UTIL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), \
                                     MAI_TYPE_UTIL))
 #define MAI_UTIL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), \
                                     MAI_TYPE_UTIL, MaiUtilClass))
 
-static GHashTable *key_listener_list = NULL;
-static guint key_snooper_id = 0;
+static GHashTable* sKey_listener_list = NULL;
+static guint sKey_snooper_id = 0;
+static GQuark sQuark_gecko_acc_obj = g_quark_from_static_string("GeckoAccObj");
+static bool sToplevel_event_hook_added = false;
+static gulong sToplevel_show_hook = 0;
+static gulong sToplevel_hide_hook = 0;
 
 G_BEGIN_DECLS
 typedef void (*GnomeAccessibilityInit) (void);
 typedef void (*GnomeAccessibilityShutdown) (void);
 G_END_DECLS
 
 struct MaiUtil
 {
@@ -265,18 +269,18 @@ mai_util_class_init(MaiUtilClass *klass)
     atk_class->remove_global_event_listener =
         mai_util_remove_global_event_listener;
     atk_class->add_key_event_listener = mai_util_add_key_event_listener;
     atk_class->remove_key_event_listener = mai_util_remove_key_event_listener;
     atk_class->get_root = mai_util_get_root;
     atk_class->get_toolkit_name = mai_util_get_toolkit_name;
     atk_class->get_toolkit_version = mai_util_get_toolkit_version;
 
-    listener_list = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
-                                          _listener_info_destroy);
+    sListener_list = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
+                                           _listener_info_destroy);
     // Keep track of added/removed windows.
     AtkObject *root = atk_get_root ();
     g_signal_connect (root, "children-changed::add", (GCallback) window_added, NULL);
     g_signal_connect (root, "children-changed::remove", (GCallback) window_removed, NULL);
 }
 
 static guint
 mai_util_add_global_event_listener(GSignalEmissionHook listener,
@@ -290,17 +294,17 @@ mai_util_add_global_event_listener(GSign
     if (split_string) {
         if (!strcmp ("window", split_string[0])) {
             guint gail_listenerid = 0;
             if (gail_add_global_event_listener) {
                 // call gail's function to track gtk native window events
                 gail_listenerid =
                     gail_add_global_event_listener(listener, event_type);
             }
-            
+
             rc = add_listener (listener, "MaiAtkObject", split_string[1],
                                event_type, gail_listenerid);
         }
         else {
             rc = add_listener (listener, split_string[1], split_string[2],
                                event_type);
         }
         g_strfreev(split_string);
@@ -311,32 +315,32 @@ mai_util_add_global_event_listener(GSign
 static void
 mai_util_remove_global_event_listener(guint remove_listener)
 {
     if (remove_listener > 0) {
         MaiUtilListenerInfo *listener_info;
         gint tmp_idx = remove_listener;
 
         listener_info = (MaiUtilListenerInfo *)
-            g_hash_table_lookup(listener_list, &tmp_idx);
+            g_hash_table_lookup(sListener_list, &tmp_idx);
 
         if (listener_info != NULL) {
             if (gail_remove_global_event_listener &&
                 listener_info->gail_listenerid) {
               gail_remove_global_event_listener(listener_info->gail_listenerid);
             }
-            
+
             /* Hook id of 0 and signal id of 0 are invalid */
             if (listener_info->hook_id != 0 && listener_info->signal_id != 0) {
                 /* Remove the emission hook */
                 g_signal_remove_emission_hook(listener_info->signal_id,
                                               listener_info->hook_id);
 
                 /* Remove the element from the hash */
-                g_hash_table_remove(listener_list, &tmp_idx);
+                g_hash_table_remove(sListener_list, &tmp_idx);
             }
             else {
                 g_warning("Invalid listener hook_id %ld or signal_id %d\n",
                           listener_info->hook_id, listener_info->signal_id);
             }
         }
         else {
             // atk-bridge is initialized with gail (e.g. yelp)
@@ -367,24 +371,24 @@ atk_key_event_from_gdk_event_key (GdkEve
         break;
     default:
         g_assert_not_reached ();
         return NULL;
     }
     event->state = key->state;
     event->keyval = key->keyval;
     event->length = key->length;
-    if (key->string && key->string [0] && 
+    if (key->string && key->string [0] &&
         (key->state & GDK_CONTROL_MASK ||
          g_unichar_isgraph (g_utf8_get_char (key->string)))) {
         event->string = key->string;
     }
     else if (key->type == GDK_KEY_PRESS ||
              key->type == GDK_KEY_RELEASE) {
-        event->string = gdk_keyval_name (key->keyval);	    
+        event->string = gdk_keyval_name (key->keyval);
     }
     event->keycode = key->hardware_keycode;
     event->timestamp = key->time;
 
     MAI_LOG_DEBUG(("MaiKey:\tsym %u\n\tmods %x\n\tcode %u\n\ttime %lx\n",
                    (unsigned int) event->keyval,
                    (unsigned int) event->state,
                    (unsigned int) event->keycode,
@@ -410,19 +414,19 @@ insert_hf(gpointer key, gpointer value, 
 
 static gint
 mai_key_snooper(GtkWidget *the_widget, GdkEventKey *event, gpointer func_data)
 {
     /* notify each AtkKeySnoopFunc in turn... */
 
     MaiKeyEventInfo *info = g_new0(MaiKeyEventInfo, 1);
     gint consumed = 0;
-    if (key_listener_list) {
+    if (sKey_listener_list) {
         GHashTable *new_hash = g_hash_table_new(NULL, NULL);
-        g_hash_table_foreach (key_listener_list, insert_hf, new_hash);
+        g_hash_table_foreach (sKey_listener_list, insert_hf, new_hash);
         info->key_event = atk_key_event_from_gdk_event_key (event);
         info->func_data = func_data;
         consumed = g_hash_table_foreach_steal (new_hash, notify_hf, info);
         g_hash_table_destroy (new_hash);
         g_free(info->key_event);
     }
     g_free(info);
     return (consumed ? 1 : 0);
@@ -431,39 +435,39 @@ mai_key_snooper(GtkWidget *the_widget, G
 static guint
 mai_util_add_key_event_listener (AtkKeySnoopFunc listener,
                                  gpointer data)
 {
     NS_ENSURE_TRUE(listener, 0);
 
     static guint key=0;
 
-    if (!key_listener_list) {
-        key_listener_list = g_hash_table_new(NULL, NULL);
-        key_snooper_id = gtk_key_snooper_install(mai_key_snooper, data);
+    if (!sKey_listener_list) {
+        sKey_listener_list = g_hash_table_new(NULL, NULL);
+        sKey_snooper_id = gtk_key_snooper_install(mai_key_snooper, data);
     }
     AtkKeySnoopFuncPointer atkKeySnoop;
     atkKeySnoop.func_ptr = listener;
-    g_hash_table_insert(key_listener_list, GUINT_TO_POINTER (key++),
+    g_hash_table_insert(sKey_listener_list, GUINT_TO_POINTER (key++),
                         atkKeySnoop.data);
     return key;
 }
 
 static void
 mai_util_remove_key_event_listener (guint remove_listener)
 {
-    if (!key_listener_list) {
+    if (!sKey_listener_list) {
         // atk-bridge is initialized with gail (e.g. yelp)
         // try gail_remove_key_event_listener
         return gail_remove_key_event_listener(remove_listener);
     }
 
-    g_hash_table_remove(key_listener_list, GUINT_TO_POINTER (remove_listener));
-    if (g_hash_table_size(key_listener_list) == 0) {
-        gtk_key_snooper_remove(key_snooper_id);
+    g_hash_table_remove(sKey_listener_list, GUINT_TO_POINTER (remove_listener));
+    if (g_hash_table_size(sKey_listener_list) == 0) {
+        gtk_key_snooper_remove(sKey_snooper_id);
     }
 }
 
 AtkObject *
 mai_util_get_root(void)
 {
     if (nsAccessibilityService::IsShutdown()) {
         // We've shutdown, try to use gail instead
@@ -513,31 +517,31 @@ add_listener (GSignalEmissionHook listen
     gint rc = 0;
 
     type = g_type_from_name(object_type);
     if (type) {
         signal_id = g_signal_lookup(signal, type);
         if (signal_id > 0) {
             MaiUtilListenerInfo *listener_info;
 
-            rc = listener_idx;
+            rc = sListener_idx;
 
             listener_info =  (MaiUtilListenerInfo *)
                 g_malloc(sizeof(MaiUtilListenerInfo));
-            listener_info->key = listener_idx;
+            listener_info->key = sListener_idx;
             listener_info->hook_id =
                 g_signal_add_emission_hook(signal_id, 0, listener,
                                            g_strdup(hook_data),
                                            (GDestroyNotify)g_free);
             listener_info->signal_id = signal_id;
             listener_info->gail_listenerid = gail_listenerid;
 
-            g_hash_table_insert(listener_list, &(listener_info->key),
+            g_hash_table_insert(sListener_list, &(listener_info->key),
                                 listener_info);
-            listener_idx++;
+            sListener_idx++;
         }
         else {
             g_warning("Invalid signal type %s\n", signal);
         }
     }
     else {
         g_warning("Invalid object type %s\n", object_type);
     }
@@ -555,16 +559,59 @@ nsApplicationAccessibleWrap::nsApplicati
 }
 
 nsApplicationAccessibleWrap::~nsApplicationAccessibleWrap()
 {
     MAI_LOG_DEBUG(("======Destory AppRootAcc=%p\n", (void*)this));
     nsAccessibleWrap::ShutdownAtkObject();
 }
 
+static gboolean
+toplevel_event_watcher(GSignalInvocationHint* ihint,
+                       guint                  n_param_values,
+                       const GValue*          param_values,
+                       gpointer               data)
+{
+  if (nsAccessibilityService::IsShutdown())
+    return TRUE;
+
+  GObject* object = reinterpret_cast<GObject*>(g_value_get_object(param_values));
+  if (!GTK_IS_WINDOW(object))
+    return TRUE;
+
+  AtkObject* child = gtk_widget_get_accessible(GTK_WIDGET(object));
+
+  // GTK native dialog
+  if (!IS_MAI_OBJECT(child) &&
+      (atk_object_get_role(child) == ATK_ROLE_DIALOG)) {
+
+    if (data == reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_SHOW)) {
+
+      // Attach the dialog accessible to app accessible tree
+      nsAccessible* windowAcc = GetAccService()->AddNativeRootAccessible(child);
+      g_object_set_qdata(G_OBJECT(child), sQuark_gecko_acc_obj,
+                         reinterpret_cast<gpointer>(windowAcc));
+
+    } else {
+
+      // Deattach the dialog accessible
+      nsAccessible* windowAcc =
+        reinterpret_cast<nsAccessible*>
+                        (g_object_get_qdata(G_OBJECT(child), sQuark_gecko_acc_obj));
+      if (windowAcc) {
+        GetAccService()->RemoveNativeRootAccessible(windowAcc);
+        g_object_set_qdata(G_OBJECT(child), sQuark_gecko_acc_obj, NULL);
+      }
+
+    }
+  }
+
+  return TRUE;
+}
+
 PRBool
 nsApplicationAccessibleWrap::Init()
 {
     // XXX following code is copied from widget/src/gtk2/nsWindow.cpp
     // we should put it to somewhere that can be used from both modules
     // see bug 390761
 
     // check if accessibility enabled/disabled by environment variable
@@ -603,24 +650,44 @@ nsApplicationAccessibleWrap::Init()
         // load and initialize atk-bridge library
         rv = LoadGtkModule(sAtkBridge);
         if (NS_SUCCEEDED(rv)) {
             // init atk-bridge
             (*sAtkBridge.init)();
         }
         else
             MAI_LOG_DEBUG(("Fail to load lib: %s\n", sAtkBridge.libName));
+
+        if (!sToplevel_event_hook_added) {
+          sToplevel_event_hook_added = true;
+          sToplevel_show_hook =
+            g_signal_add_emission_hook(g_signal_lookup("show", GTK_TYPE_WINDOW),
+              0, toplevel_event_watcher,
+              reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_SHOW), NULL);
+          sToplevel_hide_hook =
+            g_signal_add_emission_hook(g_signal_lookup("hide", GTK_TYPE_WINDOW),
+              0, toplevel_event_watcher,
+              reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_HIDE), NULL);
+        }
     }
 
     return nsApplicationAccessible::Init();
 }
 
 void
 nsApplicationAccessibleWrap::Unload()
 {
+    if (sToplevel_event_hook_added) {
+      sToplevel_event_hook_added = false;
+      g_signal_remove_emission_hook(g_signal_lookup("show", GTK_TYPE_WINDOW),
+                                    sToplevel_show_hook);
+      g_signal_remove_emission_hook(g_signal_lookup("hide", GTK_TYPE_WINDOW),
+                                    sToplevel_hide_hook);
+    }
+
     if (sAtkBridge.lib) {
         // Do not shutdown/unload atk-bridge,
         // an exit function registered will take care of it
         // if (sAtkBridge.shutdown)
         //     (*sAtkBridge.shutdown)();
         // PR_UnloadLibrary(sAtkBridge.lib);
         sAtkBridge.lib = NULL;
         sAtkBridge.init = NULL;
@@ -672,17 +739,17 @@ struct AtkRootAccessibleAddedEvent {
 gboolean fireRootAccessibleAddedCB(gpointer data)
 {
     AtkRootAccessibleAddedEvent* eventData = (AtkRootAccessibleAddedEvent*)data;
     g_signal_emit_by_name(eventData->app_accessible, "children_changed::add",
                           eventData->index, eventData->root_accessible, NULL);
     g_object_unref(eventData->app_accessible);
     g_object_unref(eventData->root_accessible);
     free(data);
-    
+
     return FALSE;
 }
 
 PRBool
 nsApplicationAccessibleWrap::AppendChild(nsAccessible *aChild)
 {
     if (!nsApplicationAccessible::AppendChild(aChild))
       return PR_FALSE;
@@ -742,17 +809,17 @@ nsApplicationAccessibleWrap::PreCreate()
                   PR_FindFunctionSymbol(sATKLib,
                                         AtkSocketAccessible
                                           ::sATKSocketEmbedSymbol);
             AtkSocketAccessible::gCanEmbed =
               AtkSocketAccessible::g_atk_socket_type != G_TYPE_INVALID &&
               AtkSocketAccessible::g_atk_socket_embed;
             }
         }
-        sATKChecked = PR_TRUE;
+        sATKChecked = true;
     }
 }
 
 static nsresult
 LoadGtkModule(GnomeAccessibilityModule& aModule)
 {
     NS_ENSURE_ARG(aModule.libName);
 
--- a/widget/src/gtk2/Makefile.in
+++ b/widget/src/gtk2/Makefile.in
@@ -71,17 +71,16 @@ CPPSRCS = \
   nsLookAndFeel.cpp \
   nsGtkKeyUtils.cpp \
   nsFilePicker.cpp \
   nsSound.cpp \
   nsNativeKeyBindings.cpp \
   nsScreenGtk.cpp \
   nsScreenManagerGtk.cpp \
   nsImageToPixbuf.cpp \
-  nsAccessibilityHelper.cpp \
   nsGtkIMModule.cpp \
   WidgetTraceEvent.cpp \
   $(NULL)
 
 ifdef MOZ_X11
 CPPSRCS         += nsIdleServiceGTK.cpp
 endif
 
--- a/widget/src/gtk2/nsFilePicker.cpp
+++ b/widget/src/gtk2/nsFilePicker.cpp
@@ -49,17 +49,16 @@
 #include "nsNetUtil.h"
 #include "nsReadableUtils.h"
 #include "mozcontainer.h"
 
 #include "prmem.h"
 #include "prlink.h"
 
 #include "nsFilePicker.h"
-#include "nsAccessibilityHelper.h"
 
 #if (MOZ_PLATFORM_MAEMO == 5)
 #include <hildon-fm-2/hildon/hildon-file-chooser-dialog.h>
 #endif
 
 #define MAX_PREVIEW_SIZE 180
 
 nsILocalFile *nsFilePicker::mPrevDisplayDirectory = nsnull;
@@ -420,17 +419,17 @@ confirm_overwrite_file(GtkWidget *parent
                                   GTK_MESSAGE_QUESTION,
                                   GTK_BUTTONS_YES_NO,
                                   "%s", NS_ConvertUTF16toUTF8(message).get());
   gtk_window_set_title(GTK_WINDOW(dialog), NS_ConvertUTF16toUTF8(title).get());
   if (parent_window && parent_window->group) {
     gtk_window_group_add_window(parent_window->group, GTK_WINDOW(dialog));
   }
 
-  PRBool result = (RunDialog(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES);
+  PRBool result = (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES);
 
   gtk_widget_destroy(dialog);
 
   return result;
 }
 
 NS_IMETHODIMP
 nsFilePicker::Show(PRInt16 *aReturn)
@@ -545,17 +544,17 @@ nsFilePicker::Show(PRInt16 *aReturn)
 
     // Set the initially selected filter
     if (mSelectedType == i) {
       gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(file_chooser), filter);
     }
   }
 
   gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(file_chooser), PR_TRUE);
-  gint response = RunDialog(GTK_DIALOG(file_chooser));
+  gint response = gtk_dialog_run(GTK_DIALOG(file_chooser));
 
   switch (response) {
     case GTK_RESPONSE_OK:
     case GTK_RESPONSE_ACCEPT:
     ReadValuesFromFileChooser(file_chooser);
     *aReturn = nsIFilePicker::returnOK;
     if (mMode == nsIFilePicker::modeSave) {
       nsCOMPtr<nsILocalFile> file;
--- a/widget/src/gtk2/nsPrintDialogGTK.cpp
+++ b/widget/src/gtk2/nsPrintDialogGTK.cpp
@@ -36,17 +36,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include <gtk/gtk.h>
 #include <gtk/gtkprintunixdialog.h>
 #include <stdlib.h>
 
 #include "mozcontainer.h"
-#include "nsAccessibilityHelper.h"
 #include "nsIPrintSettings.h"
 #include "nsIWidget.h"
 #include "nsPrintDialogGTK.h"
 #include "nsPrintSettingsGTK.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsILocalFile.h"
 #include "nsNetUtil.h"
@@ -137,17 +136,17 @@ ShowCustomDialog(GtkComboBox *changed_bo
   gtk_box_pack_start(GTK_BOX(custom_vbox), custom_entry, FALSE, FALSE, 5); // Make entry 5px underneath label
   GtkWidget* custom_hbox = gtk_hbox_new(FALSE, 2);
   gtk_box_pack_start(GTK_BOX(custom_hbox), question_icon, FALSE, FALSE, 0);
   gtk_box_pack_start(GTK_BOX(custom_hbox), custom_vbox, FALSE, FALSE, 10); // Make question icon 10px away from content
   gtk_container_set_border_width(GTK_CONTAINER(custom_hbox), 2);
   gtk_widget_show_all(custom_hbox);
 
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(prompt_dialog)->vbox), custom_hbox, FALSE, FALSE, 0);
-  gint diag_response = RunDialog(GTK_DIALOG(prompt_dialog));
+  gint diag_response = gtk_dialog_run(GTK_DIALOG(prompt_dialog));
 
   if (diag_response == GTK_RESPONSE_ACCEPT) {
     const gchar* response_text = gtk_entry_get_text(GTK_ENTRY(custom_entry));
     g_object_set_data_full(G_OBJECT(changed_box), "custom-text", strdup(response_text), (GDestroyNotify) free);
     g_object_set_data(G_OBJECT(changed_box), "previous-active", GINT_TO_POINTER(CUSTOM_VALUE_INDEX));
   } else {
     // Go back to the previous index
     gint previous_active = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(changed_box), "previous-active"));
@@ -387,17 +386,17 @@ nsPrintDialogWidgetGTK::OptionWidgetToSt
     return (const char*) g_object_get_data(G_OBJECT(dropdown), "custom-text");
   else
     return header_footer_tags[index];
 }
 
 const gint
 nsPrintDialogWidgetGTK::Run()
 {
-  const gint response = RunDialog(GTK_DIALOG(dialog));
+  const gint response = gtk_dialog_run(GTK_DIALOG(dialog));
   gtk_widget_hide(dialog);
   return response;
 }
 
 void
 nsPrintDialogWidgetGTK::ExportFramePrinting(nsIPrintSettings *aNS, GtkPrintSettings *aSettings)
 {
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_as_laid_out)))