Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-properties-license.c File Reference
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "ev-properties-license.h"
+ Include dependency graph for ev-properties-license.c:

Go to the source code of this file.

Data Structures

struct  _EvPropertiesLicense
 
struct  _EvPropertiesLicenseClass
 

Functions

static void ev_properties_license_class_init (EvPropertiesLicenseClass *properties_license_class)
 
static GtkWidget * get_license_text_widget (EvDocumentLicense *license)
 
static GtkWidget * get_license_uri_widget (const gchar *uri)
 
static void ev_properties_license_add_section (EvPropertiesLicense *properties, const gchar *title_text, GtkWidget *contents)
 
void ev_properties_license_set_license (EvPropertiesLicense *properties, EvDocumentLicense *license)
 
static void ev_properties_license_init (EvPropertiesLicense *properties)
 
GtkWidget * ev_properties_license_new (void)
 

Function Documentation

static void ev_properties_license_add_section ( EvPropertiesLicense properties,
const gchar *  title_text,
GtkWidget *  contents 
)
static

Definition at line 98 of file ev-properties-license.c.

101 {
102  GtkWidget *title;
103  GtkWidget *alignment;
104  gchar *markup;
105 
106  title = gtk_label_new (NULL);
107  gtk_misc_set_alignment (GTK_MISC (title), 0.0, 0.5);
108  gtk_label_set_use_markup (GTK_LABEL (title), TRUE);
109  markup = g_strdup_printf ("<b>%s</b>", title_text);
110  gtk_label_set_markup (GTK_LABEL (title), markup);
111  g_free (markup);
112  gtk_box_pack_start (GTK_BOX (properties), title, FALSE, FALSE, 0);
113  gtk_widget_show (title);
114 
115  alignment = gtk_alignment_new (0.5, 0.5, 1., 1.);
116  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
117  gtk_container_add (GTK_CONTAINER (alignment), contents);
118  gtk_widget_show (contents);
119 
120  gtk_box_pack_start (GTK_BOX (properties), alignment, FALSE, TRUE, 0);
121  gtk_widget_show (alignment);
122 }

+ Here is the caller graph for this function:

static void ev_properties_license_class_init ( EvPropertiesLicenseClass properties_license_class)
static

Definition at line 42 of file ev-properties-license.c.

43 {
44 }
static void ev_properties_license_init ( EvPropertiesLicense properties)
static

Definition at line 152 of file ev-properties-license.c.

153 {
154  gtk_box_set_spacing (GTK_BOX (properties), 12);
155  gtk_container_set_border_width (GTK_CONTAINER (properties), 12);
156 }
GtkWidget* ev_properties_license_new ( void  )

Definition at line 159 of file ev-properties-license.c.

160 {
161  EvPropertiesLicense *properties_license;
162 
163  properties_license = g_object_new (EV_TYPE_PROPERTIES_LICENSE,
164  "orientation", GTK_ORIENTATION_VERTICAL,
165  NULL);
166 
167  return GTK_WIDGET (properties_license);
168 }

+ Here is the caller graph for this function:

void ev_properties_license_set_license ( EvPropertiesLicense properties,
EvDocumentLicense license 
)

Definition at line 125 of file ev-properties-license.c.

127 {
128  const gchar *text = ev_document_license_get_text (license);
129  const gchar *uri = ev_document_license_get_uri (license);
130  const gchar *web_statement = ev_document_license_get_web_statement (license);
131 
132  if (text) {
134  _("Usage terms"),
135  get_license_text_widget (license));
136  }
137 
138  if (uri) {
140  _("Text License"),
141  get_license_uri_widget (uri));
142  }
143 
144  if (web_statement) {
146  _("Further Information"),
147  get_license_uri_widget (web_statement));
148  }
149 }

+ Here is the caller graph for this function:

static GtkWidget* get_license_text_widget ( EvDocumentLicense license)
static

Definition at line 47 of file ev-properties-license.c.

48 {
49  GtkWidget *swindow, *textview;
50  GtkTextBuffer *buffer;
51 
52  textview = gtk_text_view_new ();
53  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_WORD);
54  gtk_text_view_set_left_margin (GTK_TEXT_VIEW (textview), 8);
55  gtk_text_view_set_right_margin (GTK_TEXT_VIEW (textview), 8);
56 
57  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
58  gtk_text_buffer_set_text (buffer, ev_document_license_get_text (license), -1);
59 
60  swindow = gtk_scrolled_window_new (NULL, NULL);
61  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
62  GTK_SHADOW_IN);
63  gtk_container_add (GTK_CONTAINER (swindow), textview);
64  gtk_widget_show (textview);
65 
66  return swindow;
67 }

+ Here is the caller graph for this function:

static GtkWidget* get_license_uri_widget ( const gchar *  uri)
static

Definition at line 70 of file ev-properties-license.c.

71 {
72  GtkWidget *label;
73  gchar *checked_uri;
74  gchar *markup;
75 
76  label = gtk_label_new (NULL);
77  g_object_set (G_OBJECT (label),
78  "xalign", 0.0,
79  "width_chars", 25,
80  "selectable", TRUE,
81  "ellipsize", PANGO_ELLIPSIZE_END,
82  NULL);
83 
84  checked_uri = g_uri_parse_scheme (uri);
85  if (checked_uri) {
86  markup = g_markup_printf_escaped ("<a href=\"%s\">%s</a>", uri, uri);
87  gtk_label_set_markup (GTK_LABEL (label), markup);
88  g_free (markup);
89  g_free (checked_uri);
90  } else {
91  gtk_label_set_text (GTK_LABEL (label), uri);
92  }
93 
94  return label;
95 }

+ Here is the caller graph for this function: