30 GtkStyleContext *context)
36 GtkIconInfo *info = gtk_icon_theme_lookup_icon(gtk_icon_theme_get_default(), icon_name,
MAX(
width,
height),
37 GTK_ICON_LOOKUP_FORCE_SYMBOLIC);
41 ? gtk_icon_info_load_symbolic_for_context(info, context, NULL, NULL)
46 if(gdk_pixbuf_get_width(pixbuf) !=
width || gdk_pixbuf_get_height(pixbuf) !=
height)
48 GdkPixbuf *scaled = gdk_pixbuf_scale_simple(pixbuf,
width,
height, GDK_INTERP_BILINEAR);
49 g_object_unref(pixbuf);
66 gtk_image_set_from_icon_name(GTK_IMAGE(image), icon_name,
size);
70 gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf);
71 g_object_unref(pixbuf);
91 PangoAttrList *attrs = NULL;
94 const gchar *underscore =
"_";
95 gunichar mnemonic = underscore[0];
96 if(!pango_parse_markup(s, -1, mnemonic, &attrs, &plain, NULL, NULL))
99 pango_attr_list_unref(attrs);
106 gtk_widget_set_halign(label, GTK_ALIGN_FILL);
107 gtk_label_set_xalign (GTK_LABEL(label), 0.5f);
108 gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
116 gchar *str_cpy = g_strdup(str);
118 GtkWidget *label = gtk_label_new(str_cpy);
127 gchar *str_cpy = g_strdup(str);
129 GtkWidget *label = gtk_label_new(str_cpy);
131 gtk_widget_set_halign(label, GTK_ALIGN_START);
132 gtk_label_set_xalign (GTK_LABEL(label), 0.0f);
133 gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
139 GList *renderers = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(cbox));
140 for(
const GList *it = renderers; it; it = g_list_next(it))
142 GtkCellRendererText *tr = GTK_CELL_RENDERER_TEXT(it->data);
143 g_object_set(G_OBJECT(tr),
"ellipsize", PANGO_ELLIPSIZE_MIDDLE, (gchar *)0);
145 g_list_free(renderers);
151 if(!GTK_IS_TEXT_VIEW(textview))
return;
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
static gchar * dt_string_replace(const char *string, const char *to_replace)
GtkWidget * dt_ui_section_label_new(const gchar *str)
gchar * delete_underscore(const char *s)
GtkWidget * dt_ui_label_new(const gchar *str)
void dt_gui_textview_set_padding(GtkTextView *textview)
Apply the standard recessed-input text padding to a GtkTextView.
void dt_ellipsize_combo(GtkComboBox *cbox)
GdkPixbuf * dt_gui_symbolic_icon_pixbuf(const char *icon_name, GtkIconSize size, const GdkRGBA *color, GtkStyleContext *context)
Load a symbolic icon as a pre-tinted pixbuf, at the pixel size size names.
void dt_gui_set_symbolic_icon(GtkWidget *image, const char *icon_name, GtkIconSize size, const GdkRGBA *color)
Set a symbolic icon on an image widget, optionally forcing a specific color.
void dt_ui_section_label_set(GtkWidget *label)
gchar * strip_markup(const char *s)
Remove Pango/Gtk markup and accel mnemonics from a text label. If markup parsing fails,...
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.