Connect callbacks for gtk_widget_destroy where signature differs

Apparently dependent on architecture and compiler, mismatching
callback signatures can cause segmentation faults.
This commit is contained in:
Enrico Tröger 2009-12-29 23:49:10 +01:00 committed by Christian Dywan
parent d0a52ac09c
commit 9183f8e16d
7 changed files with 66 additions and 10 deletions

View file

@ -314,6 +314,14 @@ adblock_activate_link_cb (GtkWidget* label,
}
#endif
static void
adblock_preferences_response_cb (GtkWidget* dialog,
gint response,
gpointer data)
{
gtk_widget_destroy (dialog);
}
static GtkWidget*
adblock_get_preferences_dialog (MidoriExtension* extension)
{
@ -361,7 +369,7 @@ adblock_get_preferences_dialog (MidoriExtension* extension)
sokoke_widget_get_text_size (dialog, "M", &width, &height);
gtk_window_set_default_size (GTK_WINDOW (dialog), width * 52, -1);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), dialog);
G_CALLBACK (adblock_preferences_response_cb), NULL);
/* TODO: We need mnemonics */
if ((xfce_heading = sokoke_xfce_header_new (
gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title)))

View file

@ -105,6 +105,14 @@ feed_deactivate_cb (MidoriExtension* extension,
}
}
static void
feed_dialog_response_cb (GtkWidget* dialog,
gint response,
gpointer data)
{
gtk_widget_destroy (dialog);
}
static KatzeArray*
feed_add_item (KatzeArray* feeds,
const gchar* uri)
@ -126,8 +134,8 @@ feed_add_item (KatzeArray* feeds,
_("Feed '%s' already exists"), uri);
gtk_window_set_title (GTK_WINDOW (dialog), EXTENSION_NAME);
gtk_widget_show (dialog);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy), dialog);
g_signal_connect (dialog, "response",
G_CALLBACK (feed_dialog_response_cb), NULL);
}
else

View file

@ -132,6 +132,14 @@ shortcuts_hotkey_for_action (GtkAction* action,
return FALSE;
}
static void
shortcuts_preferences_response_cb (GtkWidget* dialog,
gint response,
gpointer data)
{
gtk_widget_destroy (dialog);
}
static GtkWidget*
shortcuts_get_preferences_dialog (MidoriExtension* extension)
{
@ -172,7 +180,7 @@ shortcuts_get_preferences_dialog (MidoriExtension* extension)
sokoke_widget_get_text_size (dialog, "M", &width, &height);
gtk_window_set_default_size (GTK_WINDOW (dialog), width * 52, height * 24);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), dialog);
G_CALLBACK (shortcuts_preferences_response_cb), NULL);
if ((xfce_heading = sokoke_xfce_header_new (
gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title)))
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),

View file

@ -2301,6 +2301,14 @@ _action_add_news_feed_activate (GtkAction* action,
midori_browser_subscribe_to_news_feed (browser, uri);
}
static void
_action_compact_add_response_cb (GtkWidget* dialog,
gint response,
gpointer data)
{
gtk_widget_destroy (dialog);
}
static void
_action_compact_add_activate (GtkAction* action,
MidoriBrowser* browser)
@ -2336,8 +2344,8 @@ _action_compact_add_activate (GtkAction* action,
}
gtk_widget_show (dialog);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy), dialog);
g_signal_connect (dialog, "response",
G_CALLBACK (_action_compact_add_response_cb), NULL);
}
static void

View file

@ -1189,6 +1189,14 @@ midori_search_action_treeview_destroy_cb (GtkWidget* treeview,
}
}
static void
midori_search_action_dialog_respnse_cb (GtkWidget* dialog,
gint response,
gpointer data)
{
gtk_widget_destroy (dialog);
}
/**
* midori_search_action_get_dialog:
* @search_action: a #MidoriSearchAction
@ -1251,7 +1259,7 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action)
sokoke_widget_get_text_size (dialog, "M", &width, &height);
gtk_window_set_default_size (GTK_WINDOW (dialog), width * 52, -1);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), dialog);
G_CALLBACK (midori_search_action_dialog_respnse_cb), NULL);
/* TODO: Do we want tooltips for explainations or can we omit that?
We need mnemonics */
if ((xfce_heading = sokoke_xfce_header_new (

View file

@ -4140,6 +4140,14 @@ midori_view_print_custom_widget_apply_cb (GtkPrintOperation* operation,
}
#endif
static void
midori_view_print_response_cb (GtkWidget* dialog,
gint response,
gpointer data)
{
gtk_widget_destroy (dialog);
}
/**
* midori_view_print
* @view: a #MidoriView
@ -4183,7 +4191,7 @@ midori_view_print (MidoriView* view)
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (midori_view_print_response_cb), NULL);
gtk_widget_show (dialog);
}
#else

View file

@ -104,6 +104,14 @@ sokoke_js_script_eval (JSContextRef js_context,
return value;
}
static void
sokoke_message_dialog_response_cb (GtkWidget* dialog,
gint response,
gpointer data)
{
gtk_widget_destroy (dialog);
}
void
sokoke_message_dialog (GtkMessageType message_type,
const gchar* short_message,
@ -119,8 +127,8 @@ sokoke_message_dialog (GtkMessageType message_type,
"%s", short_message);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", detailed_message);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy), dialog);
g_signal_connect (dialog, "response",
G_CALLBACK (sokoke_message_dialog_response_cb), NULL);
gtk_widget_show (dialog);
}