Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Fix some runtime errors with this signature: @browser_main_loop. Hope…
Browse files Browse the repository at this point in the history
… this fixes all of them.
  • Loading branch information
radorodopski committed Nov 11, 2012
1 parent 29930a2 commit 923c4b6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ Makefile
appshell.Makefile
Brackets.target.mk
libcef_dll_wrapper.target.mk
appshell/gtk
appshell/gtk/*

5 changes: 5 additions & 0 deletions appshell/cefclient_gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,14 @@ int main(int argc, char* argv[]) {

GtkWidget* vbox = gtk_vbox_new(FALSE, 0);

#ifdef SHOW_TOOLBAR_UI
GtkToolItem* back = gtk_tool_button_new(NULL, NULL);
GtkToolItem* forward = gtk_tool_button_new(NULL, NULL);
GtkToolItem* reload = gtk_tool_button_new(NULL, NULL);
GtkToolItem* stop = gtk_tool_button_new(NULL, NULL);

GtkWidget* m_editWnd = gtk_entry_new();
#endif // SHOW_TOOLBAR_UI

g_signal_connect(G_OBJECT(window), "delete_event",
G_CALLBACK(HandleQuit), NULL);
Expand All @@ -165,9 +167,11 @@ int main(int argc, char* argv[]) {
// Create the handler.
g_handler = new ClientHandler();
g_handler->SetMainHwnd(vbox);
#ifdef SHOW_TOOLBAR_UI
g_handler->SetEditHwnd(m_editWnd);
g_handler->SetButtonHwnds(GTK_WIDGET(back), GTK_WIDGET(forward),
GTK_WIDGET(reload), GTK_WIDGET(stop));
#endif // SHOW_TOOLBAR_UI

// Create the browser view.
CefWindowInfo window_info;
Expand Down Expand Up @@ -199,3 +203,4 @@ int main(int argc, char* argv[]) {

return 0;
}

13 changes: 0 additions & 13 deletions appshell/client_app_gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ extern char _binary_appshell_appshell_extensions_js_start;

CefString ClientApp::GetCurrentLanguage()
{
<<<<<<< HEAD
//TODO proper locale in GTK
printf("in GetCurrentLanguage: ");
const char* locconst = pango_language_to_string( gtk_get_default_language() );
//printf( "%s\n", locconst ); // for me it prints "en-us", so I have to strip everything after the "-"
char loc[10] = {0};
strncpy(loc, locconst, 9);
for(int i=0; i<8; i++)
if ( (loc[i] == '-') || (loc[i] == '_') ) { loc[i] = 0; break; }
printf( "%s\n", loc ); // here it prints just "en"
return CefString(loc);
=======
const char* locconst = pango_language_to_string( gtk_get_default_language() );
//Rado: for me it prints "en-us", so I have to strip everything after the "-"
char loc[10] = {0};
Expand All @@ -58,7 +46,6 @@ CefString ClientApp::GetCurrentLanguage()

//TODO Explore possibility of using locale as-is, without stripping
return CefString(loc);
>>>>>>> linux/linux
}

std::string ClientApp::GetExtensionJSSource()
Expand Down
7 changes: 7 additions & 0 deletions appshell/client_handler_gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& url) {
#ifdef SHOW_TOOLBAR_UI
REQUIRE_UI_THREAD();

if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
// Set the edit window text
std::string urlStr(url);
gtk_entry_set_text(GTK_ENTRY(m_EditHwnd), urlStr.c_str());
}
#endif // SHOW_TOOLBAR_UI
}

void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
Expand All @@ -52,13 +54,16 @@ void ClientHandler::SendNotification(NotificationType type) {
}

void ClientHandler::SetLoading(bool isLoading) {
#ifdef SHOW_TOOLBAR_UI
if (isLoading)
gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), true);
else
gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), false);
#endif // SHOW_TOOLBAR_UI
}

void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
#ifdef SHOW_TOOLBAR_UI
if (canGoBack)
gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), true);
else
Expand All @@ -68,6 +73,7 @@ void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), true);
else
gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), false);
#endif // SHOW_TOOLBAR_UI
}

void ClientHandler::CloseMainWindow() {
Expand All @@ -86,3 +92,4 @@ void ClientHandler::PopupCreated(CefRefPtr<CefBrowser> browser)
bool ClientHandler::CanCloseBrowser(CefRefPtr<CefBrowser> browser) {
return true;
}

0 comments on commit 923c4b6

Please sign in to comment.