void
gtk_gui::do_help() {
	const char *help_doc = find_datafile(helpfile_locations);

	if (help_doc) {
		open_web_browser(help_doc);
	} else {
		GtkMessageDialog* dialog = (GtkMessageDialog*) gtk_message_dialog_new (NULL,
			GTK_DIALOG_DESTROY_WITH_PARENT,
			GTK_MESSAGE_ERROR,
			GTK_BUTTONS_OK,
			gettext("Cannot find Ambulant Player Help"));
		gtk_dialog_run (GTK_DIALOG (dialog));
		gtk_widget_destroy (GTK_WIDGET (dialog));
	}
}
Beispiel #2
0
gboolean
on_open_browser_timeout(void)
{
    /* only start the browser after we can successfully connect the
     web server port
     */
    if (test_web_server ()) {
        applet_message ("[web] web server ready, now start browser \n");
        applet->web_status = WEB_READY;

        if (first_use) {
            open_web_browser(SEAF_HTTP_ADDR);
        }

        return FALSE;
    } else {
        //applet_message ("[web] web server not ready, wait for a moment\n");
        return TRUE;
    }
}
Beispiel #3
0
int
tray_command_cb (UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(wParam) {
    case IDM_OPEN:
        if (applet->web_status == WEB_READY) {
            open_web_browser (SEAF_HTTP_ADDR);
        }
        break;

    case IDM_DISABLE_AUTO_SYNC: {
        seafile_disable_auto_sync();
        break;
    }
                                      
    case IDM_ENABLE_AUTO_SYNC: {
        seafile_enable_auto_sync();
        break;
    }
        
    case IDM_RESTART:
        trayicon_rotate (FALSE);
        restart_all();
        break;
        
    case IDM_EXIT:
        PostQuitMessage(0);
        applet_exit(0);
        break;

    default:
        break;
    }

    return TRUE;
}
void
gtk_gui::do_homepage() {
	open_web_browser("http://www.ambulantplayer.org");
}
Beispiel #5
0
int
tray_notify_cb(UINT message, WPARAM uID, LPARAM lEvent)
{
    switch(LOWORD(lEvent)) {
    case WM_RBUTTONUP: {
        HINSTANCE hInstance = applet->hInstance;
        HMENU hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDC_STARTINTRAY));

        if (applet->web_status == WEB_READY)
            EnableMenuItem (hMenu, IDM_OPEN, MF_ENABLED);
        else
            EnableMenuItem (hMenu, IDM_OPEN, MF_GRAYED);

        if (applet->auto_sync_disabled) {
            EnableMenuItem (hMenu, IDM_ENABLE_AUTO_SYNC, MF_ENABLED);
            EnableMenuItem (hMenu, IDM_DISABLE_AUTO_SYNC, MF_GRAYED);
        } else {
            EnableMenuItem (hMenu, IDM_DISABLE_AUTO_SYNC, MF_ENABLED);
            EnableMenuItem (hMenu, IDM_ENABLE_AUTO_SYNC, MF_GRAYED);
        }

        /* Always allow restarting. */
        EnableMenuItem (hMenu, IDM_RESTART, MF_ENABLED);

        hMenu = GetSubMenu(hMenu, 0);

        HWND hWnd = applet->hWnd;
        SetForegroundWindow(hWnd); 

        POINT pos;
        GetCursorPos(&pos); 
        TrackPopupMenu(hMenu, 0, pos.x, pos.y, 0, hWnd, NULL);
        DestroyMenu(hMenu); 
        
        break;
    }
        
    case WM_MOUSEMOVE:
        break;
        
    case WM_LBUTTONUP:
        if (applet->web_status == WEB_READY) {
            open_web_browser (SEAF_HTTP_ADDR);
        }
        break;
    
    case NIN_BALLOONUSERCLICK: {
        if (applet->last_synced_repo[0] != '\0') {
            char *repo = applet->last_synced_repo;
            if (repo[0]) {
                char buf[128];
                snprintf (buf, sizeof(buf), SEAF_HTTP_ADDR "/repo/?repo=%s", repo);
                open_web_browser (buf);
                memset(repo, 0, sizeof(applet->last_synced_repo));
            }
        }
        break;
    }
    case NIN_BALLOONHIDE:
    case NIN_BALLOONTIMEOUT:
        memset(applet->last_synced_repo, 0, sizeof(applet->last_synced_repo));
        break;
    default:
        break;
    }
    return TRUE;
}