summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2735d12)
raw | patch | inline | side by side (parent: 2735d12)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 30 Dec 2011 23:24:16 +0000 (00:24 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 30 Dec 2011 23:24:16 +0000 (00:24 +0100) |
This is in preparation for managing multiple widgets through that interface.
src/tpdfview.c | patch | blob | history |
diff --git a/src/tpdfview.c b/src/tpdfview.c
index e6fee214669f91edc7a8f68fa661d361229ef402..9ae1b792ff4ab6ece44103765d78282d61bf9d44 100644 (file)
--- a/src/tpdfview.c
+++ b/src/tpdfview.c
#include "tpdfv_features.h"
#include "gtk-tpdfv.h"
+#include "tpdfv-ctl.h"
#if HAVE_LIBGEN_H
# include <libgen.h>
static gboolean
key_press(GtkWidget *window, GdkEventKey *event, gpointer data)
{
- GtkWidget *tpdfv;
+ GObject *obj;
- tpdfv = (GtkWidget *)data;
- assert(tpdfv);
+ obj = G_OBJECT(data);
+ assert(obj);
switch (event->keyval) {
case GDK_q:
break;
case GDK_r:
- gtk_tpdfv_reload(tpdfv);
+ tpdfv_ctl_reload(obj);
break;
case GDK_F:
/* navigation */
case GDK_Page_Up:
- gtk_tpdfv_page_up(tpdfv);
+ tpdfv_ctl_page_up(obj);
break;
case GDK_Page_Down:
/* fall through */
case GDK_space:
- gtk_tpdfv_page_down(tpdfv);
+ tpdfv_ctl_page_down(obj);
break;
case GDK_Home:
- gtk_tpdfv_first_page(tpdfv);
+ tpdfv_ctl_first_page(obj);
break;
case GDK_End:
- gtk_tpdfv_last_page(tpdfv);
+ tpdfv_ctl_last_page(obj);
break;
/* zoom */
case GDK_plus:
- gtk_tpdfv_zoom_in(tpdfv);
+ tpdfv_ctl_zoom_in(obj);
break;
case GDK_minus:
- gtk_tpdfv_zoom_out(tpdfv);
+ tpdfv_ctl_zoom_out(obj);
break;
case GDK_1:
- gtk_tpdfv_zoom_1(tpdfv);
+ tpdfv_ctl_zoom_1(obj);
break;
case GDK_w:
- gtk_tpdfv_zoom_width(tpdfv);
+ tpdfv_ctl_zoom_width(obj);
break;
case GDK_h:
- gtk_tpdfv_zoom_height(tpdfv);
+ tpdfv_ctl_zoom_height(obj);
break;
case GDK_z:
- gtk_tpdfv_zoom_fit(tpdfv);
+ tpdfv_ctl_zoom_fit(obj);
break;
/* scrolling */
case GDK_Up:
- gtk_tpdfv_scroll_up(tpdfv);
+ tpdfv_ctl_scroll_up(obj);
break;
case GDK_Down:
- gtk_tpdfv_scroll_down(tpdfv);
+ tpdfv_ctl_scroll_down(obj);
break;
case GDK_Left:
- gtk_tpdfv_scroll_left(tpdfv);
+ tpdfv_ctl_scroll_left(obj);
break;
case GDK_Right:
- gtk_tpdfv_scroll_right(tpdfv);
+ tpdfv_ctl_scroll_right(obj);
break;
/* screen management */
int
main(int argc, char **argv)
{
- GtkWidget *win = NULL;
- GtkWidget *tpdfv = NULL;
+ GtkWidget *win;
+ GtkWidget *tpdfv;
+
+ GObject *ctl;
char win_title[1024];
gtk_container_add(GTK_CONTAINER(win), tpdfv);
+ ctl = tpdfv_ctl_new(GTK_TPDFV(tpdfv));
+ if (! ctl)
+ return 1;
+
g_signal_connect(G_OBJECT(win), "destroy",
G_CALLBACK(on_destroy), NULL);
g_signal_connect(G_OBJECT(win), "key-press-event",
- G_CALLBACK(key_press), tpdfv);
+ G_CALLBACK(key_press), ctl);
/* TODO: use resource file */
gdk_color_parse("#000000", &bg_color);