Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifing the host from the command line #88

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/mainframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ gboolean CMainFrame::OnSize( GtkWidget* widget, GdkEventConfigure* evt,
}


CMainFrame::CMainFrame()
CMainFrame::CMainFrame(string url)
{
char* desktop = getenv("XDG_CURRENT_DESKTOP");

Expand Down Expand Up @@ -293,6 +293,10 @@ CMainFrame::CMainFrame()
}else{
gtk_window_unmaximize((GtkWindow*) m_Widget);
}

if( !url.empty() ) {
NewCon( url, url );
}
}


Expand Down
2 changes: 1 addition & 1 deletion src/mainframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CSite;
class CMainFrame : public CWidget
{
public:
CMainFrame();
CMainFrame(string url);

CTelnetCon* NewCon( string title, string url, CSite* site = NULL );
CNotebook* GetNotebook(){ return m_pNotebook; }
Expand Down
8 changes: 6 additions & 2 deletions src/pcmanx_gtk2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int main(int argc, char *argv[])
{
GError *error = NULL;
GOptionContext *context;
context = g_option_context_new ("Runtime options");
context = g_option_context_new ("[url]");
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
}
Expand Down Expand Up @@ -160,7 +160,11 @@ int main(int argc, char *argv[])
CTelnetCon::Init();
CTelnetCon::SetSocketTimeout( AppConfig.SocketTimeout );

CMainFrame* main_frm = new CMainFrame;
string cmdline_url;
if( argc >= 2) {
cmdline_url = argv[1];
}
CMainFrame* main_frm = new CMainFrame( cmdline_url );
gtk_window_move(GTK_WINDOW(main_frm->m_Widget), AppConfig.MainWndX, AppConfig.MainWndY);
gtk_window_resize(GTK_WINDOW(main_frm->m_Widget), AppConfig.MainWndW, AppConfig.MainWndH);
main_frm->Show();
Expand Down