mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
Merge branch 'openurl' of https://github.com/Pan7/GtkRadiant into Pan7-openurl
This commit is contained in:
commit
12b5a1c766
4 changed files with 28 additions and 12 deletions
|
@ -2079,7 +2079,7 @@ void about_button_changelog( GtkWidget *widget, gpointer data ){
|
||||||
Str log;
|
Str log;
|
||||||
log = g_strAppPath;
|
log = g_strAppPath;
|
||||||
log += "changelog.txt";
|
log += "changelog.txt";
|
||||||
OpenURL( log.GetBuffer() );
|
OpenURL( widget, log.GetBuffer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @note kaz 04/01/2012 - not in use
|
//! @note kaz 04/01/2012 - not in use
|
||||||
|
@ -2087,7 +2087,7 @@ void about_button_credits( GtkWidget *widget, gpointer data ){
|
||||||
Str cred;
|
Str cred;
|
||||||
cred = g_strAppPath;
|
cred = g_strAppPath;
|
||||||
cred += "credits.html";
|
cred += "credits.html";
|
||||||
OpenURL( cred.GetBuffer() );
|
OpenURL( widget, cred.GetBuffer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoAbout(){
|
void DoAbout(){
|
||||||
|
|
|
@ -827,7 +827,7 @@ gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer data )
|
||||||
}
|
}
|
||||||
|
|
||||||
gint dialog_url_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){
|
gint dialog_url_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){
|
||||||
OpenURL( (const char *)g_object_get_data( G_OBJECT( widget ), "URL" ) );
|
OpenURL( widget, (const char *)g_object_get_data( G_OBJECT( widget ), "URL" ) );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1662,14 +1662,30 @@ bool WINAPI color_dialog( void *parent, float *color, const char* title ){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenURL( const char *url ){
|
void OpenURL( GtkWidget *parent, const char *url ){
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
char command[2 * PATH_MAX];
|
char command[2 * PATH_MAX];
|
||||||
#endif
|
#endif
|
||||||
|
GError *gerror = NULL;
|
||||||
|
gboolean result;
|
||||||
|
|
||||||
Sys_Printf( "OpenURL: %s\n", url );
|
Sys_Printf( "OpenURL: %s\n", url );
|
||||||
|
|
||||||
|
#if GTK_CHECK_VERSION( 2, 14, 0 )
|
||||||
|
# if GTK_CHECK_VERSION( 3, 22, 0 )
|
||||||
|
result = gtk_show_uri_on_window( GTK_WINDOW( parent ), url, GDK_CURRENT_TIME, &gerror );
|
||||||
|
# else
|
||||||
|
result = gtk_show_uri( gtk_window_get_screen( GTK_WINDOW( parent ) ), url, GDK_CURRENT_TIME, &gerror );
|
||||||
|
# endif
|
||||||
|
if ( result ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Sys_Printf( "Could not open URL: %s\n", gerror->message );
|
||||||
|
g_error_free( gerror );
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( g_pParentWnd->m_pWidget ) ), "open", url, NULL, NULL, SW_SHOW );
|
ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( parent ) ), "open", url, NULL, NULL, SW_SHOW );
|
||||||
#else
|
#else
|
||||||
# ifdef __APPLE__
|
# ifdef __APPLE__
|
||||||
snprintf(command, sizeof(command), "open '%s' &", url);
|
snprintf(command, sizeof(command), "open '%s' &", url);
|
||||||
|
@ -1677,7 +1693,7 @@ void OpenURL( const char *url ){
|
||||||
snprintf(command, sizeof(command), "xdg-open '%s' &", url);
|
snprintf(command, sizeof(command), "xdg-open '%s' &", url);
|
||||||
# endif
|
# endif
|
||||||
if (system(command) != 0) {
|
if (system(command) != 0) {
|
||||||
gtk_MessageBox( g_pParentWnd->m_pWidget, _( "Failed to launch web browser!" ) );
|
gtk_MessageBox( parent, _( "Failed to launch web browser!" ) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ bool WINAPI color_dialog( void *parent, float *color, const char* title = "Choos
|
||||||
void dialog_button_callback( GtkWidget *widget, gpointer data );
|
void dialog_button_callback( GtkWidget *widget, gpointer data );
|
||||||
gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer data );
|
gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer data );
|
||||||
|
|
||||||
void OpenURL( const char *url );
|
void OpenURL( GtkWidget *parent, const char *url );
|
||||||
|
|
||||||
void CheckMenuSplitting( GtkWidget *&menu );
|
void CheckMenuSplitting( GtkWidget *&menu );
|
||||||
|
|
||||||
|
|
|
@ -878,7 +878,7 @@ void AddMenuItem( GtkWidget* item, unsigned int id ){
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::handle_help_command( int id ){
|
void MainFrame::handle_help_command( int id ){
|
||||||
OpenURL( mHelpURLs[id]->GetBuffer() );
|
OpenURL( m_pWidget, mHelpURLs[id]->GetBuffer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -4485,7 +4485,7 @@ void MainFrame::OnFileCheckUpdate(){
|
||||||
#endif
|
#endif
|
||||||
URL += "&Version_dlup=" RADIANT_VERSION;
|
URL += "&Version_dlup=" RADIANT_VERSION;
|
||||||
g_PrefsDlg.mGamesDialog.AddPacksURL( URL );
|
g_PrefsDlg.mGamesDialog.AddPacksURL( URL );
|
||||||
OpenURL( URL.GetBuffer() );
|
OpenURL( m_pWidget, URL.GetBuffer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::OnEditUndo(){
|
void MainFrame::OnEditUndo(){
|
||||||
|
@ -6565,7 +6565,7 @@ void MainFrame::OnPluginsRefresh(){
|
||||||
|
|
||||||
// open the Q3Rad manual
|
// open the Q3Rad manual
|
||||||
void MainFrame::OnHelp(){
|
void MainFrame::OnHelp(){
|
||||||
OpenURL( "http://icculus.org/gtkradiant/documentation/q3radiant_manual/index.htm" );
|
OpenURL( m_pWidget, "http://icculus.org/gtkradiant/documentation/q3radiant_manual/index.htm" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: we'll go towards a unified help thing soon
|
// FIXME: we'll go towards a unified help thing soon
|
||||||
|
@ -6573,11 +6573,11 @@ void MainFrame::OnHelpLinks(){
|
||||||
Str link;
|
Str link;
|
||||||
link = g_strAppPath;
|
link = g_strAppPath;
|
||||||
link += "links.htm";
|
link += "links.htm";
|
||||||
OpenURL( link.GetBuffer() );
|
OpenURL( m_pWidget, link.GetBuffer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::OnHelpBugreport(){
|
void MainFrame::OnHelpBugreport(){
|
||||||
OpenURL( "https://github.com/TTimo/GtkRadiant/issues" );
|
OpenURL( m_pWidget, "https://github.com/TTimo/GtkRadiant/issues" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::OnHelpCommandlist(){
|
void MainFrame::OnHelpCommandlist(){
|
||||||
|
|
Loading…
Reference in a new issue