Logo Search packages:      
Sourcecode: cbrpager version File versions  Download package

callbacks.c

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gnome.h>

#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include "conf.h"
#include "global.h"

gboolean
on_main_canvas_button_press_event      (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data)
{
  main_canvas_buttonpressed(event);
  return FALSE;
}


gboolean
on_main_canvas_button_release_event    (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data)
{

  return FALSE;
}


gboolean
on_main_canvas_key_press_event         (GtkWidget       *widget,
                                        GdkEventKey     *event,
                                        gpointer         user_data)
{
  return main_canvas_keypressed(event);
}


void
on_begin_btn_clicked                   (GtkButton       *button,
                                        gpointer         user_data)
{
  goto_begin();
}


void
on_next_btn_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{
  next_page(0);
}


void
on_back_btn_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{
  previous_page(0);
}


void
on_last_btn_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{
  goto_end();
}


void
on_zoom_out_btn_clicked                (GtkButton       *button,
                                        gpointer         user_data)
{
  set_zoom_factor(zoom_factor / 1.1);
}


void
on_zoom_fit_btn_clicked                (GtkButton       *button,
                                        gpointer         user_data)
{
  set_zoom_fit();
}


void
on_zoom_width_btn_clicked              (GtkButton       *button,
                                        gpointer         user_data)
{
  set_zoom_width();
}


void
on_zoom_in_btn_clicked                 (GtkButton       *button,
                                        gpointer         user_data)
{
  set_zoom_factor(zoom_factor * 1.1);
}


void
on_zoom_orig_btn_clicked               (GtkButton       *button,
                                        gpointer         user_data)
{
  set_zoom_factor(1.0);
}


void
fs_ok_sel(GtkWidget *w, GtkFileSelection *fs)
{
  strcpy(pref.lastbook, gtk_file_selection_get_filename(fs));
  gtk_widget_destroy(GTK_WIDGET(fs));

  save_config();
  start_show();
}


void
on_open_btn_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{
  GtkWidget *fs = create_fileselection1();

  gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs), pref.lastbook);

  g_signal_connect(G_OBJECT(GTK_FILE_SELECTION (fs)->ok_button),
            "clicked", G_CALLBACK(fs_ok_sel), (gpointer) fs);

  g_signal_connect_swapped (G_OBJECT 
            (GTK_FILE_SELECTION (fs)->cancel_button),
            "clicked", G_CALLBACK(gtk_widget_destroy),
            G_OBJECT (fs));

  gtk_widget_show(fs);
}


void
on_quit_btn_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{
  clean_up();
  gtk_exit(0);
}


gboolean
on_MainWindow_delete_event             (GtkWidget       *widget,
                                        GdkEvent        *event,
                                        gpointer         user_data)
{
  clean_up();
  gtk_exit(0);

  return FALSE;
}


void
on_pref_btn_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{
  GtkWidget *w = create_config_window();
  char *ttl;
  
  ttl = g_strdup_printf("%s %s v%s", _("Preferences"), prog_name,
        prog_version);
  gtk_window_set_title(GTK_WINDOW(w), ttl);
  gtk_widget_show(w);
}


void
on_conf_cancel_btn_clicked             (GtkButton       *button,
                                        gpointer         user_data)
{
  gtk_widget_destroy(lookup_widget(GTK_WIDGET(button), "config_window"));
}


void
on_conf_save_btn_clicked               (GtkButton       *button,
                                        gpointer         user_data)
{
  parse_config(GTK_WIDGET(button));
  save_config();
  gtk_widget_destroy(lookup_widget(GTK_WIDGET(button), "config_window"));
}


void
on_config_window_realize               (GtkWidget       *widget,
                                        gpointer         user_data)
{
  show_config(widget);
}


void
on_MainWindow_realize                  (GtkWidget       *widget,
                                        gpointer         user_data)
{
  initial_setup();
  
  if (pref.explicit_file)
    start_show();
}


void
on_MainWindow_size_allocate            (GtkWidget       *widget,
                                        GdkRectangle    *allocation,
                                        gpointer         user_data)
{
//  fit_page(allocation->width, allocation->height);
}


gboolean
on_nav_window_delete_event             (GtkWidget       *widget,
                                        GdkEvent        *event,
                                        gpointer         user_data)
{

  return FALSE;
}


void
on_advance_1_page1_activate            (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  next_page(1);
}


void
on_advance_2_pages1_activate           (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  next_page(2);
}


void
on_go_to_end1_activate                 (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  goto_end();
}


void
on_backup_1_page1_activate             (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  previous_page(1);
}


void
on_backup_2_pages1_activate            (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  previous_page(2);
}


void
on_go_to_start1_activate               (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{

}


void
on_zoom_to_fit1_activate               (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  set_zoom_fit();
}


void
on_enlarge1_activate                   (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  set_zoom_factor(zoom_factor * 1.1);
}


void
on_reduce1_activate                    (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  set_zoom_factor(zoom_factor / 1.1);
}


void
on_original_size1_activate             (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  set_zoom_factor(1.0);
}


void
on_fit_to_page_width1_activate         (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  set_zoom_width(); 
}


void
on_configuration_window1_activate      (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  gtk_widget_show(create_config_window());
}


void
on_file_list_tbtn_clicked              (GtkButton       *button,
                                        gpointer         user_data)
{
  file_list_tbtn_clicked();
}


void
on_conf_accel_tview_realize            (GtkWidget       *widget,
                                        gpointer         user_data)
{
  conf_accel_tview_realize(GTK_TREE_VIEW(widget));
}


void
on_conf_accel_tview_cursor_changed     (GtkTreeView     *treeview,
                                        gpointer         user_data)
{
  conf_accel_tview_cursor_changed();
}


void
on_nav_window_realize                  (GtkWidget       *widget,
                                        gpointer         user_data)
{
  set_kay_accelerators();
}


void
on_scroll_left_btn_clicked             (GtkButton       *button,
                                        gpointer         user_data)
{
  scroll_left_btn_clicked();
}


void
on_scroll_right_btn_clicked            (GtkButton       *button,
                                        gpointer         user_data)
{
  scroll_right_btn_clicked();
}


void
on_scroll_up_btn_clicked               (GtkButton       *button,
                                        gpointer         user_data)
{
  scroll_up_btn_clicked();
}


void
on_scroll_down_btn_clicked             (GtkButton       *button,
                                        gpointer         user_data)
{
  scroll_down_btn_clicked();
}


Generated by  Doxygen 1.6.0   Back to index