diff options
Diffstat (limited to 'mate-screenshot/src')
-rw-r--r-- | mate-screenshot/src/mate-screenshot.c | 50 | ||||
-rw-r--r-- | mate-screenshot/src/screenshot-dialog.c | 6 | ||||
-rw-r--r-- | mate-screenshot/src/screenshot-save.c | 4 | ||||
-rw-r--r-- | mate-screenshot/src/screenshot-shadow.c | 40 | ||||
-rw-r--r-- | mate-screenshot/src/screenshot-xfer.c | 54 |
5 files changed, 77 insertions, 77 deletions
diff --git a/mate-screenshot/src/mate-screenshot.c b/mate-screenshot/src/mate-screenshot.c index 6537e4cc..bfbc4346 100644 --- a/mate-screenshot/src/mate-screenshot.c +++ b/mate-screenshot/src/mate-screenshot.c @@ -79,7 +79,7 @@ typedef enum TEST_TMP = 2, } TestType; -typedef struct +typedef struct { char *base_uris[3]; char *retval; @@ -172,7 +172,7 @@ target_toggled_cb (GtkToggleButton *button, { take_window_shot = (target_toggle == TARGET_TOGGLE_WINDOW); take_area_shot = (target_toggle == TARGET_TOGGLE_AREA); - + gtk_widget_set_sensitive (border_check, take_window_shot); gtk_widget_set_sensitive (effect_combo, take_window_shot); gtk_widget_set_sensitive (effect_label, take_window_shot); @@ -223,7 +223,7 @@ effect_combo_changed_cb (GtkComboBox *combo, } } -static gint +static gint key_press_cb (GtkWidget* widget, GdkEventKey* event, gpointer data) { if (event->keyval == GDK_KEY_F1) @@ -266,7 +266,7 @@ create_effects_combo (void) G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); - + for (i = 0; i < n_effects; i++) { GtkTreeIter iter; @@ -301,7 +301,7 @@ create_effects_combo (void) default: break; } - + renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (retval), renderer, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (retval), renderer, @@ -541,7 +541,7 @@ create_interactive_dialog (void) NULL); g_signal_connect (G_OBJECT (retval), "key-press-event", - G_CALLBACK(key_press_cb), + G_CALLBACK(key_press_cb), NULL); return retval; @@ -578,7 +578,7 @@ set_recent_entry (ScreenshotDialog *dialog) uri = screenshot_dialog_get_uri (dialog); recent = gtk_recent_manager_get_default (); - + exec_name = g_app_info_get_executable (app); app_exec = g_strjoin (" ", exec_name, "%u", NULL); @@ -603,7 +603,7 @@ error_dialog_response_cb (GtkDialog *d, ScreenshotDialog *dialog) { gtk_widget_destroy (GTK_WIDGET (d)); - + screenshot_dialog_focus_entry (dialog); } @@ -614,7 +614,7 @@ save_callback (TransferResult result, { ScreenshotDialog *dialog = data; GtkWidget *toplevel; - + toplevel = screenshot_dialog_get_toplevel (dialog); screenshot_dialog_set_busy (dialog, FALSE); @@ -623,7 +623,7 @@ save_callback (TransferResult result, save_folder_to_settings (dialog); set_recent_entry (dialog); gtk_widget_destroy (toplevel); - + /* we're done, stop the mainloop now */ gtk_main_quit (); } @@ -642,7 +642,7 @@ save_callback (TransferResult result, */ GtkWidget *error_dialog; char *uri; - + uri = screenshot_dialog_get_uri (dialog); error_dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel), GTK_DIALOG_DESTROY_WITH_PARENT, @@ -662,7 +662,7 @@ save_callback (TransferResult result, g_free (uri); } - + } static void @@ -677,12 +677,12 @@ try_to_save (ScreenshotDialog *dialog, source_file = g_file_new_for_path (temporary_file); target_file = g_file_new_for_uri (target); - + screenshot_xfer_uri (source_file, target_file, screenshot_dialog_get_toplevel (dialog), save_callback, dialog); - + /* screenshot_xfer_uri () holds a ref, so we can unref now */ g_object_unref (source_file); g_object_unref (target_file); @@ -759,7 +759,7 @@ screenshot_dialog_response_cb (GtkDialog *d, gtk_main_quit (); } } - + static void run_dialog (ScreenshotDialog *dialog) @@ -767,9 +767,9 @@ run_dialog (ScreenshotDialog *dialog) GtkWidget *toplevel; toplevel = screenshot_dialog_get_toplevel (dialog); - + gtk_widget_show (toplevel); - + g_signal_connect (toplevel, "response", G_CALLBACK (screenshot_dialog_response_cb), @@ -817,7 +817,7 @@ play_sound_effect (GdkWindow *window) static void finish_prepare_screenshot (char *initial_uri, GdkWindow *window, GdkRectangle *rectangle) -{ +{ ScreenshotDialog *dialog; gboolean include_mask = (!take_window_shot && !take_area_shot); @@ -894,7 +894,7 @@ check_file_done (gpointer user_data) finish_prepare_screenshot (job->retval, job->window, job->rectangle); async_existence_job_free (job); - + return FALSE; } @@ -1086,7 +1086,7 @@ push_check_file_job (GdkRectangle *rectangle) job, NULL, 0, NULL); - + } static void @@ -1153,7 +1153,7 @@ expand_initial_tilde (const char *path) if (path[1] == '/' || path[1] == '\0') { return g_strconcat (g_get_home_dir (), &path[1], NULL); } - + slash_after_user_name = strchr (&path[1], '/'); if (slash_after_user_name == NULL) { user_name = g_strdup (&path[1]); @@ -1163,11 +1163,11 @@ expand_initial_tilde (const char *path) } passwd_file_entry = getpwnam (user_name); g_free (user_name); - + if (passwd_file_entry == NULL || passwd_file_entry->pw_dir == NULL) { return g_strdup (path); } - + return g_strconcat (passwd_file_entry->pw_dir, slash_after_user_name, NULL); @@ -1285,7 +1285,7 @@ loop_dialog_screenshot () if (interactive_arg) { /* HACK: give time to the dialog to actually disappear. - * We don't have any way to tell when the compositor has finished + * We don't have any way to tell when the compositor has finished * re-drawing. */ g_timeout_add (200, @@ -1345,7 +1345,7 @@ main (int argc, char *argv[]) } g_option_context_free (context); - + if (version_arg) { g_print ("%s %s\n", g_get_application_name (), VERSION); exit (EXIT_SUCCESS); diff --git a/mate-screenshot/src/screenshot-dialog.c b/mate-screenshot/src/screenshot-dialog.c index db7a0f67..f9450582 100644 --- a/mate-screenshot/src/screenshot-dialog.c +++ b/mate-screenshot/src/screenshot-dialog.c @@ -30,7 +30,7 @@ enum { TYPE_IMAGE_PNG, TYPE_TEXT_URI_LIST, - + LAST_TYPE }; @@ -139,7 +139,7 @@ drag_data_get (GtkWidget *widget, screenshot_save_get_filename (), NULL); uris[1] = NULL; - + gtk_selection_data_set_uris (selection_data, uris); g_strfreev (uris); } @@ -270,7 +270,7 @@ screenshot_dialog_new (GdkPixbuf *screenshot, gtk_editable_select_region (GTK_EDITABLE (dialog->filename_entry), 0, pos); - + g_free (current_name); return dialog; diff --git a/mate-screenshot/src/screenshot-save.c b/mate-screenshot/src/screenshot-save.c index 414fe285..85559ed6 100644 --- a/mate-screenshot/src/screenshot-save.c +++ b/mate-screenshot/src/screenshot-save.c @@ -138,14 +138,14 @@ make_temp_directory (void) { gint result, i; gchar *dir_name; - + i = 0; do { gchar *tmp_dir = g_strdup_printf ("mate-screenshot.%u.%d", (unsigned int) getpid (), i++); - + dir_name = g_build_filename (g_get_tmp_dir (), tmp_dir, NULL); diff --git a/mate-screenshot/src/screenshot-shadow.c b/mate-screenshot/src/screenshot-shadow.c index 052bb9f3..76e75812 100644 --- a/mate-screenshot/src/screenshot-shadow.c +++ b/mate-screenshot/src/screenshot-shadow.c @@ -54,13 +54,13 @@ create_blur_filter (int radius) ConvFilter *filter; int x, y; double sum; - + filter = g_new0 (ConvFilter, 1); filter->size = radius * 2 + 1; filter->data = g_new (double, filter->size * filter->size); sum = 0.0; - + for (y = 0 ; y < filter->size; y++) { for (x = 0 ; x < filter->size; x++) @@ -80,7 +80,7 @@ create_blur_filter (int radius) } return filter; - + } static ConvFilter * @@ -88,7 +88,7 @@ create_outline_filter (int radius) { ConvFilter *filter; double *iter; - + filter = g_new0 (ConvFilter, 1); filter->size = radius * 2 + 1; filter->data = g_new (double, filter->size * filter->size); @@ -118,7 +118,7 @@ create_effect (GdkPixbuf *src, int src_width, src_height; int src_rowstride, dest_rowstride; gboolean src_has_alpha; - + guchar *src_pixels, *dest_pixels; src_has_alpha = gdk_pixbuf_get_has_alpha (src); @@ -132,15 +132,15 @@ create_effect (GdkPixbuf *src, TRUE, gdk_pixbuf_get_bits_per_sample (src), dest_width, dest_height); - - gdk_pixbuf_fill (dest, 0); - + + gdk_pixbuf_fill (dest, 0); + src_pixels = gdk_pixbuf_get_pixels (src); src_rowstride = gdk_pixbuf_get_rowstride (src); - + dest_pixels = gdk_pixbuf_get_pixels (dest); dest_rowstride = gdk_pixbuf_get_rowstride (dest); - + for (y = 0; y < dest_height; y++) { for (x = 0; x < dest_width; x++) @@ -150,10 +150,10 @@ create_effect (GdkPixbuf *src, src_x = x - radius; src_y = y - radius; - /* We don't need to compute effect here, since this pixel will be + /* We don't need to compute effect here, since this pixel will be * discarded when compositing */ if (src_x >= 0 && src_x < src_width && - src_y >= 0 && src_y < src_height && + src_y >= 0 && src_y < src_height && (!src_has_alpha || src_pixels [src_y * src_rowstride + src_x * 4 + 3] == 0xFF)) continue; @@ -169,7 +169,7 @@ create_effect (GdkPixbuf *src, src_x < 0 || src_x >= src_width) continue; - suma += ( src_has_alpha ? + suma += ( src_has_alpha ? src_pixels [src_y * src_rowstride + src_x * 4 + 3] : 0xFF ) * filter->data [i * filter->size + j]; } @@ -178,7 +178,7 @@ create_effect (GdkPixbuf *src, dest_pixels [y * dest_rowstride + x * 4 + 3] = CLAMP (suma * opacity, 0x00, 0xFF); } } - + return dest; } @@ -187,11 +187,11 @@ screenshot_add_shadow (GdkPixbuf **src) { GdkPixbuf *dest; static ConvFilter *filter = NULL; - + if (!filter) filter = create_blur_filter (BLUR_RADIUS); - - dest = create_effect (*src, filter, + + dest = create_effect (*src, filter, BLUR_RADIUS, SHADOW_OFFSET, SHADOW_OPACITY); @@ -213,11 +213,11 @@ screenshot_add_border (GdkPixbuf **src) { GdkPixbuf *dest; static ConvFilter *filter = NULL; - + if (!filter) filter = create_outline_filter (OUTLINE_RADIUS); - - dest = create_effect (*src, filter, + + dest = create_effect (*src, filter, OUTLINE_RADIUS, OUTLINE_OFFSET, OUTLINE_OPACITY); diff --git a/mate-screenshot/src/screenshot-xfer.c b/mate-screenshot/src/screenshot-xfer.c index eaf09121..a11131a7 100644 --- a/mate-screenshot/src/screenshot-xfer.c +++ b/mate-screenshot/src/screenshot-xfer.c @@ -73,7 +73,7 @@ do_run_overwrite_confirm_dialog (gpointer _data) gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("The file \"%s\" already exists. " - "Would you like to replace it?"), + "Would you like to replace it?"), data->basename); gtk_dialog_add_button (GTK_DIALOG (dialog), "gtk-cancel", @@ -86,7 +86,7 @@ do_run_overwrite_confirm_dialog (gpointer _data) gtk_widget_destroy (dialog); data->resp = response; - + return FALSE; } @@ -110,9 +110,9 @@ transfer_progress_dialog_new (TransferJob *job) TransferDialog *dialog; GtkWidget *gdialog; GtkWidget *widget; - + dialog = g_new0 (TransferDialog, 1); - + gdialog = gtk_message_dialog_new (GTK_WINDOW (job->parent), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_OTHER, @@ -124,7 +124,7 @@ transfer_progress_dialog_new (TransferJob *job) gtk_widget_show (widget); dialog->progress_bar = widget; dialog->dialog = gdialog; - + g_signal_connect (gdialog, "response", G_CALLBACK (transfer_dialog_response_cb), @@ -132,7 +132,7 @@ transfer_progress_dialog_new (TransferJob *job) job->dialog = dialog; gtk_widget_show (gdialog); - + return FALSE; } @@ -161,12 +161,12 @@ run_overwrite_confirm_dialog (TransferJob *job) data->basename = basename; need_timeout = (job->dialog_timeout_id > 0); - + if (need_timeout) { g_source_remove (job->dialog_timeout_id); job->dialog_timeout_id = 0; - } + } g_io_scheduler_job_send_to_mainloop (job->io_job, do_run_overwrite_confirm_dialog, @@ -176,11 +176,11 @@ run_overwrite_confirm_dialog (TransferJob *job) if (need_timeout) transfer_progress_dialog_start (job); - + g_free (basename); g_slice_free (ErrorDialogData, data); - return response; + return response; } static gboolean @@ -188,12 +188,12 @@ transfer_progress_dialog_update (TransferJob *job) { TransferDialog *dialog = job->dialog; double fraction; - + fraction = ((double) job->current_bytes) / ((double) job->total_bytes); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (dialog->progress_bar), fraction); - + return FALSE; } @@ -202,9 +202,9 @@ transfer_job_done (gpointer user_data) { TransferJob *job = user_data; TransferDialog *dialog; - + dialog = job->dialog; - + if (job->dialog_timeout_id) { g_source_remove (job->dialog_timeout_id); @@ -212,14 +212,14 @@ transfer_job_done (gpointer user_data) } if (dialog) gtk_widget_destroy (dialog->dialog); - + if (job->callback) { (job->callback) (job->result, job->error, job->callback_data); } - + g_object_unref (job->source); g_object_unref (job->dest); g_object_unref (job->cancellable); @@ -227,7 +227,7 @@ transfer_job_done (gpointer user_data) g_free (dialog); g_free (job->error); g_slice_free (TransferJob, job); - + return FALSE; } @@ -235,12 +235,12 @@ static void transfer_progress_cb (goffset current_num_bytes, goffset total_num_bytes, TransferJob *job) -{ +{ job->current_bytes = current_num_bytes; if (!job->dialog) return; - + g_io_scheduler_job_send_to_mainloop_async (job->io_job, (GSourceFunc) transfer_progress_dialog_update, job, @@ -252,7 +252,7 @@ get_file_size (GFile *file) { GFileInfo *file_info; goffset size; - + file_info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_SIZE, 0, NULL, NULL); @@ -268,7 +268,7 @@ get_file_size (GFile *file) */ size = -1; } - + return size; } @@ -279,7 +279,7 @@ transfer_file (GIOSchedulerJob *io_job, { TransferJob *job = user_data; GError *error; - + job->io_job = io_job; job->total_bytes = get_file_size (job->source); if (job->total_bytes == -1) @@ -288,7 +288,7 @@ transfer_file (GIOSchedulerJob *io_job, error = NULL; job->result = TRANSFER_ERROR; job->error = g_strdup (_("Can't access source file")); - + goto out; } @@ -339,7 +339,7 @@ retry: g_cancellable_cancel (job->cancellable); job->result = TRANSFER_ERROR; job->error = g_strdup (error->message); - + goto out; } } @@ -347,18 +347,18 @@ retry: { /* success */ job->result = TRANSFER_OK; - + goto out; } out: if (error) g_error_free (error); - + g_io_scheduler_job_send_to_mainloop_async (io_job, transfer_job_done, job, - NULL); + NULL); return FALSE; } |