summaryrefslogtreecommitdiff
path: root/gtk/gtkinfobar.c
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/gtkinfobar.c')
-rw-r--r--gtk/gtkinfobar.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/gtk/gtkinfobar.c b/gtk/gtkinfobar.c
index 485c8956e5..a8baa91f1c 100644
--- a/gtk/gtkinfobar.c
+++ b/gtk/gtkinfobar.c
@@ -168,7 +168,8 @@ typedef struct _ResponseData ResponseData;
struct _ResponseData
{
- gint response_id;
+ int response_id;
+ gulong handler_id;
};
enum
@@ -288,6 +289,16 @@ get_response_data (GtkWidget *widget,
return ad;
}
+static void
+clear_response_data (GtkWidget *widget)
+{
+ ResponseData *data;
+
+ data = get_response_data (widget, FALSE);
+ g_signal_handler_disconnect (widget, data->handler_id);
+ g_object_set_data (G_OBJECT (widget), "gtk-info-bar-reponse-data", NULL);
+}
+
static GtkWidget *
find_button (GtkInfoBar *info_bar,
gint response_id)
@@ -594,7 +605,7 @@ gtk_info_bar_add_action_widget (GtkInfoBar *info_bar,
closure = g_cclosure_new_object (G_CALLBACK (action_widget_activated),
G_OBJECT (info_bar));
- g_signal_connect_closure_by_id (child, signal_id, 0, closure, FALSE);
+ ad->handler_id = g_signal_connect_closure_by_id (child, signal_id, 0, closure, FALSE);
}
else
g_warning ("Only 'activatable' widgets can be packed into the action area of a GtkInfoBar");
@@ -603,6 +614,28 @@ gtk_info_bar_add_action_widget (GtkInfoBar *info_bar,
}
/**
+ * gtk_info_bar_remove_action_widget:
+ * @info_bar: a #GtkInfoBar
+ * @widget: an action widget to remove
+ *
+ * Removes a widget from the action area of @info_bar, after
+ * it been put there by a call to gtk_info_bar_add_action_widget()
+ * or gtk_info_bar_add_button().
+ */
+void
+gtk_info_bar_remove_action_widget (GtkInfoBar *info_bar,
+ GtkWidget *widget)
+{
+ g_return_if_fail (GTK_IS_INFO_BAR (info_bar));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (gtk_widget_get_parent (widget) == info_bar->action_area);
+
+ clear_response_data (widget);
+
+ gtk_container_remove (GTK_CONTAINER (info_bar->action_area), widget);
+}
+
+/**
* gtk_info_bar_add_button:
* @info_bar: a #GtkInfoBar
* @button_text: text of button