Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
83865d89
Commit
83865d89
authored
Aug 05, 2012
by
Moritz Lipp
Browse files
Use GtkGrid instead of GtkTable
parent
e4b9924c
Changes
3
Hide whitespace changes
Inline
Side-by-side
config.c
View file @
83865d89
...
...
@@ -53,8 +53,13 @@ cb_page_padding_changed(girara_session_t* session, const char* UNUSED(name),
int
val
=
*
(
int
*
)
value
;
if
(
GTK_IS_TABLE
(
zathura
->
ui
.
page_widget
)
==
TRUE
)
{
#if (GTK_MAJOR_VERSION == 3)
gtk_grid_set_row_spacing
(
GTK_GRID
(
zathura
->
ui
.
page_widget
),
val
);
gtk_grid_set_column_spacing
(
GTK_GRID
(
zathura
->
ui
.
page_widget
),
val
);
#else
gtk_table_set_row_spacings
(
GTK_TABLE
(
zathura
->
ui
.
page_widget
),
val
);
gtk_table_set_col_spacings
(
GTK_TABLE
(
zathura
->
ui
.
page_widget
),
val
);
#endif
}
}
...
...
shortcuts.c
View file @
83865d89
...
...
@@ -343,7 +343,7 @@ sc_mouse_scroll(girara_session_t* session, girara_argument_t* argument, girara_e
break
;
case
GIRARA_EVENT_MOTION_NOTIFY
:
x_adj
=
gtk_scrolled_window_get_hadjustment
(
GTK_SCROLLED_WINDOW
(
session
->
gtk
.
view
));
y_adj
=
gtk_scrolled_window_get_vadjustment
(
GTK_SCROLLED_WINDOW
(
session
->
gtk
.
view
));
y_adj
=
gtk_scrolled_window_get_vadjustment
(
GTK_SCROLLED_WINDOW
(
session
->
gtk
.
view
));
if
(
x_adj
==
NULL
||
y_adj
==
NULL
)
{
return
false
;
...
...
@@ -543,7 +543,6 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
adjustment
=
gtk_scrolled_window_get_vadjustment
(
GTK_SCROLLED_WINDOW
(
session
->
gtk
.
view
));
}
gdouble
view_size
=
gtk_adjustment_get_page_size
(
adjustment
);
gdouble
value
=
gtk_adjustment_get_value
(
adjustment
);
gdouble
max
=
gtk_adjustment_get_upper
(
adjustment
)
-
view_size
;
...
...
zathura.c
View file @
83865d89
...
...
@@ -227,7 +227,11 @@ zathura_init(int argc, char* argv[])
zathura
->
ui
.
session
->
events
.
unknown_command
=
cb_unknown_command
;
/* page view */
#if (GTK_MAJOR_VERSION == 3)
zathura
->
ui
.
page_widget
=
gtk_grid_new
();
#else
zathura
->
ui
.
page_widget
=
gtk_table_new
(
0
,
0
,
TRUE
);
#endif
if
(
zathura
->
ui
.
page_widget
==
NULL
)
{
goto
error_free
;
}
...
...
@@ -274,8 +278,13 @@ zathura_init(int argc, char* argv[])
int
page_padding
=
1
;
girara_setting_get
(
zathura
->
ui
.
session
,
"page-padding"
,
&
page_padding
);
#if (GTK_MAJOR_VERSION == 3)
gtk_grid_set_row_spacing
(
GTK_GRID
(
zathura
->
ui
.
page_widget
),
page_padding
);
gtk_grid_set_column_spacing
(
GTK_GRID
(
zathura
->
ui
.
page_widget
),
page_padding
);
#else
gtk_table_set_row_spacings
(
GTK_TABLE
(
zathura
->
ui
.
page_widget
),
page_padding
);
gtk_table_set_col_spacings
(
GTK_TABLE
(
zathura
->
ui
.
page_widget
),
page_padding
);
#endif
/* database */
char
*
database
=
NULL
;
...
...
@@ -937,15 +946,22 @@ page_widget_set_mode(zathura_t* zathura, unsigned int pages_per_row, unsigned in
gtk_container_foreach
(
GTK_CONTAINER
(
zathura
->
ui
.
page_widget
),
remove_page_from_table
,
(
gpointer
)
0
);
unsigned
int
number_of_pages
=
zathura_document_get_number_of_pages
(
zathura
->
document
);
#if (GTK_MAJOR_VERSION == 3)
#else
gtk_table_resize
(
GTK_TABLE
(
zathura
->
ui
.
page_widget
),
ceil
((
number_of_pages
+
first_page_column
-
1
)
/
pages_per_row
),
pages_per_row
);
for
(
unsigned
int
i
=
0
;
i
<
number_of_pages
;
i
++
)
{
#endif
for
(
unsigned
int
i
=
0
;
i
<
number_of_pages
;
i
++
)
{
int
x
=
(
i
+
first_page_column
-
1
)
%
pages_per_row
;
int
y
=
(
i
+
first_page_column
-
1
)
/
pages_per_row
;
zathura_page_t
*
page
=
zathura_document_get_page
(
zathura
->
document
,
i
);
GtkWidget
*
page_widget
=
zathura_page_get_widget
(
zathura
,
page
);
#if (GTK_MAJOR_VERSION == 3)
gtk_grid_attach
(
GTK_GRID
(
zathura
->
ui
.
page_widget
),
page_widget
,
x
,
y
,
1
,
1
);
#else
gtk_table_attach
(
GTK_TABLE
(
zathura
->
ui
.
page_widget
),
page_widget
,
x
,
x
+
1
,
y
,
y
+
1
,
GTK_SHRINK
,
GTK_SHRINK
,
0
,
0
);
#endif
}
gtk_widget_show_all
(
zathura
->
ui
.
page_widget
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment