File: util.c

package info (click to toggle)
gtk-chtheme 0.3.1-6.2
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 252 kB
  • sloc: ansic: 903; makefile: 217; perl: 25
file content (46 lines) | stat: -rw-r--r-- 1,410 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include <gtk/gtk.h>
#include "util.h"

GtkWidget* unfocussable(GtkWidget *w)
{
	gtk_widget_set_can_focus(w, FALSE); 
	return w;
}

GtkWidget* gtk_toggle_button_new_from_stock(const gchar *stock_id)
{
	GtkWidget* button = gtk_toggle_button_new_with_label(stock_id);
	gtk_button_set_use_stock(GTK_BUTTON(button), TRUE);
	return button;
}

GtkLabel* gtk_label_new_from_pango_markup(const char *markup_text, GtkJustification jtype)
{
	PangoAttrList *attrs;
	gchar* parsed_text;
	
	pango_parse_markup(markup_text, -1, 0, &attrs, &parsed_text, NULL, NULL);

	GtkLabel* label = GTK_LABEL(gtk_label_new(parsed_text));
	gtk_label_set_attributes(label, attrs);
	gtk_label_set_line_wrap(label, TRUE);
	gtk_label_set_justify(label, jtype);

	return label;
}