[Goodies-commits] r7218 - in xfce4-screenshooter/trunk: . lib
Jerome Guelfucci
jeromeg at xfce.org
Thu Apr 16 17:37:23 CEST 2009
Author: jeromeg
Date: 2009-04-16 15:37:23 +0000 (Thu, 16 Apr 2009)
New Revision: 7218
Modified:
xfce4-screenshooter/trunk/ChangeLog
xfce4-screenshooter/trunk/lib/screenshooter-actions.c
xfce4-screenshooter/trunk/lib/screenshooter-capture.c
xfce4-screenshooter/trunk/lib/screenshooter-utils.c
Log:
* lib/screenshooter-actions.c: minor indentation change.
* lib/screenshooter-utils.c:
- minor indentation improvements.
- (screenshooter_read_rc_file) only get the home uri once.
* lib/screenshooter-capture.c:
- minor indentation improvements.
- correctly document (screenshooter_take_screenshot).
Modified: xfce4-screenshooter/trunk/ChangeLog
===================================================================
--- xfce4-screenshooter/trunk/ChangeLog 2009-04-16 14:55:18 UTC (rev 7217)
+++ xfce4-screenshooter/trunk/ChangeLog 2009-04-16 15:37:23 UTC (rev 7218)
@@ -1,5 +1,15 @@
2009-04-16 jeromeg
+ * lib/screenshooter-actions.c: minor indentation change.
+ * lib/screenshooter-utils.c:
+ - minor indentation improvements.
+ - (screenshooter_read_rc_file) only get the home uri once.
+ * lib/screenshooter-capture.c:
+ - minor indentation improvements.
+ - correctly document (screenshooter_take_screenshot).
+
+2009-04-16 jeromeg
+
* panel-plugin/screenshooter-plugin.c:
- remove the wrong XFCE_PANEL_PLUGIN_REGISTER_INTERNAL macro call,
the plugin is external.
Modified: xfce4-screenshooter/trunk/lib/screenshooter-actions.c
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-actions.c 2009-04-16 14:55:18 UTC (rev 7217)
+++ xfce4-screenshooter/trunk/lib/screenshooter-actions.c 2009-04-16 15:37:23 UTC (rev 7218)
@@ -44,13 +44,9 @@
else
{
GFile *temp_dir = g_file_new_for_path (g_get_tmp_dir ());
-
gchar *temp_dir_uri = g_file_get_uri (temp_dir);
-
gchar *screenshot_path =
- screenshooter_save_screenshot (screenshot,
- FALSE,
- temp_dir_uri);
+ screenshooter_save_screenshot (screenshot, FALSE, temp_dir_uri);
if (screenshot_path != NULL)
{
Modified: xfce4-screenshooter/trunk/lib/screenshooter-capture.c
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-capture.c 2009-04-16 14:55:18 UTC (rev 7217)
+++ xfce4-screenshooter/trunk/lib/screenshooter-capture.c 2009-04-16 15:37:23 UTC (rev 7218)
@@ -258,8 +258,8 @@
/* Change cursor to cross-hair */
TRACE ("Set the cursor");
- grabstatus_mouse = gdk_pointer_grab (root_window, FALSE, mask,
- NULL, xhair_cursor, GDK_CURRENT_TIME);
+ grabstatus_mouse =
+ gdk_pointer_grab (root_window, FALSE, mask, NULL, xhair_cursor, GDK_CURRENT_TIME);
grabstatus_keyboard = gdk_keyboard_grab (root_window, FALSE, GDK_CURRENT_TIME);
@@ -407,10 +407,11 @@
{
TRACE ("Get the pixbuf for the screenshot");
- screenshot = gdk_pixbuf_get_from_drawable (NULL, root_window, NULL,
- x, y, 0, 0, w, h);
- }
- if (gc!=NULL)
+ screenshot =
+ gdk_pixbuf_get_from_drawable (NULL, root_window, NULL, x, y, 0, 0, w, h);
+ }
+
+ if (gc != NULL)
g_object_unref (gc);
gdk_cursor_unref (xhair_cursor);
@@ -424,10 +425,23 @@
-/* Takes the screenshot with the options given in sd.
-*sd: a ScreenshotData struct.
-returns: the screenshot in a *GdkPixbuf.
-*/
+/**
+ * screenshooter_take_screenshot:
+ * @region: the region to be screenshoted. It can be FULLSCREEN, ACTIVE_WINDOW or SELECT.
+ * @delay: the delay before the screenshot is taken, in seconds.
+ * @mouse: whether the mouse pointer should be displayed on the screenshot.
+ *
+ * Takes a screenshot with the given options. If @region is FULLSCREEN, the screenshot
+ * is taken after @delay seconds. If @region is ACTIVE_WINDOW, a delay of @delay seconds
+ * ellapses, then the active window is detected and captured. If @region is SELECT, @delay
+ * will be ignored and the user will have to select a portion of the screen with the
+ * mouse.
+ *
+ * @show_mouse is only taken into account when @region is FULLSCREEN or ACTIVE_WINDOW.
+ *
+ * Return value: a #GdkPixbuf containing the screenshot or %NULL (if @region is SELECT,
+ * the user can cancel the operation).
+ **/
GdkPixbuf *screenshooter_take_screenshot (gint region, gint delay, gboolean show_mouse)
{
GdkPixbuf *screenshot = NULL;
Modified: xfce4-screenshooter/trunk/lib/screenshooter-utils.c
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-utils.c 2009-04-16 14:55:18 UTC (rev 7217)
+++ xfce4-screenshooter/trunk/lib/screenshooter-utils.c 2009-04-16 15:37:23 UTC (rev 7218)
@@ -52,9 +52,10 @@
@dir_only: if true, only read the screenshot_dir.
*/
void
-screenshooter_read_rc_file (gchar *file,
- ScreenshotData *sd)
+screenshooter_read_rc_file (gchar *file, ScreenshotData *sd)
{
+ const gchar *home_uri = screenshooter_get_home_uri ();
+
XfceRc *rc;
gint delay = 0;
gint region = FULLSCREEN;
@@ -62,10 +63,8 @@
gint show_save_dialog = 1;
gint show_mouse = 1;
gint close_app = 1;
- gchar *screenshot_dir = screenshooter_get_home_uri ();
+ gchar *screenshot_dir = g_strdup (home_uri);
gchar *app = g_strdup ("none");
-
- const gchar *home_uri = screenshooter_get_home_uri ();
if (file != NULL)
{
@@ -78,31 +77,18 @@
TRACE ("Read the entries");
delay = xfce_rc_read_int_entry (rc, "delay", 0);
-
region = xfce_rc_read_int_entry (rc, "region", FULLSCREEN);
-
action = xfce_rc_read_int_entry (rc, "action", SAVE);
+ show_save_dialog = xfce_rc_read_int_entry (rc, "show_save_dialog", 1);
+ show_mouse = xfce_rc_read_int_entry (rc, "show_mouse", 1);
+ close_app = xfce_rc_read_int_entry (rc, "close", 1);
- show_save_dialog =
- xfce_rc_read_int_entry (rc, "show_save_dialog", 1);
-
- show_mouse =
- xfce_rc_read_int_entry (rc, "show_mouse", 1);
-
- close_app =
- xfce_rc_read_int_entry (rc, "close", 1);
-
g_free (app);
-
- app =
- g_strdup (xfce_rc_read_entry (rc, "app", "none"));
+ app = g_strdup (xfce_rc_read_entry (rc, "app", "none"));
g_free (screenshot_dir);
-
- screenshot_dir =
- g_strdup (xfce_rc_read_entry (rc,
- "screenshot_dir",
- home_uri));
+ screenshot_dir =
+ g_strdup (xfce_rc_read_entry (rc, "screenshot_dir", home_uri));
}
TRACE ("Close the rc file");
@@ -130,8 +116,7 @@
@sd: a ScreenshotData.
*/
void
-screenshooter_write_rc_file (gchar *file,
- ScreenshotData *sd)
+screenshooter_write_rc_file (gchar *file, ScreenshotData *sd)
{
XfceRc *rc;
More information about the Goodies-commits
mailing list