screenshot.c File Reference

screenshot related function of the GTK+ frontend More...

#include "screenshot.h"
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "fe_gtk.h"
#include "fe_data.h"
#include "frontend.h"
#include "ui.h"
#include "di.h"

Include dependency graph for screenshot.c:

Go to the source code of this file.

Defines

#define SCREENSHOT_DIRECTORY   "/var/log"
 Directory where screenshots will be saved.

Functions

static gboolean save_screenshot (GdkWindow *gdk_window, const gchar *screenshot_path)
 Write a picture of the given window.
static gchar * create_screenshot_path (struct question *question)
 Make a path that can be used to write a screenshot.
static void popup_success (struct frontend *fe, const gchar *screenshot_path)
 Display a dialog with the path of the saved screenshot.
static void do_screenshot (struct frontend *fe, GtkWidget *widget)
 Take a screenshot of the current frontend display and inform the user of the sucess of the operation.
static gboolean handle_shortcut_key (GtkWidget *widget, GdkEventKey *key, struct frontend *fe)
 Key event handler implementing the shortcut for screenshots.
void fe_gtk_add_screenshot_shortcut (struct frontend *fe)
 Register a keyboard shortcut to make screenshots.


Detailed Description

screenshot related function of the GTK+ frontend

This is really intended to be used inside the debian-installer, even if nothing prevents the following code from working within a X11 environment.

Definition in file screenshot.c.


Function Documentation

static gchar* create_screenshot_path ( struct question *  question  )  [static]

Make a path that can be used to write a screenshot.

Screenshots will be named like the following: debian-installer_keymap_3.png

The caller must free the returned string.

Parameters:
question the question which tag will be used to create the path
Returns:
a newly allocated string containing a path where a screenshot can be saved
See also:
SCREENSHOT_DIRECTORY

Definition at line 105 of file screenshot.c.

References path, and SCREENSHOT_DIRECTORY.

Referenced by do_screenshot().

static void do_screenshot ( struct frontend *  fe,
GtkWidget *  widget 
) [static]

Take a screenshot of the current frontend display and inform the user of the sucess of the operation.

Todo:
This should also display a message in case of failure.
Parameters:
fe cdebconf frontend
widget the main window

Definition at line 158 of file screenshot.c.

References create_screenshot_path(), popup_success(), and save_screenshot().

Referenced by handle_shortcut_key().

void fe_gtk_add_screenshot_shortcut ( struct frontend *  fe  ) 

Register a keyboard shortcut to make screenshots.

The shortcut is currently F10.

Parameters:
fe cdebconf frontend

Definition at line 196 of file screenshot.c.

References fe_gtk_add_global_key_handler(), handle_shortcut_key(), and frontend_data::window.

Referenced by fe_gtk_di_setup().

static gboolean handle_shortcut_key ( GtkWidget *  widget,
GdkEventKey *  key,
struct frontend *  fe 
) [static]

Key event handler implementing the shortcut for screenshots.

Parameters:
widget main window
key pressed key
fe cdebconf frontend
Returns:
TRUE if F10 was pressed, FALSE otherwise

Definition at line 180 of file screenshot.c.

References do_screenshot().

Referenced by fe_gtk_add_screenshot_shortcut().

static void popup_success ( struct frontend *  fe,
const gchar *  screenshot_path 
) [static]

Display a dialog with the path of the saved screenshot.

Parameters:
fe cdebconf frontend
screenshot_path path of the screenshot

Definition at line 132 of file screenshot.c.

References fe_gtk_get_text(), and fe_gtk_run_message_dialog().

Referenced by do_screenshot().

static gboolean save_screenshot ( GdkWindow *  gdk_window,
const gchar *  screenshot_path 
) [static]

Write a picture of the given window.

Parameters:
gdk_window the window to capture
screenshot_path full path where the image will be saved
Returns:
TRUE if the operation was successful, FALSE otherwise

Definition at line 63 of file screenshot.c.

Referenced by do_screenshot().


Generated on Sat Jul 7 23:41:42 2007 for fe_gtk by  doxygen 1.5.1