Compare commits
	
		
			No commits in common. "a6560509d99d75728c0c857de4859ca9d81f1a0d" and "cce2b6ba51addf1b28088174708a3c09a7f81329" have entirely different histories.
		
	
	
		
			a6560509d9
			...
			cce2b6ba51
		
	
		
| @ -26,15 +26,6 @@ the _User Guide_. | |||||||
| 
 | 
 | ||||||
| Options | Options | ||||||
| ------- | ------- | ||||||
| *--browse*:: |  | ||||||
| 	When an image is passed, start in browsing mode, and preselect that |  | ||||||
| 	image in its containing directory.  This is used by *fiv*'s inode/directory |  | ||||||
| 	handler to implement the "Open Containing Folder" feature of certain |  | ||||||
| 	applications. |  | ||||||
| 
 |  | ||||||
| *--help-all*:: |  | ||||||
| 	Show the full list of options, including those provided by GTK+. |  | ||||||
| 
 |  | ||||||
| *--invalidate-cache*:: | *--invalidate-cache*:: | ||||||
| 	Invalidate the wide thumbnail cache, removing thumbnails for files that can | 	Invalidate the wide thumbnail cache, removing thumbnails for files that can | ||||||
| 	no longer be found. | 	no longer be found. | ||||||
| @ -44,11 +35,18 @@ Options | |||||||
| 	the list of MIME types within *fiv*'s desktop file when the list | 	the list of MIME types within *fiv*'s desktop file when the list | ||||||
| 	of GdkPixbuf loaders changes. | 	of GdkPixbuf loaders changes. | ||||||
| 
 | 
 | ||||||
| *-V*, *--version*:: | *--browse*:: | ||||||
| 	Output version information and exit. | 	When an image is passed, start in browsing mode, and preselect that | ||||||
|  | 	image in its containing directory.  This is used by *fiv*'s inode/directory | ||||||
|  | 	handler to implement the "Open Containing Folder" feature of certain | ||||||
|  | 	applications. | ||||||
|  | 
 | ||||||
|  | *--thumbnail*=_SIZE_:: | ||||||
|  | 	Generate thumbnails for the first argument, in all sizes not exceeding | ||||||
|  | 	_SIZE_, and present the largest of them on the standard output | ||||||
|  | 	in an application-specific bitmap format.  Available sizes follow directory | ||||||
|  | 	names in the _Thumbnail Managing Standard_. | ||||||
| 
 | 
 | ||||||
| Internal options |  | ||||||
| ~~~~~~~~~~~~~~~~ |  | ||||||
| *--extract-thumbnail*:: | *--extract-thumbnail*:: | ||||||
| 	Present any embedded thumbnail of the first argument on the standard output | 	Present any embedded thumbnail of the first argument on the standard output | ||||||
| 	in an application-specific bitmap format.  When both *--thumbnail* | 	in an application-specific bitmap format.  When both *--thumbnail* | ||||||
| @ -56,16 +54,11 @@ Internal options | |||||||
| 	exiting early if successful.  This is used to enhance responsivity | 	exiting early if successful.  This is used to enhance responsivity | ||||||
| 	of thumbnail procurement. | 	of thumbnail procurement. | ||||||
| 
 | 
 | ||||||
| *--thumbnail*=_SIZE_:: | *-V*, *--version*:: | ||||||
| 	Generate wide thumbnails for the first argument, in all sizes not exceeding | 	Output version information and exit. | ||||||
| 	_SIZE_, and present the largest of them on the standard output |  | ||||||
| 	in an application-specific bitmap format.  Available sizes follow directory |  | ||||||
| 	names in the _Thumbnail Managing Standard_. |  | ||||||
| 
 | 
 | ||||||
| *--thumbnail-for-search*=_SIZE_:: | *--help-all*:: | ||||||
| 	Transform the first argument to a widely supported image file format, | 	Show the full list of options, including those provided by GTK+. | ||||||
| 	and present it on the standard output.  The image will be downscaled as |  | ||||||
| 	necessary so as to not exceed _SIZE_ (see *--thumbnail*). |  | ||||||
| 
 | 
 | ||||||
| Reporting bugs | Reporting bugs | ||||||
| -------------- | -------------- | ||||||
|  | |||||||
| @ -17,9 +17,9 @@ q:lang(en):after { content: "’"; } | |||||||
| <span id="author">Přemysl Eric Janouch</span><br> | <span id="author">Přemysl Eric Janouch</span><br> | ||||||
| <span id="email"><a href="mailto:p@janouch.name">p@janouch.name</a></span><br> | <span id="email"><a href="mailto:p@janouch.name">p@janouch.name</a></span><br> | ||||||
| <span id="revnumber">version 0.0.0,</span> | <span id="revnumber">version 0.0.0,</span> | ||||||
| <span id="revdate">2023-04-17</span> | <span id="revdate">2022-07-31</span> | ||||||
| 
 | 
 | ||||||
| <p class="figure"><img src="fiv.webp" alt="fiv in browser and viewer modes"> | <p class="figure"><img src="fiv.webp" alt="fiv's browser and viewer"> | ||||||
| 
 | 
 | ||||||
| <h2>Introduction</h2> | <h2>Introduction</h2> | ||||||
| 
 | 
 | ||||||
| @ -33,31 +33,30 @@ and page up/down buttons in mind, such as SteelSeries Sensei series. Ozone Neon | |||||||
| series may also be mapped this way. Your experience may be degraded with other | series may also be mapped this way. Your experience may be degraded with other | ||||||
| kinds of devices. | kinds of devices. | ||||||
| 
 | 
 | ||||||
| <p>Controls should generally be accessible through the keyboard. Pressing | <p>Controls should generally be accessible through the keyboard. Pressing Ctrl+? | ||||||
| <kbd>Ctrl</kbd> + <kbd>?</kbd> will give you a convenient overview | will give you a convenient overview of all shortcuts. In addition to these, | ||||||
| of all shortcuts. In addition to these, remember that you may often use | remember that you may often use Ctrl+Tab and F6 to navigate to different groups | ||||||
| <kbd>Ctrl</kbd> + <kbd>Tab</kbd> and <kbd>F6</kbd> to navigate to | of widgets. | ||||||
| different groups of widgets. |  | ||||||
| 
 | 
 | ||||||
| <h2>Browser</h2> | <h2>Browser</h2> | ||||||
| 
 | 
 | ||||||
| <p><i>fiv</i> normally starts in a file browser view. On the left side of the | <p><i>fiv</i> normally starts in a file browser view. On the left side of the | ||||||
| window, you'll find your GTK+ bookmarks, mounted locations as recognized by | window, you'll find your GTK+ bookmarks, mounted locations as recognized by | ||||||
| GVfs, an item for entering arbitrary filesystem paths or URIs, and finally | GVfs, an item for entering arbitrary filesystem paths or URIs, view controls, | ||||||
| breadcrumbs leading to the currently opened directory, as well as descendants | and finally breadcrumbs leading to the currently opened directory, as well as | ||||||
| of it.  At the top, there is a toolbar with view controls. | its descendants. | ||||||
| 
 | 
 | ||||||
| <p>You can open items in a new window either by middle clicking on them, or with | <p>You can open items in a new window either by middle clicking on them either | ||||||
| the left mouse button while holding the <kbd>Ctrl</kbd> key. | directly, or with the Ctrl key pressed down. Right clicking the directory view | ||||||
| Right clicking the directory view offers a context menu for opening files, | offers a context menu for opening files, or even the directory itself, | ||||||
| or even the directory itself, in a different application. | in a different application. | ||||||
| 
 | 
 | ||||||
| <h2>Viewer</h2> | <h2>Viewer</h2> | ||||||
| 
 | 
 | ||||||
| <p>The image viewer may be both entered (so long as you have a file selected) | <p>The image viewer may be both entered (so long as you have a file selected) | ||||||
| and exited using the <kbd>Enter</kbd> key. This way you may easily switch | and exited using the Enter key. This way you may easily switch between the two | ||||||
| between the two modes. When using the mouse, the forwards and backwards buttons | modes. When using the mouse, the forwards and backwards buttons will fulfill | ||||||
| will fulfill the same function. | the same function. | ||||||
| 
 | 
 | ||||||
| <p>Double clicking the image switches full-screen view, and the mouse wheel | <p>Double clicking the image switches full-screen view, and the mouse wheel | ||||||
| adjusts the zoom level. | adjusts the zoom level. | ||||||
| @ -97,8 +96,8 @@ rm -rf ~/.cache/thumbnails/wide-* | |||||||
| 
 | 
 | ||||||
| <p>The few configuration options <i>fiv</i> has can be adjusted using | <p>The few configuration options <i>fiv</i> has can be adjusted using | ||||||
| <i>dconf-editor</i>, which can be launched in the appropriate location from | <i>dconf-editor</i>, which can be launched in the appropriate location from | ||||||
| within the application by pressing <kbd>Ctrl</kbd> + <kbd>,</kbd>. | within the application by pressing Ctrl+,. For command line usage, there is | ||||||
| For command line usage, there is the <i>gsettings</i> utility: | the <i>gsettings</i> utility: | ||||||
| 
 | 
 | ||||||
| <pre> | <pre> | ||||||
| gsettings list-recursively name.janouch.fiv | gsettings list-recursively name.janouch.fiv | ||||||
|  | |||||||
| @ -5,5 +5,4 @@ h2 { padding-top: .67em; border-top: 1px solid silver; } | |||||||
| p { line-height: 1.5; } .figure { text-align: center; } img { max-width: 100%; } | p { line-height: 1.5; } .figure { text-align: center; } img { max-width: 100%; } | ||||||
| q { font-style: normal; } .details { border-bottom: 1px solid silver; } | q { font-style: normal; } .details { border-bottom: 1px solid silver; } | ||||||
| .details br { display: none; } .details br + span:before { content: " — "; } | .details br { display: none; } .details br + span:before { content: " — "; } | ||||||
| pre { padding: 0 1em; } kbd { border: solid #ccc; border-radius: .25em; | pre { padding: 0 1em; } | ||||||
| 	border-width: 1px 2px 2px 1px; padding: 0 .25em; font-family: inherit; } |  | ||||||
|  | |||||||
							
								
								
									
										9
									
								
								fiv-io.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								fiv-io.c
									
									
									
									
									
								
							| @ -121,11 +121,8 @@ const char *fiv_io_supported_media_types[] = { | |||||||
| gchar ** | gchar ** | ||||||
| fiv_io_all_supported_media_types(void) | fiv_io_all_supported_media_types(void) | ||||||
| { | { | ||||||
| 	GHashTable *unique = |  | ||||||
| 		g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |  | ||||||
| 	GPtrArray *types = g_ptr_array_new(); | 	GPtrArray *types = g_ptr_array_new(); | ||||||
| 	for (const char **p = fiv_io_supported_media_types; *p; p++) | 	for (const char **p = fiv_io_supported_media_types; *p; p++) | ||||||
| 		if (g_hash_table_insert(unique, g_strdup(*p), NULL)) |  | ||||||
| 		g_ptr_array_add(types, g_strdup(*p)); | 		g_ptr_array_add(types, g_strdup(*p)); | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_GDKPIXBUF | #ifdef HAVE_GDKPIXBUF | ||||||
| @ -133,16 +130,14 @@ fiv_io_all_supported_media_types(void) | |||||||
| 	for (GSList *iter = formats; iter; iter = iter->next) { | 	for (GSList *iter = formats; iter; iter = iter->next) { | ||||||
| 		gchar **subtypes = gdk_pixbuf_format_get_mime_types(iter->data); | 		gchar **subtypes = gdk_pixbuf_format_get_mime_types(iter->data); | ||||||
| 		for (gchar **p = subtypes; *p; p++) | 		for (gchar **p = subtypes; *p; p++) | ||||||
| 			if (g_hash_table_insert(unique, *p, NULL)) | 			g_ptr_array_add(types, *p); | ||||||
| 				g_ptr_array_add(types, g_strdup(*p)); |  | ||||||
| 		g_free(subtypes); | 		g_free(subtypes); | ||||||
| 	} | 	} | ||||||
| 	g_slist_free(formats); | 	g_slist_free(formats); | ||||||
| #endif  // HAVE_GDKPIXBUF
 | #endif  // HAVE_GDKPIXBUF
 | ||||||
| 
 | 
 | ||||||
| 	g_hash_table_unref(unique); |  | ||||||
| 	g_ptr_array_add(types, NULL); | 	g_ptr_array_add(types, NULL); | ||||||
| 	return (gchar **) g_ptr_array_free(types, FALSE); | 	return (char **) g_ptr_array_free(types, FALSE); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | ||||||
|  | |||||||
							
								
								
									
										54
									
								
								fiv.c
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								fiv.c
									
									
									
									
									
								
							| @ -2172,56 +2172,40 @@ main(int argc, char *argv[]) | |||||||
| 	const GOptionEntry options[] = { | 	const GOptionEntry options[] = { | ||||||
| 		{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, | 		{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, | ||||||
| 			NULL, "[PATH | URI]..."}, | 			NULL, "[PATH | URI]..."}, | ||||||
| 		{"browse", 0, G_OPTION_FLAG_IN_MAIN, |  | ||||||
| 			G_OPTION_ARG_NONE, &browse, |  | ||||||
| 			"Start in filesystem browsing mode", NULL}, |  | ||||||
| 		{"invalidate-cache", 0, G_OPTION_FLAG_IN_MAIN, |  | ||||||
| 			G_OPTION_ARG_NONE, &invalidate_cache, |  | ||||||
| 			"Invalidate the wide thumbnail cache", NULL}, |  | ||||||
| 		{"list-supported-media-types", 0, G_OPTION_FLAG_IN_MAIN, | 		{"list-supported-media-types", 0, G_OPTION_FLAG_IN_MAIN, | ||||||
| 			G_OPTION_ARG_NONE, &show_supported_media_types, | 			G_OPTION_ARG_NONE, &show_supported_media_types, | ||||||
| 			"Output supported media types and exit", NULL}, | 			"Output supported media types and exit", NULL}, | ||||||
|  | 		{"browse", 0, G_OPTION_FLAG_IN_MAIN, | ||||||
|  | 			G_OPTION_ARG_NONE, &browse, | ||||||
|  | 			"Start in filesystem browsing mode", NULL}, | ||||||
|  | 		{"thumbnail-for-search", 0, G_OPTION_FLAG_IN_MAIN, | ||||||
|  | 			G_OPTION_ARG_STRING, &thumbnail_size_search, | ||||||
|  | 			"Output an image file suitable for searching by content", "SIZE"}, | ||||||
|  | 		{"extract-thumbnail", 0, G_OPTION_FLAG_IN_MAIN, | ||||||
|  | 			G_OPTION_ARG_NONE, &extract_thumbnail, | ||||||
|  | 			"Output any embedded thumbnail (superseding --thumbnail)", NULL}, | ||||||
|  | 		{"thumbnail", 0, G_OPTION_FLAG_IN_MAIN, | ||||||
|  | 			G_OPTION_ARG_STRING, &thumbnail_size, | ||||||
|  | 			"Generate thumbnails, up to SIZE, and output that size", "SIZE"}, | ||||||
|  | 		{"invalidate-cache", 0, G_OPTION_FLAG_IN_MAIN, | ||||||
|  | 			G_OPTION_ARG_NONE, &invalidate_cache, | ||||||
|  | 			"Invalidate the wide thumbnail cache", NULL}, | ||||||
| 		{"version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, | 		{"version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, | ||||||
| 			&show_version, "Output version information and exit", NULL}, | 			&show_version, "Output version information and exit", NULL}, | ||||||
| 		{}, | 		{}, | ||||||
| 	}; | 	}; | ||||||
| 	const GOptionEntry options_internal[] = { |  | ||||||
| 		{"extract-thumbnail", 0, 0, |  | ||||||
| 			G_OPTION_ARG_NONE, &extract_thumbnail, |  | ||||||
| 			"Output any embedded thumbnail (superseding --thumbnail)", NULL}, |  | ||||||
| 		{"thumbnail", 0, 0, |  | ||||||
| 			G_OPTION_ARG_STRING, &thumbnail_size, |  | ||||||
| 			"Generate thumbnails, up to SIZE, and output that size", "SIZE"}, |  | ||||||
| 		{"thumbnail-for-search", 0, 0, |  | ||||||
| 			G_OPTION_ARG_STRING, &thumbnail_size_search, |  | ||||||
| 			"Output an image file suitable for searching by content", "SIZE"}, |  | ||||||
| 		{}, |  | ||||||
| 	}; |  | ||||||
| 
 |  | ||||||
| 	GOptionContext *context = |  | ||||||
| 		g_option_context_new(" - Image browser and viewer"); |  | ||||||
| 	g_option_context_add_group(context, gtk_get_option_group(TRUE)); |  | ||||||
| 	g_option_context_add_main_entries(context, options, NULL); |  | ||||||
| 
 |  | ||||||
| 	GOptionGroup *internals = g_option_group_new( |  | ||||||
| 		"internal", "Internal Options:", "Show internal options", NULL, NULL); |  | ||||||
| 	g_option_group_add_entries(internals, options_internal); |  | ||||||
| 	g_option_context_add_group(context, internals); |  | ||||||
| 
 | 
 | ||||||
| 	GError *error = NULL; | 	GError *error = NULL; | ||||||
| 	gboolean initialized = | 	gboolean initialized = gtk_init_with_args( | ||||||
| 		g_option_context_parse(context, &argc, &argv, &error); | 		&argc, &argv, " - Image browser and viewer", options, NULL, &error); | ||||||
| 	g_option_context_free(context); |  | ||||||
| 	if (show_version) { | 	if (show_version) { | ||||||
| 		const char *version = PROJECT_VERSION; | 		const char *version = PROJECT_VERSION; | ||||||
| 		printf("%s %s\n", PROJECT_NAME, &version[*version == 'v']); | 		printf("%s %s\n", PROJECT_NAME, &version[*version == 'v']); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 	if (show_supported_media_types) { | 	if (show_supported_media_types) { | ||||||
| 		char **types = fiv_io_all_supported_media_types(); | 		for (char **types = fiv_io_all_supported_media_types(); *types; ) | ||||||
| 		for (char **p = types; *p; p++) | 			g_print("%s\n", *types++); | ||||||
| 			g_print("%s\n", *p); |  | ||||||
| 		g_strfreev(types); |  | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 	if (invalidate_cache) { | 	if (invalidate_cache) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user