summaryrefslogtreecommitdiff
path: root/properties/ev-properties-view.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-23 18:15:54 +0300
committermonsta <[email protected]>2016-11-23 18:15:54 +0300
commitae5f4711a21508a70d7123dbc0efb610af1289a2 (patch)
tree54d4a9de3b092aa772ed8799fcf30e11e19ff93f /properties/ev-properties-view.c
parent7884bbe50fe8b8c26e68b8077c18047861c2dd0c (diff)
downloadatril-ae5f4711a21508a70d7123dbc0efb610af1289a2.tar.bz2
atril-ae5f4711a21508a70d7123dbc0efb610af1289a2.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require caja >= 1.17.1
Diffstat (limited to 'properties/ev-properties-view.c')
-rw-r--r--properties/ev-properties-view.c98
1 files changed, 1 insertions, 97 deletions
diff --git a/properties/ev-properties-view.c b/properties/ev-properties-view.c
index e1a283bf..f4fab251 100644
--- a/properties/ev-properties-view.c
+++ b/properties/ev-properties-view.c
@@ -76,11 +76,8 @@ static const PropertyInfo properties_info[] = {
struct _EvPropertiesView {
GtkBox base_instance;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *grid;
-#else
- GtkWidget *table;
-#endif
+
GtkWidget *labels[N_PROPERTIES];
gchar *uri;
};
@@ -154,11 +151,7 @@ make_valid_utf8 (const gchar *name)
static void
set_property (EvPropertiesView *properties,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *grid,
-#else
- GtkTable *table,
-#endif
Property property,
const gchar *text,
gint *row)
@@ -174,12 +167,7 @@ set_property (EvPropertiesView *properties,
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free (markup);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach (grid, label, 0, *row, 1, 1);
-#else
- gtk_table_attach (table, label, 0, 1, *row, *row + 1,
- GTK_FILL, GTK_FILL, 0, 0);
-#endif
gtk_widget_show (label);
}
@@ -212,12 +200,7 @@ set_property (EvPropertiesView *properties,
}
if (!properties->labels[property]) {
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach (grid, label, 1, *row, 1, 1);
-#else
- gtk_table_attach (table, label, 1, 2, *row, *row + 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
-#endif
properties->labels[property] = label;
}
@@ -334,7 +317,6 @@ ev_regular_paper_size (const EvDocumentInfo *info)
void
ev_properties_view_set_info (EvPropertiesView *properties, const EvDocumentInfo *info)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *grid;
gchar *text;
gint row = 0;
@@ -401,74 +383,6 @@ ev_properties_view_set_info (EvPropertiesView *properties, const EvDocumentInfo
text = ev_regular_paper_size (info);
set_property (properties, GTK_GRID (grid), PAPER_SIZE_PROPERTY, text, &row);
g_free (text);
-#else
- GtkWidget *table;
- gchar *text;
- gint row = 0;
-
- table = properties->table;
-
- if (info->fields_mask & EV_DOCUMENT_INFO_TITLE) {
- set_property (properties, GTK_TABLE (table), TITLE_PROPERTY, info->title, &row);
- }
- set_property (properties, GTK_TABLE (table), URI_PROPERTY, properties->uri, &row);
- if (info->fields_mask & EV_DOCUMENT_INFO_SUBJECT) {
- set_property (properties, GTK_TABLE (table), SUBJECT_PROPERTY, info->subject, &row);
- }
- if (info->fields_mask & EV_DOCUMENT_INFO_AUTHOR) {
- set_property (properties, GTK_TABLE (table), AUTHOR_PROPERTY, info->author, &row);
- }
- if (info->fields_mask & EV_DOCUMENT_INFO_KEYWORDS) {
- set_property (properties, GTK_TABLE (table), KEYWORDS_PROPERTY, info->keywords, &row);
- }
- if (info->fields_mask & EV_DOCUMENT_INFO_PRODUCER) {
- set_property (properties, GTK_TABLE (table), PRODUCER_PROPERTY, info->producer, &row);
- }
- if (info->fields_mask & EV_DOCUMENT_INFO_CREATOR) {
- set_property (properties, GTK_TABLE (table), CREATOR_PROPERTY, info->creator, &row);
- }
- if (info->fields_mask & EV_DOCUMENT_INFO_CREATION_DATE) {
- text = ev_document_misc_format_date (info->creation_date);
- set_property (properties, GTK_TABLE (table), CREATION_DATE_PROPERTY, text, &row);
- g_free (text);
- }
- if (info->fields_mask & EV_DOCUMENT_INFO_MOD_DATE) {
- text = ev_document_misc_format_date (info->modified_date);
- set_property (properties, GTK_TABLE (table), MOD_DATE_PROPERTY, text, &row);
- g_free (text);
- }
- if (info->fields_mask & EV_DOCUMENT_INFO_FORMAT) {
- set_property (properties, GTK_TABLE (table), FORMAT_PROPERTY, info->format, &row);
- }
- if (info->fields_mask & EV_DOCUMENT_INFO_N_PAGES) {
- text = g_strdup_printf ("%d", info->n_pages);
- set_property (properties, GTK_TABLE (table), N_PAGES_PROPERTY, text, &row);
- g_free (text);
- }
- if (info->fields_mask & EV_DOCUMENT_INFO_LINEARIZED)
- {
- /* nice hack bro */
- if (info->linearized == 1)
- {
- set_property (properties, GTK_TABLE (table), LINEARIZED_PROPERTY, _("Yes"), &row);
- }
- else if (info->linearized == 0)
- {
- set_property (properties, GTK_TABLE (table), LINEARIZED_PROPERTY, _("No"), &row);
- }
- else
- {
- set_property (properties, GTK_TABLE (table), LINEARIZED_PROPERTY, info->linearized, &row);
- }
- }
- if (info->fields_mask & EV_DOCUMENT_INFO_SECURITY) {
- set_property (properties, GTK_TABLE (table), SECURITY_PROPERTY, info->security, &row);
- }
- if (info->fields_mask & EV_DOCUMENT_INFO_PAPER_SIZE) {
- text = ev_regular_paper_size (info);
- set_property (properties, GTK_TABLE (table), PAPER_SIZE_PROPERTY, text, &row);
- g_free (text);
-#endif
}
}
@@ -476,22 +390,12 @@ static void
ev_properties_view_init (EvPropertiesView *properties)
{
gtk_orientable_set_orientation (GTK_ORIENTABLE (properties), GTK_ORIENTATION_VERTICAL);
-#if GTK_CHECK_VERSION (3, 0, 0)
properties->grid = gtk_grid_new ();
gtk_grid_set_column_spacing (GTK_GRID (properties->grid), 12);
gtk_grid_set_row_spacing (GTK_GRID (properties->grid), 6);
gtk_container_set_border_width (GTK_CONTAINER (properties->grid), 12);
gtk_box_pack_start (GTK_BOX (properties), properties->grid, TRUE, TRUE, 0);
gtk_widget_show (properties->grid);
-#else
- properties->table = gtk_table_new (13, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (properties->table), 12);
- gtk_table_set_row_spacings (GTK_TABLE (properties->table), 6);
- gtk_container_set_border_width (GTK_CONTAINER (properties->table), 12);
- gtk_box_pack_start (GTK_BOX (properties), properties->table,
- TRUE, TRUE, 0);
- gtk_widget_show (properties->table);
-#endif
}
void