diff options
author | Jasmine Hassan <[email protected]> | 2012-10-27 10:35:57 +0200 |
---|---|---|
committer | Jasmine Hassan <[email protected]> | 2012-11-16 09:45:49 +0200 |
commit | cebbe2c78c33b41e164d8e5318d7a51d8cd8839b (patch) | |
tree | 7cb4f48c966f83d29f563b4c006a90ec6323cd6c /eel | |
parent | e6b8ac93464b85b77b9a3cbcc932ab60a5a2b75c (diff) | |
download | caja-cebbe2c78c33b41e164d8e5318d7a51d8cd8839b.tar.bz2 caja-cebbe2c78c33b41e164d8e5318d7a51d8cd8839b.tar.xz |
[eel] add a utility to pack details into a message dialog
So that we can remove EelAlertDialog.
http://git.gnome.org/browse/nautilus/commit/?id=a2b4de80a94b4e049f1d2a7ef00a174865b5c9ec
Diffstat (limited to 'eel')
-rw-r--r-- | eel/eel-gtk-extensions.c | 27 | ||||
-rw-r--r-- | eel/eel-gtk-extensions.h | 4 |
2 files changed, 29 insertions, 2 deletions
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c index c880ec32..da8e7d7c 100644 --- a/eel/eel-gtk-extensions.c +++ b/eel/eel-gtk-extensions.c @@ -32,16 +32,17 @@ #include "eel-gdk-pixbuf-extensions.h" #include "eel-glib-extensions.h" #include "eel-mate-extensions.h" +#include "eel-marshal.h" #include "eel-string.h" + #include <X11/Xlib.h> #include <X11/Xatom.h> #include <gdk/gdk.h> #include <gdk/gdkprivate.h> #include <gdk/gdkx.h> #include <gtk/gtk.h> +#include <glib/gi18n-lib.h> #include <math.h> -#include "eel-marshal.h" -#include "eel-marshal.c" /* This number is fairly arbitrary. Long enough to show a pretty long * menu title, but not so long to make a menu grotesquely wide. @@ -486,3 +487,25 @@ eel_gtk_tree_view_set_activate_on_single_click (GtkTreeView *tree_view, GUINT_TO_POINTER (button_press_id)); } } + +void +eel_gtk_message_dialog_set_details_label (GtkMessageDialog *dialog, + const gchar *details_text) +{ + GtkWidget *content_area, *expander, *label; + + content_area = gtk_message_dialog_get_message_area (dialog); + expander = gtk_expander_new_with_mnemonic (_("Show more _details")); + gtk_expander_set_spacing (GTK_EXPANDER (expander), 6); + + label = gtk_label_new (details_text); + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_label_set_selectable (GTK_LABEL (label), TRUE); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + + gtk_container_add (GTK_CONTAINER (expander), label); + gtk_box_pack_start (GTK_BOX (content_area), expander, FALSE, FALSE, 0); + + gtk_widget_show (label); + gtk_widget_show (expander); +} diff --git a/eel/eel-gtk-extensions.h b/eel/eel-gtk-extensions.h index 8703d4b5..e26c2e2f 100644 --- a/eel/eel-gtk-extensions.h +++ b/eel/eel-gtk-extensions.h @@ -77,4 +77,8 @@ void eel_gtk_adjustment_clamp_value (GtkAdjust void eel_gtk_tree_view_set_activate_on_single_click (GtkTreeView *tree_view, gboolean should_activate); +/* GtkMessageDialog */ +void eel_gtk_message_dialog_set_details_label (GtkMessageDialog *dialog, + const gchar *details_text); + #endif /* EEL_GTK_EXTENSIONS_H */ |