예제 #1
0
static void
gth_file_tool_negative_activate (GthFileTool *base)
{
	GtkWidget *window;
	GtkWidget *viewer_page;
	GthTask   *task;

	window = gth_file_tool_get_window (base);
	viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
	if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
		return;

	task = gth_image_viewer_task_new (GTH_IMAGE_VIEWER_PAGE (viewer_page),
					  _("Applying changes"),
					  NULL,
					  negative_exec,
					  NULL,
					  NULL,
					  NULL);
	g_signal_connect (task,
			  "completed",
			  G_CALLBACK (gth_image_viewer_task_set_destination),
			  NULL);
	gth_browser_exec_task (GTH_BROWSER (window), task, FALSE);
}
예제 #2
0
static void
ok_button_clicked_cb (GtkButton          *button,
		      GthFileToolSharpen *self)
{
	GtkWidget   *window;
	GtkWidget   *viewer_page;
	SharpenData *sharpen_data;
	GthTask     *task;

	if (self->priv->apply_event != 0) {
		g_source_remove (self->priv->apply_event);
		self->priv->apply_event = 0;
	}

	window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
	viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
	if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
		return;

	sharpen_data = sharpen_data_new (self);
	sharpen_data->viewer_page = g_object_ref (viewer_page);
	sharpen_data->source = cairo_surface_reference (self->priv->source);
	task = gth_async_task_new (sharpen_before,
				   sharpen_exec,
				   sharpen_after,
				   sharpen_data,
				   sharpen_data_free);
	gth_browser_exec_task (GTH_BROWSER (gth_file_tool_get_window (GTH_FILE_TOOL (self))), task, FALSE);

	g_object_unref (task);

	gth_file_tool_hide_options (GTH_FILE_TOOL (self));
}
예제 #3
0
static void
gth_file_tool_equalize_activate (GthFileTool *base)
{
	GtkWidget    *window;
	GtkWidget    *viewer_page;
	EqualizeData *equalize_data;
	GthTask      *task;

	window = gth_file_tool_get_window (base);
	viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
	if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
		return;

	equalize_data = g_new0 (EqualizeData, 1);
	task = gth_image_viewer_task_new (GTH_IMAGE_VIEWER_PAGE (viewer_page),
					  _("Equalizing image histogram"),
					  NULL,
					  equalize_exec,
					  NULL,
					  equalize_data,
					  equalize_destroy_data);
	g_signal_connect (task,
			  "completed",
			  G_CALLBACK (gth_image_viewer_task_set_destination),
			  NULL);
	gth_browser_exec_task (GTH_BROWSER (window), task, FALSE);
}
예제 #4
0
static void
gth_file_tool_negative_activate (GthFileTool *base)
{
	GtkWidget       *window;
	GtkWidget       *viewer_page;
	GtkWidget       *viewer;
	cairo_surface_t *image;
	NegativeData    *negative_data;
	GthTask         *task;

	window = gth_file_tool_get_window (base);
	viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
	if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
		return;

	viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
	image = gth_image_viewer_get_current_image (GTH_IMAGE_VIEWER (viewer));
	if (image == NULL)
		return;

	negative_data = g_new0 (NegativeData, 1);
	negative_data->viewer_page = viewer_page;
	negative_data->source = cairo_surface_reference (image);
	task = gth_async_task_new (negative_init,
				   negative_exec,
				   negative_after,
				   negative_data,
				   negative_data_free);
	gth_browser_exec_task (GTH_BROWSER (window), task, FALSE);

	g_object_unref (task);
}
예제 #5
0
static void
gth_file_tool_save_as_update_sensitivity (GthFileTool *base)
{
	GtkWidget *window;
	gboolean   can_save;

	window = gth_file_tool_get_window (base);

	can_save = gth_viewer_page_can_save (GTH_VIEWER_PAGE (gth_browser_get_viewer_page (GTH_BROWSER (window))));
	can_save = can_save && (gth_browser_get_current_file (GTH_BROWSER (window)) != NULL);
	gtk_widget_set_sensitive (GTK_WIDGET (base), can_save);
}
void
gth_browser_activate_browser_properties (GSimpleAction *action,
					 GVariant      *state,
					 gpointer       user_data)
{
	GthBrowser *browser = user_data;

	g_simple_action_set_state (action, state);
	if (g_variant_get_boolean (state))
		gth_browser_show_file_properties (GTH_BROWSER (browser));
	else
		gth_browser_hide_sidebar (GTH_BROWSER (browser));
}
예제 #7
0
파일: actions.c 프로젝트: GNOME/gthumb
void
gth_browser_activate_folder_context_move_to (GSimpleAction *action,
					     GVariant      *parameter,
					     gpointer       user_data)
{
	copy_folder_to_folder (GTH_BROWSER (user_data), TRUE);
}
예제 #8
0
파일: actions.c 프로젝트: GNOME/gthumb
void
gth_browser_activate_folder_context_open_in_file_manager (GSimpleAction *action,
							  GVariant      *parameter,
							  gpointer       user_data)
{
	GthBrowser  *browser = GTH_BROWSER (user_data);
	GthFileData *file_data;
	char        *uri;
	GError      *error = NULL;

	file_data = gth_browser_get_folder_popup_file_data (browser);
	if (file_data == NULL)
		return;

	uri = g_file_get_uri (file_data->file);
	if (! gtk_show_uri_on_window (GTK_WINDOW (browser),
				      uri,
				      GDK_CURRENT_TIME,
				      &error))
	{
		_gtk_error_dialog_from_gerror_run (GTK_WINDOW (browser), _("Could not open the location"), error);
		g_clear_error (&error);
	}

	g_free (uri);
	g_object_unref (file_data);
}
예제 #9
0
파일: actions.c 프로젝트: GNOME/gthumb
void
gth_browser_activate_move_to_folder (GSimpleAction *action,
				     GVariant      *parameter,
				     gpointer       user_data)
{
	copy_selected_files_to_folder (GTH_BROWSER (user_data), TRUE);
}
void
gth_browser_activate_browser_edit_file (GSimpleAction *action,
					GVariant      *parameter,
					gpointer       user_data)
{
	gth_browser_show_viewer_tools (GTH_BROWSER (user_data));
}
void
gth_browser_activate_go_to_history_pos (GSimpleAction *action,
					GVariant      *parameter,
					gpointer       user_data)
{
	gth_browser_go_to_history_pos (GTH_BROWSER (user_data), atoi (g_variant_get_string (parameter, NULL)));
}
예제 #12
0
파일: actions.c 프로젝트: GNOME/gthumb
void
gth_browser_activate_import_folder (GSimpleAction	*action,
				    GVariant		*parameter,
				    gpointer		 user_data)
{
	GthBrowser *browser = GTH_BROWSER (user_data);
	GtkWidget  *chooser;
	GFile      *folder;

	chooser = gtk_file_chooser_dialog_new (_("Choose a folder"),
					       GTK_WINDOW (browser),
					       GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
					       _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
					       _("Import"), GTK_RESPONSE_OK,
					       NULL);
	_gtk_dialog_add_class_to_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK, GTK_STYLE_CLASS_SUGGESTED_ACTION);
	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), FALSE);

	folder = NULL;
	if (GTH_IS_FILE_SOURCE_VFS (gth_browser_get_location_source (browser)))
		folder = _g_object_ref (gth_browser_get_location (browser));
	if (folder == NULL)
		folder = g_file_new_for_uri (get_home_uri ());
	gtk_file_chooser_set_file (GTK_FILE_CHOOSER (chooser), folder, NULL);

	g_signal_connect (chooser,
			  "response",
			  G_CALLBACK (folder_chooser_response_cb),
			  browser);
	gtk_widget_show (chooser);

	_g_object_unref (folder);
}
예제 #13
0
static void
impl_gth_application_load_image (PortableServer_Servant  _servant,
				 const CORBA_char       *uri,
				 CORBA_Environment      *ev)
{
	if (*uri == '\0') 
		uri = NULL;

	if (UseViewer) {
		GtkWidget *viewer = gth_viewer_get_current_viewer ();
		if (viewer == NULL) {
			show_grabbing_focus (gth_viewer_new (uri));
		}
		else {
			gth_viewer_load_from_uri (GTH_VIEWER (viewer), uri);
			show_grabbing_focus (viewer);
		}
	} 
	else {
		GtkWidget *browser = gth_browser_get_current_browser ();
		if (browser == NULL) {
			show_grabbing_focus (gth_browser_new (uri));
		}
		else {
			gth_browser_load_uri (GTH_BROWSER (browser), uri);
			show_grabbing_focus (browser);
		}
	}
}
예제 #14
0
static gboolean
update_image_size_cb (gpointer user_data)
{
	GthFileToolResize *self = user_data;

	self->priv->update_size_id = 0;

	if (self->priv->resize_task != NULL) {
		gth_task_cancel (self->priv->resize_task);
		return FALSE;
	}

	self->priv->resize_task = gth_image_task_new (_("Resizing images"),
						      NULL,
						      resize_task_exec,
						      NULL,
						      self,
						      NULL);
	if (self->priv->apply_to_original)
		gth_image_task_set_source_surface (GTH_IMAGE_TASK (self->priv->resize_task), gth_image_viewer_page_tool_get_source (GTH_IMAGE_VIEWER_PAGE_TOOL (self)));
	else
		gth_image_task_set_source_surface (GTH_IMAGE_TASK (self->priv->resize_task), self->priv->preview);

	g_signal_connect (self->priv->resize_task,
			  "completed",
			  G_CALLBACK (resize_task_completed_cb),
			  self);
	gth_browser_exec_task (GTH_BROWSER (gth_file_tool_get_window (GTH_FILE_TOOL (self))),
			       self->priv->resize_task,
			       GTH_TASK_FLAGS_DEFAULT);

	return FALSE;
}
void
gth_browser_activate_sort_by (GSimpleAction *action,
			      GVariant      *parameter,
			      gpointer       user_data)
{
	dlg_sort_order (GTH_BROWSER (user_data));
}
void
gth_browser_activate_unfullscreen (GSimpleAction *action,
				   GVariant      *parameter,
				   gpointer       user_data)
{
	gth_browser_unfullscreen (GTH_BROWSER (user_data));
}
void
gth_browser_activate_open_location (GSimpleAction *action,
				    GVariant      *parameter,
				    gpointer       user_data)
{
	dlg_location (GTH_BROWSER (user_data));
}
void
gth_browser_activate_reload (GSimpleAction *action,
			     GVariant      *parameter,
			     gpointer       user_data)
{
	gth_browser_reload (GTH_BROWSER (user_data));
}
void
gth_browser_activate_go_up (GSimpleAction *action,
			    GVariant      *parameter,
			    gpointer       user_data)
{
	gth_browser_go_up (GTH_BROWSER (user_data), 1);
}
static gboolean
apply_cb (gpointer user_data)
{
	GthFileToolAdjustContrast *self = user_data;
	GtkWidget                 *window;

	if (self->priv->apply_event != 0) {
		g_source_remove (self->priv->apply_event);
		self->priv->apply_event = 0;
	}

	if (self->priv->image_task != NULL) {
		gth_task_cancel (self->priv->image_task);
		return FALSE;
	}

	window = gth_file_tool_get_window (GTH_FILE_TOOL (self));

	self->priv->image_task = get_image_task_for_method (self->priv->method);
	if (self->priv->apply_to_original)
		gth_image_task_set_source_surface (GTH_IMAGE_TASK (self->priv->image_task), gth_image_viewer_page_tool_get_source (GTH_IMAGE_VIEWER_PAGE_TOOL (self)));
	else
		gth_image_task_set_source_surface (GTH_IMAGE_TASK (self->priv->image_task), self->priv->preview);

	g_signal_connect (self->priv->image_task,
			  "completed",
			  G_CALLBACK (image_task_completed_cb),
			  self);
	gth_browser_exec_task (GTH_BROWSER (window), self->priv->image_task, GTH_TASK_FLAGS_DEFAULT);

	return FALSE;
}
static void
gth_file_tool_adjust_contrast_destroy_options (GthFileTool *base)
{
	GthFileToolAdjustContrast *self;
	GtkWidget                 *window;
	GtkWidget                 *viewer_page;

	self = (GthFileToolAdjustContrast *) base;

	if (self->priv->apply_event != 0) {
		g_source_remove (self->priv->apply_event);
		self->priv->apply_event = 0;
	}

	window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
	viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
	gth_image_viewer_page_reset_viewer_tool (GTH_IMAGE_VIEWER_PAGE (viewer_page));
	gth_viewer_page_update_sensitivity (GTH_VIEWER_PAGE (viewer_page));

	_g_clear_object (&self->priv->builder);

	_cairo_clear_surface (&self->priv->preview);
	_cairo_clear_surface (&self->priv->destination);
	self->priv->method = GTH_FILTER_GRID_NO_FILTER;
	self->priv->last_applied_method = GTH_FILTER_GRID_NO_FILTER;
}
예제 #22
0
파일: actions.c 프로젝트: cormac-w/gthumb
void
gth_browser_activate_add_to_selection_2 (GSimpleAction	 *action,
					 GVariant	 *parameter,
					 gpointer	  user_data)
{
	gth_browser_activate_add_to_selection (GTH_BROWSER (user_data), 2);
}
예제 #23
0
파일: actions.c 프로젝트: GNOME/gthumb
void
gth_browser_activate_import_device (GSimpleAction	*action,
				    GVariant		*parameter,
				    gpointer		 user_data)
{
	dlg_photo_importer_from_device (GTH_BROWSER (user_data), NULL);
}
예제 #24
0
파일: actions.c 프로젝트: cormac-w/gthumb
void
gth_browser_activate_add_to_catalog (GSimpleAction 	*action,
				     GVariant		*parameter,
				     gpointer		 user_data)
{
	dlg_add_to_catalog (GTH_BROWSER (user_data));
}
예제 #25
0
static void
image_task_completed_cb (GthTask  *task,
			 GError   *error,
			 gpointer  user_data)
{
	GthFileTool     *base = user_data;
	GthImage        *destination_image;
	cairo_surface_t *destination;
	GtkWidget       *window;
	GtkWidget       *viewer_page;

	if (error != NULL) {
		g_object_unref (task);
		return;
	}

	destination_image = gth_image_task_get_destination (GTH_IMAGE_TASK (task));
	if (destination_image == NULL) {
		g_object_unref (task);
		return;
	}

	destination = gth_image_get_cairo_surface (destination_image);

	window = gth_file_tool_get_window (base);
	viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
	gth_image_viewer_page_set_image (GTH_IMAGE_VIEWER_PAGE (viewer_page), destination, TRUE);

	cairo_surface_destroy (destination);
	g_object_unref (task);
}
void
gth_browser_activate_clear_history (GSimpleAction *action,
				    GVariant      *parameter,
				    gpointer       user_data)
{
	gth_browser_clear_history (GTH_BROWSER (user_data));
}
예제 #27
0
파일: actions.c 프로젝트: cormac-w/gthumb
void
gth_browser_activate_go_to_selection_3 (GSimpleAction	 *action,
				        GVariant	 *parameter,
				        gpointer 	  user_data)
{
	gth_browser_activate_show_selection (GTH_BROWSER (user_data), 3);
}
예제 #28
0
파일: actions.c 프로젝트: GNOME/gthumb
void
gth_browser_activate_rename (GSimpleAction *action,
			     GVariant      *parameter,
			     gpointer       user_data)
{
	GthBrowser *browser = GTH_BROWSER (user_data);
	GtkWidget  *folder_tree;
	GtkWidget  *file_list;

	folder_tree = gth_browser_get_folder_tree (browser);
	if (gtk_widget_has_focus (folder_tree)) {
		GthFileData *file_data;

		file_data = gth_folder_tree_get_selected (GTH_FOLDER_TREE (folder_tree));
		if (file_data == NULL)
			return;
		if (! g_file_info_get_attribute_boolean (file_data->info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME))
			return;
		gth_folder_tree_start_editing (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)), file_data->file);
		g_object_unref (file_data);

		return;
	}

	file_list = gth_browser_get_file_list_view (browser);
	if (gtk_widget_has_focus (file_list)) {
		gth_hook_invoke ("gth-browser-file-list-rename", browser);
		return;
	}

	if (gth_window_get_current_page (GTH_WINDOW (browser)) == GTH_BROWSER_PAGE_VIEWER) {
		gth_hook_invoke ("gth-browser-file-list-rename", browser);
		return;
	}
}
예제 #29
0
파일: actions.c 프로젝트: cormac-w/gthumb
void
gth_browser_activate_go_to_container_from_catalog (GSimpleAction	 *action,
						   GVariant		 *parameter,
						   gpointer		  user_data)
{
	GthBrowser *browser = GTH_BROWSER (user_data);
	GList *items;
	GList *file_list = NULL;

	items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
	file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items);

	if (file_list != NULL) {
		GthFileData *first_file = file_list->data;
		GFile       *parent;

		parent = g_file_get_parent (first_file->file);
		gth_browser_go_to (browser, parent, first_file->file);

		g_object_unref (parent);
	}

	_g_object_list_unref (file_list);
	_gtk_tree_path_list_free (items);
}
예제 #30
0
파일: actions.c 프로젝트: GNOME/gthumb
void
gth_browser_activate_import_flickr (GSimpleAction	*action,
				    GVariant		*parameter,
				    gpointer		 user_data)
{
	dlg_import_from_flickr (&www_flickr_com, GTH_BROWSER (user_data));
}