Compare commits
	
		
			No commits in common. "a6560509d99d75728c0c857de4859ca9d81f1a0d" and "cce2b6ba51addf1b28088174708a3c09a7f81329" have entirely different histories.
		
	
	
		
			a6560509d9
			...
			cce2b6ba51
		
	
		
| @ -26,15 +26,6 @@ the _User Guide_. | ||||
| 
 | ||||
| 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 the wide thumbnail cache, removing thumbnails for files that can | ||||
| 	no longer be found. | ||||
| @ -44,11 +35,18 @@ Options | ||||
| 	the list of MIME types within *fiv*'s desktop file when the list | ||||
| 	of GdkPixbuf loaders changes. | ||||
| 
 | ||||
| *-V*, *--version*:: | ||||
| 	Output version information and exit. | ||||
| *--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. | ||||
| 
 | ||||
| *--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*:: | ||||
| 	Present any embedded thumbnail of the first argument on the standard output | ||||
| 	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 | ||||
| 	of thumbnail procurement. | ||||
| 
 | ||||
| *--thumbnail*=_SIZE_:: | ||||
| 	Generate wide 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_. | ||||
| *-V*, *--version*:: | ||||
| 	Output version information and exit. | ||||
| 
 | ||||
| *--thumbnail-for-search*=_SIZE_:: | ||||
| 	Transform the first argument to a widely supported image file format, | ||||
| 	and present it on the standard output.  The image will be downscaled as | ||||
| 	necessary so as to not exceed _SIZE_ (see *--thumbnail*). | ||||
| *--help-all*:: | ||||
| 	Show the full list of options, including those provided by GTK+. | ||||
| 
 | ||||
| Reporting bugs | ||||
| -------------- | ||||
|  | ||||
| @ -17,9 +17,9 @@ q:lang(en):after { content: "’"; } | ||||
| <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="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> | ||||
| 
 | ||||
| @ -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 | ||||
| kinds of devices. | ||||
| 
 | ||||
| <p>Controls should generally be accessible through the keyboard. Pressing | ||||
| <kbd>Ctrl</kbd> + <kbd>?</kbd> will give you a convenient overview | ||||
| of all shortcuts. In addition to these, remember that you may often use | ||||
| <kbd>Ctrl</kbd> + <kbd>Tab</kbd> and <kbd>F6</kbd> to navigate to | ||||
| different groups of widgets. | ||||
| <p>Controls should generally be accessible through the keyboard. Pressing Ctrl+? | ||||
| will give you a convenient overview of all shortcuts. In addition to these, | ||||
| remember that you may often use Ctrl+Tab and F6 to navigate to different groups | ||||
| of widgets. | ||||
| 
 | ||||
| <h2>Browser</h2> | ||||
| 
 | ||||
| <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 | ||||
| GVfs, an item for entering arbitrary filesystem paths or URIs, and finally | ||||
| breadcrumbs leading to the currently opened directory, as well as descendants | ||||
| of it.  At the top, there is a toolbar with view controls. | ||||
| GVfs, an item for entering arbitrary filesystem paths or URIs, view controls, | ||||
| and finally breadcrumbs leading to the currently opened directory, as well as | ||||
| its descendants. | ||||
| 
 | ||||
| <p>You can open items in a new window either by middle clicking on them, or with | ||||
| the left mouse button while holding the <kbd>Ctrl</kbd> key. | ||||
| Right clicking the directory view offers a context menu for opening files, | ||||
| or even the directory itself, in a different application. | ||||
| <p>You can open items in a new window either by middle clicking on them either | ||||
| directly, or with the Ctrl key pressed down. Right clicking the directory view | ||||
| offers a context menu for opening files, or even the directory itself, | ||||
| in a different application. | ||||
| 
 | ||||
| <h2>Viewer</h2> | ||||
| 
 | ||||
| <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 | ||||
| between the two modes. When using the mouse, the forwards and backwards buttons | ||||
| will fulfill the same function. | ||||
| and exited using the Enter key. This way you may easily switch between the two | ||||
| modes. When using the mouse, the forwards and backwards buttons will fulfill | ||||
| the same function. | ||||
| 
 | ||||
| <p>Double clicking the image switches full-screen view, and the mouse wheel | ||||
| 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 | ||||
| <i>dconf-editor</i>, which can be launched in the appropriate location from | ||||
| within the application by pressing <kbd>Ctrl</kbd> + <kbd>,</kbd>. | ||||
| For command line usage, there is the <i>gsettings</i> utility: | ||||
| within the application by pressing Ctrl+,. For command line usage, there is | ||||
| the <i>gsettings</i> utility: | ||||
| 
 | ||||
| <pre> | ||||
| 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%; } | ||||
| q { font-style: normal; } .details { border-bottom: 1px solid silver; } | ||||
| .details br { display: none; } .details br + span:before { content: " — "; } | ||||
| pre { padding: 0 1em; } kbd { border: solid #ccc; border-radius: .25em; | ||||
| 	border-width: 1px 2px 2px 1px; padding: 0 .25em; font-family: inherit; } | ||||
| pre { padding: 0 1em; } | ||||
|  | ||||
							
								
								
									
										9
									
								
								fiv-io.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								fiv-io.c
									
									
									
									
									
								
							| @ -121,11 +121,8 @@ const char *fiv_io_supported_media_types[] = { | ||||
| gchar ** | ||||
| 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(); | ||||
| 	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)); | ||||
| 
 | ||||
| #ifdef HAVE_GDKPIXBUF | ||||
| @ -133,16 +130,14 @@ fiv_io_all_supported_media_types(void) | ||||
| 	for (GSList *iter = formats; iter; iter = iter->next) { | ||||
| 		gchar **subtypes = gdk_pixbuf_format_get_mime_types(iter->data); | ||||
| 		for (gchar **p = subtypes; *p; p++) | ||||
| 			if (g_hash_table_insert(unique, *p, NULL)) | ||||
| 				g_ptr_array_add(types, g_strdup(*p)); | ||||
| 			g_ptr_array_add(types, *p); | ||||
| 		g_free(subtypes); | ||||
| 	} | ||||
| 	g_slist_free(formats); | ||||
| #endif  // HAVE_GDKPIXBUF
 | ||||
| 
 | ||||
| 	g_hash_table_unref(unique); | ||||
| 	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[] = { | ||||
| 		{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, | ||||
| 			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, | ||||
| 			G_OPTION_ARG_NONE, &show_supported_media_types, | ||||
| 			"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, | ||||
| 			&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; | ||||
| 	gboolean initialized = | ||||
| 		g_option_context_parse(context, &argc, &argv, &error); | ||||
| 	g_option_context_free(context); | ||||
| 	gboolean initialized = gtk_init_with_args( | ||||
| 		&argc, &argv, " - Image browser and viewer", options, NULL, &error); | ||||
| 	if (show_version) { | ||||
| 		const char *version = PROJECT_VERSION; | ||||
| 		printf("%s %s\n", PROJECT_NAME, &version[*version == 'v']); | ||||
| 		return 0; | ||||
| 	} | ||||
| 	if (show_supported_media_types) { | ||||
| 		char **types = fiv_io_all_supported_media_types(); | ||||
| 		for (char **p = types; *p; p++) | ||||
| 			g_print("%s\n", *p); | ||||
| 		g_strfreev(types); | ||||
| 		for (char **types = fiv_io_all_supported_media_types(); *types; ) | ||||
| 			g_print("%s\n", *types++); | ||||
| 		return 0; | ||||
| 	} | ||||
| 	if (invalidate_cache) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user