Exemple #1
0
void runGlobalSearch(RuskWindow *rusk)
{
	char *uri = NULL;
	const char *site = gtk_entry_get_placeholder_text(rusk->globalSearch);

	if(strstr(site, "google"))
	{
		uri = "https://google.com/search?q=%s";
	}else if(strstr(site, "maps"))
	{
		uri = "https://google.com/maps?q=%s";
	}else if(strstr(site, "images"))
	{
		uri = "https://google.com/search?tbm=isch&q=%s";
	}

	if(uri)
	{
		char *realURI = g_strdup_printf(uri, gtk_entry_get_text(rusk->globalSearch));
		openURI(rusk, realURI);
		g_free(realURI);

		gtk_entry_set_text(rusk->globalSearch, "");
	}

	globalSearchToggle(rusk, "");
}
Exemple #2
0
gboolean onAddressbarInput(GtkWidget *widget, GdkEventKey *key, RuskWindow *rusk)
{
	if(key->keyval == GDK_KEY_Return)
	{
		openURI(rusk, gtk_entry_get_text(rusk->addressbar));
		addressbarToggle(rusk);
	}
	return FALSE;
}
Exemple #3
0
int main(int argc, char **argv)
{
	gtk_init(&argc, &argv);

	if(argc <= 1)
	{
		openURI(makeRusk(), HOMEPAGE);
	}else
	{
		for(int i=1; i<argc; i++)
		{
			openURI(makeRusk(), argv[i]);
		}
	}

	gtk_main();

	return 0;
}
std::istream* URIStreamOpener::open(const URI& uri) const
{
	FastMutex::ScopedLock lock(_mutex);

	std::string scheme;
	if (uri.isRelative())
		scheme = "file";
	else
		scheme = uri.getScheme();
	return openURI(scheme, uri);
}
void Driver::open(std::string const& uri)
{
    openURI(uri);
    
    conf_mode = true;
    // clean communication channel
    cleanComChannel();

    // send stop command to enter configuration mode
    stopAcquisition();
}
std::istream* URIStreamOpener::open(const std::string& pathOrURI) const
{
	FastMutex::ScopedLock lock(_mutex);

	try
	{
		URI uri(pathOrURI);
		std::string scheme(uri.getScheme());
		FactoryMap::const_iterator it = _map.find(scheme);
		if (it != _map.end())
			return openURI(scheme, uri);
	}
	catch (Exception&)
	{
	}
	Path path(pathOrURI, Path::PATH_GUESS);
	return openFile(path);
}
Exemple #7
0
gboolean onKeyPress(GtkWidget *widget, GdkEventKey *key, RuskWindow *rusk)
{
	gboolean proceed = TRUE;

	char *script = g_strdup_printf(
			"onKeyPress({ctrlKey: %d, shiftKey: %d, superKey: %d, hyperKey: %d, metaKey: %d, string: '%s'})",
			(key->state & GDK_CONTROL_MASK)?1:0,
			(key->state & GDK_SHIFT_MASK)?1:0,
			(key->state & GDK_SUPER_MASK)?1:0,
			(key->state & GDK_HYPER_MASK)?1:0,
			(key->state & GDK_META_MASK)?1:0,
			gdk_keyval_name(key->keyval));
	webkit_web_view_run_javascript(rusk->webview, script, NULL, NULL, NULL);
	g_free(script);

	if(key->state & GDK_CONTROL_MASK)
	{
		switch(gdk_keyval_to_upper(key->keyval))
		{
			case GDK_KEY_S:
				inSiteSearchToggle(rusk);
				break;
			case GDK_KEY_N:
				if(key->state & GDK_SHIFT_MASK)
				{
					openURI(createNewWindow(rusk), HOMEPAGE);
				}else
				{
					inSiteSearchNext(rusk);
				}
				break;
			case GDK_KEY_P:
				if(key->state & GDK_SHIFT_MASK)
				{
					togglePrivateBrowsing(rusk);
				}else
				{
					inSiteSearchPrev(rusk);
				}
				break;

			case GDK_KEY_U:
				addressbarToggle(rusk);
				break;

			case GDK_KEY_G:
				globalSearchToggle(rusk, "google");
				break;
			case GDK_KEY_M:
				globalSearchToggle(rusk, "maps");
				break;
			case GDK_KEY_I:
				if(key->state & GDK_SHIFT_MASK)
				{
					toggleInspector(rusk);
				}else
				{
					globalSearchToggle(rusk, "images");
				}
				break;

			default:
				proceed = FALSE;
		}
	}else
	{
		proceed = FALSE;
	}

	return proceed;
}